mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-28 10:49:56 +02:00
[docs]: add subgraph streaming how-to (and some small cleanups) (#1606)
* wip * spelling * edit format_namespace
This commit is contained in:
@@ -26,6 +26,7 @@ _MANUAL = {
|
||||
"streaming-events-from-within-tools.ipynb",
|
||||
"streaming-events-from-within-tools-without-langchain.ipynb",
|
||||
"streaming-from-final-node.ipynb",
|
||||
"streaming-subgraphs.ipynb",
|
||||
"persistence.ipynb",
|
||||
"input_output_schema.ipynb",
|
||||
"pass_private_state.ipynb",
|
||||
|
||||
@@ -54,7 +54,7 @@ The first way to solve this is to add path maps to your conditional edges. A pat
|
||||
=== "Javascript"
|
||||
|
||||
```ts
|
||||
graph.addConditionalEdges("node_a", routingFunction, ["node_b", "node_c"]);
|
||||
graph.addConditionalEdges("node_a", routingFunction, { true: "node_b", false: "node_c" });
|
||||
```
|
||||
|
||||
In this case, the routing function returns either True or False, which map to `node_b` and `node_c` respectively.
|
||||
@@ -66,8 +66,8 @@ Instead of passing a path map, you can also be explicit about the typing of your
|
||||
```python
|
||||
def routing_function(state: GraphState) -> Literal["node_b","node_c"]:
|
||||
if state['some_condition'] == True:
|
||||
return "node_a"
|
||||
else:
|
||||
return "node_b"
|
||||
else:
|
||||
return "node_c"
|
||||
```
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ These guides show how to use different streaming modes.
|
||||
- [How to stream events from within a tool](streaming-events-from-within-tools.ipynb)
|
||||
- [How to stream events from within a tool without LangChain models](streaming-events-from-within-tools-without-langchain.ipynb)
|
||||
- [How to stream events from the final node](streaming-from-final-node.ipynb)
|
||||
- [How to stream from subgraphs](streaming-subgraphs.ipynb)
|
||||
|
||||
## Tool calling
|
||||
|
||||
|
||||
@@ -155,6 +155,7 @@ nav:
|
||||
- Stream events from within tools: how-tos/streaming-events-from-within-tools.ipynb
|
||||
- Stream events from within tools without LangChain models: how-tos/streaming-events-from-within-tools-without-langchain.ipynb
|
||||
- Stream events from the final node: how-tos/streaming-from-final-node.ipynb
|
||||
- Stream from subgraphs: how-tos/streaming-subgraphs.ipynb
|
||||
- Tool calling:
|
||||
- Call tools using ToolNode: how-tos/tool-calling.ipynb
|
||||
- Handle tool calling errors: how-tos/tool-calling-errors.ipynb
|
||||
|
||||
@@ -13,7 +13,11 @@
|
||||
"id": "964686a6-8fed-4360-84d2-958c48186008",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"A common use case is streaming from an agent is to stream LLM tokens from inside the final node. This guide demonstrates how you can do this."
|
||||
"A common use case is streaming from an agent is to stream LLM tokens from inside the final node. This guide demonstrates how you can do this.\n",
|
||||
"\n",
|
||||
"## Setup\n",
|
||||
"\n",
|
||||
"First let's install our required packages and set our environment variables."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -34,7 +38,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdin",
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"OPENAI_API_KEY: ········\n"
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user