From fd82f037c6b9953b8f631306fa210f1ea001294a Mon Sep 17 00:00:00 2001 From: Vadym Barda Date: Thu, 31 Oct 2024 09:58:11 -0400 Subject: [PATCH] docs: update remote graph how-to (#2269) --- docs/docs/how-tos/use-remote-graph.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/docs/how-tos/use-remote-graph.md b/docs/docs/how-tos/use-remote-graph.md index 640ca6946..c1295c9da 100644 --- a/docs/docs/how-tos/use-remote-graph.md +++ b/docs/docs/how-tos/use-remote-graph.md @@ -92,7 +92,7 @@ Since `RemoteGraph` is a `Runnable` that implements the same methods as `Compile # stream outputs from the graph async for chunk in remote_graph.astream({ - "messages": [("user", "what's the weather in la?")] + "messages": [{"role": "user", "content": "what's the weather in la"}] }): print(chunk) ``` @@ -128,7 +128,7 @@ Since `RemoteGraph` is a `Runnable` that implements the same methods as `Compile # stream outputs from the graph for chunk in remote_graph.stream({ - "messages": [("user", "what's the weather in la?")] + "messages": [{"role": "user", "content": "what's the weather in la"}] }): print(chunk) ``` @@ -152,8 +152,8 @@ By default, the graph runs (i.e. `.invoke()` or `.stream()` invocations) are sta # invoke the graph with the thread config config = {"configurable": {"thread_id": thread["thread_id"]}} result = remote_graph.invoke({ - "messages": [{"role": "user", "content": "what's the weather in sf"}], config=config - }) + "messages": [{"role": "user", "content": "what's the weather in sf"}] + }, config=config) # verify that the state was persisted to the thread thread_state = remote_graph.get_state(config) @@ -176,8 +176,7 @@ By default, the graph runs (i.e. `.invoke()` or `.stream()` invocations) are sta const config = { configurable: { thread_id: thread["thread_id"] }}; const result = await remoteGraph.invoke({ messages: [{ role: "user", content: "what's the weather in sf" }], - config - }); + }, config); // verify that the state was persisted to the thread const threadState = await remoteGraph.getState(config); @@ -231,7 +230,7 @@ Since the `RemoteGraph` behaves the same way as a regular `CompiledGraph`, it ca // define parent graph and add remote graph directly as a node const graph = new StateGraph(MessagesAnnotation) .addNode("child", remoteGraph) - .addEdge("START", "child") + .addEdge(START, "child") .compile() // invoke the parent graph