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
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 Campos and GitHub
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
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 Nguonly and GitHub
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
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 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 Campos
6f888b6206
Add single arg overload for add_node, which takes function/runnable's name as the node name
2024-05-14 17:51:25 -07:00
Nuno Campos
52b2c755d7
Use uuid6 as the id for checkpoints
...
- this avoids conflicts if multiple processes creating checkpoints in same thread at same time
- uuid6 with a monotically increasing clock_seq is sortable by creation time at ms precision (plus clock_seq for ties, plus 48 bits of randomness for further ties)
2024-05-14 16:56:25 -07:00
Nuno Campos and GitHub
a694aaa2bb
Merge pull request #444 from langchain-ai/an/10may/few-shot-clone
...
Add `FewShotExamples` managed value (redo)
2024-05-14 15:35:48 -07:00
Nuno Campos
273a836fc4
debug: Include task index in task id
2024-05-14 13:35:56 -07:00
Andrew Nguonly
28e5d8f699
Update FewShotExamples class to support setting filter and limit params.
2024-05-14 12:41:55 -07:00
Nuno Campos and GitHub
d8af81312a
Merge pull request #447 from langchain-ai/nc/14may/small-fixes
...
Fix memory checkpointer list/alist
2024-05-14 11:24:04 -07:00
Nuno Campos
0c37a17172
Fix memory checkpointer list/alist
...
- add tests for memory checkpointer list and alist
- fix async step counting
2024-05-14 10:37:01 -07:00
William FH and GitHub
f146668735
Rename "action" to "tools" in tools_condition w/in docs ( #445 )
2024-05-13 23:41:33 -07:00
Andrew Nguonly
065e0ff360
Remove unused imports.
2024-05-13 18:34:54 -07:00
Andrew Nguonly
aae05407f4
Lint code.
2024-05-13 18:22:07 -07:00
445a110917
Add managed values and IsLastStep ( #330 )
...
* Add managed values and IsLastStep
- managed values are read-only state keys whose values are managed by langgraph
- this PR implements one: IsLastValue, a boolean which is True in the last iteration, eg to allow you to return a nice "ran out of iterations" message to user
* Fix
* Fix some issues
* py39
* Break ref
* Fix types
* Fix
* Fix
* Update state.py
* Don't mutate dictionary while using it in for loop.
---------
Co-authored-by: Andrew Nguonly <andrewnguonly@gmail.com >
2024-05-10 13:44:20 -07:00
Nuno Campos
227f409611
Add writes property in checkpoint metadata
...
- This adds a historic view of the actions taken by nodes inside a thread, supporting rendering a richer history of a thread (eg in debug ui)
2024-05-09 14:30:29 -07:00
Nuno Campos
a6c6b8211f
Add tests for calling update on an empty thread
...
- this would eg be what you'd do in an api like openai assistants api
2024-05-08 10:43:31 -07:00
Nuno Campos
e892c95194
Export all exceptions from langgraph.errors
2024-05-07 08:07:26 -07:00
Nuno Campos and GitHub
5bee63c7d5
Merge pull request #387 from langchain-ai/nc/3may/checkpoint-metadata
...
Add metadata to checkpoints, checkpoint inputs before first step
2024-05-06 14:41:29 -07:00
Nuno Campos
48865daf02
Fix checkpoint lineage for updates/resumes
2024-05-06 11:53:20 -07:00
Nuno Campos
611ecdb1cd
Checkpoint inputs before starting the first step for easier error recovery
...
- this enables easier retrying, for any error just do .invoke(None, config) no matter which step the error happened on
2024-05-06 11:53:20 -07:00
Nuno Campos
f160f82912
Add checkpoint metadata fields
...
- source: input, update or loop
- step: int
- make step counter continue from previous last step
2024-05-06 11:52:49 -07:00
Nuno Campos
3ff3def62b
Remove option to only checkpoint at end of run
...
- Now that checkpoint at end of each step adds no latency there is not point to keep this
- This will make it easier to add future features
2024-05-06 11:52:49 -07:00
Nuno Campos
f304908102
Add metadata to checkpoints
...
- not yet used in this PR
2024-05-06 11:52:49 -07:00
Nuno Campos
04fe48f661
Add (failing) test for drawing cyclic edge
...
- fix waiting for new release of langchain-core
2024-05-03 15:17:20 -07:00
Nuno Campos
42d3215e34
Implement cursor pagination for get_state_history (time travel endpoint)
...
- interface in base checkpointer
- implement in sqlite, aiosqlite, memory
- implement in Pregel.get_state_history()
2024-05-03 10:34:11 -07:00
Nuno Campos
467f42d799
Optional 2nd arg to StateGraph with config schema
2024-05-03 10:05:14 -07:00
Nuno Campos
27efba27c0
Update tests
2024-05-02 09:31:22 -07:00