Added "should handle checkpoints correctly" Unit Tests + Fix 2 Bugs That Were Preventing Them From Passing#93
Merged
Nuno Campos (nfcampos) merged 5 commits intolangchain-ai:mainfrom Mar 21, 2024
Conversation
|
|
||
| public checkpoint(): Value { | ||
| if (!this.value) { | ||
| if (this.value === undefined) { |
Contributor
Author
There was a problem hiding this comment.
nit for consistency with the rest of the file
Nuno Campos (nfcampos)
previously approved these changes
Mar 21, 2024
langgraph/src/channels/base.ts
Outdated
| newCheckpoint.channelValues[k] = await channels[k].checkpoint(); | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| } catch (error: any) { | ||
| if ("name" in error && error.name === EmptyChannelError.name) { |
Collaborator
There was a problem hiding this comment.
Worth simplifying into one conditional?
Contributor
Author
There was a problem hiding this comment.
good point - done!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
should handle checkpoints correctlyunit test was initially skipped because it didn't pass.This PR fixes the two bugs that were preventing it from passing.
BinaryOperatorAggregateChannel did not implementempty()(aka - snapshot) correctly. The issue was that the old checkpoint's value was not being saved as the initial value leading to a lossy channel that stored state in correctlyCheckpointwas not implemented correctly, because it would only update the checkpoint's channel value if it had never been set before. Updated the code such that it always update's the checkpoint value based on the latest channel valueNow that these have been fixed, add the checkpointing test back in!