Rename empty() to fromCheckpoint() to match LangGraph Python#118
Merged
Nuno Campos (nfcampos) merged 6 commits intolangchain-ai:mainfrom Apr 18, 2024
Merged
Conversation
…o exactly match Python implementations.
|
|
||
| // eslint-disable-next-line prefer-destructuring | ||
| this.value = values[0]; | ||
| this.value = values[values.length - 1]; |
Contributor
Author
There was a problem hiding this comment.
|
|
||
| // eslint-disable-next-line prefer-destructuring | ||
| this.value = values[0]; | ||
| this.value = values[values.length - 1]; |
Contributor
Author
There was a problem hiding this comment.
|
|
||
| // eslint-disable-next-line prefer-destructuring | ||
| this.value = values[0]; | ||
| this.value = values[values.length - 1]; |
Contributor
Author
There was a problem hiding this comment.
| */ | ||
| abstract empty( | ||
| checkpoint?: CheckpointType, | ||
| initialValueFactory?: () => CheckpointType |
Contributor
Author
There was a problem hiding this comment.
initialValueFactory is removed from BaseChannel, but it remains in BinaryOperatorAggregate.
langgraph/src/channels/base.ts
Outdated
| channelValues: { ...checkpoint.channelValues }, | ||
| channelVersions: { ...checkpoint.channelVersions }, | ||
| versionsSeen: { ...checkpoint.versionsSeen }, | ||
| channelValues: deepCopy(checkpoint.channelValues), |
Contributor
Author
There was a problem hiding this comment.
checkpoint.channelValues and checkpoint.channelVersions don't need to be deep copied. They can be set to an empty object so previous channel values aren't carried over. This is equivalent to Python implementation.
Nuno Campos (nfcampos)
approved these changes
Apr 18, 2024
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.
Summary
All files in the
channelsdirectory are updated to match the corresponding naming and implementation in LangGraph Python.Implementation
empty()tofromCheckpoint()inBaseChannelclass.update()methods to return last element ofvaluesarray.To Do
BaseChannel.createCheckpoint()is equivalent to the Python implementation.initialValueFactoryAPI fromBaseChannel? The API doesn't exist in the Python implementation. Static functionStateGraph._getChannels()depends on this interface.Future
guardAPI fromEphemeralValue. It's not needed anymore.NamedBarrierValue.update()transactional (this.seencan be partially updated).I'm keeping track of these items separately.