Commit Graph
260 Commits
Author SHA1 Message Date
Nuno Campos a8b14a4e04 Allow checkpointer to override logic that creates the next version for each channel 2024-06-13 17:49:18 -07:00
Nuno Campos 09c70d9eda py 3.9 2024-06-13 16:13:56 -07:00
Nuno Campos e88e246a73 Update core and add tests for cancellation of astream and astream_events v2 2024-06-13 16:12:01 -07:00
Nuno CamposandGitHub cc91110257 Merge pull request #663 from langchain-ai/nc/13jun/adjust-default-error-policy
Adjust default error policy
2024-06-13 09:24:43 -07:00
Nuno Campos b6cc30c6d4 Adjust default error policy
- Add information about the last exception to retry logging
- Add a few more exceptions to the list not retried by default
2024-06-13 09:23:01 -07:00
William FHandGitHub fe11bb77ab Update Lockfile (#644)
Removes a security warning
2024-06-12 11:37:12 -07:00
Nuno Campos 3b4fcf6ee6 In Binop channels unwrap types before trying to instantiate
- this makes List/Sequence annotations behave same as list
2024-06-09 16:33:23 -07:00
William FHandGitHub 5799d6ca1c Accept dead-ends (#626)
Previously, we validated that nodes explicitly route to END.
This feels a bit unnecessary, since graphs are expected to keep processing until no work is left to be done

Plus fix a small bug in validation.
2024-06-08 00:00:13 -07:00
vbarda 91653cf2ab fix ci 2024-06-07 17:45:20 -04:00
vbarda 76e207b643 add unittest 2024-06-07 16:36:48 -04:00
Nuno Campos ec0aa273fd Fix for update_state mistakenly resetting barrier channels
- This introduces a new optional method BaseChannel.consume, which gets called when a channel triggers a node
- This is an alternative place to clean up channel state, in addition to the existing pattern of clearing state in the update() call for the next step
- Channels should implement consume() when they want to clean up state exactly if and only if the channel triggered a node
- Channels should clean up state in update() when they instead need to guarantee their value is available for a single step, irrespective of whether it was actually read
2024-06-06 17:53:14 -07:00
Nuno Campos 145e655c09 Fix 2024-06-05 17:17:21 -07:00
Nuno Campos d366bacf03 Expose filter arg in get_state_history
- Combine list and search methods in Checkpointer
2024-06-05 17:14:35 -07:00
William FHandGitHub eac9c600aa Nicer NotImplementedError in sqlite checkpointer (#598) 2024-06-05 06:35:21 -07:00
Nuno Campos 2b5d503906 Add sqlite test with emoji 2024-06-03 16:38:44 -07:00
Nuno Campos d22fe60d4c serde: Handle unicode issues when encoding
- any invalid utf-8 chars now removed on dumps
- fix serialization of Send
- remove serialization of NamedTuple, which doesn't work
- add test for custom serde passed to memory saver
- add test using Send and JsonPlus serde
2024-06-03 16:28:32 -07:00
Nuno Campos 5b5323b94f Rename Packet to Send 2024-05-31 15:17:22 -07:00
Nuno Campos 30e456be91 One more test, handle negative timeout 2024-05-31 15:13:07 -07:00
Nuno Campos ef3332ff74 Remove nested output for packet tasks 2024-05-31 14:46:56 -07:00
Nuno Campos 5ae9db83c7 Update ids in tests 2024-05-31 13:58:35 -07:00
Nuno Campos 0409d70d0c For stream_mode=updates (the default) stream the output of each node as soon as that node finishes
- currently output of all nodes is streamed only when all nodes in that step finish
- checkpoint/values stream chunks still yielded only at the end of the step, as they require applying all updates
2024-05-31 13:30:05 -07:00
Nuno CamposandGitHub 48f75699b0 Merge pull request #559 from langchain-ai/nc/30may/debug-checkpoint-metadata
Add metadata to debug/checkpoint stream events
2024-05-31 13:25:09 -07:00
Nuno Campos 9fd459c7fc Update to use a single arg like other nodes 2024-05-31 13:19:29 -07:00
Nuno Campos 87de8df888 Add metadata to debug/checkpoint stream events
- reorganize checkpointing code to share code between input and step checkpoints
- do not emit debug/checkpoint events when there is no checkpointer attached
- emit debug/checkpoint event for input checkpoint as well
2024-05-30 17:39:28 -07:00
Nuno Campos ae9c5639f0 Lint 2024-05-30 17:01:21 -07:00
Nuno Campos dc9c7254e7 Passthrough additional keys from node to cond edge
- this can be used to eg inform what gets sent in packets, without needing to write them to state first
2024-05-30 16:59:08 -07:00
Nuno Campos b19c426a33 In state graph validate that all nodes either return None or write to one of the state keys 2024-05-30 16:41:14 -07:00
Nuno Campos 75f14cc06d Finish tests 2024-05-30 16:08:30 -07:00
Nuno Campos 7a1feb466b Implement map-reduce api for StateGraph/Pregel
- current Pregel primitive is pull-based, ie. nodes write to channels, and it's up to other nodes to subscribe to those channels to "pull" updates
- this adds a "push" primitive where a node can directly schedule a node (more than once if desired) for execution in the next step, with additional kwargs to be passed in. Nodes scheduled in this way get called with both the current state and any kwargs passed to Packet
2024-05-30 15:36:32 -07:00
Nuno Campos 7a2de5e369 WIP 2024-05-30 11:45:21 -07:00
Nuno Campos 02326d74bf WIP 2024-05-30 11:45:21 -07:00
Nuno Campos e4c32248aa Support returning non-dict objects as state updates from nodes 2024-05-30 08:38:40 -07:00
Nuno Campos 86bc774b3d Lint 2024-05-30 08:08:21 -07:00
Nuno Campos 6e74415ec8 Add test for node decorated with traceable decorator 2024-05-30 08:04:48 -07:00
Nuno Campos 24d130d407 Add support for requesting multiple stream modes in same stream/astream call 2024-05-22 12:25:28 -07:00
Nuno Campos 8b946af20f Add support and tests for using messagegraph checkpoints on a stategraph with 1 __root__ key other keys 2024-05-21 14:01:23 -07:00
Andrew NguonlyandGitHub 08b505e017 Merge configurable fields with previous checkpoint config before each run (#510)
* Merge configurable fields with previous checkpoint config.

* Update update_state() and aupdate_state() to merge configurable fields with previous checkpoint config.

* Update tests to verify that all checkpoint metadata contain the expected configurable field keys. This assertion is needed because a run can have an arbitrary number of steps based on the construction of the graph.
2024-05-21 11:03:25 -07:00
Nuno Campos de71709fdc Expose checkpoint timestamp in get/update/list state methods 2024-05-20 16:23:46 -07:00
Nuno CamposandGitHub e33e4a64f9 Merge pull request #499 from langchain-ai/wfh/warn 2024-05-20 09:46:43 -07:00
William Fu-Hinthorn 70c5a22e4b Warn invalid state 2024-05-20 09:33:19 -07:00
Andrew Nguonly f5454715df Merge main branch. 2024-05-17 19:32:14 -07:00
Andrew Nguonly 09bae3022d Add checkpoint config to checkpoint metadata? 2024-05-17 19:25:02 -07:00
Andrew Nguonly 18addb52aa Add support for passing Callable metadata filter to FewShotExamples managed value. 2024-05-17 18:41:57 -07:00
Nuno Campos 695503a4d3 Update to langchain-core 0.2.0
- Use stream_events(version=v2) in tests
2024-05-17 14:38:51 -07:00
Nuno CamposandGitHub 920978c4ab Merge pull request #484 from langchain-ai/nc/16may/retry-policy
Add retry_policy for graphs
2024-05-16 18:10:32 -07:00
Nuno Campos a4e88e930f Disable retries by default 2024-05-16 15:59:45 -07:00
Nuno Campos 2414e0ab5e Add retry_policy for graphs
- default is to retry, fully configurable
- configuration options follow temporal https://docs.temporal.io/retry-policies#properties
2024-05-16 15:44:30 -07:00
Nuno CamposandGitHub f03930ad36 Merge pull request #454 from langchain-ai/nc/add-node-single-arg
Add single arg overload for add_node, which takes function/runnable's…
2024-05-16 10:59:23 -07:00
William FHandGitHub 4209508556 Tool Validator Node (#468) 2024-05-15 20:02:38 -07:00
William FHandGitHub d8c3e70900 Accept raw functions (#466) 2024-05-15 17:03:51 -07:00