From d6836300945c980dcd4fd77d4df6266cfc0d5d48 Mon Sep 17 00:00:00 2001
From: Eugene Yurtsev
Date: Wed, 2 Oct 2024 18:06:03 -0400
Subject: [PATCH] docs: how-to fix some issues (#1983)
Fixes some issues introduced while updating how-to docs
---
docs/docs/how-tos/async.ipynb | 4 ++--
docs/docs/how-tos/branching.ipynb | 15 ++++++++++++---
docs/docs/how-tos/pass_private_state.ipynb | 8 --------
docs/docs/how-tos/persistence_mongodb.ipynb | 9 ++++++++-
docs/docs/how-tos/persistence_redis.ipynb | 14 +++++++++-----
docs/docs/how-tos/state-model.ipynb | 20 +++++++++++++++-----
6 files changed, 46 insertions(+), 24 deletions(-)
diff --git a/docs/docs/how-tos/async.ipynb b/docs/docs/how-tos/async.ipynb
index ba6c55ce1..9f186b419 100644
--- a/docs/docs/how-tos/async.ipynb
+++ b/docs/docs/how-tos/async.ipynb
@@ -18,8 +18,8 @@
" \n",
" \n",
" \n",
- " \n",
- " LangGraph Concepts\n",
+ " \n",
+ " LangGraph Glossary\n",
" \n",
" \n",
" \n",
diff --git a/docs/docs/how-tos/branching.ipynb b/docs/docs/how-tos/branching.ipynb
index 10c23f1e2..6f05c824f 100644
--- a/docs/docs/how-tos/branching.ipynb
+++ b/docs/docs/how-tos/branching.ipynb
@@ -18,15 +18,24 @@
" This guide assumes familiarity with the following:\n",
" \n",
" - \n",
- " \n",
- " LangGraph Concepts\n",
+ " \n",
+ " Node\n",
+ " \n",
+ "
\n",
+ " - \n",
+ " \n",
+ " Edge\n",
+ " \n",
+ "
\n",
+ " - \n",
+ " \n",
+ " Reducer\n",
" \n",
"
\n",
"
\n",
"
\n",
" \n",
"\n",
- "\n",
"Parallel execution of nodes is essential to speed up overall graph operation. LangGraph offers native support for parallel execution of nodes, which can significantly enhance the performance of graph-based workflows. This parallelization is achieved through fan-out and fan-in mechanisms, utilizing both standard edges and [conditional_edges](https://langchain-ai.github.io/langgraph/reference/graphs/#langgraph.graph.MessageGraph.add_conditional_edges). Below are some examples showing how to add create branching dataflows that work for you. \n",
"\n",
""
diff --git a/docs/docs/how-tos/pass_private_state.ipynb b/docs/docs/how-tos/pass_private_state.ipynb
index b1818ebbc..1e3541527 100644
--- a/docs/docs/how-tos/pass_private_state.ipynb
+++ b/docs/docs/how-tos/pass_private_state.ipynb
@@ -151,14 +151,6 @@
"print()\n",
"print(f\"Output of graph invocation: {response}\")"
]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "4ce80b5c-73cc-4f78-9d14-26c4ba46f478",
- "metadata": {},
- "outputs": [],
- "source": []
}
],
"metadata": {
diff --git a/docs/docs/how-tos/persistence_mongodb.ipynb b/docs/docs/how-tos/persistence_mongodb.ipynb
index e03bddecc..31e3b8bd7 100644
--- a/docs/docs/how-tos/persistence_mongodb.ipynb
+++ b/docs/docs/how-tos/persistence_mongodb.ipynb
@@ -30,9 +30,16 @@
"\n",
"This reference implementation shows how to use MongoDB as the backend for persisting checkpoint state. Make sure that you have MongoDB running on port `27017` for going through this guide.\n",
"\n",
- "NOTE: this is just an reference implementation. You can implement your own checkpointer using a different database or modify this one as long as it conforms to the `BaseCheckpointSaver` interface.\n",
+ "\n",
+ "
Note
\n",
+ "
\n",
+ " This is a **reference** implementation. You can implement your own checkpointer using a different database or modify this one as long as it conforms to the BaseCheckpointSaver interface.\n",
+ "
\n",
+ "
\n",
"\n",
"For demonstration purposes we add persistence to the [pre-built create react agent](https://langchain-ai.github.io/langgraph/reference/prebuilt/#langgraph.prebuilt.chat_agent_executor.create_react_agent), but you can add a checkpointer to any custom graph that you build.\n",
+ "\n",
+ "## TLDR\n",
" \n",
"```python\n",
"from langgraph.graph import StateGraph\n",
diff --git a/docs/docs/how-tos/persistence_redis.ipynb b/docs/docs/how-tos/persistence_redis.ipynb
index 917d8e2f7..97d06c8c9 100644
--- a/docs/docs/how-tos/persistence_redis.ipynb
+++ b/docs/docs/how-tos/persistence_redis.ipynb
@@ -16,7 +16,7 @@
" \n",
" Persistence\n",
" \n",
- " \n",
+ " \n",
" \n",
" \n",
" Redis\n",
@@ -30,8 +30,12 @@
"\n",
"This reference implementation shows how to use Redis as the backend for persisting checkpoint state. Make sure that you have Redis running on port `6379` for going through this guide.\n",
"\n",
- "NOTE: this is just an reference implementation. You can implement your own checkpointer using a different database or modify this one as long as it conforms to the `BaseCheckpointSaver` interface.\n",
- "\n",
+ "\n",
+ "
Note
\n",
+ "
\n",
+ " This is a **reference** implementation. You can implement your own checkpointer using a different database or modify this one as long as it conforms to the BaseCheckpointSaver interface.\n",
+ "
\n",
+ "
\n",
"\n",
"For demonstration purposes we add persistence to the [pre-built create react agent](https://langchain-ai.github.io/langgraph/reference/prebuilt/#langgraph.prebuilt.chat_agent_executor.create_react_agent), but you can add a checkpointer to any custom graph that you build.\n",
"\n",
@@ -41,7 +45,7 @@
"\n",
"builder = StateGraph(....)\n",
"# ... define the graph\n",
- "checkpointer = # mongodb checkpointer (see examples below)\n",
+ "checkpointer = # redis checkpointer (see examples below)\n",
"graph = builder.compile(checkpointer=checkpointer)\n",
"...\n",
"```"
@@ -1037,7 +1041,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.9"
+ "version": "3.11.4"
}
},
"nbformat": 4,
diff --git a/docs/docs/how-tos/state-model.ipynb b/docs/docs/how-tos/state-model.ipynb
index 091546b9e..e21c8b993 100644
--- a/docs/docs/how-tos/state-model.ipynb
+++ b/docs/docs/how-tos/state-model.ipynb
@@ -25,7 +25,7 @@
" \n",
" \n",
" Pydantic\n",
- " -- this is a very popular Python library for run time validation.\n",
+ " : this is a popular Python library for run time validation.\n",
" \n",
" \n",
" \n",
@@ -41,10 +41,20 @@
"\n",
"
Known Limitations
\n",
"
\n",
- " * This notebook uses Pydantic v2 BaseModel, which requires langchain-core >= 0.3. Using langchain-core < 0.3 will result in errors due to mixing of Pydantic v1 and v2 BaseModels.\n",
- " * Currently, the `output` of the graph will **NOT** be an instance of a pydantic model.\n",
- " * Run-time validation only occurs on **inputs** into nodes, not on the outputs.\n",
- " * The validation error trace from pydantic does not show which node the error arises in.\n",
+ "
\n",
+ " - \n",
+ " This notebook uses Pydantic v2
BaseModel, which requires langchain-core >= 0.3. Using langchain-core < 0.3 will result in errors due to mixing of Pydantic v1 and v2 BaseModels. \n",
+ " \n",
+ " - \n",
+ " Currently, the `output` of the graph will **NOT** be an instance of a pydantic model.\n",
+ "
\n",
+ " - \n",
+ " Run-time validation only occurs on **inputs** into nodes, not on the outputs.\n",
+ "
\n",
+ " - \n",
+ " The validation error trace from pydantic does not show which node the error arises in.\n",
+ "
\n",
+ "
\n",
" \n",
"
"
]