Commit Graph
218 Commits
Author SHA1 Message Date
William Fu-Hinthorn 70c5a22e4b Warn invalid state 2024-05-20 09:33:19 -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
William FHandGitHub 4f8346df35 Handle Async Callable (#457) 2024-05-15 10:54:53 -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 a909d90b08 More small fixes following JS impl 2024-05-14 15:36:38 -07:00
Nuno CamposandGitHub 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
Andrew Nguonly 78e3a240f1 Update implementation for constructing WHERE clause for SqliteSaver so that parameter values are not hardcoded, but bound instead. 2024-05-14 14:44:59 -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 CamposandGitHub 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
Andrew Nguonly d6d33f9551 Fix bug with WHERE clause being incorrect when passing before param. 2024-05-14 10:38:26 -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 FHandGitHub 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
William FHandGitHub f335105853 Update Refs to clean up syntax highlighting (#443) 2024-05-13 18:32:42 -07:00
Andrew Nguonly aae05407f4 Lint code. 2024-05-13 18:22:07 -07:00
Andrew Nguonly 7a8cbe18f9 Implement asearch() in AsyncSqliteSaver. 2024-05-13 17:21:17 -07:00
Andrew Nguonly 9b1efe9698 Implement search() for SqliteSaver. 2024-05-13 16:59:59 -07:00
Andrew Nguonly dcb7278c56 Add search and asearch APIs to BaseCheckpointerSaver class. Implement search and asearch in MemorySaver. 2024-05-13 15:55:38 -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
William FHandGitHub 3e5ea31cdc Add Spellcheck and import hogwarts (#419) 2024-05-08 10:25:11 -07:00
William FHandGitHub dbe10a8c99 Migrate Tool Executor to ReAct Agent (#409) 2024-05-07 12:23:04 -07:00
Nuno Campos e892c95194 Export all exceptions from langgraph.errors 2024-05-07 08:07:26 -07:00
Nuno CamposandGitHub 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 52852cb226 Update langchain-core 2024-05-06 12:20:20 -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 446543d973 Fix RunnableCallable wrapper when sync func with config arg is invoked async 2024-05-03 12:33:12 -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 CamposandGitHub 8ec1d2e3e9 Merge pull request #363 from langchain-ai/harrison/add-args
Harrison/add args
2024-05-02 15:49:21 -07:00
Nuno Campos 27efba27c0 Update tests 2024-05-02 09:31:22 -07:00
Harrison Chase dea85d236c Merge branch 'master' into harrison/add-args 2024-05-01 08:26:00 -07:00
Harrison Chase 97f3d66c0e cr 2024-05-01 08:17:21 -07:00
Nuno Campos 5e322a6550 Implement stream_mode=debug
- outputs 3 types of payloads
-- task: node about to be executed
-- task_result: result of node execution
-- checkpoint: state values at end of superstep
2024-04-30 16:15:38 -07:00
Nuno Campos 281e312d40 Add tests for async cancellation
- when outer invoke/stream is cancelled currently running nodes should be cancelled
- when multiple nodes run in parallel and one fails the others should be cancelled
2024-04-30 13:57:11 -07:00
Nuno Campos afa6a91934 Implement interrupt_before=* and interrupt_after=*
- This interrupts execution before/after all nodes
2024-04-30 10:05:53 -07:00