From eeebd44a8785aa10076c421de47023a7a0fe6e20 Mon Sep 17 00:00:00 2001 From: Vadym Barda Date: Fri, 1 Nov 2024 18:16:09 -0400 Subject: [PATCH] docs: add subgraph streaming example for remote graph (#2306) --- docs/docs/how-tos/use-remote-graph.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/docs/how-tos/use-remote-graph.md b/docs/docs/how-tos/use-remote-graph.md index ecca665e2..819c46f4b 100644 --- a/docs/docs/how-tos/use-remote-graph.md +++ b/docs/docs/how-tos/use-remote-graph.md @@ -217,6 +217,12 @@ Since the `RemoteGraph` behaves the same way as a regular `CompiledGraph`, it ca "messages": [{"role": "user", "content": "what's the weather in sf"}] }) print(result) + + # stream outputs from both the parent graph and subgraph + for chunk in graph.stream({ + "messages": [{"role": "user", "content": "what's the weather in sf"}] + }, subgraphs=True): + print(chunk) ``` === "JavaScript" @@ -240,4 +246,11 @@ Since the `RemoteGraph` behaves the same way as a regular `CompiledGraph`, it ca messages: [{ role: "user", content: "what's the weather in sf" }] }); console.log(result); + + // stream outputs from both the parent graph and subgraph + for await (const chunk of await graph.stream({ + messages: [{ role: "user", content: "what's the weather in la" }] + }, { subgraphs: true })) { + console.log(chunk); + } ``` \ No newline at end of file