From aef06f17edabe27e1ff091241cce0ea87091844a Mon Sep 17 00:00:00 2001 From: William FH <13333726+hinthornw@users.noreply.github.com> Date: Wed, 15 May 2024 13:50:12 -0700 Subject: [PATCH] Add pointers to create_react_agent in how-tos where appropriate (#464) --- Makefile | 24 +++++++++++-------- docs/_scripts/copy_notebooks.py | 1 - examples/async.ipynb | 10 +++++++- .../dynamically-returning-directly.ipynb | 10 +++++++- examples/human-in-the-loop.ipynb | 9 ++++++- examples/persistence.ipynb | 9 ++++++- examples/streaming-tokens.ipynb | 9 ++++++- examples/time-travel.ipynb | 9 ++++++- 8 files changed, 64 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index e779fc3ac..fb74512f1 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: all clean docs_build docs_clean docs_linkcheck api_docs_build api_docs_clean api_docs_linkcheck format lint test tests test_watch integration_tests docker_tests help extended_tests coverage spell_check spell_fix build-docs serve-docs +.PHONY: all clean format lint test tests test_watch integration_tests docker_tests help extended_tests coverage spell_check spell_fix build-docs serve-docs serve-clean-docs clean-docs # Default target executed when no arguments are given to make. all: help @@ -53,8 +53,18 @@ build-docs: poetry run python docs/_scripts/copy_notebooks.py poetry run mkdocs build --clean -f docs/mkdocs.yml --strict -serve-docs: build-docs - poetry run mkdocs serve -f docs/mkdocs.yml +serve-clean-docs: clean-docs + poetry run python docs/_scripts/copy_notebooks.py + poetry run python -m mkdocs serve -c -f mkdocs.yml --strict -w ./langgraph + +serve-docs: + poetry run python docs/_scripts/copy_notebooks.py + poetry run python -m mkdocs serve -f docs/mkdocs.yml -w ./langgraph --dirty + +clean-docs: + find ./docs/docs -name "*.ipynb" -type f -delete + rm -rf docs/site + ###################### # HELP @@ -63,13 +73,7 @@ serve-docs: build-docs help: @echo '====================' @echo '-- DOCUMENTATION --' - @echo 'clean - run docs_clean and api_docs_clean' - @echo 'docs_build - build the documentation' - @echo 'docs_clean - clean the documentation build artifacts' - @echo 'docs_linkcheck - run linkchecker on the documentation' - @echo 'api_docs_build - build the API Reference documentation' - @echo 'api_docs_clean - clean the API Reference documentation build artifacts' - @echo 'api_docs_linkcheck - run linkchecker on the API Reference documentation' + @echo '-- LINTING --' @echo 'format - run code formatters' @echo 'lint - run linters' diff --git a/docs/_scripts/copy_notebooks.py b/docs/_scripts/copy_notebooks.py index 021afcec3..51b5e1eb7 100644 --- a/docs/_scripts/copy_notebooks.py +++ b/docs/_scripts/copy_notebooks.py @@ -19,7 +19,6 @@ _MANUAL = { "visualization.ipynb", "state-model.ipynb", "subgraph.ipynb", - "persistence_postgres.ipynb", "force-calling-a-tool-first.ipynb", "dynamic-returning-direct.ipynb", "managing-agent-steps.ipynb", diff --git a/examples/async.ipynb b/examples/async.ipynb index 4e94cb217..147ffdb68 100644 --- a/examples/async.ipynb +++ b/examples/async.ipynb @@ -10,7 +10,15 @@ "In this example we will build a ReAct agent with native [async](https://docs.python.org/3/library/asyncio.html) implementations of the core logic. When Chat Models have async clients, this can give us some nice performance improvements if you\n", "are running concurrent branches in your graph or if your graph is running within a larger web server process.\n", "\n", - "In general, you don't need to change anything about your graph to add `async` support. That's one of the beauties of [Runnables](https://python.langchain.com/docs/expression_language/interface/). " + "In general, you don't need to change anything about your graph to add `async` support. That's one of the beauties of [Runnables](https://python.langchain.com/docs/expression_language/interface/). \n", + "\n", + "\n", + "
Note:
\n", + "\n",
+ " In this how-to, we will create our agent from scratch to be transparent (but verbose). You can accomplish similar functionality using the create_react_agent(model, tools=tool) (API doc) constructor. This may be more appropriate if you are used to LangChain’s AgentExecutor class.\n",
+ "
Note
\n", + "\n",
+ " In this how-to, we will create our agent from scratch to be transparent (but verbose). You can accomplish similar functionality using the create_react_agent(model, tools=tool, interrupt_before=[\"agent\" | \"tools\"], interrupt_after=[\"agent\" | \"tools\"], checkpointer=checkpointer) (API doc) constructor. This may be more appropriate if you are used to LangChain’s AgentExecutor class.\n",
+ "
Note
\n", + "\n",
+ " In this how-to, we will create our agent from scratch to be transparent (but verbose). You can accomplish similar functionality using either `interrupt_before` or `interrupt_after` in the create_react_agent(model, tools=tool, interrupt_before=[\"tools\" | \"agent\"], interrupt_after=[\"tools\" | \"agent\"]) (API doc) constructor. This may be more appropriate if you are used to LangChain’s AgentExecutor class.\n",
+ "
Note
\n", + "\n",
+ " In this how-to, we will create our agent from scratch to be transparent (but verbose). You can accomplish similar functionality using the create_react_agent(model, tools=tool, checkpointer=checkpointer) (API doc) constructor. This may be more appropriate if you are used to LangChain’s AgentExecutor class.\n",
+ "
Note
\n", + "\n",
+ " In this how-to, we will create our agent from scratch to be transparent (but verbose). You can accomplish similar functionality using the create_react_agent(model, tools=tool) (API doc) constructor. This may be more appropriate if you are used to LangChain’s AgentExecutor class.\n",
+ "
Note:
\n", + "\n",
+ " In this how-to, we will create our agent from scratch to be transparent (but verbose). You can accomplish similar functionality using the create_react_agent(model, tools=tool, checkpointer=checkpointer) (API doc) constructor. This may be more appropriate if you are used to LangChain’s AgentExecutor class.\n",
+ "