Commit Graph
150 Commits
Author SHA1 Message Date
Nuno Campos f2803372ec Improve graph validation
- Move all validation to compile() This allows adding edges before nodes
- Detect more cases of missing edges with shorthand branches
2024-04-24 11:19:40 -07:00
Nuno Campos 190d163005 Fix 2024-04-22 09:54:45 -07:00
Nuno Campos 85bdc8bdfa Fix issue when drawing graphs w repeat conditions 2024-04-22 09:53:14 -07:00
Nuno Campos 3edf7e4d73 Fix 2024-04-18 10:18:56 -07:00
Nuno Campos 38d990cf99 Merge branch 'main' into improve_visualization_notebook 2024-04-18 09:02:45 -07:00
Nuno Campos 9e6fc78ac2 Make test deterministic 2024-04-18 08:40:56 -07:00
Angel Igareta d925736741 Snapshot updated for python 3.11 2024-04-18 13:19:51 +02:00
Angel Igareta 63125fe7a7 Snapshot updated 2024-04-18 13:01:24 +02:00
Angel Igareta 99c2754156 Fix tests due to change of style for conditional edges. Migrate ascii to snapshot for system compatiblity 2024-04-18 12:53:43 +02:00
Nuno Campos 64dd631668 Lint 2024-04-17 15:26:05 -07:00
Nuno Campos 322cea054c Fix astream_events modifying output format unexpectedly
- (unrelated) use run_id passed in
- if using a graph as node in another graph ensure stream_mode for inner call is always values
- ensure langchain-core doesn't auto promote streamed dicts to addable dicts, which results in unexpected output (only) when calling astream_events
2024-04-17 15:24:43 -07:00
Angel Igareta 0f667cd9eb Add add_condition_nodes parameter to offer possibility of not including conditional nodes 2024-04-15 10:56:19 +02:00
Nuno Campos f5a7c01e88 py39 2024-04-12 11:55:20 -07:00
Nuno Campos 74a40a895a Make ser/de configurable in checkpointer classes
- Remove pydantic usage from base checkpointer class
- Make serialization configurable for all existing checkpointer classes, you can eg use dill or json instead of pickle
2024-04-12 11:49:29 -07:00
Nuno Campos f3ae555b91 Shorten conditional edge names 2024-04-12 09:29:27 -07:00
Nuno Campos a8af7467b8 In stream_mode=values yield all values, instead of only changed ones 2024-04-11 11:12:10 -07:00
Nuno CamposandGitHub 9ffd6d9c78 Merge pull request #296 from langchain-ai/nc/10apr/tool-node
Add prebuilt ToolNode, Make prebuilt create_tool_calling_executor compatible with any tool calling model
2024-04-11 11:10:59 -07:00
Nuno Campos 46e67cff87 Remove flag 2024-04-11 08:44:41 -07:00
hmasdev 236ecb1982 rename node name in tests 2024-04-11 20:34:45 +09:00
hmasdev 42de3304dc Add support for allow_falsy_output parameter in Pregel class 2024-04-11 19:46:01 +09:00
Nuno Campos 7dafc09a5b Add prebuilt ToolNode 2024-04-10 18:15:19 -07:00
Nuno Campos 8788a6adfb Support stream_mode=updates in invoke() 2024-04-10 17:12:09 -07:00
Nuno Campos 641def6fdb Fix null output for node with conditional edge returning END 2024-04-10 16:10:08 -07:00
Nuno Campos fd6f44a7e4 feat: Return multiple destinations from conditional edge 2024-04-08 17:05:16 -07:00
Nuno Campos db3219f77c Ensure node tracing output is exactly what was returned from node 2024-04-03 13:13:04 -07:00
Nuno Campos 2f8ae4fdb4 Simplify tool executor 2024-04-02 14:46:14 -07:00
Nuno Campos 2a299d070e Optimize tracing output of Graph/StateGraph/MessageGraph
- control selection of relevant runs (needs langsmith release)
- see output of conditional edge function
- fix issue with conditional entry point not getting full state values as input
2024-04-02 10:32:47 -07:00
Nuno Campos a184600915 MessageGraph now accepts same shorthand message formats as langchain-core 2024-04-01 18:44:06 -07:00
Nuno Campos 694343c5b5 Update test 2024-04-01 18:03:52 -07:00
Nuno Campos cbd2024dec Add async test, add test for validation error 2024-04-01 17:56:18 -07:00
Nuno Campos 961ddd49ed Add test and notebook for using pydantic base model as state object 2024-04-01 17:40:55 -07:00
Nuno Campos f88ef74002 Add tests for both values of CheckpointAt
- fix bug when using at=END_OF_RUN together with interrupt_before
- fix bug when calling update_state after only node has run
- update some notebooks to new streaming format (ie. no __end__ node)
2024-04-01 17:17:39 -07:00
Nuno Campos 2736d72989 Remove __start__ node from stream output 2024-04-01 16:05:12 -07:00
Nuno Campos b6848c5fdf Optimize tracing run tree
- Do not run node if it's a passthrough
- Do not run writers that wouldn't affect any channels
- Combine consecutive writers when it doesn't change semantics
2024-04-01 13:43:23 -07:00
Nuno Campos 3451e04b7d Add test for waiting edge triggered via conditional edge 2024-04-01 12:36:55 -07:00
Nuno Campos 2bf66b8834 Add some more docstrings around multi edges
- prompted by some github issues
2024-04-01 12:29:00 -07:00
Nuno Campos 4e373b8af2 Remove noisy frames from stack traces
- The less frames in library code the less confused the user is
- This doesn't remove all library frames (not possible), but it's a start
2024-03-31 20:19:10 -07:00
Nuno Campos a20bf12da9 Lint 2024-03-31 19:18:47 -07:00
Nuno Campos 0d2bbe85c6 Fix default condition name 2024-03-31 18:56:38 -07:00
Nuno Campos b668bf8eab Rewrite Graph/StateGraph.compile()
- Each iteration of the graph is one single iteration in Pregel (ie. no more "{node}:edges" nodes)
- .update_state() now acts exactly as one of the nodes in the graph (which can be chosen), which makes human-in-the-loop scenarios where you want to override the actions of a specific node a lot easier to build
- Graph/StateGraph.compile() now delegate adding nodes/edges/etc to dedicated methods that operate on the Pregel object, which is 90% of the way towards dynamic graphs where nodes and edges can be added during execution
2024-03-31 17:17:18 -07:00
Nuno Campos 4fd90f8ad6 Rename BaseChannel.empty() to BaseChannel.from_checkpoint()
- clearer name
- channels with complex data structures in checkpoint (eg a set or list) now copy the checkpointed data structures before creating the new channel
2024-03-31 09:25:08 -07:00
Nuno Campos 03b7d6fe0d Remove __end__ node from state graph
No longer necessary with stream output modes
2024-03-30 22:04:27 -07:00
Nuno Campos 1ad017781d Add stream_mode=updates or values
- stream(stream_mode="values") yields thre current channel values whenever a channel is updated
- stream(stream_mode="updates") yields the update sent to each channel by each node
- this removes the __end__ value present at the end of each call to Graph/StateGraph/MessageGraph.stream(). To access the __end__ value either call .invoke() or stream(stream_mode="values")
2024-03-30 21:24:39 -07:00
Nuno Campos 0baaf5cd96 Remove private api to mutate values during call to stream() 2024-03-30 19:41:50 -07:00
Nuno Campos 5aa036639b Update 2024-03-26 15:42:16 -07:00
jacoblee93 a6a9def91a Adds async conditional edge support 2024-03-26 12:46:15 -07:00
Nuno CamposandGitHub 458d71e694 Merge pull request #226 from langchain-ai/nc/21mar/add-message-graph-test
Add one more test for message graph
2024-03-21 18:00:00 -07:00
Nuno Campos db2ec5b2de Rename to add_edge(string[], string) 2024-03-21 17:56:35 -07:00
Nuno Campos e11153cf09 Fix graph repr 2024-03-21 16:53:59 -07:00
Nuno Campos 319d72952c Add one more test for message graph 2024-03-21 16:35:26 -07:00