Compare commits

..
Author SHA1 Message Date
William Fu-Hinthorn 52910f3b04 InMemorySaver 2024-10-06 20:49:11 -07:00
William FH 57727be9db Checkpoint 2.0.1 (#2018) 2024-10-06 14:10:48 -07:00
William FH 05dbc1d498 Validate in async batched store (#2017) 2024-10-06 14:09:35 -07:00
Vadym BardaandWilliam Fu-Hinthorn b35fe5864d docs: update how-to for passing runtime values (#1984)
Co-authored-by: William Fu-Hinthorn <13333726+hinthornw@users.noreply.github.com>
2024-10-05 01:23:55 +00:00
Andrew Nguonly db3271ace5 docs: Update field descriptions for API spec (#2013) 2024-10-04 22:32:20 +00:00
Vadym BardaandWilliam Fu-Hinthorn bacf92c441 langgraph: add support for passing store via state_modifier (#1992)
Co-authored-by: William Fu-Hinthorn <13333726+hinthornw@users.noreply.github.com>
2024-10-04 15:28:56 -07:00
Andrew Nguonly c847f7df4e docs: Updates to API spec (#2012) 2024-10-04 22:12:13 +00:00
Vadym Barda c2dc498b1c docs: clean up memory docs (#2000) 2024-10-04 16:58:22 -04:00
Andrew Nguonly c2171f4a20 docs: Create API spec (#2009) 2024-10-04 20:40:01 +00:00
William FH d8d4714a73 Update JS sdk version (#2008) 2024-10-04 11:04:10 -07:00
William FH 018e9ac42e Check is string in store namespace validation (on put) (#2007) 2024-10-04 17:55:30 +00:00
Brace Sproul f9afd3c215 Merge pull request #1993 from langchain-ai/brace/after-seconds-js
fix(js): Add afterSeconds run arg
2024-10-03 11:18:02 -07:00
Eugene Yurtsev ac7903b3dc docs: how to guide batch 4 (#1991)
Updated the following guides:

docs/docs/how-tos/streaming-content.ipynb

docs/docs/how-tos/streaming-events-from-within-tools-without-langchain.ipynb
docs/docs/how-tos/streaming-events-from-within-tools.ipynb
docs/docs/how-tos/streaming-tokens-without-langchain.ipynb
2024-10-03 14:11:53 -04:00
Eugene Yurtsev 4a8510b690 docs: minor formatting change for how to docs 2024-10-03 13:47:59 -04:00
bracesproul 92e75aac17 cr 2024-10-03 09:40:37 -07:00
bracesproul 3e8be7fd79 fix(js): Add afterSeconds run arg 2024-10-03 09:40:10 -07:00
Vadym Barda 99fd0eedbd docs: clean up and standardize more how-tos (#1959) 2024-10-03 13:40:34 +00:00
William FHandvbarda f55586ea23 [Docs] Drop memory doc (#1986)
---------

Co-authored-by: vbarda <vadym@langchain.dev>
2024-10-03 03:05:49 +00:00
Vadym Barda 055b2ae74f ci: filter to added/modified for notebooks (#1987) 2024-10-03 02:27:57 +00:00
Isaac Francisco c39e08ec8e export checkpoint type from js-sdk (#1973) 2024-10-02 18:47:34 -07:00
William FH c74aba8cc5 [Docs] Storage ref docs (#1985) 2024-10-02 16:53:39 -07:00
Eugene Yurtsev d683630094 docs: how-to fix some issues (#1983)
Fixes some issues introduced while updating how-to docs
2024-10-02 22:06:03 +00:00
Vadym Barda 86edf631e3 langgraph: release 0.2.34 (#1982) 2024-10-02 17:42:14 -04:00
Vadym Barda 93c22fbdde langgraph: add store to the prebuilt agent (#1981) 2024-10-02 21:38:15 +00:00
Eugene Yurtsev 7f95d7de42 docs: how to guide batch 2 (#1956)
Updates the following how to guides

docs/docs/how-tos/disable-streaming.ipynb
docs/docs/how-tos/input_output_schema.ipynb
docs/docs/how-tos/many-tools.ipynb
docs/docs/how-tos/map-reduce.ipynb
docs/docs/how-tos/node-retries.ipynb
docs/docs/how-tos/pass-config-to-tools.ipynb
docs/docs/how-tos/pass_private_state.ipynb
2024-10-02 17:29:21 -04:00
Eugene Yurtsev 1a4f375226 docs: how-to guides batch 3 (#1979)
Updates the following how to guides:

docs/docs/how-tos/persistence.ipynb
docs/docs/how-tos/persistence_mongodb.ipynb
docs/docs/how-tos/persistence_postgres.ipynb
docs/docs/how-tos/persistence_redis.ipynb
docs/docs/how-tos/react-agent-from-scratch.ipynb
docs/docs/how-tos/react-agent-structured-output.ipynb
docs/docs/how-tos/recursion-limit.ipynb
docs/docs/how-tos/return-when-recursion-limit-hits.ipynb
docs/docs/how-tos/run-id-langsmith.ipynb
docs/docs/how-tos/state-model.ipynb
2024-10-02 17:29:01 -04:00
William FH 6c0da426c6 [PostGres Checkpointer] Run CI on PG15 as well (#1953) 2024-10-02 19:16:58 +00:00
William FH 7ede237508 [Docs] Add SDK ref docs for the Store client (#1974) 2024-10-02 19:16:36 +00:00
Jacob Lee fb382c20f7 fix: Fix for drawing subgraphs with multiple sinks (#1962)
* Fix for drawing subgraphs with multiple sinks

* Expand error message
2024-10-02 12:03:30 -07:00
Vadym Barda 9821638965 docs: add InjectedStore to reference (#1976) 2024-10-02 18:54:25 +00:00
Vadym Barda e48d9d3c38 docs: add a note for shared memory to persistence how-to (#1975) 2024-10-02 18:41:23 +00:00
Vadym Barda 7ecc672e61 langgraph: release 0.2.33 (#1972) 2024-10-02 13:43:17 -04:00
Vadym Barda 7efd3c726e langgraph: add support for store in ToolNode (#1968) 2024-10-02 17:39:25 +00:00
Eugene Yurtsev 74b36adb18 docs: update how-to guides batch 1 (#1918)
Add links to the following how-to guides:

docs/docs/how-tos/async.ipynb
docs/docs/how-tos/branching.ipynb
docs/docs/how-tos/configuration.ipynb
docs/docs/how-tos/create-react-agent-hitl.ipynb
docs/docs/how-tos/create-react-agent-memory.ipynb
docs/docs/how-tos/create-react-agent-system-prompt.ipynb
docs/docs/how-tos/create-react-agent.ipynb

Identified two missing concepts:
1) RunnableConfig in LangChain
2) Unclear where ReAct should link in langgraph
2024-10-02 15:09:11 +00:00
Eugene Yurtsev 2f7da90a38 docs: check for format violations with ruff (#1967) 2024-10-02 14:40:33 +00:00
William FH a3cb9c1a94 Validate no empty namespace is added (#1961)
Also check the root label isn't "langgraph"
2024-10-01 18:43:45 -07:00
Vadym Barda e0fd95b22a docs: update tutorial for long-term memory (#1955) 2024-10-01 17:56:43 -07:00
William FH db87642a10 Revert "Validate not empty (#1957)" (#1960)
This reverts commit cf67acb699.
2024-10-01 17:44:08 -07:00
William FH cf67acb699 Validate not empty (#1957) 2024-10-01 17:23:44 -07:00
Lance Martin 36be928791 Fix link (#1954) 2024-10-01 20:47:30 +00:00
Brace Sproul 702b5949d9 fix(sdk-js): Release 0.0.14 2024-10-01 13:18:02 -07:00
Brace Sproul 267485f3e6 Merge branch 'main' into rc 2024-10-01 13:13:01 -07:00
William FH 5c3ac5d16d Update PG Implementation (#1948) 2024-10-01 13:11:19 -07:00
Vadym Barda db6f8a53b6 docs: add shared memory how to (#1920) 2024-10-01 19:54:59 +00:00
Lance MartinandChester Curme 98d1f27471 Add memory conceptual doc (#1868)
* Add memory conceptual doc

* update

* typo

* v1 conceptual doc

* Update per feedback

* Capture feedback

* Update based on feedback

* Remove memory service

* Address comments

---------

Co-authored-by: Chester Curme <chester.curme@gmail.com>
2024-10-01 12:54:23 -07:00
bracesproul 79cded748d fix(sdk-js): Release 0.0.14 2024-10-01 12:45:57 -07:00
Brace Sproul c08dd2f71c Merge pull request #1949 from langchain-ai/brace/update-rc
fix: Update rc branch
2024-10-01 12:44:02 -07:00
bracesproul 7dbb5ce98f Merge branch 'main' of https://github.com/langchain-ai/langgraph into rc 2024-10-01 12:37:22 -07:00
Brace Sproul 813aadeb47 Merge pull request #1947 from langchain-ai/brace/fix-null-obj-err
fix(sdk-js): Fix null item error
2024-10-01 12:36:57 -07:00
Vadym Barda 4a45f6c99a langgraph, sqlite, postgres: update to use langgraph-checkpoint==2.0.0 (#1946) 2024-10-01 15:28:06 -04:00
bracesproul 38a3e11c9f cr 2024-10-01 11:32:07 -07:00
bracesproul 8486c9d413 fix(sdk-js): Fix null item error 2024-10-01 11:31:29 -07:00
Vadym Barda 00662ab557 ci: update the check for changed notebooks (#1945) 2024-10-01 18:14:32 +00:00
Brace Sproul db4191b89e Merge pull request #1943 from langchain-ai/release
Release 0.0.14-rc.0
2024-10-01 10:48:36 -07:00
bracesproul 45bf27bafe Release 0.0.14-rc.0 2024-10-01 10:45:49 -07:00
Brace Sproul 11d636ff83 Merge pull request #1910 from langchain-ai/wfh/js_store_client
Add JS SDK Store Client
2024-10-01 10:44:06 -07:00
Vadym Barda 78c9c15b14 langgraph, checkpoint: update versions (#1942) 2024-10-01 13:43:07 -04:00
Vadym Barda 46b52b2426 ci: run notebook checks for changed notebooks (#1941) 2024-10-01 16:50:24 +00:00
Eugene Yurtsev 674180ad0c docs: Add linting check as part of docs deploy (#1939)
We'll need to add the same thing as part of CI testing, but a second check
during deployment wont hurt in case CI is by passed for whatever reason.
2024-10-01 10:50:39 -04:00
Vadym Barda 71efff7cee ci: add a script to check sync and async methods in SDK (#1938) 2024-10-01 09:50:26 -04:00
William FH dd88ac6224 Bump SDK Py (#1935) 2024-10-01 08:17:51 +00:00
Nuno Campos 53c2e4d8c2 Merge pull request #1932 from langchain-ai/eugene/format_docs
docs: format with ruff
2024-09-30 19:13:47 -07:00
Eugene Yurtsev 70b0032191 format docs 2024-09-30 22:08:27 -04:00
William FH 445b795037 [Docs] update min bounds from API (#1929) 2024-09-30 17:06:34 -07:00
William FH 29f58fd9e5 Custom loads support in postgres checkpointer (#1930) 2024-09-30 16:42:23 -07:00
Vadym Barda 716d23e269 langgraph: release 0.2.31 (#1928) 2024-09-30 18:33:34 -04:00
Vadym Barda a9df3a3515 langgraph: use correct logic for binding tools in prebuilt agent (#1927) 2024-09-30 22:22:48 +00:00
Vadym Barda da935e7805 langgraph: fix edge case with string enums as node names (#1926) 2024-09-30 18:00:33 -04:00
Andrew Nguonly 6d1d705b84 Update API docs. (#1925) 2024-09-30 14:23:32 -07:00
William FH 97f79fc66b Add Postgres Store Implementation (#1906) 2024-09-30 21:18:58 +00:00
Isaac Francisco 17dc1108a3 docs: __start__/__end__ consistency (#1874)
* changes

* skip mermaid

* retries fix

* viz error

* changes
2024-09-30 13:55:53 -07:00
Eugene Yurtsev d29747906d docs: Add ruff commands to Makefile and pyproject (#1921) 2024-09-30 16:19:17 -04:00
Vadym Barda cb8db211c2 langgraph: bump checkpoint (#1922) 2024-09-30 15:56:46 -04:00
Isaac Francisco 865436529e simple -> simply (#1919) 2024-09-30 19:30:29 +00:00
Vadym Barda 3c9441c039 checkpoint: release 1.0.14 (#1917) 2024-09-30 14:54:00 -04:00
Vadym Barda 7071817155 checkpoint: fix namespace issues (#1915) 2024-09-30 14:52:57 -04:00
William Fu-Hinthorn 4fca814d3a Merge branch 'main' into wfh/js_store_client 2024-09-30 10:49:09 -07:00
William Fu-Hinthorn d309c36388 Review 2024-09-30 10:48:49 -07:00
William Fu-Hinthorn f064a5969d Add JS SDK Store Client 2024-09-30 09:08:37 -07:00
180 changed files with 10300 additions and 5145 deletions

No files matched your search

+64
View File
@@ -0,0 +1,64 @@
import ast
import os
from itertools import filterfalse
from typing import List, Tuple
ROOT_PATH = os.path.abspath(os.path.join(__file__, "..", "..", ".."))
CLIENT_PATH = os.path.join(ROOT_PATH, "libs", "sdk-py", "langgraph_sdk", "client.py")
def get_class_methods(node: ast.ClassDef) -> List[str]:
return [n.name for n in node.body if isinstance(n, (ast.FunctionDef, ast.AsyncFunctionDef))]
def find_classes(tree: ast.AST) -> List[Tuple[str, List[str]]]:
classes = []
for node in ast.walk(tree):
if isinstance(node, ast.ClassDef):
methods = get_class_methods(node)
classes.append((node.name, methods))
return classes
def compare_sync_async_methods(sync_methods: List[str], async_methods: List[str]) -> List[str]:
sync_set = set(sync_methods)
async_set = set(async_methods)
missing_in_sync = list(async_set - sync_set)
missing_in_async = list(sync_set - async_set)
return missing_in_sync + missing_in_async
def main():
with open(CLIENT_PATH, "r") as file:
tree = ast.parse(file.read())
classes = find_classes(tree)
def is_sync(class_spec: Tuple[str, List[str]]) -> bool:
return class_spec[0].startswith("Sync")
sync_class_name_to_methods = {class_name: class_methods for class_name, class_methods in filter(is_sync, classes)}
async_class_name_to_methods = {class_name: class_methods for class_name, class_methods in filterfalse(is_sync, classes)}
mismatches = []
for async_class_name, async_class_methods in async_class_name_to_methods.items():
sync_class_name = "Sync" + async_class_name
sync_class_methods = sync_class_name_to_methods.get(sync_class_name, [])
diff = compare_sync_async_methods(sync_class_methods, async_class_methods)
if diff:
mismatches.append((sync_class_name, async_class_name, diff))
if mismatches:
error_message = "Mismatches found between sync and async client methods:\n"
for sync_class_name, async_class_name, diff in mismatches:
error_message += f"{sync_class_name} vs {async_class_name}:\n"
for method in diff:
error_message += f" - {method}\n"
raise ValueError(error_message)
print("All sync and async client methods match.")
if __name__ == "__main__":
main()
+12
View File
@@ -66,6 +66,18 @@ jobs:
uses: ./.github/workflows/_test_scheduler_kafka.yml
secrets: inherit
check-sdk-methods:
name: "Check SDK methods matching"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Run check_sdk_methods script
run: python .github/scripts/check_sdk_methods.py
integration-test:
name: CLI integration test
uses: ./.github/workflows/_integration_test.yml
+24
View File
@@ -22,7 +22,27 @@ concurrency:
cancel-in-progress: false
jobs:
get-changed-files:
runs-on: ubuntu-latest
outputs:
changed-files: ${{ steps.changed-files.outputs.added_modified }}
steps:
- uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: Ana06/get-changed-files@v2.3.0
with:
filter: "docs/docs/**"
run-changed-notebooks:
needs: get-changed-files
uses: ./.github/workflows/run_notebooks.yml
secrets: inherit
with:
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
deploy:
# needs: run-changed-notebooks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@@ -41,6 +61,10 @@ jobs:
poetry install --with docs
poetry run pip install -U pytest pytest-check-links langsmith langchain GitPython
- name: Lint Docs
# This step lints the docs using the existing linting set up.
# It should be very fast and should not require any external services.
run: make lint-docs
- name: Build site
run: make build-docs
env:
+18 -2
View File
@@ -2,6 +2,12 @@ name: Run notebooks
on:
workflow_dispatch:
workflow_call:
inputs:
changed-files:
required: false
type: string
description: "JSON string of changed files"
schedule:
- cron: '0 13 * * *'
@@ -14,7 +20,6 @@ jobs:
- "development"
- "latest"
name: "test (langgraph: ${{ matrix.lib-version }})"
steps:
- uses: actions/checkout@v4
- name: Set up Python + Poetry
@@ -56,7 +61,18 @@ jobs:
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
FIREWORKS_API_KEY: ${{ secrets.FIREWORKS_API_KEY }}
run: |
./docs/_scripts/execute_notebooks.sh
if [ "${{ github.event_name }}" = "workflow_dispatch" ] || [ "${{ github.event_name }}" = "schedule" ]; then
echo "Running all notebooks"
./docs/_scripts/execute_notebooks.sh
else
CHANGED_FILES=$(echo '${{ inputs.changed-files }}' | tr ' ' '\n' | grep '\.ipynb$' || true)
if [ -n "$CHANGED_FILES" ]; then
echo "Running changed notebooks: $CHANGED_FILES"
./docs/_scripts/execute_notebooks.sh $CHANGED_FILES
else
echo "No notebook files changed, skipping execution"
fi
fi
- name: Stop services
run: make stop-services
+12 -2
View File
@@ -1,4 +1,4 @@
.PHONY: build-docs serve-docs serve-clean-docs clean-docs codespell build-typedoc
.PHONY: lint-docs format-docs build-docs serve-docs serve-clean-docs clean-docs codespell build-typedoc
build-typedoc:
cd libs/sdk-js && yarn install --include-dev && yarn typedoc
@@ -19,6 +19,16 @@ clean-docs:
find ./docs/docs -name "*.ipynb" -type f -delete
rm -rf docs/site
## Run format against the project documentation.
format-docs:
poetry run ruff format docs/docs
poetry run ruff check --fix docs/docs
# Check the docs for linting violations
lint-docs:
poetry run ruff format --check docs/docs
poetry run ruff check docs/docs
codespell:
./docs/codespell_notebooks.sh .
@@ -26,4 +36,4 @@ start-services:
docker compose -f docs/test-compose.yml up -V --force-recreate --wait --remove-orphans
stop-services:
docker compose -f docs/test-compose.yml down
docker compose -f docs/test-compose.yml down
+3 -3
View File
@@ -60,7 +60,7 @@ from typing import Annotated, Literal, TypedDict
from langchain_core.messages import HumanMessage
from langchain_anthropic import ChatAnthropic
from langchain_core.tools import tool
from langgraph.checkpoint.memory import MemorySaver
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.graph import END, START, StateGraph, MessagesState
from langgraph.prebuilt import ToolNode
@@ -125,7 +125,7 @@ workflow.add_conditional_edges(
workflow.add_edge("tools", 'agent')
# Initialize memory to persist state between graph runs
checkpointer = MemorySaver()
checkpointer = InMemorySaver()
# Finally, we compile it!
# This compiles it into a LangChain Runnable,
@@ -201,7 +201,7 @@ final_state["messages"][-1].content
<summary>Compile the graph.</summary>
- When we compile the graph, we turn it into a LangChain [Runnable](https://python.langchain.com/v0.2/docs/concepts/#runnable-interface), which automatically enables calling `.invoke()`, `.stream()` and `.batch()` with your inputs
- We can also optionally pass checkpointer object for persisting state between graph runs, and enabling memory, human-in-the-loop workflows, time travel and more. In our case we use `MemorySaver` - a simple in-memory checkpointer
- We can also optionally pass checkpointer object for persisting state between graph runs, and enabling memory, human-in-the-loop workflows, time travel and more. In our case we use `InMemorySaver` - a simple in-memory checkpointer
</details>
6. <details>
+7 -2
View File
@@ -22,8 +22,13 @@ execute_notebook() {
export -f execute_notebook
# Find all notebooks and filter out those in the skip list
notebooks=$(find docs/docs/tutorials docs/docs/how-tos -name "*.ipynb" | grep -v ".ipynb_checkpoints" | grep -vFf <(echo "$SKIP_NOTEBOOKS"))
# Check if custom notebook paths are provided
if [ $# -gt 0 ]; then
notebooks="$@"
else
# Find all notebooks and filter out those in the skip list
notebooks=$(find docs/docs/tutorials docs/docs/how-tos -name "*.ipynb" | grep -v ".ipynb_checkpoints" | grep -vFf <(echo "$SKIP_NOTEBOOKS"))
fi
# Execute notebooks sequentially
for file in $notebooks; do
+16 -2
View File
@@ -11,6 +11,13 @@ NOTEBOOK_DIRS = ("docs/docs/how-tos","docs/docs/tutorials")
DOCS_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
CASSETTES_PATH = os.path.join(DOCS_PATH, "cassettes")
BLOCKLIST_COMMANDS = (
# skip if has WebBaseLoader to avoid caching web pages
"WebBaseLoader",
# skip if has draw_mermaid_png to avoid generating mermaid images via API
"draw_mermaid_png",
)
NOTEBOOKS_NO_CASSETTES = (
"docs/docs/how-tos/visualization.ipynb",
"docs/docs/how-tos/many-tools.ipynb"
@@ -63,6 +70,14 @@ def is_comment(code: str) -> bool:
return code.strip().startswith("#")
def has_blocklisted_command(code: str) -> bool:
code = code.strip()
for blocklisted_command in BLOCKLIST_COMMANDS:
if blocklisted_command in code:
return True
return False
def add_vcr_to_notebook(
notebook: nbformat.NotebookNode, cassette_prefix: str
) -> nbformat.NotebookNode:
@@ -93,8 +108,7 @@ def add_vcr_to_notebook(
if all(is_comment(line) or not line.strip() for line in lines):
continue
# skip if has WebBaseLoader to avoid caching web pages
if "WebBaseLoader" in cell.source:
if has_blocklisted_command(cell.source):
continue
cell_id = cell.get("id", idx)
@@ -0,0 +1 @@
eNqFVG1sU1UYLkIIGkA0GkkY7Fid8Qenve1tR9uQYO0Ax6gbW0GKEXJ27rnttfeLe07HPiTKwKAjkVxJGCrG6LqWlA26AGrAKYmQGPWHhhgsBELUGP/4C6KJBua5XcsgW2Z/NPee9+t5n+c5t7/QRSyqGPqcEUVnxEKY8Rdq9xcssjNLKNuX1whLG1KurbUjMZS1lHJDmjGTRrxeZCoepLO0ZZgK9mBD83b5vBqhFKUIzXUaUk/5hz63hrp3MCNDdOqOAJ/gD6wE7loSP3m5z20ZKuFP7iwllptHscGR6Mw5ekF5ErQTjWidxIoArQfoSCNAoeB5o9O9+xWnlSER1UnFKspKBIowCKmh64RBPx8mNPoFpyftoYxoTl7SyAJkEYBAmqimnFUBolShjG8CGFIzip4CzAAsTYADyAM283+g6LLBi3cX0gRJnLGDubRBmT02jYOTCGNiMkh0bEi8lz2a6lXMlUAisooYKWIHW4Vku5ghxIRIVbpIfrLKLiHTVBWMnLj3Vb7HSJUMyHpMMj1cdCBCTqXO7M+iNRzeth4umQ4Ejxjw+EvdkG+n6ConHaqIQ8qblfi5ewMmwhneB1btYOcni0/cm2NQeziOcGvHfS2RhdP2MLK0xsCpe8+trM4UjdiFWNv0cdXg1DjR4/N5wmP3NaY9OraHZaRSMnaX5LslRa6vCIVGKPhO1FhSiZ5iaXvIL4SOWYSa3Mpkb563ZFnan+OKkO+/KVTd90lrS03N665Hc01cHXt8naWsBEIAtGIGHP8AXyjiD0cEP1gfT4zEqmMSM4oxlrCQ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PnMqf/bT36n8+/u72N46V/vvJ0NHhof9d+bhgTD82erTprYu9f371g7Wtf/qFvXdb2897tk7+9px1qmc6t2f9p3/pC7wSvDi04+Syj3YfXf3shv7H9/+RmXfnFje1VVXRK8LyA7/cPLPrX2n3zlbtkdzI5wv7QqdHl33vjhbhwOuNe55MuAOXfv9+4OHTT/edXnBi4ZW944t+8OHK6NINX3kRPXp0+W27V74yM/4ds7pjVfvyh860f3n83hNXf/QHa9ddS3A1WfTMO8WnVoaO7Hw3NH+xdOflqwc2fRgk773pNv1N34t27HlrUVpFb/4mU2iaPzT10eJrt2dTF9ZebPts+YFlv5s4u/O5hhWXRp9ZkSCvXr7jjc+eGzi79/ySf/y9+sJusatYePpn2befbSvse5eev++bF34cX5PYJjd9vqCq6tq1BVXzTp5+351fVfV/OX+JnA==
+2 -2
View File
@@ -36,8 +36,8 @@ Dependencies can optionally be specified in one of the following files: `pyproje
The dependencies below will be included in the image, you can also use them in your code, as long as with a compatible version range:
```
langgraph>=0.2.18,<0.3.0
langgraph-checkpoint>=1.0.9
langgraph>=0.2.30,<0.3.0
langgraph-checkpoint>=1.0.14
langchain-core>=0.2.38,<0.4.0
langsmith>=0.1.63
orjson>=3.9.7
@@ -36,8 +36,8 @@ Dependencies can optionally be specified in one of the following files: `pyproje
The dependencies below will be included in the image, you can also use them in your code, as long as with a compatible version range:
```
langgraph>=0.2.18,<0.3.0
langgraph-checkpoint>=1.0.9
langgraph>=0.2.30,<0.3.0
langgraph-checkpoint>=1.0.14
langchain-core>=0.2.38,<0.4.0
langsmith>=0.1.63
orjson>=3.9.7
@@ -392,7 +392,7 @@
"metadata": {},
"outputs": [],
"source": [
"from langgraph.checkpoint.memory import MemorySaver"
"from langgraph.checkpoint.memory import InMemorySaver"
]
},
{
@@ -402,7 +402,7 @@
"metadata": {},
"outputs": [],
"source": [
"checkpointer = MemorySaver()\n",
"checkpointer = InMemorySaver()\n",
"graph_with_memory = create_react_agent(model, tools, checkpointer=checkpointer)"
]
},
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,19 @@
<!doctype html>
<html>
<head>
<title>Open Assistants API Specification</title>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1" />
</head>
<body>
<script id="api-reference" data-url="./open_agent_api.json"></script>
<script>
var configuration = {}
document.getElementById('api-reference').dataset.configuration =
JSON.stringify(configuration)
</script>
<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
</body>
</html>
+67 -45
View File
@@ -255,6 +255,18 @@
},
"name": "assistant_id",
"in": "path"
},
{
"description": "Include graph representation of subgraphs. If an integer value is provided, only subgraphs with a depth less than or equal to the value will be included.",
"required": false,
"schema": {
"oneOf": [{ "type": "boolean" }, { "type": "integer" }],
"title": "Xray",
"default": false,
"description": "Include graph representation of subgraphs. If an integer value is provided, only subgraphs with a depth less than or equal to the value will be included."
},
"name": "xray",
"in": "query"
}
],
"responses": {
@@ -629,37 +641,24 @@
}
}
},
"/threads/{thread_id}/state/{checkpoint_id}": {
"get": {
"/threads/{thread_id}/state/checkpoint": {
"post": {
"tags": [
"threads/state"
],
"summary": "Get Thread State At Checkpoint",
"description": "Get state for a thread.",
"operationId": "get_thread_state_at_checkpoint_threads__thread_id__state__checkpoint_id__get",
"parameters": [
{
"description": "The ID of the thread.",
"required": true,
"schema": {
"type": "string",
"format": "uuid",
"title": "Thread Id",
"description": "The ID of the thread."
},
"name": "thread_id",
"in": "path"
"description": "Get state for a thread at a specific checkpoint.",
"operationId": "post_thread_state_at_checkpoint_threads__thread_id__state__checkpoint_id__get",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ThreadStateCheckpointRequest"
}
}
},
{
"required": true,
"schema": {
"type": "string",
"title": "Checkpoint Id"
},
"name": "checkpoint_id",
"in": "path"
}
],
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
@@ -2847,6 +2846,26 @@
"title": "ThreadPatch",
"description": "Payload for creating a thread."
},
"ThreadStateCheckpointRequest": {
"properties": {
"checkpoint": {
"type": "object",
"title": "Checkpoint",
"description": "The checkpoint to get the state for."
},
"subgraphs": {
"type": "boolean",
"title": "Subgraphs",
"description": "Include subgraph states."
}
},
"required": [
"checkpoint"
],
"type": "object",
"title": "ThreadStateCheckpointRequest",
"description": "Payload for getting the state of a thread at a checkpoint."
},
"ThreadState": {
"properties": {
"values": {
@@ -2889,6 +2908,13 @@
"interrupts": {
"type": "array",
"items": {}
},
"checkpoint": {
"type": "object",
"title": "Checkpoint"
},
"state": {
"$ref": "#/components/schemas/ThreadState"
}
},
"required": [
@@ -2899,9 +2925,9 @@
"type": "array",
"title": "Tasks"
},
"checkpoint_id": {
"type": "string",
"title": "Checkpoint Id"
"checkpoint": {
"type": "object",
"title": "Checkpoint"
},
"metadata": {
"type": "object",
@@ -2911,16 +2937,16 @@
"type": "string",
"title": "Created At"
},
"parent_checkpoint_id": {
"type": "string",
"title": "Parent Checkpoint Id"
"parent_checkpoint": {
"type": "object",
"title": "Parent Checkpoint"
}
},
"type": "object",
"required": [
"values",
"next",
"checkpoint_id",
"checkpoint",
"metadata",
"created_at"
],
@@ -2969,9 +2995,9 @@
],
"title": "Values"
},
"checkpoint_id": {
"type": "string",
"title": "Checkpoint Id"
"checkpoint": {
"type": "object",
"title": "Checkpoint"
},
"as_node": {
"type": "string",
@@ -2984,18 +3010,14 @@
},
"ThreadStateUpdateResponse": {
"properties": {
"checkpoint_id": {
"type": "string",
"title": "Checkpoint Id"
},
"as_node": {
"type": "string",
"title": "As Node"
"checkpoint": {
"type": "object",
"title": "Checkpoint"
}
},
"type": "object",
"title": "ThreadStateUpdate",
"description": "Payload for adding state to a thread."
"title": "ThreadStateUpdateResponse",
"description": "Response for adding state to a thread."
},
"ValidationError": {
"properties": {
@@ -1,79 +1,8 @@
# Python SDK Reference
The Python SDK provides four underlying clients (`AssistantsClient`, `ThreadsClient`, `RunsClient`, `CronClient`) that correspond to each of the core API models and one top-level client (`LangGraphClient`) to access them.
## get_client()
The `get_client()` function returns the top-level `LangGraphClient` client.
```python
from langgraph_sdk import get_client
# get top-level LangGraphClient
client = get_client(url="http://localhost:8123")
# example usage: client.<model>.<method_name>()
assistants = await client.assistants.get(assistant_id="some_uuid")
```
::: langgraph_sdk.client.get_client
::: langgraph_sdk.client
handler: python
## LangGraphClient
`LangGraphClient` is the top-level client for accessing `AssistantsClient`, `ThreadsClient`, `RunsClient`, and `CronClient`.
::: langgraph_sdk.client.LangGraphClient
handler: python
## AssistantsClient
Access the `AssistantsClient` via the `LangGraphClient.assistants` attribute.
```python
from langgraph_sdk import get_client
client = get_client(url="http://localhost:8123")
await client.assistants.<method_name>()
```
::: langgraph_sdk.client.AssistantsClient
handler: python
## ThreadsClient
Access the `ThreadsClient` via the `LangGraphClient.threads` attribute.
```python
from langgraph_sdk import get_client
client = get_client(url="http://localhost:8123")
await client.threads.<method_name>()
```
::: langgraph_sdk.client.ThreadsClient
handler: python
## RunsClient
Access the `RunsClient` via the `LangGraphClient.runs` attribute.
```python
from langgraph_sdk import get_client
client = get_client(url="http://localhost:8123")
await client.runs.<method_name>()
```
::: langgraph_sdk.client.RunsClient
handler: python
## CronClient
Access the `CronClient` via the `LangGraphClient.crons` attribute.
```python
from langgraph_sdk import get_client
client = get_client(url="http://localhost:8123")
await client.crons.<method_name>()
```
::: langgraph_sdk.client.CronClient
::: langgraph_sdk.schema
handler: python
+175
View File
@@ -0,0 +1,175 @@
# Memory
## What is Memory?
Memory in the context of LLMs and AI applications refers to the ability to process, retain, and utilize information from past interactions or data sources. Examples include:
- Managing what messages (e.g., from a long message history) are sent to a chat model to limit token usage
- Summarizing past conversations to give a chat model context from prior interactions
- Selecting few shot examples (e.g., from a dataset) to guide model responses
- Maintaining persistent data (e.g., user preferences) across multiple chat sessions
- Allowing an LLM to update its own prompt using past information (e.g., meta-prompting)
- Retrieving information relevant to a conversation or question from a long-term storage system
Below, we'll discuss each of these examples in some detail.
## Managing Messages
### Editing message lists
Chat models accept instructions through [messages](https://python.langchain.com/docs/concepts/#messages), which can serve as general instructions (e.g., a system message) or user-provided instructions (e.g., human messages). In chat applications, messages often alternate between human inputs and model responses, accumulating in a list over time. Because context windows are limited and token-rich message lists can be costly, many applications can benefit from approaches to actively manage messages.
The most directed approach is to remove specific messages from a list. This can be done using [RemoveMessage](https://langchain-ai.github.io/langgraph/how-tos/memory/delete-messages/#manually-deleting-messages) based upon the message `id`, a unique identifier for each message. In the below example, we keep only the last two messages in the list using `RemoveMessage` to remove older messages based upon their `id`.
```python
from langchain_core.messages import RemoveMessage
# Message list
messages = [AIMessage("Hi.", name="Bot", id="1")]
messages.append(HumanMessage("Hi.", name="Lance", id="2"))
messages.append(AIMessage("So you said you were researching ocean mammals?", name="Bot", id="3"))
messages.append(HumanMessage("Yes, I know about whales. But what others should I learn about?", name="Lance", id="4"))
# Isolate messages to delete
delete_messages = [RemoveMessage(id=m.id) for m in messages[:-2]]
print(delete_messages)
[RemoveMessage(content='', id='1'), RemoveMessage(content='', id='2')]
```
Because the context window for chat model is denominated in tokens, it can be useful to trim message lists based upon some number of tokens that we want to retain. To do this, we can use [`trim_messages`](https://python.langchain.com/docs/how_to/trim_messages/#trimming-based-on-token-count) and specify number of token to keep from the list, as well as the `strategy` (e.g., keep the last `max_tokens`).
```python
from langchain_core.messages import trim_messages
trim_messages(
messages,
# Keep the last <= n_count tokens of the messages.
strategy="last",
# Remember to adjust based on your model
# or else pass a custom token_encoder
token_counter=ChatOpenAI(model="gpt-4o"),
# Most chat models expect that chat history starts with either:
# (1) a HumanMessage or
# (2) a SystemMessage followed by a HumanMessage
# Remember to adjust based on the desired conversation
# length
max_tokens=45,
# Most chat models expect that chat history starts with either:
# (1) a HumanMessage or
# (2) a SystemMessage followed by a HumanMessage
start_on="human",
# Most chat models expect that chat history ends with either:
# (1) a HumanMessage or
# (2) a ToolMessage
end_on=("human", "tool"),
# Usually, we want to keep the SystemMessage
# if it's present in the original history.
# The SystemMessage has special instructions for the model.
include_system=True,
)
```
### Usage with LangGraph
When building agents in LangGraph, we commonly want to manage a list of messages in the graph state. Because this is such a common use case, [MessagesState](https://langchain-ai.github.io/langgraph/concepts/low_level/#working-with-messages-in-graph-state) is a built-in LangGraph state schema that includes a `messages` key, which is a list of messages. `MessagesState` also includes an `add_messages` reducer for updating the messages list with new messages as the application runs. The `add_messages` reducer allows us to [append](https://langchain-ai.github.io/langgraph/concepts/low_level/#serialization) new messages to the `messages` state key as shown below. When we perform a state update with `{"messages": new_message}` returned from `my_node`, the `add_messages` reducer appends `new_message` to the existing list of messages.
```python
def my_node(state: State):
# Add a new message to the state
new_message = HumanMessage(content="message")
return {"messages": new_message}
```
The `add_messages` reducer built into `MessagesState` [also works with the `RemoveMessage` utility that we discussed above](https://langchain-ai.github.io/langgraph/how-tos/memory/delete-messages/). In this case, we can perform a state update with a list of `delete_messages` to remove specific messages from the `messages` list.
```python
def my_node(state: State):
# Delete messages from state
delete_messages = [RemoveMessage(id=m.id) for m in state['messages'][:-2]]
return {"messages": delete_messages}
```
See this how-to [guide](https://langchain-ai.github.io/langgraph/how-tos/memory/manage-conversation-history/) and module 2 from our [LangChain Academy](https://github.com/langchain-ai/langchain-academy/tree/main/module-2) course for example usage.
## Summarizing Past Conversations
The problem with trimming or removing messages, as shown above, is that we may loose information from culling of the message queue. Because of this, some applications benefit from a more sophisticated approach of summarizing the message history using a chat model.
Simple prompting and orchestration logic can be used to achieve this. As an example, in LangGraph we can extend the [MessagesState](https://langchain-ai.github.io/langgraph/concepts/low_level/#working-with-messages-in-graph-state) to include a `summary` key.
```python
from langgraph.graph import MessagesState
class State(MessagesState):
summary: str
```
Then, we can generate a summary of the chat history, using any existing summary as context for the next summary. This `summarize_conversation` node can be called after some number of messages have accumulated in the `messages` state key.
```python
def summarize_conversation(state: State):
# First, we get any existing summary
summary = state.get("summary", "")
# Create our summarization prompt
if summary:
# A summary already exists
summary_message = (
f"This is summary of the conversation to date: {summary}\n\n"
"Extend the summary by taking into account the new messages above:"
)
else:
summary_message = "Create a summary of the conversation above:"
# Add prompt to our history
messages = state["messages"] + [HumanMessage(content=summary_message)]
response = model.invoke(messages)
# Delete all but the 2 most recent messages
delete_messages = [RemoveMessage(id=m.id) for m in state["messages"][:-2]]
return {"summary": response.content, "messages": delete_messages}
```
See this how-to [here](https://langchain-ai.github.io/langgraph/how-tos/memory/add-summary-conversation-history/) and module 2 from our [LangChain Academy](https://github.com/langchain-ai/langchain-academy/tree/main/module-2) course for example usage.
## Few Shot Examples
Few-shot learning is a powerful technique where LLMs can be ["programmed"](https://x.com/karpathy/status/1627366413840322562) inside the prompt with input-output examples to perform diverse tasks. While various [best-practices](https://python.langchain.com/docs/concepts/#1-generating-examples) can be used to generate few-shot examples, often the challenge lies in selecting the most relevant examples based on user input.
LangChain [`ExampleSelectors`](https://python.langchain.com/docs/how_to/#example-selectors) can be used to customize few-shot example selection from a collection of examples using criteria such as length, semantic similarity, semantic ngram overlap, or maximal marginal relevance.
If few-shot examples are stored in a [LangSmith Dataset](https://docs.smith.langchain.com/how_to_guides/datasets), then dynamic few-shot example selectors can be used out-of-the box to achieve this same goal. LangSmith will index the dataset for you and enable retrieval of few shot examples that are most relevant to the user input based upon keyword similarity ([using a BM25-like algorithm](https://docs.smith.langchain.com/how_to_guides/datasets/index_datasets_for_dynamic_few_shot_example_selection) for keyword based similarity).
See this how-to [video](https://www.youtube.com/watch?v=37VaU7e7t5o) for example usage of dynamic few-shot example selection in LangSmith. Also, see this [blog post](https://blog.langchain.dev/few-shot-prompting-to-improve-tool-calling-performance/) showcasing few-shot prompting to improve tool calling performance and this [blog post](https://blog.langchain.dev/aligning-llm-as-a-judge-with-human-preferences/) using few-shot example to align an LLMs to human preferences.
## Maintaining Data Across Chat Sessions
LangGraph's [persistence layer](https://langchain-ai.github.io/langgraph/concepts/persistence/#persistence) has checkpointers that utilize various storage systems, including an in-memory key-value store or different databases. These checkpoints capture the graph state at each execution step and accumulate in a thread, which can be accessed at a later time using a thread ID to resume a previous graph execution. We add persistence to our graph by passing a checkpointer to the `compile` method, as shown here.
```python
# Compile the graph with a checkpointer
checkpointer = InMemorySaver()
graph = workflow.compile(checkpointer=checkpointer)
# Invoke the graph with a thread ID
config = {"configurable": {"thread_id": "1"}}
graph.invoke(input_state, config)
# get the latest state snapshot at a later time
config = {"configurable": {"thread_id": "1"}}
graph.get_state(config)
```
Persistence is critical sustaining a long-running chat sessions. For example, a chat between a user and an AI assistant may have interruptions. Persistence ensures that a user can continue that particular chat session at any later point in time. However, what happens if a user initiates a new chat session with an assistant? This spawns a new thread, and the information from the previous session (thread) is not retained. This motivates the need for a memory service that can maintain data across chat sessions (threads).
## Meta-prompting
Meta-prompting uses an LLM to generate or refine its own prompts or instructions. This approach allows the system to dynamically update and improve its own behavior, potentially leading to better performance on various tasks. This is particularly useful for tasks where the instructions are challenging to specify a priori.
Meta-prompting can use past information to update the prompt. As an example, this [Tweet generator](https://www.youtube.com/watch?v=Vn8A3BxfplE) uses meta-prompting to iteratively improve the summarization prompt used to generate high quality paper summaries for Twitter. In this case, we used a LangSmith dataset to house several papers that we wanted to summarize, generated summaries using a naive summarization prompt, manually reviewed the summaries, captured feedback from human review using the LangSmith Annotation Queue, and passed this feedback to a chat model to re-generate the summarization prompt. The process was repeated in a loop until the summaries met our criteria in human review.
## Retrieving relevant information from long-term storage
A central challenge that spans many different memory use-case can be summarized simply: how can we retrieve *relevant information* from a long-term storage system and pass it to a chat model? As an example, assume we have a system that stores a large number of specific details about a user, but the user asks a specific question related to restaurant recommendations. It would be costly to trivially extract *all* personal user information and pass it to a chat model. Instead, we want to extract only the information that is most relevant to the user's current chat interaction (e,g,. food preferences, location, etc.) and pass it to the chat model.
There is a large body of work on retrieval that aims to address this challenge. See our tutorials focused on [RAG, or Retrieval Augmented Generation](https://langchain-ai.github.io/langgraph/tutorials/rag/langgraph_adaptive_rag/), our conceptual docs on [retrieval](https://python.langchain.com/docs/concepts/#retrieval), and our [open source repository](https://github.com/langchain-ai/rag-from-scratch) along with [videos](https://www.youtube.com/playlist?list=PLfaIDFEXuae2LXbO1_PKyVJiQ23ZztA0x) on this topic.
+4 -4
View File
@@ -26,7 +26,7 @@ Let's see what checkpoints are saved when a simple graph is invoked as follows:
```python
from langgraph.graph import StateGraph, START, END
from langgraph.checkpoint.memory import MemorySaver
from langgraph.checkpoint.memory import InMemorySaver
from typing import Annotated
from typing_extensions import TypedDict
from operator import add
@@ -49,7 +49,7 @@ workflow.add_edge(START, "node_a")
workflow.add_edge("node_a", "node_b")
workflow.add_edge("node_b", END)
checkpointer = MemorySaver()
checkpointer = InMemorySaver()
graph = workflow.compile(checkpointer=checkpointer)
config = {"configurable": {"thread_id": "1"}}
@@ -220,7 +220,7 @@ The final thing you can optionally specify when calling `update_state` is `as_no
Under the hood, checkpointing is powered by checkpointer objects that conform to [BaseCheckpointSaver][langgraph.checkpoint.base.BaseCheckpointSaver] interface. LangGraph provides several checkpointer implementations, all implemented via standalone, installable libraries:
* `langgraph-checkpoint`: The base interface for checkpointer savers ([BaseCheckpointSaver][langgraph.checkpoint.base.BaseCheckpointSaver]) and serialization/deserialization interface ([SerializerProtocol][langgraph.checkpoint.serde.base.SerializerProtocol]). Includes in-memory checkpointer implementation ([MemorySaver][langgraph.checkpoint.memory.MemorySaver]) for experimentation. LangGraph comes with `langgraph-checkpoint` included.
* `langgraph-checkpoint`: The base interface for checkpointer savers ([BaseCheckpointSaver][langgraph.checkpoint.base.BaseCheckpointSaver]) and serialization/deserialization interface ([SerializerProtocol][langgraph.checkpoint.serde.base.SerializerProtocol]). Includes in-memory checkpointer implementation ([InMemorySaver][langgraph.checkpoint.memory.InMemorySaver]) for experimentation. LangGraph comes with `langgraph-checkpoint` included.
* `langgraph-checkpoint-sqlite`: An implementation of LangGraph checkpointer that uses SQLite database ([SqliteSaver][langgraph.checkpoint.sqlite.SqliteSaver] / [AsyncSqliteSaver][langgraph.checkpoint.sqlite.aio.AsyncSqliteSaver]). Ideal for experimentation and local workflows. Needs to be installed separately.
* `langgraph-checkpoint-postgres`: An advanced checkpointer that uses Postgres database ([PostgresSaver][langgraph.checkpoint.postgres.PostgresSaver] / [AsyncPostgresSaver][langgraph.checkpoint.postgres.aio.AsyncPostgresSaver]), used in LangGraph Cloud. Ideal for using in production. Needs to be installed separately.
@@ -236,7 +236,7 @@ Each checkpointer conforms to [BaseCheckpointSaver][langgraph.checkpoint.base.Ba
If the checkpointer is used with asynchronous graph execution (i.e. executing the graph via `.ainvoke`, `.astream`, `.abatch`), asynchronous versions of the above methods will be used (`.aput`, `.aput_writes`, `.aget_tuple`, `.alist`).
!!! note Note
For running your graph asynchronously, you can use `MemorySaver`, or async versions of Sqlite/Postgres checkpointers -- `AsyncSqliteSaver` / `AsyncPostgresSaver` checkpointers.
For running your graph asynchronously, you can use `InMemorySaver`, or async versions of Sqlite/Postgres checkpointers -- `AsyncSqliteSaver` / `AsyncPostgresSaver` checkpointers.
### Serializer
+78 -44
View File
@@ -5,16 +5,44 @@
"id": "51466c8d-8ce4-4b3d-be4e-18fdbeda5f53",
"metadata": {},
"source": [
"# How to run graph asynchronously\n",
"\n",
"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/). \n",
"\n",
"# How to run a graph asynchronously\n",
"\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Note:</p>\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://docs.python.org/3/library/asyncio.html\">\n",
" async programming\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/low_level/\">\n",
" LangGraph Glossary\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#runnable-interface\">\n",
" Runnable Interface\n",
" </a>\n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"\n",
"Using the [async](https://docs.python.org/3/library/asyncio.html) programming paradigm can produce significant performance improvements when running [IO-bound](https://en.wikipedia.org/wiki/I/O_bound) code concurrently (e.g., making concurrent API requests to a chat model provider).\n",
"\n",
"To convert a `sync` implementation of the graph to an `async` implementation, you will need to:\n",
"\n",
"1. Update `nodes` use `async def` instead of `def`.\n",
"2. Update the code inside to use `await` appropriately.\n",
"\n",
"Because many LangChain objects implement the [Runnable Protocol](https://python.langchain.com/docs/expression_language/interface/) which has `async` variants of all the `sync` methods it's typically fairly quick to upgrade a `sync` graph to an `async` graph.\n",
"\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Note</p>\n",
" <p>\n",
" In this how-to, we will create our agent from scratch to be transparent (but verbose). You can accomplish similar functionality using the <code>create_react_agent(model, tools=tool)</code> (<a href=\"https://langchain-ai.github.io/langgraph/reference/prebuilt/#create_react_agent\">API doc</a>) constructor. This may be more appropriate if you are used to LangChain’s <a href=\"https://python.langchain.com/v0.1/docs/modules/agents/concepts/#agentexecutor\">AgentExecutor</a> class.\n",
" </p>\n",
@@ -52,7 +80,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"id": "c903a1cf-2977-4e2d-ad7d-8b3946821d89",
"metadata": {},
"outputs": [],
@@ -102,7 +130,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"id": "6768a3ab",
"metadata": {},
"outputs": [],
@@ -137,7 +165,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"id": "d7ef57dd-5d6e-4ad3-9377-a92201c1310e",
"metadata": {},
"outputs": [],
@@ -166,7 +194,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"id": "5cf3331e-ccb3-41c8-aeb9-a840a94d41e7",
"metadata": {},
"outputs": [],
@@ -194,7 +222,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"id": "892b54b9-75f0-4804-9ed0-88b5e5532989",
"metadata": {},
"outputs": [],
@@ -216,7 +244,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"id": "cd3cbae5-d92c-4559-a4aa-44721b80d107",
"metadata": {},
"outputs": [],
@@ -257,7 +285,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"id": "3b541bb9-900c-40d0-964d-7b5dfee30667",
"metadata": {},
"outputs": [],
@@ -297,7 +325,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 9,
"id": "813ae66c-3b58-4283-a02a-36da72a2ab90",
"metadata": {},
"outputs": [],
@@ -348,7 +376,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 10,
"id": "4b369a6f",
"metadata": {},
"outputs": [
@@ -382,20 +410,20 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 11,
"id": "8edb04b9-40b6-46f1-a7a8-4b2d8aba7752",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'messages': [HumanMessage(content='what is the weather in sf', id='9f0cba38-4d30-4c79-b490-e6856cfffadc'),\n",
" AIMessage(content=[{'id': 'toolu_01CmGrSyn4yAF9RR6YdaK52q', 'input': {'query': 'weather in sf'}, 'name': 'search', 'type': 'tool_use'}], response_metadata={'id': 'msg_014NYTLsJxh4cRojqkqETWu6', 'model': 'claude-3-haiku-20240307', 'stop_reason': 'tool_use', 'stop_sequence': None, 'usage': {'input_tokens': 335, 'output_tokens': 53}}, id='run-de5145ea-feea-4922-bf04-0dfcdd2840fd-0', tool_calls=[{'name': 'search', 'args': {'query': 'weather in sf'}, 'id': 'toolu_01CmGrSyn4yAF9RR6YdaK52q'}]),\n",
" ToolMessage(content='[\"The answer to your question lies within.\"]', name='search', id='66752fc0-9ff0-41df-a3c9-f9216dac9c7b', tool_call_id='toolu_01CmGrSyn4yAF9RR6YdaK52q'),\n",
" AIMessage(content='Based on the search, it looks like the current weather in San Francisco (SF) is:\\n\\n- Partly cloudy with a high of 61°F (16°C) and a low of 53°F (12°C).\\n- There is a 20% chance of rain throughout the day.\\n- Winds are light at around 8 mph (13 km/h) from the west.\\n- The UV index is moderate at 5.\\n\\nOverall, a typical mild and partly cloudy day in the San Francisco Bay Area.', response_metadata={'id': 'msg_01C43rFRUks3SjqBzCmsu6VN', 'model': 'claude-3-haiku-20240307', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 410, 'output_tokens': 122}}, id='run-bfadc399-d37c-4fba-98c7-610cf8ba104f-0')]}"
"{'messages': [HumanMessage(content='what is the weather in sf', additional_kwargs={}, response_metadata={}, id='144d2b42-22e7-4697-8d87-ae45b2e15633'),\n",
" AIMessage(content=[{'id': 'toolu_01DvcgvQpeNpEwG7VqvfFL4j', 'input': {'query': 'weather in san francisco'}, 'name': 'search', 'type': 'tool_use'}], additional_kwargs={}, response_metadata={'id': 'msg_01Ke5ivtyU91W5RKnGS6BMvq', 'model': 'claude-3-haiku-20240307', 'stop_reason': 'tool_use', 'stop_sequence': None, 'usage': {'input_tokens': 328, 'output_tokens': 54}}, id='run-482de1f4-0e4b-4445-9b35-4be3221e3f82-0', tool_calls=[{'name': 'search', 'args': {'query': 'weather in san francisco'}, 'id': 'toolu_01DvcgvQpeNpEwG7VqvfFL4j', 'type': 'tool_call'}], usage_metadata={'input_tokens': 328, 'output_tokens': 54, 'total_tokens': 382}),\n",
" ToolMessage(content='[\"The answer to your question lies within.\"]', name='search', id='20b8fcf2-25b3-4fd0-b141-8ccf6eb88f7e', tool_call_id='toolu_01DvcgvQpeNpEwG7VqvfFL4j'),\n",
" AIMessage(content='Based on the search results, it looks like the current weather in San Francisco is:\\n- Partly cloudy\\n- High of 63F (17C)\\n- Low of 54F (12C)\\n- Slight chance of rain\\n\\nThe weather in San Francisco today seems to be fairly mild and pleasant, with mostly sunny skies and comfortable temperatures. The city is known for its variable and often cool coastal climate.', additional_kwargs={}, response_metadata={'id': 'msg_014e8eFYUjLenhy4DhUJfVqo', 'model': 'claude-3-haiku-20240307', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 404, 'output_tokens': 93}}, id='run-23f6ace6-4e11-417f-8efa-1739147086a4-0', usage_metadata={'input_tokens': 404, 'output_tokens': 93, 'total_tokens': 497})]}"
]
},
"execution_count": 22,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
@@ -426,7 +454,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 12,
"id": "f544977e-31f7-41f0-88c4-ec9c27b8cecb",
"metadata": {},
"outputs": [
@@ -438,12 +466,12 @@
"---\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"[{'id': 'toolu_01WhN2JW3ihnmjSUz9YTPxPs', 'input': {'query': 'weather in sf'}, 'name': 'search', 'type': 'tool_use'}]\n",
"[{'id': 'toolu_01R3qRoggjdwVLPjaqRgM5vA', 'input': {'query': 'weather in san francisco'}, 'name': 'search', 'type': 'tool_use'}]\n",
"Tool Calls:\n",
" search (toolu_01WhN2JW3ihnmjSUz9YTPxPs)\n",
" Call ID: toolu_01WhN2JW3ihnmjSUz9YTPxPs\n",
" search (toolu_01R3qRoggjdwVLPjaqRgM5vA)\n",
" Call ID: toolu_01R3qRoggjdwVLPjaqRgM5vA\n",
" Args:\n",
" query: weather in sf\n",
" query: weather in san francisco\n",
"None\n",
"\n",
"---\n",
@@ -462,11 +490,17 @@
"---\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"Based on the search results, the weather in San Francisco is:\n",
"The current weather in San Francisco is:\n",
"\n",
"The current weather in San Francisco, California is mostly sunny with a high of 68°F (20°C) and a low of 57°F (14°C). Winds are light at around 7 mph (11 km/h). There is a 0% chance of rain today, making it a pleasant day to be outdoors in the city.\n",
"Current conditions: Partly cloudy \n",
"Temperature: 62°F (17°C)\n",
"Wind: 12 mph (19 km/h) from the west\n",
"Chance of rain: 0%\n",
"Humidity: 73%\n",
"\n",
"Overall, the weather in San Francisco tends to be mild and moderate year-round, with average high temperatures in the 60s Fahrenheit (15-20°C). The city experiences a Mediterranean climate, characterized by cool, wet winters and dry, foggy summers.\n",
"San Francisco has a mild Mediterranean climate. The city experiences cool, dry summers and mild, wet winters. Temperatures are moderated by the Pacific Ocean and the coastal location. Fog is common, especially during the summer months.\n",
"\n",
"Does this help provide the weather information you were looking for in San Francisco? Let me know if you need any other details.\n",
"None\n",
"\n",
"---\n",
@@ -499,7 +533,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 13,
"id": "cfd140f0-a5a6-4697-8115-322242f197b5",
"metadata": {},
"outputs": [
@@ -507,15 +541,15 @@
"name": "stdout",
"output_type": "stream",
"text": [
"{'id': 'toolu_01WoEXZGiAjKsKx99HC9oSxp', 'input': {}, 'name': 'search', 'type': 'tool_use', 'index': 0}||{\"q|uery\"|: |\"weathe|r in sf\"}|\n",
"{'id': 'toolu_01ULvL7VnwHg8DHTvdGCpuAM', 'input': {}, 'name': 'search', 'type': 'tool_use', 'index': 0}||{\"|query\": \"wea|ther in |sf\"}|\n",
"\n",
"According| to the search results|, the current| weather in San Francisco| is:\n",
"Base|d on the search results|, it looks| like the current| weather in San Francisco| is:\n",
"\n",
"-| Mostly| sunny with a high| of 68°|F (20°|C) and a| low of 55|°F (13|°C).|\n",
"- Light| winds aroun|d 10| mph (16| km/h|).|\n",
"- Very| little| chance| of rain.|\n",
"-| Partly| clou|dy with a high| of 65|°F (18|°C) an|d a low of |53|°F (12|°C). |\n",
"- There| is a 20|% chance of rain| throughout| the day.|\n",
"-| Winds are light at| aroun|d 10| mph (16| km/h|).\n",
"\n",
"The weather in| San Francisco today| appears| to be quite| pleasant,| with mil|d temperatures and mostly| sunny skies.| It| shoul|d be a nice| day to| be| out| and about in| the city.|"
"The| weather in San Francisco| today| seems| to be pleasant| with| a| mix| of sun and clouds|. The| temperatures| are mil|d, making| it a nice| day to be out|doors in| the city.|"
]
}
],
@@ -533,12 +567,12 @@
" # because we chose to only include LLMs, these are LLM tokens\n",
" try:\n",
" content = op[\"value\"].content[0]\n",
" if 'partial_json' in content:\n",
" print(content['partial_json'], end=\"|\")\n",
" elif 'text' in content:\n",
" print(content['text'], end='|')\n",
" if \"partial_json\" in content:\n",
" print(content[\"partial_json\"], end=\"|\")\n",
" elif \"text\" in content:\n",
" print(content[\"text\"], end=\"|\")\n",
" else:\n",
" print(content,end=\"|\")\n",
" print(content, end=\"|\")\n",
" except:\n",
" pass"
]
@@ -560,7 +594,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
+48 -24
View File
@@ -12,6 +12,30 @@
"source": [
"# How to create branches for parallel node execution\n",
"\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/low_level/#nodes\">\n",
" Node\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/low_level/#edges\">\n",
" Edge\n",
" </a>\n",
" </li> \n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/low_level/#reducers\">\n",
" Reducer\n",
" </a>\n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div> \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",
"![Screenshot 2024-07-09 at 2.55.56 PM.png](attachment:51f122de-b2ce-4c21-a5a7-c3be70c28a91.png)"
@@ -29,7 +53,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"id": "bb54e2d0",
"metadata": {},
"outputs": [],
@@ -65,7 +89,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"id": "09372b8b-edea-4b9d-9ec3-3d93ce1ba819",
"metadata": {},
"outputs": [],
@@ -108,7 +132,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"id": "66f52a20",
"metadata": {},
"outputs": [
@@ -139,7 +163,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"id": "38846b01",
"metadata": {},
"outputs": [
@@ -159,7 +183,7 @@
"{'aggregate': [\"I'm A\", \"I'm B\", \"I'm C\", \"I'm D\"]}"
]
},
"execution_count": 3,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
@@ -196,7 +220,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 6,
"id": "259a7704-5aa0-4e4c-aeef-cca04e8be0ff",
"metadata": {},
"outputs": [],
@@ -231,7 +255,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 7,
"id": "83320227-8ab3-44c0-b6cf-064a7a425b9f",
"metadata": {},
"outputs": [
@@ -254,7 +278,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"id": "3f971fa3-29e4-466f-a85e-2863bfecf7fe",
"metadata": {},
"outputs": [
@@ -275,7 +299,7 @@
"{'aggregate': [\"I'm A\", \"I'm B\", \"I'm C\", \"I'm B2\", \"I'm D\"]}"
]
},
"execution_count": 6,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
@@ -298,7 +322,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 9,
"id": "95f5e026",
"metadata": {},
"outputs": [],
@@ -348,7 +372,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 10,
"id": "1d0e6c56",
"metadata": {},
"outputs": [
@@ -371,7 +395,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 11,
"id": "7134f652",
"metadata": {},
"outputs": [
@@ -391,7 +415,7 @@
"{'aggregate': [\"I'm A\", \"I'm B\", \"I'm C\", \"I'm E\"], 'which': 'bc'}"
]
},
"execution_count": 9,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
@@ -402,7 +426,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 12,
"id": "b130e694",
"metadata": {},
"outputs": [
@@ -411,8 +435,8 @@
"output_type": "stream",
"text": [
"Adding I'm A to []\n",
"Adding I'm D to [\"I'm A\"]\n",
"Adding I'm C to [\"I'm A\"]\n",
"Adding I'm D to [\"I'm A\"]\n",
"Adding I'm E to [\"I'm A\", \"I'm C\", \"I'm D\"]\n"
]
},
@@ -422,7 +446,7 @@
"{'aggregate': [\"I'm A\", \"I'm C\", \"I'm D\", \"I'm E\"], 'which': 'cd'}"
]
},
"execution_count": 10,
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
@@ -447,7 +471,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 13,
"id": "836bc12d",
"metadata": {},
"outputs": [],
@@ -540,13 +564,13 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 14,
"id": "932c497e",
"metadata": {},
"outputs": [
{
"data": {
"image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/4gHYSUNDX1BST0ZJTEUAAQEAAAHIAAAAAAQwAABtbnRyUkdCIFhZWiAH4AABAAEAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAACRyWFlaAAABFAAAABRnWFlaAAABKAAAABRiWFlaAAABPAAAABR3dHB0AAABUAAAABRyVFJDAAABZAAAAChnVFJDAAABZAAAAChiVFJDAAABZAAAAChjcHJ0AAABjAAAADxtbHVjAAAAAAAAAAEAAAA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3tf8AewSDnK9erNn+5z4dyXZ9ydpxvdRrRcmYq6gRwVQkEvTQx9JsheXgEmMNJ5g5BIOkrzUxMbUK7xC8jrl+S367VoqzjiPKyHRN1kke2ONkbXOe44DQHDJJWjNc17Q5pDmkZBByCE0jdUc58qVuD+oiLnqiIiAiIgIiICIiAiIgIiICIiAiIgIiICKIvOp6Kzvlpg4112bSvrIrTSvY6rqI2lrSWRucMjc9jdxIaC4ZIXVltFzv0tQ251Xcdt6Wnmpqage+KcbAHSNmlDvGa5/LawAbWYLnB5aA7HhVR1Feyjt+btKKp9JUuonNkZRSMYHuE7s4jOHM8U+Md7cDGSOpSaaq7tDBNqaeKtnfRyUtTbKYHvc7pHZdmN+TIduGZecEBxDWbiFP09LDSRlkETIWF7pC2NoaC5zi5zsDtLiST2kkrlQZxw38gNPfMYvqhWRQkVrvOkou4KS0y3q3xE9zSU08TJWMJ5Me2V7QS3JG4HmAOQKd9r98jLr61RfbrtV4uVzXTVGJnO2I9VpjM5TaKsDVl2deHWwaNvPdbYBUkdJS7NhcWjx+m25yD4uc9uMFdzvtfvkZdfWqL7dU7H90f7R+TDr8RGh+jLm1wBaWNBB7fHarFU6cq7NDUzaamip5ugggp7ZVl3e+NsZAwxjecRMeWZZ4ow1xY7BBhu9d41YWUldaZLLbekZJO6pnjfLKGuDhG1sbnAAkc3F3VkAHORfV5tImIppozmYzOrXtx+CdmEPHqekbWupK0OtVQ6rNHTNri2MVj9hkHQnJEmWtccDxhsdkDCmFw1NJBWsY2ohjnax7ZWtlYHBr2kFrhnqIIBB7CFBR2u6abZTR2yY3K2QtqXzUtbI6Wre53jLine truncated
"text/plain": [
"<IPython.core.display.Image object>"
]
@@ -563,7 +587,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 15,
"id": "933b3afd",
"metadata": {},
"outputs": [
@@ -584,7 +608,7 @@
" 'which': 'bc'}"
]
},
"execution_count": 13,
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
@@ -595,7 +619,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 16,
"id": "e30531bf",
"metadata": {},
"outputs": [
@@ -616,7 +640,7 @@
" 'which': 'cd'}"
]
},
"execution_count": 14,
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
@@ -642,7 +666,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
+61 -59
View File
@@ -11,6 +11,26 @@
"Examples of this include configuring which LLM to use.\n",
"Below we walk through an example of doing so.\n",
"\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/low_level/#state\">\n",
" LangGraph State\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#chat-models/\">\n",
" Chat Models\n",
" </a>\n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"\n",
"## Setup\n",
"\n",
"First, let's install the required packages and set our API keys"
@@ -18,7 +38,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "03df6e04",
"metadata": {},
"outputs": [],
@@ -29,7 +49,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "a00c45e0",
"metadata": {},
"outputs": [],
@@ -71,7 +91,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"id": "816523d0-0b59-47cf-9f4c-4838024efe22",
"metadata": {},
"outputs": [],
@@ -93,39 +113,18 @@
"\n",
"\n",
"def _call_model(state):\n",
" state[\"messages\"]\n",
" response = model.invoke(state[\"messages\"])\n",
" return {\"messages\": [response]}\n",
"\n",
"\n",
"# Define a new graph\n",
"workflow = StateGraph(AgentState)\n",
"workflow.add_node(\"model\", _call_model)\n",
"workflow.add_edge(START, \"model\")\n",
"workflow.add_edge(\"model\", END)\n",
"builder = StateGraph(AgentState)\n",
"builder.add_node(\"model\", _call_model)\n",
"builder.add_edge(START, \"model\")\n",
"builder.add_edge(\"model\", END)\n",
"\n",
"app = workflow.compile()"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "070f11a6-2441-4db5-9df6-e318f110e281",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'messages': [HumanMessage(content='hi'),\n",
" AIMessage(content='Hello!', response_metadata={'id': 'msg_012SakNGNitBcKJgc9yZ1Asv', 'model': 'claude-2.1', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 10, 'output_tokens': 6}}, id='run-9e375cd7-ae84-4db2-981c-c7e18ecabddf-0', usage_metadata={'input_tokens': 10, 'output_tokens': 6, 'total_tokens': 16})]}"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"app.invoke({\"messages\": [HumanMessage(content=\"hi\")]})"
"graph = builder.compile()"
]
},
{
@@ -142,7 +141,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 4,
"id": "c01f1e7c-8e8b-4e26-98f7-56ac225077b4",
"metadata": {},
"outputs": [],
@@ -158,6 +157,7 @@
" \"openai\": openai_model,\n",
"}\n",
"\n",
"\n",
"def _call_model(state: AgentState, config: RunnableConfig):\n",
" # Access the config through the configurable key\n",
" model_name = config[\"configurable\"].get(\"model\", \"anthropic\")\n",
@@ -167,12 +167,12 @@
"\n",
"\n",
"# Define a new graph\n",
"workflow = StateGraph(AgentState)\n",
"workflow.add_node(\"model\", _call_model)\n",
"workflow.add_edge(START, \"model\")\n",
"workflow.add_edge(\"model\", END)\n",
"builder = StateGraph(AgentState)\n",
"builder.add_node(\"model\", _call_model)\n",
"builder.add_edge(START, \"model\")\n",
"builder.add_edge(\"model\", END)\n",
"\n",
"app = workflow.compile()"
"graph = builder.compile()"
]
},
{
@@ -185,24 +185,24 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 5,
"id": "ef50f048-fc43-40c0-b713-346408fcf052",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'messages': [HumanMessage(content='hi'),\n",
" AIMessage(content='Hello!', response_metadata={'id': 'msg_0133PAX5DyoUYL1gZiGR8NXs', 'model': 'claude-2.1', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 10, 'output_tokens': 6}}, id='run-03e8bd8b-fa09-4258-920d-8f53a7b91fcc-0', usage_metadata={'input_tokens': 10, 'output_tokens': 6, 'total_tokens': 16})]}"
"{'messages': [HumanMessage(content='hi', additional_kwargs={}, response_metadata={}),\n",
" AIMessage(content='Hello!', additional_kwargs={}, response_metadata={'id': 'msg_01WFXkfgK8AvSckLvYYrHshi', 'model': 'claude-2.1', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 10, 'output_tokens': 6}}, id='run-ece54b16-f8fc-4201-8405-b97122edf8d8-0', usage_metadata={'input_tokens': 10, 'output_tokens': 6, 'total_tokens': 16})]}"
]
},
"execution_count": 7,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"app.invoke({\"messages\": [HumanMessage(content=\"hi\")]})"
"graph.invoke({\"messages\": [HumanMessage(content=\"hi\")]})"
]
},
{
@@ -215,25 +215,25 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 6,
"id": "f2f7c74b-9fb0-41c6-9728-dcf9d8a3c397",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'messages': [HumanMessage(content='hi'),\n",
" AIMessage(content='Hello! How can I assist you today?', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 9, 'prompt_tokens': 8, 'total_tokens': 17}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-6d0c7c25-03de-49d6-b3be-ff0858d17122-0', usage_metadata={'input_tokens': 8, 'output_tokens': 9, 'total_tokens': 17})]}"
"{'messages': [HumanMessage(content='hi', additional_kwargs={}, response_metadata={}),\n",
" AIMessage(content='Hello! How can I assist you today?', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 9, 'prompt_tokens': 8, 'total_tokens': 17, 'completion_tokens_details': {'reasoning_tokens': 0}}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-f8331964-d811-4b44-afb8-56c30ade7c15-0', usage_metadata={'input_tokens': 8, 'output_tokens': 9, 'total_tokens': 17})]}"
]
},
"execution_count": 8,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"config = {\"configurable\": {\"model\": \"openai\"}}\n",
"app.invoke({\"messages\": [HumanMessage(content=\"hi\")]}, config=config)"
"graph.invoke({\"messages\": [HumanMessage(content=\"hi\")]}, config=config)"
]
},
{
@@ -246,19 +246,21 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 7,
"id": "f0393a43-9fbe-4056-972f-3e91ea329041",
"metadata": {},
"outputs": [],
"source": [
"from langchain_core.messages import SystemMessage\n",
"\n",
"\n",
"# We can define a config schema to specify the configuration options for the graph\n",
"# A config schema is useful for indicating which fields are available in the configurable dict inside the config\n",
"class ConfigSchema(TypedDict):\n",
" model: Optional[str]\n",
" system_message: Optional[str]\n",
"\n",
"\n",
"def _call_model(state: AgentState, config: RunnableConfig):\n",
" # Access the config through the configurable key\n",
" model_name = config[\"configurable\"].get(\"model\", \"anthropic\")\n",
@@ -278,52 +280,52 @@
"workflow.add_edge(START, \"model\")\n",
"workflow.add_edge(\"model\", END)\n",
"\n",
"app = workflow.compile()"
"graph = workflow.compile()"
]
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 8,
"id": "718685f7-4cdd-4181-9fc8-e7762d584727",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'messages': [HumanMessage(content='hi'),\n",
" AIMessage(content='Hello!', response_metadata={'id': 'msg_01TVJvxCXsCT9JVe7A4iUUi9', 'model': 'claude-2.1', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 10, 'output_tokens': 6}}, id='run-627eb685-c4d7-481d-9095-c0a1822e8c10-0', usage_metadata={'input_tokens': 10, 'output_tokens': 6, 'total_tokens': 16})]}"
"{'messages': [HumanMessage(content='hi', additional_kwargs={}, response_metadata={}),\n",
" AIMessage(content='Hello!', additional_kwargs={}, response_metadata={'id': 'msg_01VgCANVHr14PsHJSXyKkLVh', 'model': 'claude-2.1', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 10, 'output_tokens': 6}}, id='run-f8c5f18c-be58-4e44-9a4e-d43692d7eed1-0', usage_metadata={'input_tokens': 10, 'output_tokens': 6, 'total_tokens': 16})]}"
]
},
"execution_count": 10,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"app.invoke({\"messages\": [HumanMessage(content=\"hi\")]})"
"graph.invoke({\"messages\": [HumanMessage(content=\"hi\")]})"
]
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 9,
"id": "e043a719-f197-46ef-9d45-84740a39aeb0",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'messages': [HumanMessage(content='hi'),\n",
" AIMessage(content='Ciao!', response_metadata={'id': 'msg_01CpBD1cMCYvvPX2cogUawJj', 'model': 'claude-2.1', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 14, 'output_tokens': 7}}, id='run-6ef2fea6-9bfa-4266-bd05-263160a1db7b-0', usage_metadata={'input_tokens': 14, 'output_tokens': 7, 'total_tokens': 21})]}"
"{'messages': [HumanMessage(content='hi', additional_kwargs={}, response_metadata={}),\n",
" AIMessage(content='Ciao!', additional_kwargs={}, response_metadata={'id': 'msg_011YuCYQk1Rzc8PEhVCpQGr6', 'model': 'claude-2.1', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 14, 'output_tokens': 7}}, id='run-a583341e-5868-4e8c-a536-881338f21252-0', usage_metadata={'input_tokens': 14, 'output_tokens': 7, 'total_tokens': 21})]}"
]
},
"execution_count": 11,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"config = {\"configurable\": {\"system_message\": \"respond in italian\"}}\n",
"app.invoke({\"messages\": [HumanMessage(content=\"hi\")]}, config=config)"
"graph.invoke({\"messages\": [HumanMessage(content=\"hi\")]}, config=config)"
]
}
],
@@ -343,7 +345,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
+58 -36
View File
@@ -7,7 +7,36 @@
"source": [
"# How to add human-in-the-loop processes to the prebuilt ReAct agent\n",
"\n",
"This tutorial will show how to add human-in-the-loop processes to the prebuilt ReAct agent. Please see [this tutorial](../create-react-agent) for how to get started with the prebuilt ReAct agent\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li> \n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/human_in_the_loop/\">\n",
" Human-in-the-loop\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/agentic_concepts/\">\n",
" Agent Architectures\n",
" </a> \n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#chat-models/\">\n",
" Chat Models\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#tools\">\n",
" Tools\n",
" </a>\n",
" </li> \n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"This guide will show how to add human-in-the-loop processes to the prebuilt ReAct agent. Please see [this tutorial](../create-react-agent) for how to get started with the prebuilt ReAct agent\n",
"\n",
"You can add a a breakpoint before tools are called by passing `interrupt_before=[\"tools\"]` to `create_react_agent`. Note that you need to be using a checkpointer for this to work."
]
@@ -24,7 +53,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"id": "a213e11a-5c62-4ddb-a707-490d91add383",
"metadata": {},
"outputs": [],
@@ -35,18 +64,10 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"id": "23a1885c-04ab-4750-aefa-105891fddf3e",
"metadata": {},
"outputs": [
{
"name": "stdin",
"output_type": "stream",
"text": [
"OPENAI_API_KEY: ········\n"
]
}
],
"outputs": [],
"source": [
"import getpass\n",
"import os\n",
@@ -83,7 +104,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"id": "7a154152-973e-4b5d-aa13-48c617744a4c",
"metadata": {},
"outputs": [],
@@ -95,7 +116,6 @@
"\n",
"\n",
"# For this tutorial we will use custom tool that returns pre-defined values for weather in two cities (NYC & SF)\n",
"\n",
"from typing import Literal\n",
"\n",
"from langchain_core.tools import tool\n",
@@ -115,9 +135,9 @@
"tools = [get_weather]\n",
"\n",
"# We need a checkpointer to enable human-in-the-loop patterns\n",
"from langgraph.checkpoint.memory import MemorySaver\n",
"from langgraph.checkpoint.memory import InMemorySaver\n",
"\n",
"memory = MemorySaver()\n",
"memory = InMemorySaver()\n",
"\n",
"# Define the graph\n",
"\n",
@@ -138,12 +158,13 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 7,
"id": "16636975-5f2d-4dc7-ab8e-d0bea0830a28",
"metadata": {},
"outputs": [],
"source": [
"def print_stream(stream):\n",
" \"\"\"A utility to pretty print the stream.\"\"\"\n",
" for s in stream:\n",
" message = s[\"messages\"][-1]\n",
" if isinstance(message, tuple):\n",
@@ -154,7 +175,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 8,
"id": "9ffff6c3-a4f5-47c9-b51d-97caaee85cd6",
"metadata": {},
"outputs": [
@@ -167,8 +188,8 @@
"what is the weather in SF, CA?\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"Tool Calls:\n",
" get_weather (call_uCtiELl4MERM1BSzvGQNVNIO)\n",
" Call ID: call_uCtiELl4MERM1BSzvGQNVNIO\n",
" get_weather (call_YjOKDkgMGgUZUpKIasYk1AdK)\n",
" Call ID: call_YjOKDkgMGgUZUpKIasYk1AdK\n",
" Args:\n",
" location: SF, CA\n"
]
@@ -176,6 +197,7 @@
],
"source": [
"from langchain_core.messages import HumanMessage\n",
"\n",
"config = {\"configurable\": {\"thread_id\": \"42\"}}\n",
"inputs = {\"messages\": [(\"user\", \"what is the weather in SF, CA?\")]}\n",
"\n",
@@ -192,7 +214,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 9,
"id": "3decf001-7228-4ed5-8779-2b9ed98a74ea",
"metadata": {},
"outputs": [
@@ -221,7 +243,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 10,
"id": "740bbaeb",
"metadata": {},
"outputs": [
@@ -231,8 +253,8 @@
"text": [
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"Tool Calls:\n",
" get_weather (call_uCtiELl4MERM1BSzvGQNVNIO)\n",
" Call ID: call_uCtiELl4MERM1BSzvGQNVNIO\n",
" get_weather (call_YjOKDkgMGgUZUpKIasYk1AdK)\n",
" Call ID: call_YjOKDkgMGgUZUpKIasYk1AdK\n",
" Args:\n",
" location: SF, CA\n",
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
@@ -242,8 +264,8 @@
" Please fix your mistakes.\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"Tool Calls:\n",
" get_weather (call_CS02EQchFuqotH3gAiKcABx1)\n",
" Call ID: call_CS02EQchFuqotH3gAiKcABx1\n",
" get_weather (call_CLu9ofeBhtWF2oheBspxXkfE)\n",
" Call ID: call_CLu9ofeBhtWF2oheBspxXkfE\n",
" Args:\n",
" location: San Francisco, CA\n"
]
@@ -265,7 +287,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 11,
"id": "1c81ed9f",
"metadata": {},
"outputs": [
@@ -274,10 +296,10 @@
"text/plain": [
"{'configurable': {'thread_id': '42',\n",
" 'checkpoint_ns': '',\n",
" 'checkpoint_id': '1ef706ce-e7a4-6740-8004-0bf23a8d9eb8'}}"
" 'checkpoint_id': '1ef801d1-5b93-6bb9-8004-a088af1f9cec'}}"
]
},
"execution_count": 8,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
@@ -285,15 +307,15 @@
"source": [
"state = graph.get_state(config)\n",
"\n",
"last_message = state.values['messages'][-1]\n",
"last_message.tool_calls[0]['args'] = {\"location\": \"San Francisco\"}\n",
"last_message = state.values[\"messages\"][-1]\n",
"last_message.tool_calls[0][\"args\"] = {\"location\": \"San Francisco\"}\n",
"\n",
"graph.update_state(config, {\"messages\": [ last_message]})"
"graph.update_state(config, {\"messages\": [last_message]})"
]
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 12,
"id": "83148e08-63e8-49e5-a08b-02dc907bed1d",
"metadata": {},
"outputs": [
@@ -303,8 +325,8 @@
"text": [
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"Tool Calls:\n",
" get_weather (call_CS02EQchFuqotH3gAiKcABx1)\n",
" Call ID: call_CS02EQchFuqotH3gAiKcABx1\n",
" get_weather (call_CLu9ofeBhtWF2oheBspxXkfE)\n",
" Call ID: call_CLu9ofeBhtWF2oheBspxXkfE\n",
" Args:\n",
" location: San Francisco\n",
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
@@ -346,7 +368,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
+290 -246
View File
@@ -1,249 +1,293 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "992c4695-ec4f-428d-bd05-fb3b5fbd70f4",
"metadata": {},
"source": [
"# How to add memory to the prebuilt ReAct agent\n",
"\n",
"This tutorial will show how to add memory to the prebuilt ReAct agent. Please see [this tutorial](../create-react-agent) for how to get started with the prebuilt ReAct agent\n",
"\n",
"All we need to do to enable memory is pass in a checkpointer to `create_react_agents`"
]
},
{
"cell_type": "markdown",
"id": "7be3889f-3c17-4fa1-bd2b-84114a2c7247",
"metadata": {},
"source": [
"## Setup\n",
"\n",
"First, let's install the required packages and set our API keys"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "a213e11a-5c62-4ddb-a707-490d91add383",
"metadata": {},
"outputs": [],
"source": [
"%%capture --no-stderr\n",
"%pip install -U langgraph langchain-openai"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "23a1885c-04ab-4750-aefa-105891fddf3e",
"metadata": {},
"outputs": [],
"source": [
"import getpass\n",
"import os\n",
"\n",
"\n",
"def _set_env(var: str):\n",
" if not os.environ.get(var):\n",
" os.environ[var] = getpass.getpass(f\"{var}: \")\n",
"\n",
"\n",
"_set_env(\"OPENAI_API_KEY\")"
]
},
{
"cell_type": "markdown",
"id": "87a00ce9",
"metadata": {},
"source": [
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Set up <a href=\"https://smith.langchain.com\">LangSmith</a> for LangGraph development</p>\n",
" <p style=\"padding-top: 5px;\">\n",
" Sign up for LangSmith to quickly spot issues and improve the performance of your LangGraph projects. LangSmith lets you use trace data to debug, test, and monitor your LLM apps built with LangGraph — read more about how to get started <a href=\"https://docs.smith.langchain.com\">here</a>. \n",
" </p>\n",
"</div> "
]
},
{
"cell_type": "markdown",
"id": "03c0f089-070c-4cd4-87e0-6c51f2477b82",
"metadata": {},
"source": [
"## Code"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "7a154152-973e-4b5d-aa13-48c617744a4c",
"metadata": {},
"outputs": [],
"source": [
"# First we initialize the model we want to use.\n",
"from langchain_openai import ChatOpenAI\n",
"\n",
"model = ChatOpenAI(model=\"gpt-4o\", temperature=0)\n",
"\n",
"\n",
"# For this tutorial we will use custom tool that returns pre-defined values for weather in two cities (NYC & SF)\n",
"\n",
"from typing import Literal\n",
"\n",
"from langchain_core.tools import tool\n",
"\n",
"\n",
"@tool\n",
"def get_weather(city: Literal[\"nyc\", \"sf\"]):\n",
" \"\"\"Use this to get weather information.\"\"\"\n",
" if city == \"nyc\":\n",
" return \"It might be cloudy in nyc\"\n",
" elif city == \"sf\":\n",
" return \"It's always sunny in sf\"\n",
" else:\n",
" raise AssertionError(\"Unknown city\")\n",
"\n",
"\n",
"tools = [get_weather]\n",
"\n",
"# We can add \"chat memory\" to the graph with LangGraph's checkpointer\n",
"# to retain the chat context between interactions\n",
"from langgraph.checkpoint.memory import MemorySaver\n",
"\n",
"memory = MemorySaver()\n",
"\n",
"# Define the graph\n",
"\n",
"from langgraph.prebuilt import create_react_agent\n",
"\n",
"graph = create_react_agent(model, tools=tools, checkpointer=memory)"
]
},
{
"cell_type": "markdown",
"id": "00407425-506d-4ffd-9c86-987921d8c844",
"metadata": {},
"source": [
"## Usage\n",
"\n",
"Let's interact with it multiple times to show that it can remember"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "16636975-5f2d-4dc7-ab8e-d0bea0830a28",
"metadata": {},
"outputs": [],
"source": [
"def print_stream(stream):\n",
" for s in stream:\n",
" message = s[\"messages\"][-1]\n",
" if isinstance(message, tuple):\n",
" print(message)\n",
" else:\n",
" message.pretty_print()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "9ffff6c3-a4f5-47c9-b51d-97caaee85cd6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"What's the weather in NYC?\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"Tool Calls:\n",
" get_weather (call_mdovy4yXSSYrmSlnlVSUacVn)\n",
" Call ID: call_mdovy4yXSSYrmSlnlVSUacVn\n",
" Args:\n",
" city: nyc\n",
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
"Name: get_weather\n",
"\n",
"It might be cloudy in nyc\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"The weather in NYC might be cloudy.\n"
]
}
],
"source": [
"config = {\"configurable\": {\"thread_id\": \"1\"}}\n",
"inputs = {\"messages\": [(\"user\", \"What's the weather in NYC?\")]}\n",
"\n",
"print_stream(graph.stream(inputs, config=config, stream_mode=\"values\"))"
]
},
{
"cell_type": "markdown",
"id": "838a043f-90ad-4e69-9d1d-6e22db2c346c",
"metadata": {},
"source": [
"Notice that when we pass the same the same thread ID, the chat history is preserved"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "187479f9-32fa-4611-9487-cf816ba2e147",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"What's it known for?\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"New York City (NYC) is known for many things, including:\n",
"\n",
"1. **Landmarks and Attractions**: The Statue of Liberty, Times Square, Central Park, Empire State Building, and Brooklyn Bridge.\n",
"2. **Cultural Institutions**: Broadway theaters, Metropolitan Museum of Art, Museum of Modern Art (MoMA), and the American Museum of Natural History.\n",
"3. **Diverse Neighborhoods**: Areas like Chinatown, Little Italy, Harlem, and Greenwich Village.\n",
"4. **Financial Hub**: Wall Street and the New York Stock Exchange.\n",
"5. **Cuisine**: A melting pot of global cuisines, famous for its pizza, bagels, and street food.\n",
"6. **Media and Entertainment**: Home to major media companies, TV networks, and film studios.\n",
"7. **Fashion**: A global fashion capital, hosting New York Fashion Week.\n",
"8. **Sports**: Teams like the New York Yankees, New York Mets, New York Knicks, and New York Rangers.\n",
"9. **Public Transportation**: An extensive subway system and iconic yellow taxis.\n",
"10. **Events**: New Year's Eve celebration in Times Square, Macy's Thanksgiving Day Parade, and various cultural festivals.\n"
]
}
],
"source": [
"inputs = {\"messages\": [(\"user\", \"What's it known for?\")]}\n",
"print_stream(graph.stream(inputs, config=config, stream_mode=\"values\"))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.1"
}
"cells": [
{
"cell_type": "markdown",
"id": "992c4695-ec4f-428d-bd05-fb3b5fbd70f4",
"metadata": {},
"source": [
"# How to add memory to the prebuilt ReAct agent\n",
"\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li> \n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/persistence/\">\n",
" LangGraph Persistence\n",
" </a>\n",
" </li>\n",
" <li> \n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/persistence/#checkpointer-interface\">\n",
" Checkpointer interface\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/agentic_concepts/\">\n",
" Agent Architectures\n",
" </a> \n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#chat-models/\">\n",
" Chat Models\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#tools\">\n",
" Tools\n",
" </a>\n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"This guide will show how to add memory to the prebuilt ReAct agent. Please see [this tutorial](../create-react-agent) for how to get started with the prebuilt ReAct agent\n",
"\n",
"We can add memory to the agent, by passing a [checkpointer](https://langchain-ai.github.io/langgraph/reference/checkpoints/) to the [create_react_agent](https://langchain-ai.github.io/langgraph/reference/prebuilt/#langgraph.prebuilt.chat_agent_executor.create_react_agent) function."
]
},
"nbformat": 4,
"nbformat_minor": 5
{
"cell_type": "markdown",
"id": "7be3889f-3c17-4fa1-bd2b-84114a2c7247",
"metadata": {},
"source": [
"## Setup\n",
"\n",
"First, let's install the required packages and set our API keys"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "a213e11a-5c62-4ddb-a707-490d91add383",
"metadata": {},
"outputs": [],
"source": [
"%%capture --no-stderr\n",
"%pip install -U langgraph langchain-openai"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "23a1885c-04ab-4750-aefa-105891fddf3e",
"metadata": {},
"outputs": [],
"source": [
"import getpass\n",
"import os\n",
"\n",
"\n",
"def _set_env(var: str):\n",
" if not os.environ.get(var):\n",
" os.environ[var] = getpass.getpass(f\"{var}: \")\n",
"\n",
"\n",
"_set_env(\"OPENAI_API_KEY\")"
]
},
{
"cell_type": "markdown",
"id": "87a00ce9",
"metadata": {},
"source": [
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Set up <a href=\"https://smith.langchain.com\">LangSmith</a> for LangGraph development</p>\n",
" <p style=\"padding-top: 5px;\">\n",
" Sign up for LangSmith to quickly spot issues and improve the performance of your LangGraph projects. LangSmith lets you use trace data to debug, test, and monitor your LLM apps built with LangGraph — read more about how to get started <a href=\"https://docs.smith.langchain.com\">here</a>. \n",
" </p>\n",
"</div> "
]
},
{
"cell_type": "markdown",
"id": "03c0f089-070c-4cd4-87e0-6c51f2477b82",
"metadata": {},
"source": [
"## Code"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "7a154152-973e-4b5d-aa13-48c617744a4c",
"metadata": {},
"outputs": [],
"source": [
"# First we initialize the model we want to use.\n",
"from langchain_openai import ChatOpenAI\n",
"\n",
"model = ChatOpenAI(model=\"gpt-4o\", temperature=0)\n",
"\n",
"\n",
"# For this tutorial we will use custom tool that returns pre-defined values for weather in two cities (NYC & SF)\n",
"\n",
"from typing import Literal\n",
"\n",
"from langchain_core.tools import tool\n",
"\n",
"\n",
"@tool\n",
"def get_weather(city: Literal[\"nyc\", \"sf\"]):\n",
" \"\"\"Use this to get weather information.\"\"\"\n",
" if city == \"nyc\":\n",
" return \"It might be cloudy in nyc\"\n",
" elif city == \"sf\":\n",
" return \"It's always sunny in sf\"\n",
" else:\n",
" raise AssertionError(\"Unknown city\")\n",
"\n",
"\n",
"tools = [get_weather]\n",
"\n",
"# We can add \"chat memory\" to the graph with LangGraph's checkpointer\n",
"# to retain the chat context between interactions\n",
"from langgraph.checkpoint.memory import InMemorySaver\n",
"\n",
"memory = InMemorySaver()\n",
"\n",
"# Define the graph\n",
"\n",
"from langgraph.prebuilt import create_react_agent\n",
"\n",
"graph = create_react_agent(model, tools=tools, checkpointer=memory)"
]
},
{
"cell_type": "markdown",
"id": "00407425-506d-4ffd-9c86-987921d8c844",
"metadata": {},
"source": [
"## Usage\n",
"\n",
"Let's interact with it multiple times to show that it can remember"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "16636975-5f2d-4dc7-ab8e-d0bea0830a28",
"metadata": {},
"outputs": [],
"source": [
"def print_stream(stream):\n",
" for s in stream:\n",
" message = s[\"messages\"][-1]\n",
" if isinstance(message, tuple):\n",
" print(message)\n",
" else:\n",
" message.pretty_print()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "9ffff6c3-a4f5-47c9-b51d-97caaee85cd6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"What's the weather in NYC?\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"Tool Calls:\n",
" get_weather (call_xM1suIq26KXvRFqJIvLVGfqG)\n",
" Call ID: call_xM1suIq26KXvRFqJIvLVGfqG\n",
" Args:\n",
" city: nyc\n",
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
"Name: get_weather\n",
"\n",
"It might be cloudy in nyc\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"The weather in NYC might be cloudy.\n"
]
}
],
"source": [
"config = {\"configurable\": {\"thread_id\": \"1\"}}\n",
"inputs = {\"messages\": [(\"user\", \"What's the weather in NYC?\")]}\n",
"\n",
"print_stream(graph.stream(inputs, config=config, stream_mode=\"values\"))"
]
},
{
"cell_type": "markdown",
"id": "838a043f-90ad-4e69-9d1d-6e22db2c346c",
"metadata": {},
"source": [
"Notice that when we pass the same the same thread ID, the chat history is preserved"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "187479f9-32fa-4611-9487-cf816ba2e147",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"What's it known for?\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"New York City (NYC) is known for a variety of iconic landmarks, cultural institutions, and vibrant neighborhoods. Some of the most notable aspects include:\n",
"\n",
"1. **Statue of Liberty**: A symbol of freedom and democracy.\n",
"2. **Times Square**: Known for its bright lights, Broadway theaters, and bustling atmosphere.\n",
"3. **Central Park**: A large urban park offering a green oasis in the middle of the city.\n",
"4. **Empire State Building**: An iconic skyscraper with an observation deck offering panoramic views of the city.\n",
"5. **Broadway**: Famous for its world-class theater productions.\n",
"6. **Wall Street**: The financial hub of the United States.\n",
"7. **Museums**: Including the Metropolitan Museum of Art, the Museum of Modern Art (MoMA), and the American Museum of Natural History.\n",
"8. **Diverse Cuisine**: A melting pot of culinary experiences from around the world.\n",
"9. **Cultural Diversity**: A rich tapestry of cultures, languages, and traditions.\n",
"10. **Fashion**: A global fashion capital, home to New York Fashion Week.\n",
"\n",
"These are just a few highlights of what makes NYC a unique and vibrant city.\n"
]
}
],
"source": [
"inputs = {\"messages\": [(\"user\", \"What's it known for?\")]}\n",
"print_stream(graph.stream(inputs, config=config, stream_mode=\"values\"))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c461eb47-b4f9-406f-8923-c68db7c5687f",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
@@ -7,9 +7,39 @@
"source": [
"# How to add a custom system prompt to the prebuilt ReAct agent\n",
"\n",
"This tutorial will show how to add a custom system prompt to the prebuilt ReAct agent. Please see [this tutorial](../create-react-agent) for how to get started with the prebuilt ReAct agent\n",
"\n",
"You can add a custom system prompt by passing a string to the `state_modifier` param."
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li> \n",
" <a href=\"https://python.langchain.com/v0.1/docs/modules/model_io/concepts/#systemmessage\">\n",
" SystemMessage\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/agentic_concepts/\">\n",
" Agent Architectures\n",
" </a> \n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#chat-models/\">\n",
" Chat Models\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#tools\">\n",
" Tools\n",
" </a>\n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"This tutorial will show how to add a custom system prompt to the [prebuilt ReAct agent](https://langchain-ai.github.io/langgraph/reference/prebuilt/#langgraph.prebuilt.chat_agent_executor.create_react_agent). Please see [this tutorial](../create-react-agent) for how to get started with the prebuilt ReAct agent\n",
"\n",
"You can add a custom system prompt by passing a string to the `state_modifier` param.\n"
]
},
{
@@ -193,7 +223,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.1"
"version": "3.11.4"
}
},
"nbformat": 4,
+35 -11
View File
@@ -13,6 +13,30 @@
"id": "e0fcced0-9767-412f-90f9-7f3cd618ff90",
"metadata": {},
"source": [
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/agentic_concepts/\">\n",
" Agent Architectures\n",
" </a> \n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#chat-models/\">\n",
" Chat Models\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#tools\">\n",
" Tools\n",
" </a>\n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"In this how-to we'll create a simple [ReAct](https://arxiv.org/abs/2210.03629) agent app that can check the weather. The app consists of an agent (LLM) and tools. As we interact with the app, we will first call the agent (LLM) to decide if we should use tools. Then we will run a loop: \n",
"\n",
"1. If the agent said to take an action (i.e. call tool), we'll run the tools and pass the results back to the agent\n",
@@ -21,7 +45,7 @@
"<div class=\"admonition warning\">\n",
" <p class=\"admonition-title\">Prebuilt Agent</p>\n",
" <p>\n",
"Please note that here will we use a prebuilt agent. One of the big benefits of LangGraph is that you can easily create your own agent architectures. So while it's fine to start here to build an agent quickly, we would strongly recommend learning how to build your own agent so that you can take full advantage of LangGraph.\n",
"Please note that here will we use <a href=\"https://langchain-ai.github.io/langgraph/reference/prebuilt/#langgraph.prebuilt.chat_agent_executor.create_react_agent\">a prebuilt agent</a>. One of the big benefits of LangGraph is that you can easily create your own agent architectures. So while it's fine to start here to build an agent quickly, we would strongly recommend learning how to build your own agent so that you can take full advantage of LangGraph.\n",
" </p>\n",
"</div> "
]
@@ -49,7 +73,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"id": "23a1885c-04ab-4750-aefa-105891fddf3e",
"metadata": {},
"outputs": [],
@@ -89,7 +113,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 8,
"id": "7a154152-973e-4b5d-aa13-48c617744a4c",
"metadata": {},
"outputs": [],
@@ -140,13 +164,13 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 9,
"id": "fa16de4c-aac0-4ff4-ab69-60d399f75423",
"metadata": {},
"outputs": [
{
"data": {
"image/jpeg": "/9j/4AAQSkZJRgABAQ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InZkHnnbkcufJSZM6jD10Ted+y3D81JqjYIiLnQREQEREBERAREQEREBERAREQEREBERAREQEREBERBXujSPXf4jYPPo7Zn5GT41YSr3Rv33+I3Z/N2zsxn+Zk/T+tWEgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgrzRg/8AWDiPzB+x2zkO0fYZFYarzRmPXh4j+z0ds7v+jIrDQEREBERAREQEREBERAREQEREBERAREQEREBERAREQERfL3tjY573BrWjJcTgAIPpFCjq++XYCos1soRbX84Z7hUyMkmb/jEbYztae0ZOSDzDexfPXmsPcNj86m+rXZ0XE7bR9YWybrQv9bWW2w3Kst9D1pX09NJLT0PS9F4xI1pLI9+Dt3EAZwcZzgqL9eaw9w2Pzqb6tOvNYe4bH51N9WnRa98c4LPInAjw6qviR4QVTZKHhvPFWamqaWnmBurSaCOBjhNK4dAN+1pc7bkfa4zzyveS808PPB/m4bcZNY8RbbQWZ1z1CBindPKI6QuO6Ys8j+0eA7uxzA5FW/15rD3DY/Opvq06LXvjnBZN0UI681h7hsfnU31adeaw9w2Pzqb6tOi1745wWTdFFrTquuZcIKK+UVPSPqXbKapo53SxPeATsdua0scQDjtBweYJAMpXPiYdWHNqi1hERa0EREBERAREQEREBERAREQEREBERAREQFyNXEt0neiDgiinIP8A23Lrrkaw/qle/wAhn+bctuF1lPGFja4engBYLaAAAKaLkPxAugtDT/8AQNt/Jov9gW+vQr+KSdoiIsUEREBFo0t8t9bda62U9bBPcKFsb6qmjkDpIBICY94HNu4NcRntAW8g4OrDg2MjtF3pOf8A3AFYKr7Vv9x/nej+dCsFaso+Cj6r2CIi4UEREBERAREQEREBERAREQEREBERAREQFyNYf1Svf5DP825ddcjWH9Ur3+Qz/NuW3C6ynjCxtcTT/wDQNt/Jov8AYFtVVTFRU01RM7ZDEwyPce5oGSf1LV0//QNt/Jov9gW85oe0tcAWkYIPevQr+KSdryPw+1VqaDidw2vtBU6jGj9Zz1kTGak1D46+si8VlnhlFL0eyl5xtI2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e0b8i5Liz2jfkXJcZiIiICIiAiIgIiICIiAiIgIiICIiAq80L/MD/n13/VSqw1XczMhpjMzY7HYufO0rEs9thqPa19RznCSSKQyFrBu6YFg5g4tcQG7Rlx92TzGbVRe0zadOjVfqsarJCi0nstLine truncated
"text/plain": [
"<IPython.core.display.Image object>"
]
@@ -163,7 +187,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 10,
"id": "16636975-5f2d-4dc7-ab8e-d0bea0830a28",
"metadata": {},
"outputs": [],
@@ -187,7 +211,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 11,
"id": "9ffff6c3-a4f5-47c9-b51d-97caaee85cd6",
"metadata": {},
"outputs": [
@@ -200,8 +224,8 @@
"what is the weather in sf\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"Tool Calls:\n",
" get_weather (call_jgO5OOUnugRkhRi3wAOHl8Et)\n",
" Call ID: call_jgO5OOUnugRkhRi3wAOHl8Et\n",
" get_weather (call_zVvnU9DKr6jsNnluFIl59mHb)\n",
" Call ID: call_zVvnU9DKr6jsNnluFIl59mHb\n",
" Args:\n",
" city: sf\n",
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
@@ -229,7 +253,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 12,
"id": "187479f9-32fa-4611-9487-cf816ba2e147",
"metadata": {},
"outputs": [
@@ -268,7 +292,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
@@ -0,0 +1,358 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"id": "d2eecb96-cf0e-47ed-8116-88a7eaa4236d",
"metadata": {},
"source": [
"# How to add cross-thread persistence to your graph\n",
"\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/persistence/\">\n",
" Persistence\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/memory/\">\n",
" Memory\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#chat-models/\">\n",
" Chat Models\n",
" </a>\n",
" </li> \n",
" </ul>\n",
" </p>\n",
"</div>\n",
"\n",
"In the [previous guide](https://langchain-ai.github.io/langgraph/how-tos/persistence/) you learned how to persist graph state across multiple interactions on a single [thread](). LangGraph also allows you to persist data across **multiple threads**. For instance, you can store information about users (their names or preferences) in a shared memory and reuse them in the new conversational threads.\n",
"\n",
"In this guide, we will show how to construct and use a graph that has a shared memory implemented using the [Store](https://langchain-ai.github.io/langgraph/reference/store/#langgraph.store.base.BaseStore) interface.\n",
"\n",
"<div class=\"admonition note\">\n",
" <p class=\"admonition-title\">Note</p>\n",
" <p>\n",
" Support for the <code><a href=\"https://langchain-ai.github.io/langgraph/reference/store/#langgraph.store.base.BaseStore\">Store</a></code> API that is used in this guide was added in LangGraph <code>v0.2.32</code>.\n",
" </p>\n",
"</div>\n",
"\n",
"## Setup\n",
"\n",
"First, let's install the required packages and set our API keys"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "3457aadf",
"metadata": {},
"outputs": [],
"source": [
"%%capture --no-stderr\n",
"%pip install -U langchain_openai langgraph"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "aa2c64a7",
"metadata": {},
"outputs": [
{
"name": "stdin",
"output_type": "stream",
"text": [
"ANTHROPIC_API_KEY: ········\n"
]
}
],
"source": [
"import getpass\n",
"import os\n",
"\n",
"\n",
"def _set_env(var: str):\n",
" if not os.environ.get(var):\n",
" os.environ[var] = getpass.getpass(f\"{var}: \")\n",
"\n",
"\n",
"_set_env(\"ANTHROPIC_API_KEY\")"
]
},
{
"cell_type": "markdown",
"id": "51b6817d",
"metadata": {},
"source": [
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Set up <a href=\"https://smith.langchain.com\">LangSmith</a> for LangGraph development</p>\n",
" <p style=\"padding-top: 5px;\">\n",
" Sign up for LangSmith to quickly spot issues and improve the performance of your LangGraph projects. LangSmith lets you use trace data to debug, test, and monitor your LLM apps built with LangGraph — read more about how to get started <a href=\"https://docs.smith.langchain.com\">here</a>. \n",
" </p>\n",
"</div> "
]
},
{
"cell_type": "markdown",
"id": "c4c550b5-1954-496b-8b9d-800361af17dc",
"metadata": {},
"source": [
"## Define store\n",
"\n",
"In this example we will create a graph that will be able to retrieve information about a user's preferences. We will do so by defining an `InMemoryStore` - an object that can store data in memory and query that data. We will then pass the store object when compiling the graph. This allows each node in the graph to access the store: when you define node functions, you can define `store` keyword argument, and LangGraph will automatically pass the store object you compiled the graph with.\n",
"\n",
"When storing objects using the `Store` interface you define two things:\n",
"\n",
"* the namespace for the object, a tuple (similar to directories)\n",
"* the object key (similar to filenames)\n",
"\n",
"In our example, we'll be using `(\"memories\", <user_id>)` as namespace and random UUID as key for each new memory.\n",
"\n",
"Importantly, to determine the user, we will be passing `user_id` via the config keyword argument of the node function.\n",
"\n",
"Let's first define an `InMemoryStore` which is already populated with some memories about the users."
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "a7f303d6-612e-4e34-bf36-29d4ed25d802",
"metadata": {},
"outputs": [],
"source": [
"from langgraph.store.memory import InMemoryStore\n",
"\n",
"in_memory_store = InMemoryStore()"
]
},
{
"cell_type": "markdown",
"id": "3389c9f4-226d-40c7-8bfc-ee8aac24f79d",
"metadata": {},
"source": [
"## Create graph"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "2a30a362-528c-45ee-9df6-630d2d843588",
"metadata": {},
"outputs": [],
"source": [
"import uuid\n",
"from typing import Annotated\n",
"from typing_extensions import TypedDict\n",
"\n",
"from langchain_anthropic import ChatAnthropic\n",
"from langchain_core.runnables import RunnableConfig\n",
"from langgraph.graph import StateGraph, MessagesState, START\n",
"from langgraph.checkpoint.memory import InMemorySaver\n",
"from langgraph.store.base import BaseStore\n",
"\n",
"\n",
"model = ChatAnthropic(model=\"claude-3-5-sonnet-20240620\")\n",
"\n",
"\n",
"# NOTE: we're passing the Store param to the node --\n",
"# this is the Store we compile the graph with\n",
"def call_model(state: MessagesState, config: RunnableConfig, *, store: BaseStore):\n",
" user_id = config[\"configurable\"][\"user_id\"]\n",
" namespace = (\"memories\", user_id)\n",
" memories = store.search(namespace)\n",
" info = \"\\n\".join([d.value[\"data\"] for d in memories])\n",
" system_msg = f\"You are a helpful assistant talking to the user. User info: {info}\"\n",
"\n",
" # Store new memories if the user asks the model to remember\n",
" last_message = state[\"messages\"][-1]\n",
" if \"remember\" in last_message.content.lower():\n",
" memory = \"User name is Bob\"\n",
" store.put(namespace, str(uuid.uuid4()), {\"data\": memory})\n",
"\n",
" response = model.invoke(\n",
" [{\"type\": \"system\", \"content\": system_msg}] + state[\"messages\"]\n",
" )\n",
" return {\"messages\": response}\n",
"\n",
"\n",
"builder = StateGraph(MessagesState)\n",
"builder.add_node(\"call_model\", call_model)\n",
"builder.add_edge(START, \"call_model\")\n",
"\n",
"# NOTE: we're passing the store object here when compiling the graph\n",
"graph = builder.compile(checkpointer=InMemorySaver(), store=in_memory_store)\n",
"# If you're using LangGraph Cloud or LangGraph Studio, you don't need to pass the store or checkpointer when compiling the graph, since it's done automatically."
]
},
{
"cell_type": "markdown",
"id": "f22a4a18-67e4-4f0b-b655-a29bbe202e1c",
"metadata": {},
"source": [
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Note</p>\n",
" <p>\n",
" If you're using LangGraph Cloud or LangGraph Studio, you <strong>don't need</strong> to pass store when compiling the graph, since it's done automatically.\n",
" </p>\n",
"</div>"
]
},
{
"cell_type": "markdown",
"id": "552d4e33-556d-4fa5-8094-2a076bc21529",
"metadata": {},
"source": [
"## Run the graph!"
]
},
{
"cell_type": "markdown",
"id": "1842c626-6cd9-4f58-b549-58978e478098",
"metadata": {},
"source": [
"Now let's specify a user ID in the config and tell the model our name:"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "c871a073-a466-46ad-aafe-2b870831057e",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"Hi! Remember: my name is Bob\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"Hello Bob! It's nice to meet you. I'll remember that your name is Bob. How can I assist you today?\n"
]
}
],
"source": [
"config = {\"configurable\": {\"thread_id\": \"1\", \"user_id\": \"1\"}}\n",
"input_message = {\"type\": \"user\", \"content\": \"Hi! Remember: my name is Bob\"}\n",
"for chunk in graph.stream({\"messages\": [input_message]}, config, stream_mode=\"values\"):\n",
" chunk[\"messages\"][-1].pretty_print()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "d862be40-1f8a-4057-81c4-b7bf073dc4c1",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"what is my name?\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"Your name is Bob.\n"
]
}
],
"source": [
"config = {\"configurable\": {\"thread_id\": \"2\", \"user_id\": \"1\"}}\n",
"input_message = {\"type\": \"user\", \"content\": \"what is my name?\"}\n",
"for chunk in graph.stream({\"messages\": [input_message]}, config, stream_mode=\"values\"):\n",
" chunk[\"messages\"][-1].pretty_print()"
]
},
{
"cell_type": "markdown",
"id": "80fd01ec-f135-4811-8743-daff8daea422",
"metadata": {},
"source": [
"We can now inspect our in-memory store and verify that we have in fact saved the memories for the user:"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "76cde493-89cf-4709-a339-207d2b7e9ea7",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'data': 'User name is Bob'}\n"
]
}
],
"source": [
"for memory in in_memory_store.search((\"memories\", \"1\")):\n",
" print(memory.value)"
]
},
{
"cell_type": "markdown",
"id": "23f5d7eb-af23-4131-b8fd-2a69e74e6e55",
"metadata": {},
"source": [
"Let's now run the graph for another user to verify that the memories about the first user are self contained:"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "d362350b-d730-48bd-9652-983812fd7811",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"what is my name?\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"I apologize, but I don't have any information about your name. As an AI assistant, I don't have access to personal information about users unless it has been specifically shared in our conversation. If you'd like, you can tell me your name and I'll be happy to use it in our discussion.\n"
]
}
],
"source": [
"config = {\"configurable\": {\"thread_id\": \"3\", \"user_id\": \"2\"}}\n",
"input_message = {\"type\": \"user\", \"content\": \"what is my name?\"}\n",
"for chunk in graph.stream({\"messages\": [input_message]}, config, stream_mode=\"values\"):\n",
" chunk[\"messages\"][-1].pretty_print()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
+43 -68
View File
@@ -6,14 +6,33 @@
"source": [
"# How to disable streaming for models that don't support it\n",
"\n",
"Certain LLM models do not support streaming - perhaps most noticeably the new (depending on when you're reading this) o1 models from OpenAI. This can break LangGraph when using `astream_events` since under the hood, LangGraph is calling all the models in streaming mode. This guide shows how you can avoid this error by returning the final message as a chunk instead of receiving a streaming output.\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#streaming\">\n",
" streaming\n",
" </a> \n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#chat-models/\">\n",
" Chat Models\n",
" </a>\n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"Let's see how this would cause an error by defining the simplest graph we can:"
"Some chat models, including the new O1 models from OpenAI (depending on when you're reading this), do not support streaming. This can lead to issues when using the [astream_events API](https://python.langchain.com/docs/concepts/#astream_events), as it calls models in streaming mode, expecting streaming to function properly.\n",
"\n",
"In this guide, we’ll show you how to disable streaming for models that don’t support it, ensuring they they're never called in streaming mode, even when invoked through the astream_events API."
]
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
@@ -21,13 +40,15 @@
"from langgraph.graph import MessagesState\n",
"from langgraph.graph import StateGraph, START, END\n",
"\n",
"llm = ChatOpenAI(model=\"o1-preview\",temperature=1)\n",
"llm = ChatOpenAI(model=\"o1-preview\", temperature=1)\n",
"\n",
"graph_builder = StateGraph(MessagesState)\n",
"\n",
"\n",
"def chatbot(state: MessagesState):\n",
" return {\"messages\": [llm.invoke(state[\"messages\"])]}\n",
"\n",
"\n",
"graph_builder.add_node(\"chatbot\", chatbot)\n",
"graph_builder.add_edge(START, \"chatbot\")\n",
"graph_builder.add_edge(\"chatbot\", END)\n",
@@ -36,7 +57,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 5,
"metadata": {},
"outputs": [
{
@@ -67,52 +88,19 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 6,
"metadata": {},
"outputs": [
{
"ename": "BadRequestError",
"evalue": "Error code: 400 - {'error': {'message': \"Unsupported value: 'stream' does not support true with this model. Only the default (false) value is supported.\", 'type': 'invalid_request_error', 'param': 'stream', 'code': 'unsupported_value'}}",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mBadRequestError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[2], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28minput\u001b[39m \u001b[38;5;241m=\u001b[39m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmessages\u001b[39m\u001b[38;5;124m\"\u001b[39m: {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrole\u001b[39m\u001b[38;5;124m\"\u001b[39m:\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124muser\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcontent\u001b[39m\u001b[38;5;124m\"\u001b[39m:\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhow many r\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124ms are in strawberry?\u001b[39m\u001b[38;5;124m\"\u001b[39m}}\n\u001b[0;32m----> 2\u001b[0m \u001b[38;5;28;01masync\u001b[39;00m \u001b[38;5;28;01mfor\u001b[39;00m event \u001b[38;5;129;01min\u001b[39;00m graph\u001b[38;5;241m.\u001b[39mastream_events(\u001b[38;5;28minput\u001b[39m, version\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mv2\u001b[39m\u001b[38;5;124m\"\u001b[39m):\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m event[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mevent\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mon_chat_model_end\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n\u001b[1;32m 4\u001b[0m \u001b[38;5;28mprint\u001b[39m(event[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdata\u001b[39m\u001b[38;5;124m\"\u001b[39m][\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124moutput\u001b[39m\u001b[38;5;124m\"\u001b[39m]\u001b[38;5;241m.\u001b[39mcontent, end\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m, flush\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_core/runnables/base.py:1377\u001b[0m, in \u001b[0;36mRunnable.astream_events\u001b[0;34m(self, input, config, version, include_names, include_types, include_tags, exclude_names, exclude_types, exclude_tags, **kwargs)\u001b[0m\n\u001b[1;32m 1372\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mNotImplementedError\u001b[39;00m(\n\u001b[1;32m 1373\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mOnly versions \u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mv1\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m and \u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mv2\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m of the schema is currently supported.\u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[1;32m 1374\u001b[0m )\n\u001b[1;32m 1376\u001b[0m \u001b[38;5;28;01masync\u001b[39;00m \u001b[38;5;28;01mwith\u001b[39;00m aclosing(event_stream):\n\u001b[0;32m-> 1377\u001b[0m \u001b[38;5;28;01masync\u001b[39;00m \u001b[38;5;28;01mfor\u001b[39;00m event \u001b[38;5;129;01min\u001b[39;00m event_stream:\n\u001b[1;32m 1378\u001b[0m \u001b[38;5;28;01myield\u001b[39;00m event\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_core/tracers/event_stream.py:1006\u001b[0m, in \u001b[0;36m_astream_events_implementation_v2\u001b[0;34m(runnable, input, config, include_names, include_types, include_tags, exclude_names, exclude_types, exclude_tags, **kwargs)\u001b[0m\n\u001b[1;32m 1004\u001b[0m \u001b[38;5;66;03m# Await it anyway, to run any cleanup code, and propagate any exceptions\u001b[39;00m\n\u001b[1;32m 1005\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 1006\u001b[0m \u001b[38;5;28;01mawait\u001b[39;00m task\n\u001b[1;32m 1007\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m asyncio\u001b[38;5;241m.\u001b[39mCancelledError:\n\u001b[1;32m 1008\u001b[0m \u001b[38;5;28;01mpass\u001b[39;00m\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_core/tracers/event_stream.py:966\u001b[0m, in \u001b[0;36m_astream_events_implementation_v2.<locals>.consume_astream\u001b[0;34m()\u001b[0m\n\u001b[1;32m 963\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 964\u001b[0m \u001b[38;5;66;03m# if astream also calls tap_output_aiter this will be a no-op\u001b[39;00m\n\u001b[1;32m 965\u001b[0m \u001b[38;5;28;01masync\u001b[39;00m \u001b[38;5;28;01mwith\u001b[39;00m aclosing(runnable\u001b[38;5;241m.\u001b[39mastream(\u001b[38;5;28minput\u001b[39m, config, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)) \u001b[38;5;28;01mas\u001b[39;00m stream:\n\u001b[0;32m--> 966\u001b[0m \u001b[38;5;28;01masync\u001b[39;00m \u001b[38;5;28;01mfor\u001b[39;00m _ \u001b[38;5;129;01min\u001b[39;00m event_streamer\u001b[38;5;241m.\u001b[39mtap_output_aiter(run_id, stream):\n\u001b[1;32m 967\u001b[0m \u001b[38;5;66;03m# All the content will be picked up\u001b[39;00m\n\u001b[1;32m 968\u001b[0m \u001b[38;5;28;01mpass\u001b[39;00m\n\u001b[1;32m 969\u001b[0m \u001b[38;5;28;01mfinally\u001b[39;00m:\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_core/tracers/event_stream.py:182\u001b[0m, in \u001b[0;36m_AstreamEventsCallbackHandler.tap_output_aiter\u001b[0;34m(self, run_id, output)\u001b[0m\n\u001b[1;32m 180\u001b[0m tap \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mis_tapped\u001b[38;5;241m.\u001b[39msetdefault(run_id, sentinel)\n\u001b[1;32m 181\u001b[0m \u001b[38;5;66;03m# wait for first chunk\u001b[39;00m\n\u001b[0;32m--> 182\u001b[0m first \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m py_anext(output, default\u001b[38;5;241m=\u001b[39msentinel)\n\u001b[1;32m 183\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m first \u001b[38;5;129;01mis\u001b[39;00m sentinel:\n\u001b[1;32m 184\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_core/utils/aiter.py:78\u001b[0m, in \u001b[0;36mpy_anext.<locals>.anext_impl\u001b[0;34m()\u001b[0m\n\u001b[1;32m 71\u001b[0m \u001b[38;5;28;01masync\u001b[39;00m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21manext_impl\u001b[39m() \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Union[T, Any]:\n\u001b[1;32m 72\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 73\u001b[0m \u001b[38;5;66;03m# The C code is way more low-level than this, as it implements\u001b[39;00m\n\u001b[1;32m 74\u001b[0m \u001b[38;5;66;03m# all methods of the iterator protocol. In this implementation\u001b[39;00m\n\u001b[1;32m 75\u001b[0m \u001b[38;5;66;03m# we're relying on higher-level coroutine concepts, but that's\u001b[39;00m\n\u001b[1;32m 76\u001b[0m \u001b[38;5;66;03m# exactly what we want -- crosstest pure-Python high-level\u001b[39;00m\n\u001b[1;32m 77\u001b[0m \u001b[38;5;66;03m# implementation and low-level C anext() iterators.\u001b[39;00m\n\u001b[0;32m---> 78\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mawait\u001b[39;00m \u001b[38;5;21m__anext__\u001b[39m(iterator)\n\u001b[1;32m 79\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mStopAsyncIteration\u001b[39;00m:\n\u001b[1;32m 80\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m default\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langgraph/pregel/__init__.py:1477\u001b[0m, in \u001b[0;36mPregel.astream\u001b[0;34m(self, input, config, stream_mode, output_keys, interrupt_before, interrupt_after, debug, subgraphs)\u001b[0m\n\u001b[1;32m 1466\u001b[0m \u001b[38;5;66;03m# Similarly to Bulk Synchronous Parallel / Pregel model\u001b[39;00m\n\u001b[1;32m 1467\u001b[0m \u001b[38;5;66;03m# computation proceeds in steps, while there are channel updates\u001b[39;00m\n\u001b[1;32m 1468\u001b[0m \u001b[38;5;66;03m# channel updates from step N are only visible in step N+1\u001b[39;00m\n\u001b[1;32m 1469\u001b[0m \u001b[38;5;66;03m# channels are guaranteed to be immutable for the duration of the step,\u001b[39;00m\n\u001b[1;32m 1470\u001b[0m \u001b[38;5;66;03m# with channel updates applied only at the transition between steps\u001b[39;00m\n\u001b[1;32m 1471\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m loop\u001b[38;5;241m.\u001b[39mtick(\n\u001b[1;32m 1472\u001b[0m input_keys\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39minput_channels,\n\u001b[1;32m 1473\u001b[0m interrupt_before\u001b[38;5;241m=\u001b[39minterrupt_before,\n\u001b[1;32m 1474\u001b[0m interrupt_after\u001b[38;5;241m=\u001b[39minterrupt_after,\n\u001b[1;32m 1475\u001b[0m manager\u001b[38;5;241m=\u001b[39mrun_manager,\n\u001b[1;32m 1476\u001b[0m ):\n\u001b[0;32m-> 1477\u001b[0m \u001b[38;5;28;01masync\u001b[39;00m \u001b[38;5;28;01mfor\u001b[39;00m _ \u001b[38;5;129;01min\u001b[39;00m runner\u001b[38;5;241m.\u001b[39matick(\n\u001b[1;32m 1478\u001b[0m loop\u001b[38;5;241m.\u001b[39mtasks\u001b[38;5;241m.\u001b[39mvalues(),\n\u001b[1;32m 1479\u001b[0m timeout\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mstep_timeout,\n\u001b[1;32m 1480\u001b[0m retry_policy\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mretry_policy,\n\u001b[1;32m 1481\u001b[0m get_waiter\u001b[38;5;241m=\u001b[39mget_waiter,\n\u001b[1;32m 1482\u001b[0m ):\n\u001b[1;32m 1483\u001b[0m \u001b[38;5;66;03m# emit output\u001b[39;00m\n\u001b[1;32m 1484\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m o \u001b[38;5;129;01min\u001b[39;00m output():\n\u001b[1;32m 1485\u001b[0m \u001b[38;5;28;01myield\u001b[39;00m o\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langgraph/pregel/runner.py:124\u001b[0m, in \u001b[0;36mPregelRunner.atick\u001b[0;34m(self, tasks, reraise, timeout, retry_policy, get_waiter)\u001b[0m\n\u001b[1;32m 122\u001b[0m task \u001b[38;5;241m=\u001b[39m tasks[\u001b[38;5;241m0\u001b[39m]\n\u001b[1;32m 123\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 124\u001b[0m \u001b[38;5;28;01mawait\u001b[39;00m arun_with_retry(task, retry_policy, stream\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39muse_astream)\n\u001b[1;32m 125\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcommit(task, \u001b[38;5;28;01mNone\u001b[39;00m)\n\u001b[1;32m 126\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc:\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langgraph/pregel/retry.py:92\u001b[0m, in \u001b[0;36marun_with_retry\u001b[0;34m(task, retry_policy, stream)\u001b[0m\n\u001b[1;32m 90\u001b[0m \u001b[38;5;66;03m# run the task\u001b[39;00m\n\u001b[1;32m 91\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m stream:\n\u001b[0;32m---> 92\u001b[0m \u001b[38;5;28;01masync\u001b[39;00m \u001b[38;5;28;01mfor\u001b[39;00m _ \u001b[38;5;129;01min\u001b[39;00m task\u001b[38;5;241m.\u001b[39mproc\u001b[38;5;241m.\u001b[39mastream(task\u001b[38;5;241m.\u001b[39minput, config):\n\u001b[1;32m 93\u001b[0m \u001b[38;5;28;01mpass\u001b[39;00m\n\u001b[1;32m 94\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langgraph/utils/runnable.py:503\u001b[0m, in \u001b[0;36mRunnableSeq.astream\u001b[0;34m(self, input, config, **kwargs)\u001b[0m\n\u001b[1;32m 501\u001b[0m output: Output \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 502\u001b[0m add_supported \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[0;32m--> 503\u001b[0m \u001b[38;5;28;01masync\u001b[39;00m \u001b[38;5;28;01mfor\u001b[39;00m chunk \u001b[38;5;129;01min\u001b[39;00m aiterator:\n\u001b[1;32m 504\u001b[0m \u001b[38;5;28;01myield\u001b[39;00m chunk\n\u001b[1;32m 505\u001b[0m \u001b[38;5;66;03m# collect final output\u001b[39;00m\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_core/tracers/event_stream.py:182\u001b[0m, in \u001b[0;36m_AstreamEventsCallbackHandler.tap_output_aiter\u001b[0;34m(self, run_id, output)\u001b[0m\n\u001b[1;32m 180\u001b[0m tap \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mis_tapped\u001b[38;5;241m.\u001b[39msetdefault(run_id, sentinel)\n\u001b[1;32m 181\u001b[0m \u001b[38;5;66;03m# wait for first chunk\u001b[39;00m\n\u001b[0;32m--> 182\u001b[0m first \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m py_anext(output, default\u001b[38;5;241m=\u001b[39msentinel)\n\u001b[1;32m 183\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m first \u001b[38;5;129;01mis\u001b[39;00m sentinel:\n\u001b[1;32m 184\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_core/utils/aiter.py:78\u001b[0m, in \u001b[0;36mpy_anext.<locals>.anext_impl\u001b[0;34m()\u001b[0m\n\u001b[1;32m 71\u001b[0m \u001b[38;5;28;01masync\u001b[39;00m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21manext_impl\u001b[39m() \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Union[T, Any]:\n\u001b[1;32m 72\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 73\u001b[0m \u001b[38;5;66;03m# The C code is way more low-level than this, as it implements\u001b[39;00m\n\u001b[1;32m 74\u001b[0m \u001b[38;5;66;03m# all methods of the iterator protocol. In this implementation\u001b[39;00m\n\u001b[1;32m 75\u001b[0m \u001b[38;5;66;03m# we're relying on higher-level coroutine concepts, but that's\u001b[39;00m\n\u001b[1;32m 76\u001b[0m \u001b[38;5;66;03m# exactly what we want -- crosstest pure-Python high-level\u001b[39;00m\n\u001b[1;32m 77\u001b[0m \u001b[38;5;66;03m# implementation and low-level C anext() iterators.\u001b[39;00m\n\u001b[0;32m---> 78\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mawait\u001b[39;00m \u001b[38;5;21m__anext__\u001b[39m(iterator)\n\u001b[1;32m 79\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mStopAsyncIteration\u001b[39;00m:\n\u001b[1;32m 80\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m default\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_core/runnables/base.py:1444\u001b[0m, in \u001b[0;36mRunnable.atransform\u001b[0;34m(self, input, config, **kwargs)\u001b[0m\n\u001b[1;32m 1441\u001b[0m final: Input\n\u001b[1;32m 1442\u001b[0m got_first_val \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[0;32m-> 1444\u001b[0m \u001b[38;5;28;01masync\u001b[39;00m \u001b[38;5;28;01mfor\u001b[39;00m ichunk \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28minput\u001b[39m:\n\u001b[1;32m 1445\u001b[0m \u001b[38;5;66;03m# The default implementation of transform is to buffer input and\u001b[39;00m\n\u001b[1;32m 1446\u001b[0m \u001b[38;5;66;03m# then call stream.\u001b[39;00m\n\u001b[1;32m 1447\u001b[0m \u001b[38;5;66;03m# It'll attempt to gather all input into a single chunk using\u001b[39;00m\n\u001b[1;32m 1448\u001b[0m \u001b[38;5;66;03m# the `+` operator.\u001b[39;00m\n\u001b[1;32m 1449\u001b[0m \u001b[38;5;66;03m# If the input is not addable, then we'll assume that we can\u001b[39;00m\n\u001b[1;32m 1450\u001b[0m \u001b[38;5;66;03m# only operate on the last chunk,\u001b[39;00m\n\u001b[1;32m 1451\u001b[0m \u001b[38;5;66;03m# and we'll iterate until we get to the last chunk.\u001b[39;00m\n\u001b[1;32m 1452\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m got_first_val:\n\u001b[1;32m 1453\u001b[0m final \u001b[38;5;241m=\u001b[39m ichunk\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_core/runnables/base.py:1006\u001b[0m, in \u001b[0;36mRunnable.astream\u001b[0;34m(self, input, config, **kwargs)\u001b[0m\n\u001b[1;32m 988\u001b[0m \u001b[38;5;28;01masync\u001b[39;00m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mastream\u001b[39m(\n\u001b[1;32m 989\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 990\u001b[0m \u001b[38;5;28minput\u001b[39m: Input,\n\u001b[1;32m 991\u001b[0m config: Optional[RunnableConfig] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 992\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs: Optional[Any],\n\u001b[1;32m 993\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m AsyncIterator[Output]:\n\u001b[1;32m 994\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 995\u001b[0m \u001b[38;5;124;03m Default implementation of astream, which calls ainvoke.\u001b[39;00m\n\u001b[1;32m 996\u001b[0m \u001b[38;5;124;03m Subclasses should override this method if they support streaming output.\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1004\u001b[0m \u001b[38;5;124;03m The output of the Runnable.\u001b[39;00m\n\u001b[1;32m 1005\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m-> 1006\u001b[0m \u001b[38;5;28;01myield\u001b[39;00m \u001b[38;5;28;01mawait\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mainvoke(\u001b[38;5;28minput\u001b[39m, config, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langgraph/utils/runnable.py:171\u001b[0m, in \u001b[0;36mRunnableCallable.ainvoke\u001b[0;34m(self, input, config, **kwargs)\u001b[0m\n\u001b[1;32m 169\u001b[0m context\u001b[38;5;241m.\u001b[39mrun(_set_config_context, config)\n\u001b[1;32m 170\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m ASYNCIO_ACCEPTS_CONTEXT:\n\u001b[0;32m--> 171\u001b[0m ret \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m asyncio\u001b[38;5;241m.\u001b[39mcreate_task(\n\u001b[1;32m 172\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mafunc(\u001b[38;5;28minput\u001b[39m, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs), context\u001b[38;5;241m=\u001b[39mcontext\n\u001b[1;32m 173\u001b[0m )\n\u001b[1;32m 174\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 175\u001b[0m ret \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mafunc(\u001b[38;5;28minput\u001b[39m, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_core/runnables/config.py:590\u001b[0m, in \u001b[0;36mrun_in_executor\u001b[0;34m(executor_or_config, func, *args, **kwargs)\u001b[0m\n\u001b[1;32m 586\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mRuntimeError\u001b[39;00m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mexc\u001b[39;00m\n\u001b[1;32m 588\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m executor_or_config \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(executor_or_config, \u001b[38;5;28mdict\u001b[39m):\n\u001b[1;32m 589\u001b[0m \u001b[38;5;66;03m# Use default executor with context copied from current context\u001b[39;00m\n\u001b[0;32m--> 590\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mawait\u001b[39;00m asyncio\u001b[38;5;241m.\u001b[39mget_running_loop()\u001b[38;5;241m.\u001b[39mrun_in_executor(\n\u001b[1;32m 591\u001b[0m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 592\u001b[0m cast(Callable[\u001b[38;5;241m.\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;241m.\u001b[39m, T], partial(copy_context()\u001b[38;5;241m.\u001b[39mrun, wrapper)),\n\u001b[1;32m 593\u001b[0m )\n\u001b[1;32m 595\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mawait\u001b[39;00m asyncio\u001b[38;5;241m.\u001b[39mget_running_loop()\u001b[38;5;241m.\u001b[39mrun_in_executor(executor_or_config, wrapper)\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/concurrent/futures/thread.py:58\u001b[0m, in \u001b[0;36m_WorkItem.run\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 55\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m\n\u001b[1;32m 57\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m---> 58\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfn\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 59\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mBaseException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc:\n\u001b[1;32m 60\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfuture\u001b[38;5;241m.\u001b[39mset_exception(exc)\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_core/runnables/config.py:581\u001b[0m, in \u001b[0;36mrun_in_executor.<locals>.wrapper\u001b[0;34m()\u001b[0m\n\u001b[1;32m 579\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mwrapper\u001b[39m() \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m T:\n\u001b[1;32m 580\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 581\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 582\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mStopIteration\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc:\n\u001b[1;32m 583\u001b[0m \u001b[38;5;66;03m# StopIteration can't be set on an asyncio.Future\u001b[39;00m\n\u001b[1;32m 584\u001b[0m \u001b[38;5;66;03m# it raises a TypeError and leaves the Future pending forever\u001b[39;00m\n\u001b[1;32m 585\u001b[0m \u001b[38;5;66;03m# so we need to convert it to a RuntimeError\u001b[39;00m\n\u001b[1;32m 586\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mRuntimeError\u001b[39;00m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mexc\u001b[39;00m\n",
"Cell \u001b[0;32mIn[1], line 10\u001b[0m, in \u001b[0;36mchatbot\u001b[0;34m(state)\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mchatbot\u001b[39m(state: MessagesState):\n\u001b[0;32m---> 10\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmessages\u001b[39m\u001b[38;5;124m\"\u001b[39m: [\u001b[43mllm\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minvoke\u001b[49m\u001b[43m(\u001b[49m\u001b[43mstate\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mmessages\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m]}\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:286\u001b[0m, in \u001b[0;36mBaseChatModel.invoke\u001b[0;34m(self, input, config, stop, **kwargs)\u001b[0m\n\u001b[1;32m 275\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21minvoke\u001b[39m(\n\u001b[1;32m 276\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 277\u001b[0m \u001b[38;5;28minput\u001b[39m: LanguageModelInput,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 281\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs: Any,\n\u001b[1;32m 282\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m BaseMessage:\n\u001b[1;32m 283\u001b[0m config \u001b[38;5;241m=\u001b[39m ensure_config(config)\n\u001b[1;32m 284\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m cast(\n\u001b[1;32m 285\u001b[0m ChatGeneration,\n\u001b[0;32m--> 286\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgenerate_prompt\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 287\u001b[0m \u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_convert_input\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 288\u001b[0m \u001b[43m \u001b[49m\u001b[43mstop\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstop\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 289\u001b[0m \u001b[43m \u001b[49m\u001b[43mcallbacks\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mconfig\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mcallbacks\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 290\u001b[0m \u001b[43m \u001b[49m\u001b[43mtags\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mconfig\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtags\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 291\u001b[0m \u001b[43m \u001b[49m\u001b[43mmetadata\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mconfig\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mmetadata\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 292\u001b[0m \u001b[43m \u001b[49m\u001b[43mrun_name\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mconfig\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mrun_name\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 293\u001b[0m \u001b[43m \u001b[49m\u001b[43mrun_id\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mconfig\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpop\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mrun_id\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 294\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 295\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241m.\u001b[39mgenerations[\u001b[38;5;241m0\u001b[39m][\u001b[38;5;241m0\u001b[39m],\n\u001b[1;32m 296\u001b[0m )\u001b[38;5;241m.\u001b[39mmessage\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:786\u001b[0m, in \u001b[0;36mBaseChatModel.generate_prompt\u001b[0;34m(self, prompts, stop, callbacks, **kwargs)\u001b[0m\n\u001b[1;32m 778\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mgenerate_prompt\u001b[39m(\n\u001b[1;32m 779\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 780\u001b[0m prompts: List[PromptValue],\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 783\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs: Any,\n\u001b[1;32m 784\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m LLMResult:\n\u001b[1;32m 785\u001b[0m prompt_messages \u001b[38;5;241m=\u001b[39m [p\u001b[38;5;241m.\u001b[39mto_messages() \u001b[38;5;28;01mfor\u001b[39;00m p \u001b[38;5;129;01min\u001b[39;00m prompts]\n\u001b[0;32m--> 786\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgenerate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mprompt_messages\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstop\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstop\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcallbacks\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcallbacks\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:643\u001b[0m, in \u001b[0;36mBaseChatModel.generate\u001b[0;34m(self, messages, stop, callbacks, tags, metadata, run_name, run_id, **kwargs)\u001b[0m\n\u001b[1;32m 641\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m run_managers:\n\u001b[1;32m 642\u001b[0m run_managers[i]\u001b[38;5;241m.\u001b[39mon_llm_error(e, response\u001b[38;5;241m=\u001b[39mLLMResult(generations\u001b[38;5;241m=\u001b[39m[]))\n\u001b[0;32m--> 643\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m e\n\u001b[1;32m 644\u001b[0m flattened_outputs \u001b[38;5;241m=\u001b[39m [\n\u001b[1;32m 645\u001b[0m LLMResult(generations\u001b[38;5;241m=\u001b[39m[res\u001b[38;5;241m.\u001b[39mgenerations], llm_output\u001b[38;5;241m=\u001b[39mres\u001b[38;5;241m.\u001b[39mllm_output) \u001b[38;5;66;03m# type: ignore[list-item]\u001b[39;00m\n\u001b[1;32m 646\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m res \u001b[38;5;129;01min\u001b[39;00m results\n\u001b[1;32m 647\u001b[0m ]\n\u001b[1;32m 648\u001b[0m llm_output \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_combine_llm_outputs([res\u001b[38;5;241m.\u001b[39mllm_output \u001b[38;5;28;01mfor\u001b[39;00m res \u001b[38;5;129;01min\u001b[39;00m results])\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:633\u001b[0m, in \u001b[0;36mBaseChatModel.generate\u001b[0;34m(self, messages, stop, callbacks, tags, metadata, run_name, run_id, **kwargs)\u001b[0m\n\u001b[1;32m 630\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m i, m \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28menumerate\u001b[39m(messages):\n\u001b[1;32m 631\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 632\u001b[0m results\u001b[38;5;241m.\u001b[39mappend(\n\u001b[0;32m--> 633\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_generate_with_cache\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 634\u001b[0m \u001b[43m \u001b[49m\u001b[43mm\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 635\u001b[0m \u001b[43m \u001b[49m\u001b[43mstop\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstop\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 636\u001b[0m \u001b[43m \u001b[49m\u001b[43mrun_manager\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrun_managers\u001b[49m\u001b[43m[\u001b[49m\u001b[43mi\u001b[49m\u001b[43m]\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mif\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mrun_managers\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01melse\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 637\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 638\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 639\u001b[0m )\n\u001b[1;32m 640\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mBaseException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 641\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m run_managers:\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:843\u001b[0m, in \u001b[0;36mBaseChatModel._generate_with_cache\u001b[0;34m(self, messages, stop, run_manager, **kwargs)\u001b[0m\n\u001b[1;32m 837\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_should_stream(\n\u001b[1;32m 838\u001b[0m async_api\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[1;32m 839\u001b[0m run_manager\u001b[38;5;241m=\u001b[39mrun_manager,\n\u001b[1;32m 840\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs,\n\u001b[1;32m 841\u001b[0m ):\n\u001b[1;32m 842\u001b[0m chunks: List[ChatGenerationChunk] \u001b[38;5;241m=\u001b[39m []\n\u001b[0;32m--> 843\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43;01mfor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mchunk\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01min\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_stream\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmessages\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstop\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstop\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\u001b[43m:\u001b[49m\n\u001b[1;32m 844\u001b[0m \u001b[43m \u001b[49m\u001b[43mchunk\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmessage\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mresponse_metadata\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43m_gen_info_and_msg_metadata\u001b[49m\u001b[43m(\u001b[49m\u001b[43mchunk\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 845\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43;01mif\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mrun_manager\u001b[49m\u001b[43m:\u001b[49m\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_openai/chat_models/base.py:621\u001b[0m, in \u001b[0;36mBaseChatOpenAI._stream\u001b[0;34m(self, messages, stop, run_manager, **kwargs)\u001b[0m\n\u001b[1;32m 619\u001b[0m base_generation_info \u001b[38;5;241m=\u001b[39m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mheaders\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;28mdict\u001b[39m(raw_response\u001b[38;5;241m.\u001b[39mheaders)}\n\u001b[1;32m 620\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 621\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mclient\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcreate\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mpayload\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 622\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m response:\n\u001b[1;32m 623\u001b[0m is_first_chunk \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/openai/_utils/_utils.py:274\u001b[0m, in \u001b[0;36mrequired_args.<locals>.inner.<locals>.wrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 272\u001b[0m msg \u001b[38;5;241m=\u001b[39m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mMissing required argument: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mquote(missing[\u001b[38;5;241m0\u001b[39m])\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 273\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(msg)\n\u001b[0;32m--> 274\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/openai/resources/chat/completions.py:704\u001b[0m, in \u001b[0;36mCompletions.create\u001b[0;34m(self, messages, model, frequency_penalty, function_call, functions, logit_bias, logprobs, max_completion_tokens, max_tokens, n, parallel_tool_calls, presence_penalty, response_format, seed, service_tier, stop, stream, stream_options, temperature, tool_choice, tools, top_logprobs, top_p, user, extra_headers, extra_query, extra_body, timeout)\u001b[0m\n\u001b[1;32m 668\u001b[0m \u001b[38;5;129m@required_args\u001b[39m([\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmessages\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmodel\u001b[39m\u001b[38;5;124m\"\u001b[39m], [\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmessages\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmodel\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstream\u001b[39m\u001b[38;5;124m\"\u001b[39m])\n\u001b[1;32m 669\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcreate\u001b[39m(\n\u001b[1;32m 670\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 701\u001b[0m timeout: \u001b[38;5;28mfloat\u001b[39m \u001b[38;5;241m|\u001b[39m httpx\u001b[38;5;241m.\u001b[39mTimeout \u001b[38;5;241m|\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;241m|\u001b[39m NotGiven \u001b[38;5;241m=\u001b[39m NOT_GIVEN,\n\u001b[1;32m 702\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m ChatCompletion \u001b[38;5;241m|\u001b[39m Stream[ChatCompletionChunk]:\n\u001b[1;32m 703\u001b[0m validate_response_format(response_format)\n\u001b[0;32m--> 704\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_post\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 705\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m/chat/completions\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 706\u001b[0m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmaybe_transform\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 707\u001b[0m \u001b[43m \u001b[49m\u001b[43m{\u001b[49m\n\u001b[1;32m 708\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mmessages\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mmessages\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 709\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mmodel\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mmodel\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 710\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mfrequency_penalty\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mfrequency_penalty\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 711\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mfunction_call\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mfunction_call\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 712\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mfunctions\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mfunctions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 713\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mlogit_bias\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mlogit_bias\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 714\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mlogprobs\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mlogprobs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 715\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mmax_completion_tokens\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mmax_completion_tokens\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 716\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mmax_tokens\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mmax_tokens\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 717\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mn\u001b[39;49m\u001b[38Line truncated
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/openai/_base_client.py:1260\u001b[0m, in \u001b[0;36mSyncAPIClient.post\u001b[0;34m(self, path, cast_to, body, options, files, stream, stream_cls)\u001b[0m\n\u001b[1;32m 1246\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mpost\u001b[39m(\n\u001b[1;32m 1247\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 1248\u001b[0m path: \u001b[38;5;28mstr\u001b[39m,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1255\u001b[0m stream_cls: \u001b[38;5;28mtype\u001b[39m[_StreamT] \u001b[38;5;241m|\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 1256\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m ResponseT \u001b[38;5;241m|\u001b[39m _StreamT:\n\u001b[1;32m 1257\u001b[0m opts \u001b[38;5;241m=\u001b[39m FinalRequestOptions\u001b[38;5;241m.\u001b[39mconstruct(\n\u001b[1;32m 1258\u001b[0m method\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpost\u001b[39m\u001b[38;5;124m\"\u001b[39m, url\u001b[38;5;241m=\u001b[39mpath, json_data\u001b[38;5;241m=\u001b[39mbody, files\u001b[38;5;241m=\u001b[39mto_httpx_files(files), \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39moptions\n\u001b[1;32m 1259\u001b[0m )\n\u001b[0;32m-> 1260\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m cast(ResponseT, \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcast_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mopts\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstream\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstream_cls\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstream_cls\u001b[49m\u001b[43m)\u001b[49m)\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/openai/_base_client.py:937\u001b[0m, in \u001b[0;36mSyncAPIClient.request\u001b[0;34m(self, cast_to, options, remaining_retries, stream, stream_cls)\u001b[0m\n\u001b[1;32m 928\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mrequest\u001b[39m(\n\u001b[1;32m 929\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 930\u001b[0m cast_to: Type[ResponseT],\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 935\u001b[0m stream_cls: \u001b[38;5;28mtype\u001b[39m[_StreamT] \u001b[38;5;241m|\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 936\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m ResponseT \u001b[38;5;241m|\u001b[39m _StreamT:\n\u001b[0;32m--> 937\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 938\u001b[0m \u001b[43m \u001b[49m\u001b[43mcast_to\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcast_to\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 939\u001b[0m \u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 940\u001b[0m \u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstream\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 941\u001b[0m \u001b[43m \u001b[49m\u001b[43mstream_cls\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstream_cls\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 942\u001b[0m \u001b[43m \u001b[49m\u001b[43mremaining_retries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mremaining_retries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 943\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/openai/_base_client.py:1041\u001b[0m, in \u001b[0;36mSyncAPIClient._request\u001b[0;34m(self, cast_to, options, remaining_retries, stream, stream_cls)\u001b[0m\n\u001b[1;32m 1038\u001b[0m err\u001b[38;5;241m.\u001b[39mresponse\u001b[38;5;241m.\u001b[39mread()\n\u001b[1;32m 1040\u001b[0m log\u001b[38;5;241m.\u001b[39mdebug(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mRe-raising status error\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m-> 1041\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_make_status_error_from_response(err\u001b[38;5;241m.\u001b[39mresponse) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 1043\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_process_response(\n\u001b[1;32m 1044\u001b[0m cast_to\u001b[38;5;241m=\u001b[39mcast_to,\n\u001b[1;32m 1045\u001b[0m options\u001b[38;5;241m=\u001b[39moptions,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1049\u001b[0m retries_taken\u001b[38;5;241m=\u001b[39moptions\u001b[38;5;241m.\u001b[39mget_max_retries(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmax_retries) \u001b[38;5;241m-\u001b[39m retries,\n\u001b[1;32m 1050\u001b[0m )\n",
"\u001b[0;31mBadRequestError\u001b[0m: Error code: 400 - {'error': {'message': \"Unsupported value: 'stream' does not support true with this model. Only the default (false) value is supported.\", 'type': 'invalid_request_error', 'param': 'stream', 'code': 'unsupported_value'}}"
"name": "stdout",
"output_type": "stream",
"text": [
"Streaming not supported!\n"
]
}
],
"source": [
"input = {\"messages\": {\"role\":\"user\", \"content\":\"how many r's are in strawberry?\"}}\n",
"input = {\"messages\": {\"role\": \"user\", \"content\": \"how many r's are in strawberry?\"}}\n",
"try:\n",
" async for event in graph.astream_events(input, version=\"v2\"):\n",
" if event[\"event\"] == \"on_chat_model_end\":\n",
@@ -129,22 +117,24 @@
"\n",
"## Disabling streaming\n",
"\n",
"Now without making any changse to our graph, let's set the `disable_streaming` parameter on our model to be `True` which will solve our issues:"
"Now without making any changes to our graph, let's set the [disable_streaming](https://python.langchain.com/api_reference/core/language_models/langchain_core.language_models.chat_models.BaseChatModel.html#langchain_core.language_models.chat_models.BaseChatModel.disable_streaming) parameter on our model to be `True` which will solve the problem:"
]
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"llm = ChatOpenAI(model=\"o1-preview\",temperature=1,disable_streaming=True)\n",
"llm = ChatOpenAI(model=\"o1-preview\", temperature=1, disable_streaming=True)\n",
"\n",
"graph_builder = StateGraph(MessagesState)\n",
"\n",
"\n",
"def chatbot(state: MessagesState):\n",
" return {\"messages\": [llm.invoke(state[\"messages\"])]}\n",
"\n",
"\n",
"graph_builder.add_node(\"chatbot\", chatbot)\n",
"graph_builder.add_edge(START, \"chatbot\")\n",
"graph_builder.add_edge(\"chatbot\", END)\n",
@@ -160,34 +150,19 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"There are **three** letter \"r\"s in the word \"strawberry.\"\n",
"\n",
"Here's the breakdown:\n",
"\n",
"- **S**\n",
"- **T**\n",
"- **R** (1st \"r\")\n",
"- **A**\n",
"- **W**\n",
"- **B**\n",
"- **E**\n",
"- **R** (2nd \"r\")\n",
"- **R** (3rd \"r\")\n",
"- **Y**\n",
"\n",
"So, the letters \"r\" appear in the 3rd, 8th, and 9th positions of the word \"strawberry.\""
"There are three \"r\"s in the word \"strawberry\"."
]
}
],
"source": [
"input = {\"messages\": {\"role\":\"user\", \"content\":\"how many r's are in strawberry?\"}}\n",
"input = {\"messages\": {\"role\": \"user\", \"content\": \"how many r's are in strawberry?\"}}\n",
"async for event in graph.astream_events(input, version=\"v2\"):\n",
" if event[\"event\"] == \"on_chat_model_end\":\n",
" print(event[\"data\"][\"output\"].content, end=\"\", flush=True)"
@@ -196,7 +171,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@@ -210,9 +185,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
@@ -124,7 +124,7 @@
"source": [
"from typing_extensions import TypedDict\n",
"from langgraph.graph import StateGraph, START, END\n",
"from langgraph.checkpoint.memory import MemorySaver\n",
"from langgraph.checkpoint.memory import InMemorySaver\n",
"from IPython.display import Image, display\n",
"\n",
"\n",
@@ -157,7 +157,7 @@
"builder.add_edge(\"step_3\", END)\n",
"\n",
"# Set up memory\n",
"memory = MemorySaver()\n",
"memory = InMemorySaver()\n",
"\n",
"# Add\n",
"graph = builder.compile(checkpointer=memory, interrupt_before=[\"step_3\"])\n",
@@ -270,7 +270,7 @@
"from langgraph.graph import MessagesState, START\n",
"from langgraph.prebuilt import ToolNode\n",
"from langgraph.graph import END, StateGraph\n",
"from langgraph.checkpoint.memory import MemorySaver\n",
"from langgraph.checkpoint.memory import InMemorySaver\n",
"\n",
"\n",
"@tool\n",
@@ -352,7 +352,7 @@
"workflow.add_edge(\"action\", \"agent\")\n",
"\n",
"# Set up memory\n",
"memory = MemorySaver()\n",
"memory = InMemorySaver()\n",
"\n",
"# Finally, we compile it!\n",
"# This compiles it into a LangChain Runnable,\n",
@@ -78,7 +78,7 @@
"from IPython.display import Image, display\n",
"\n",
"from langgraph.graph import StateGraph, START, END\n",
"from langgraph.checkpoint.memory import MemorySaver\n",
"from langgraph.checkpoint.memory import InMemorySaver\n",
"from langgraph.errors import NodeInterrupt\n",
"\n",
"\n",
@@ -94,12 +94,15 @@
"def step_2(state: State) -> State:\n",
" # Let's optionally raise a NodeInterrupt\n",
" # if the length of the input is longer than 5 characters\n",
" if len(state['input']) > 5:\n",
" raise NodeInterrupt(f\"Received input that is longer than 5 characters: {state['input']}\")\n",
" \n",
" if len(state[\"input\"]) > 5:\n",
" raise NodeInterrupt(\n",
" f\"Received input that is longer than 5 characters: {state['input']}\"\n",
" )\n",
"\n",
" print(\"---Step 2---\")\n",
" return state\n",
"\n",
"\n",
"def step_3(state: State) -> State:\n",
" print(\"---Step 3---\")\n",
" return state\n",
@@ -115,7 +118,7 @@
"builder.add_edge(\"step_3\", END)\n",
"\n",
"# Set up memory\n",
"memory = MemorySaver()\n",
"memory = InMemorySaver()\n",
"\n",
"# Compile the graph with memory\n",
"graph = builder.compile(checkpointer=memory)\n",
@@ -126,7 +126,7 @@
"source": [
"from typing_extensions import TypedDict\n",
"from langgraph.graph import StateGraph, START, END\n",
"from langgraph.checkpoint.memory import MemorySaver\n",
"from langgraph.checkpoint.memory import InMemorySaver\n",
"from IPython.display import Image, display\n",
"\n",
"\n",
@@ -159,7 +159,7 @@
"builder.add_edge(\"step_3\", END)\n",
"\n",
"# Set up memory\n",
"memory = MemorySaver()\n",
"memory = InMemorySaver()\n",
"\n",
"# Add\n",
"graph = builder.compile(checkpointer=memory, interrupt_before=[\"step_2\"])\n",
@@ -279,7 +279,7 @@
"from langchain_core.tools import tool\n",
"from langgraph.graph import MessagesState, START, END, StateGraph\n",
"from langgraph.prebuilt import ToolNode\n",
"from langgraph.checkpoint.memory import MemorySaver\n",
"from langgraph.checkpoint.memory import InMemorySaver\n",
"\n",
"\n",
"@tool\n",
@@ -361,7 +361,7 @@
"workflow.add_edge(\"action\", \"agent\")\n",
"\n",
"# Set up memory\n",
"memory = MemorySaver()\n",
"memory = InMemorySaver()\n",
"\n",
"# Finally, we compile it!\n",
"# This compiles it into a LangChain Runnable,\n",
@@ -120,7 +120,7 @@
"source": [
"from typing_extensions import TypedDict, Literal\n",
"from langgraph.graph import StateGraph, START, END, MessagesState\n",
"from langgraph.checkpoint.memory import MemorySaver\n",
"from langgraph.checkpoint.memory import InMemorySaver\n",
"from langchain_anthropic import ChatAnthropic\n",
"from langchain_core.tools import tool\n",
"from langchain_core.messages import AIMessage\n",
@@ -195,7 +195,7 @@
"builder.add_edge(\"run_tool\", \"call_llm\")\n",
"\n",
"# Set up memory\n",
"memory = MemorySaver()\n",
"memory = InMemorySaver()\n",
"\n",
"# Add\n",
"graph = builder.compile(checkpointer=memory, interrupt_before=[\"human_review_node\"])\n",
File diff suppressed because it is too large. Load diff
@@ -120,7 +120,7 @@
"source": [
"from typing_extensions import TypedDict\n",
"from langgraph.graph import StateGraph, START, END\n",
"from langgraph.checkpoint.memory import MemorySaver\n",
"from langgraph.checkpoint.memory import InMemorySaver\n",
"from IPython.display import Image, display\n",
"\n",
"\n",
@@ -154,7 +154,7 @@
"builder.add_edge(\"step_3\", END)\n",
"\n",
"# Set up memory\n",
"memory = MemorySaver()\n",
"memory = InMemorySaver()\n",
"\n",
"# Add\n",
"graph = builder.compile(checkpointer=memory, interrupt_before=[\"human_feedback\"])\n",
@@ -382,6 +382,7 @@
"\n",
"from pydantic import BaseModel\n",
"\n",
"\n",
"# We are going \"bind\" all tools to the model\n",
"# We have the ACTUAL tools from above, but we also need a mock tool to ask a human\n",
"# Since `bind_tools` takes in tools but also just tool definitions,\n",
@@ -396,6 +397,7 @@
"\n",
"# Define nodes and conditional edges\n",
"\n",
"\n",
"# Define the function that determines whether to continue or not\n",
"def should_continue(state):\n",
" messages = state[\"messages\"]\n",
@@ -473,9 +475,9 @@
"workflow.add_edge(\"ask_human\", \"agent\")\n",
"\n",
"# Set up memory\n",
"from langgraph.checkpoint.memory import MemorySaver\n",
"from langgraph.checkpoint.memory import InMemorySaver\n",
"\n",
"memory = MemorySaver()\n",
"memory = InMemorySaver()\n",
"\n",
"# Finally, we compile it!\n",
"# This compiles it into a LangChain Runnable,\n",
+12 -6
View File
@@ -18,16 +18,22 @@ These how-to guides show how to achieve that controllability.
## Persistence
LangGraph makes it easy to persist state across graph runs. The guide below shows how to add persistence to your graph.
LangGraph makes it easy to persist state across graph runs (thread-level persistence) and across threads (cross-thread persistence). These how-to guides show how to add persistence to your graph.
- [How to add persistence ("memory") to your graph](persistence.ipynb)
- [How to manage conversation history](memory/manage-conversation-history.ipynb)
- [How to delete messages](memory/delete-messages.ipynb)
- [How to add summary conversation memory](memory/add-summary-conversation-history.ipynb)
- [How to add thread-level persistence to your graph](persistence.ipynb)
- [How to add cross-thread persistence to your graph](cross-thread-persistence.ipynb)
- [How to use Postgres checkpointer for persistence](persistence_postgres.ipynb)
- [How to create a custom checkpointer using MongoDB](persistence_mongodb.ipynb)
- [How to create a custom checkpointer using Redis](persistence_redis.ipynb)
## Memory
LangGraph makes it easy to manage conversation [memory](../concepts/memory.md) in your graph. These how-to guides show how to implement different strategies for that.
- [How to manage conversation history](memory/manage-conversation-history.ipynb)
- [How to delete messages](memory/delete-messages.ipynb)
- [How to add summary conversation memory](memory/add-summary-conversation-history.ipynb)
## Human in the Loop
One of LangGraph's main benefits is that it makes human-in-the-loop workflows easy.
@@ -61,7 +67,7 @@ These guides show how to use different streaming modes.
- [How to call tools using ToolNode](tool-calling.ipynb)
- [How to handle tool calling errors](tool-calling-errors.ipynb)
- [How to pass graph state to tools](pass-run-time-values-to-tools.ipynb)
- [How to pass runtime values to tools](pass-run-time-values-to-tools.ipynb)
- [How to pass config to tools](pass-config-to-tools.ipynb)
- [How to handle large numbers of tools](many-tools.ipynb)
+45 -20
View File
@@ -7,11 +7,30 @@
"source": [
"# How to define input/output schema for your graph\n",
"\n",
"By default, `StateGraph` takes in a single schema and all nodes are expected to communicate with that schema. However, it is also possible to define explicit input and output schemas for a graph. Often, in these cases, we define an \"internal\" schema that contains all keys relevant to graph operations. But, we use specific input and output schemas to filter what's permitted when invoking and what's returned. We use type hints below to, for example, show that the output of `answer_node` will be filtered to `OutputState`. In addition, we define each node's input schema (e.g., as state: `OverallState` for `answer_node`).\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/low_level/#multiple-schemas\">\n",
" Multiple Schemas\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/low_level/#stategraph\">\n",
" State Graph\n",
" </a> \n",
" </li> \n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"In this notebook we'll walk through an example of this. At a high level, in order to do this you simply have to pass in `input=..., output=...` when defining the graph. See the conceptual docs [here](https://langchain-ai.github.io/langgraph/concepts/low_level/#multiple-schemas) for more details.\n",
"By default, `StateGraph` operates with a single schema, and all nodes are expected to communicate using that schema. However, it's also possible to define distinct input and output schemas for a graph.\n",
"\n",
"Let's look at an example!\n",
"When distinct schemas are specified, an internal schema will still be used for communication between nodes. The input schema ensures that the provided input matches the expected structure, while the output schema filters the internal data to return only the relevant information according to the defined output schema.\n",
"\n",
"In this example, we'll see how to define distinct input and output schema.\n",
"\n",
"## Setup\n",
"\n",
@@ -20,7 +39,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"id": "678286f2",
"metadata": {},
"outputs": [],
@@ -52,19 +71,16 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"id": "6ec0eb77-874e-443e-8c73-93125b515106",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'answer': 'bye'}"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
"name": "stdout",
"output_type": "stream",
"text": [
"{'answer': 'bye'}\n"
]
}
],
"source": [
@@ -72,27 +88,36 @@
"from typing_extensions import TypedDict\n",
"\n",
"\n",
"# Define the schema for the input\n",
"class InputState(TypedDict):\n",
" question: str\n",
"\n",
"\n",
"# Define the schema for the output\n",
"class OutputState(TypedDict):\n",
" answer: str\n",
"\n",
"\n",
"# Define the overall schema, combining both input and output\n",
"class OverallState(InputState, OutputState):\n",
" pass\n",
"\n",
"\n",
"# Define the node that processes the input and generates an answer\n",
"def answer_node(state: InputState):\n",
" return {\"answer\": \"bye\"}\n",
" # Example answer and an extra key\n",
" return {\"answer\": \"bye\", \"question\": state[\"question\"]}\n",
"\n",
"\n",
"# Build the graph with input and output schemas specified\n",
"builder = StateGraph(OverallState, input=InputState, output=OutputState)\n",
"builder.add_node(answer_node)\n",
"builder.add_edge(START, \"answer_node\")\n",
"builder.add_edge(\"answer_node\", END)\n",
"graph = builder.compile()\n",
"builder.add_node(answer_node) # Add the answer node\n",
"builder.add_edge(START, \"answer_node\") # Define the starting edge\n",
"builder.add_edge(\"answer_node\", END) # Define the ending edge\n",
"graph = builder.compile() # Compile the graph\n",
"\n",
"graph.invoke({\"question\": \"hi\"})"
"# Invoke the graph with an input and print the result\n",
"print(graph.invoke({\"question\": \"hi\"}))"
]
},
{
@@ -120,7 +145,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
+96 -37
View File
@@ -7,6 +7,41 @@
"source": [
"# How to handle large numbers of tools\n",
"\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#tools\">\n",
" Tools\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#chat-models/\">\n",
" Chat Models\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#embedding-models\">\n",
" Embedding Models\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#vector-stores\">\n",
" Vectorstores\n",
" </a>\n",
" </li> \n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#documents\">\n",
" Document\n",
" </a>\n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"\n",
"The subset of available tools to call is generally at the discretion of the model (although many providers also enable the user to [specify or constrain the choice of tool](https://python.langchain.com/docs/how_to/tool_choice/)). As the number of available tools grows, you may want to limit the scope of the LLM's selection, to decrease token consumption and to help manage sources of error in LLM reasoning.\n",
"\n",
"Here we will demonstrate how to dynamically adjust the tools available to a model. Bottom line up front: like [RAG](https://python.langchain.com/docs/concepts/#retrieval) and similar methods, we prefix the model invocation by retrieving over available tools. Although we demonstrate one implementation that searches over tool descriptions, the details of the tool selection can be customized as needed.\n",
@@ -18,7 +53,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "9b6c62bd",
"metadata": {},
"outputs": [],
@@ -29,7 +64,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "360d7ff6",
"metadata": {},
"outputs": [],
@@ -72,14 +107,14 @@
"id": "24708f3b-18b1-4b42-9f6a-0d4827222918",
"metadata": {},
"source": [
"Let's consider a toy example in which we have one tool for each company in the S&P 500 index. Each tool will fetch information, and is parameterized by a single integer representing the year.\n",
"Let's consider a toy example in which we have one tool for each publicly traded company in the [S&P 500 index](https://en.wikipedia.org/wiki/S%26P_500). Each tool fetches company-specific information based on the year provided as a parameter.\n",
"\n",
"We first construct a registry that associates a unique identifier with a schema for each tool. We will represent the tools using JSON schema, which can be bound directly to chat models supporting tool calling."
]
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 10,
"id": "da30c3f1-127f-4828-8609-94e16719f0be",
"metadata": {},
"outputs": [],
@@ -92,9 +127,11 @@
"\n",
"def create_tool(company: str) -> dict:\n",
" \"\"\"Create schema for a placeholder tool.\"\"\"\n",
" # Remove non-alphanumeric characters and replace spaces with underscores for the tool name\n",
" formatted_company = re.sub(r\"[^\\w\\s]\", \"\", company).replace(\" \", \"_\")\n",
"\n",
" def company_tool(year: int) -> str:\n",
" # Placeholder function returning static revenue information for the company and year\n",
" return f\"{company} had revenues of $100 in {year}.\"\n",
"\n",
" return StructuredTool.from_function(\n",
@@ -104,7 +141,8 @@
" )\n",
"\n",
"\n",
"s_and_p_500_companies = [ # Abbreviated list for demonstration purposes\n",
"# Abbreviated list of S&P 500 companies for demonstration\n",
"s_and_p_500_companies = [\n",
" \"3M\",\n",
" \"A.O. Smith\",\n",
" \"Abbott\",\n",
@@ -116,6 +154,7 @@
" \"Zoetis\",\n",
"]\n",
"\n",
"# Create a tool for each company and store it in a registry with a unique UUID as the key\n",
"tool_registry = {\n",
" str(uuid.uuid4()): create_tool(company) for company in s_and_p_500_companies\n",
"}"
@@ -147,7 +186,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 11,
"id": "435b0201-7296-4617-abf8-2c757a71f6b5",
"metadata": {},
"outputs": [],
@@ -185,7 +224,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 12,
"id": "d319fea9-e8ae-4763-a785-b2bf72239ae4",
"metadata": {},
"outputs": [],
@@ -200,23 +239,34 @@
"from langgraph.prebuilt import ToolNode, tools_condition\n",
"\n",
"\n",
"# Define the state structure using TypedDict.\n",
"# It includes a list of messages (processed by add_messages)\n",
"# and a list of selected tool IDs.\n",
"class State(TypedDict):\n",
" messages: Annotated[list, add_messages]\n",
" selected_tools: list[str]\n",
"\n",
"\n",
"graph_builder = StateGraph(State)\n",
"builder = StateGraph(State)\n",
"\n",
"# Retrieve all available tools from the tool registry.\n",
"tools = list(tool_registry.values())\n",
"llm = ChatOpenAI()\n",
"\n",
"\n",
"# The agent function processes the current state\n",
"# by binding selected tools to the LLM.\n",
"def agent(state: State):\n",
" # Map tool IDs to actual tools\n",
" # based on the state's selected_tools list.\n",
" selected_tools = [tool_registry[id] for id in state[\"selected_tools\"]]\n",
" # Bind the selected tools to the LLM for the current interaction.\n",
" llm_with_tools = llm.bind_tools(selected_tools)\n",
" # Invoke the LLM with the current messages and return the updated message list.\n",
" return {\"messages\": [llm_with_tools.invoke(state[\"messages\"])]}\n",
"\n",
"\n",
"# The select_tools function selects tools based on the user's last message content.\n",
"def select_tools(state: State):\n",
" last_user_message = state[\"messages\"][-1]\n",
" query = last_user_message.content\n",
@@ -224,25 +274,25 @@
" return {\"selected_tools\": [document.id for document in tool_documents]}\n",
"\n",
"\n",
"graph_builder.add_node(\"agent\", agent)\n",
"graph_builder.add_node(\"select_tools\", select_tools)\n",
"builder.add_node(\"agent\", agent)\n",
"builder.add_node(\"select_tools\", select_tools)\n",
"\n",
"tool_node = ToolNode(tools=tools)\n",
"graph_builder.add_node(\"tools\", tool_node)\n",
"builder.add_node(\"tools\", tool_node)\n",
"\n",
"graph_builder.add_conditional_edges(\n",
"builder.add_conditional_edges(\n",
" \"agent\",\n",
" tools_condition,\n",
")\n",
"graph_builder.add_edge(\"tools\", \"agent\")\n",
"graph_builder.add_edge(\"select_tools\", \"agent\")\n",
"graph_builder.add_edge(START, \"select_tools\")\n",
"graph = graph_builder.compile()"
"builder.add_edge(\"tools\", \"agent\")\n",
"builder.add_edge(\"select_tools\", \"agent\")\n",
"builder.add_edge(START, \"select_tools\")\n",
"graph = builder.compile()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 13,
"id": "35cab3b2-4d03-4cb5-ba10-f7d3a5ad5244",
"metadata": {},
"outputs": [
@@ -269,7 +319,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 14,
"id": "66f62a69-989b-46ce-80b3-97a867e36782",
"metadata": {},
"outputs": [],
@@ -281,7 +331,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 15,
"id": "479a459d-6896-4960-aae9-9f1259fb47d1",
"metadata": {},
"outputs": [
@@ -289,7 +339,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"['3b7d1528-6007-4473-a92f-b9b3341c3bfe', '8d77b753-c58a-41bf-9649-ad1a7326bc27', '514a6fc3-03d1-4e73-b410-c39309ad7b2f', '83c5cc8f-5111-46ed-874a-e0b883265ff6']\n"
"['ab9c0d59-3d16-448d-910c-73cf10a26020', 'f5eff8f6-7fb9-47b6-b54f-19872a52db84', '2962e168-9ef4-48dc-8b7c-9227e7956d39', '24a9fb82-19fe-4a88-944e-47bc4032e94a']\n"
]
}
],
@@ -299,7 +349,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 16,
"id": "376f28fd-3f7f-4ae5-a34c-baef1778e82b",
"metadata": {},
"outputs": [
@@ -312,8 +362,8 @@
"Can you give me some information about AMD in 2022?\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"Tool Calls:\n",
" Advanced_Micro_Devices (call_Htbv7Imx4BwSsYWhZvSSs6yW)\n",
" Call ID: call_Htbv7Imx4BwSsYWhZvSSs6yW\n",
" Advanced_Micro_Devices (call_CRxQ0oT7NY7lqf35DaRNTJ35)\n",
" Call ID: call_CRxQ0oT7NY7lqf35DaRNTJ35\n",
" Args:\n",
" year: 2022\n",
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
@@ -322,7 +372,7 @@
"Advanced Micro Devices had revenues of $100 in 2022.\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"In 2022, Advanced Micro Devices had revenues of $100.\n"
"In 2022, Advanced Micro Devices (AMD) had revenues of $100.\n"
]
}
],
@@ -358,7 +408,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 46,
"id": "1954a5f1-91e4-4b32-9be9-c8bc1cc43cb5",
"metadata": {},
"outputs": [],
@@ -376,11 +426,18 @@
"\n",
"\n",
"def select_tools(state: State):\n",
" \"\"\"Selects tools based on the last message in the conversation state.\n",
"\n",
" If the last message is from a human, directly uses the content of the message\n",
" as the query. Otherwise, constructs a query using a system message and invokes\n",
" the LLM to generate tool suggestions.\n",
" \"\"\"\n",
" last_message = state[\"messages\"][-1]\n",
" hack_remove_tool_condition = False\n",
" hack_remove_tool_condition = False # Simulate an error in the first tool selection\n",
"\n",
" if isinstance(last_message, HumanMessage):\n",
" query = last_message.content\n",
" hack_remove_tool_condition = True\n",
" hack_remove_tool_condition = True # Simulate wrong tool selection\n",
" else:\n",
" assert isinstance(last_message, ToolMessage)\n",
" system = SystemMessage(\n",
@@ -394,9 +451,11 @@
" input_messages\n",
" )\n",
" query = response.tool_calls[0][\"args\"][\"query\"]\n",
"\n",
" # Search the tool vector store using the generated query\n",
" tool_documents = vector_store.similarity_search(query)\n",
" if hack_remove_tool_condition:\n",
" # Remove needed tool\n",
" # Simulate error by removing the correct tool from the selection\n",
" selected_tools = [\n",
" document.id\n",
" for document in tool_documents\n",
@@ -426,7 +485,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 47,
"id": "9110789a-843a-4c21-aeff-8841b24f7674",
"metadata": {},
"outputs": [
@@ -453,7 +512,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 48,
"id": "bee04c3d-0e36-4443-b0c8-10986a5f6e39",
"metadata": {},
"outputs": [],
@@ -465,7 +524,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 49,
"id": "6906fb50-435c-4473-bbb6-5353433b9199",
"metadata": {},
"outputs": [
@@ -478,8 +537,8 @@
"Can you give me some information about AMD in 2022?\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"Tool Calls:\n",
" Accenture (call_L82JRUyIFilhzeTmPnNbPeVD)\n",
" Call ID: call_L82JRUyIFilhzeTmPnNbPeVD\n",
" Accenture (call_qGmwFnENwwzHOYJXiCAaY5Mx)\n",
" Call ID: call_qGmwFnENwwzHOYJXiCAaY5Mx\n",
" Args:\n",
" year: 2022\n",
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
@@ -488,8 +547,8 @@
"Accenture had revenues of $100 in 2022.\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"Tool Calls:\n",
" Advanced_Micro_Devices (call_k3zR9zS98gjiejmNgq6aVsXL)\n",
" Call ID: call_k3zR9zS98gjiejmNgq6aVsXL\n",
" Advanced_Micro_Devices (call_u9e5UIJtiieXVYi7Y9GgyDpn)\n",
" Call ID: call_u9e5UIJtiieXVYi7Y9GgyDpn\n",
" Args:\n",
" year: 2022\n",
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
@@ -498,7 +557,7 @@
"Advanced Micro Devices had revenues of $100 in 2022.\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"In 2022, Advanced Micro Devices (AMD) had revenues of $100.\n"
"In 2022, AMD had revenues of $100.\n"
]
}
],
@@ -539,7 +598,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
+313 -283
View File
@@ -1,287 +1,317 @@
{
"cells": [
{
"attachments": {
"a108ffc8-6136-4cd7-a6f9-579e41a5a786.png": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAACBEAAAHICAYAAAAS6ODsAAAMP2lDQ1BJQ0MgUHJvZmlsZQAASImVVwdYU8kWnluSkEBCCSAgJfQmCEgJICWEFkB6EWyEJEAoMQaCiB1dVHDtYgEbuiqi2AGxI3YWwd4XRRSUdbFgV96kgK77yvfO9829//3nzH/OnDu3DADqp7hicQ6qAUCuKF8SGxLAGJucwiB1AwTggAYIgMDl5YlZ0dERANrg+e/27ib0hnbNQab1z/7/app8QR4PACQa4jR+Hi8X4kMA4JU8sSQfAKKMN5+aL5Zh2IC2BCYI8UIZzlDgShlOU+B9cp/4WDbEzQCoqHG5kgwAaG2QZxTwMqAGrQ9iJxFfKAJAnQGxb27uZD7EqRDbQB8xxDJ9ZtoPOhl/00wb0uRyM4awYi5yUwkU5olzuNP+z3L8b8vNkQ7GsIJNLVMSGiubM6zb7ezJ4TKsBnGvKC0yCmItiD8I+XJ/iFFKpjQ0QeGPGvL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2lvbj4yMDY1PC9leGlmOlBpeGVsWERpbWVuc2lvbj4KICAgICAgICAgPGV4aWY6VXNlckNvbW1lbnQ+U2NyZWVuc2hvdDwvZXhpZjpVc2VyQ29tbWVudD4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiALine truncated
}
},
"cell_type": "markdown",
"id": "95a87145-34d0-4f97-b45f-5c9fd8532c8a",
"metadata": {},
"source": [
"# How to create map-reduce branches for parallel execution\n",
"\n",
"[Map-reduce](https://en.wikipedia.org/wiki/MapReduce) operations are essential for efficient task decomposition and parallel processing. This approach involves breaking a task into smaller sub-tasks, processing each sub-task in parallel, and aggregating the results across all of the completed sub-tasks. \n",
"\n",
"Consider this example: given a general topic from the user, generate a list of related subjects, generate a joke for each subject, and select the best joke from the resulting list. In this design pattern, a first node may generate a list of objects (e.g., related subjects) and we want to apply some other node (e.g., generate a joke) to all those objects (e.g., subjects). However, two main challenges arise.\n",
" \n",
"(1) the number of objects (e.g., subjects) may be unknown ahead of time (meaning the number of edges may not be known) when we lay out the graph and (2) the input State to the downstream Node should be different (one for each generated object).\n",
" \n",
"LangGraph addresses these challenges [through its `Send` API](https://langchain-ai.github.io/langgraph/concepts/low_level/#send). By utilizing conditional edges, `Send` can distribute different states (e.g., subjects) to multiple instances of a node (e.g., joke generation). Importantly, the sent state can differ from the core graph's state, allowing for flexible and dynamic workflow management. \n",
"\n",
"![Screenshot 2024-07-12 at 9.45.40 AM.png](attachment:a108ffc8-6136-4cd7-a6f9-579e41a5a786.png)"
]
},
{
"cell_type": "markdown",
"id": "66c58b5f",
"metadata": {},
"source": [
"## Setup\n",
"\n",
"First, let's install the required packages and set our API keys"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "3eb04cd1",
"metadata": {},
"outputs": [],
"source": [
"%%capture --no-stderr\n",
"%pip install -U langchain-anthropic langgraph"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "dc292321",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import getpass\n",
"\n",
"\n",
"def _set_env(name: str):\n",
" if not os.getenv(name):\n",
" os.environ[name] = getpass.getpass(f\"{name}: \")\n",
"\n",
"\n",
"_set_env(\"ANTHROPIC_API_KEY\")"
]
},
{
"cell_type": "markdown",
"id": "b87911bb",
"metadata": {},
"source": [
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Set up <a href=\"https://smith.langchain.com\">LangSmith</a> for LangGraph development</p>\n",
" <p style=\"padding-top: 5px;\">\n",
" Sign up for LangSmith to quickly spot issues and improve the performance of your LangGraph projects. LangSmith lets you use trace data to debug, test, and monitor your LLM apps built with LangGraph — read more about how to get started <a href=\"https://docs.smith.langchain.com\">here</a>. \n",
" </p>\n",
"</div> "
]
},
{
"cell_type": "markdown",
"id": "b4e782a0",
"metadata": {},
"source": [
"## Define the graph"
]
},
{
"cell_type": "markdown",
"id": "66803b55",
"metadata": {},
"source": [
"<div class=\"admonition note\">\n",
" <p class=\"admonition-title\">Using Pydantic with LangChain</p>\n",
" <p>\n",
" This notebook uses Pydantic v2 <code>BaseModel</code>, which requires <code>langchain-core >= 0.3</code>. Using <code>langchain-core < 0.3</code> will result in errors due to mixing of Pydantic v1 and v2 <code>BaseModels</code>.\n",
" </p>\n",
"</div>"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "0f0f78e4-423d-4e2d-aa1a-01efaec4715f",
"metadata": {},
"outputs": [],
"source": [
"import operator\n",
"from typing import Annotated\n",
"from typing_extensions import TypedDict\n",
"\n",
"from langchain_anthropic import ChatAnthropic\n",
"\n",
"from langgraph.types import Send\n",
"from langgraph.graph import END, StateGraph, START\n",
"\n",
"from pydantic import BaseModel, Field\n",
"\n",
"# Model and prompts\n",
"# Define model and prompts we will use\n",
"subjects_prompt = \"\"\"Generate a comma separated list of between 2 and 5 examples related to: {topic}.\"\"\"\n",
"joke_prompt = \"\"\"Generate a joke about {subject}\"\"\"\n",
"best_joke_prompt = \"\"\"Below are a bunch of jokes about {topic}. Select the best one! Return the ID of the best one.\n",
"\n",
"{jokes}\"\"\"\n",
"\n",
"\n",
"class Subjects(BaseModel):\n",
" subjects: list[str]\n",
"\n",
"\n",
"class Joke(BaseModel):\n",
" joke: str\n",
"\n",
"\n",
"class BestJoke(BaseModel):\n",
" id: int = Field(description=\"Index of the best joke, starting with 0\", ge=0)\n",
"\n",
"\n",
"model = ChatAnthropic(model=\"claude-3-5-sonnet-20240620\")\n",
"\n",
"# Graph components: define the components that will make up the graph\n",
"\n",
"\n",
"# This will be the overall state of the main graph.\n",
"# It will contain a topic (which we expect the user to provide)\n",
"# and then will generate a list of subjects, and then a joke for\n",
"# each subject\n",
"class OverallState(TypedDict):\n",
" topic: str\n",
" subjects: list\n",
" # Notice here we use the operator.add\n",
" # This is because we want combine all the jokes we generate\n",
" # from individual nodes back into one list - this is essentially\n",
" # the \"reduce\" part\n",
" jokes: Annotated[list, operator.add]\n",
" best_selected_joke: str\n",
"\n",
"\n",
"# This will be the state of the node that we will \"map\" all\n",
"# subjects to in order to generate a joke\n",
"class JokeState(TypedDict):\n",
" subject: str\n",
"\n",
"\n",
"# This is the function we will use to generate the subjects of the jokes\n",
"def generate_topics(state: OverallState):\n",
" prompt = subjects_prompt.format(topic=state[\"topic\"])\n",
" response = model.with_structured_output(Subjects).invoke(prompt)\n",
" return {\"subjects\": response.subjects}\n",
"\n",
"\n",
"# Here we generate a joke, given a subject\n",
"def generate_joke(state: JokeState):\n",
" prompt = joke_prompt.format(subject=state[\"subject\"])\n",
" response = model.with_structured_output(Joke).invoke(prompt)\n",
" return {\"jokes\": [response.joke]}\n",
"\n",
"\n",
"# Here we define the logic to map out over the generated subjects\n",
"# We will use this an edge in the graph\n",
"def continue_to_jokes(state: OverallState):\n",
" # We will return a list of `Send` objects\n",
" # Each `Send` object consists of the name of a node in the graph\n",
" # as well as the state to send to that node\n",
" return [Send(\"generate_joke\", {\"subject\": s}) for s in state[\"subjects\"]]\n",
"\n",
"\n",
"# Here we will judge the best joke\n",
"def best_joke(state: OverallState):\n",
" jokes = \"\\n\\n\".join(state[\"jokes\"])\n",
" prompt = best_joke_prompt.format(topic=state[\"topic\"], jokes=jokes)\n",
" response = model.with_structured_output(BestJoke).invoke(prompt)\n",
" return {\"best_selected_joke\": state[\"jokes\"][response.id]}\n",
"\n",
"\n",
"# Construct the graph: here we put everything together to construct our graph\n",
"graph = StateGraph(OverallState)\n",
"graph.add_node(\"generate_topics\", generate_topics)\n",
"graph.add_node(\"generate_joke\", generate_joke)\n",
"graph.add_node(\"best_joke\", best_joke)\n",
"graph.add_edge(START, \"generate_topics\")\n",
"graph.add_conditional_edges(\"generate_topics\", continue_to_jokes, [\"generate_joke\"])\n",
"graph.add_edge(\"generate_joke\", \"best_joke\")\n",
"graph.add_edge(\"best_joke\", END)\n",
"app = graph.compile()"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "37ed1f71-63db-416f-b715-4617b33d4b7f",
"metadata": {},
"outputs": [
{
"data": {
"image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/4gHYSUNDX1BST0ZJTEUAAQEAAAHIAAAAAAQwAABtbnRyUkdCIFhZWiAH4AABAAEAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAACRyWFlaAAABFAAAABRnWFlaAAABKAAAABRiWFlaAAABPAAAABR3dHB0AAABUAAAABRyVFJDAAABZAAAAChnVFJDAAABZAAAAChiVFJDAAABZAAAAChjcHJ0AAABjAAAADxtbHVjAAAAAAAAAAEAAAAMZW5VUwAAAAgAAAAcAHMAUgBHAEJYWVogAAAAAAAAb6IAADj1AAADkFhZWiAAAAAAAABimQAAt4UAABjaWFlaIAAAAAAAACSgAAAPhAAAts9YWVogAAAAAAAA9tYAAQAAAADTLXBhcmEAAAAAAAQAAAACZmYAAPKnAAANWQAAE9AAAApbAAAAAAA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4v8AS0nJXa7sgjrajlHnlWwhwiG6Tut3Q93wLine truncated
"text/plain": [
"<IPython.core.display.Image object>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from IPython.display import Image\n",
"\n",
"Image(app.get_graph().draw_mermaid_png())"
]
},
{
"cell_type": "markdown",
"id": "4a0026d8",
"metadata": {},
"source": [
"## Use the graph"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "fd90cace",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'generate_topics': {'subjects': ['Lions', 'Elephants', 'Penguins', 'Dolphins']}}\n",
"{'generate_joke': {'jokes': [\"Why don't elephants use computers? They're afraid of the mouse!\"]}}\n",
"{'generate_joke': {'jokes': [\"Why don't dolphins use smartphones? Because they're afraid of phishing!\"]}}\n",
"{'generate_joke': {'jokes': [\"Why don't you see penguins in Britain? Because they're afraid of Wales!\"]}}\n",
"{'generate_joke': {'jokes': [\"Why don't lions like fast food? Because they can't catch it!\"]}}\n",
"{'best_joke': {'best_selected_joke': \"Why don't dolphins use smartphones? Because they're afraid of phishing!\"}}\n"
]
}
],
"source": [
"# Call the graph: here we call it to generate a list of jokes\n",
"for s in app.stream({\"topic\": \"animals\"}):\n",
" print(s)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"cells": [
{
"attachments": {
"a108ffc8-6136-4cd7-a6f9-579e41a5a786.png": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAACBEAAAHICAYAAAAS6ODsAAAMP2lDQ1BJQ0MgUHJvZmlsZQAASImVVwdYU8kWnluSkEBCCSAgJfQmCEgJICWEFkB6EWyEJEAoMQaCiB1dVHDtYgEbuiqi2AGxI3YWwd4XR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htcHRrPSJYTVAgQ29yZSA2LjAuMCI+CiAgIDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICAgICAgICAgIHhtbG5zOmV4aWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vZXhpZi8xLjAvIj4KICAgICAgICAgPGV4aWY6UGl4ZWxZRGltZW5zaW9uPjQ1NjwvZXhpZjpQaXhlbFlEaW1lbnNpb24+CiAgICAgICAgIDxleGlmOlBpeGVsWERpbWVuc2lvbj4yMDY1PC9leGlmOlBpeGVsWERpbWVuc2lvbj4KICAgICAgICAgPGV4aWY6VXNlckNvbW1lbnQ+U2NyZWVuc2hvdDwvZXhpZjpVc2VyQ29tbWVudD4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgIDwvLine truncated
}
},
"cell_type": "markdown",
"id": "95a87145-34d0-4f97-b45f-5c9fd8532c8a",
"metadata": {},
"source": [
"# How to create map-reduce branches for parallel execution\n",
"\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/low_level/\">\n",
" LangGraph Glossary\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/low_level/#send\">\n",
" Send API\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#chat-models/\">\n",
" Chat Models\n",
" </a>\n",
" </li> \n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#structured-output\">\n",
" Structured Output\n",
" </a>\n",
" </li> \n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"\n",
"[Map-reduce](https://en.wikipedia.org/wiki/MapReduce) operations are essential for efficient task decomposition and parallel processing. This approach involves breaking a task into smaller sub-tasks, processing each sub-task in parallel, and aggregating the results across all of the completed sub-tasks. \n",
"\n",
"Consider this example: given a general topic from the user, generate a list of related subjects, generate a joke for each subject, and select the best joke from the resulting list. In this design pattern, a first node may generate a list of objects (e.g., related subjects) and we want to apply some other node (e.g., generate a joke) to all those objects (e.g., subjects). However, two main challenges arise.\n",
" \n",
"(1) the number of objects (e.g., subjects) may be unknown ahead of time (meaning the number of edges may not be known) when we lay out the graph and (2) the input State to the downstream Node should be different (one for each generated object).\n",
" \n",
"LangGraph addresses these challenges [through its `Send` API](https://langchain-ai.github.io/langgraph/concepts/low_level/#send). By utilizing conditional edges, `Send` can distribute different states (e.g., subjects) to multiple instances of a node (e.g., joke generation). Importantly, the sent state can differ from the core graph's state, allowing for flexible and dynamic workflow management. \n",
"\n",
"![Screenshot 2024-07-12 at 9.45.40 AM.png](attachment:a108ffc8-6136-4cd7-a6f9-579e41a5a786.png)"
]
},
"nbformat": 4,
"nbformat_minor": 5
{
"cell_type": "markdown",
"id": "66c58b5f",
"metadata": {},
"source": [
"## Setup\n",
"\n",
"First, let's install the required packages and set our API keys"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "3eb04cd1",
"metadata": {},
"outputs": [],
"source": [
"%%capture --no-stderr\n",
"%pip install -U langchain-anthropic langgraph"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "dc292321",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import getpass\n",
"\n",
"\n",
"def _set_env(name: str):\n",
" if not os.getenv(name):\n",
" os.environ[name] = getpass.getpass(f\"{name}: \")\n",
"\n",
"\n",
"_set_env(\"ANTHROPIC_API_KEY\")"
]
},
{
"cell_type": "markdown",
"id": "b87911bb",
"metadata": {},
"source": [
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Set up <a href=\"https://smith.langchain.com\">LangSmith</a> for LangGraph development</p>\n",
" <p style=\"padding-top: 5px;\">\n",
" Sign up for LangSmith to quickly spot issues and improve the performance of your LangGraph projects. LangSmith lets you use trace data to debug, test, and monitor your LLM apps built with LangGraph — read more about how to get started <a href=\"https://docs.smith.langchain.com\">here</a>. \n",
" </p>\n",
"</div> "
]
},
{
"cell_type": "markdown",
"id": "b4e782a0",
"metadata": {},
"source": [
"## Define the graph"
]
},
{
"cell_type": "markdown",
"id": "66803b55",
"metadata": {},
"source": [
"<div class=\"admonition note\">\n",
" <p class=\"admonition-title\">Using Pydantic with LangChain</p>\n",
" <p>\n",
" This notebook uses Pydantic v2 <code>BaseModel</code>, which requires <code>langchain-core >= 0.3</code>. Using <code>langchain-core < 0.3</code> will result in errors due to mixing of Pydantic v1 and v2 <code>BaseModels</code>.\n",
" </p>\n",
"</div>"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "0f0f78e4-423d-4e2d-aa1a-01efaec4715f",
"metadata": {},
"outputs": [],
"source": [
"import operator\n",
"from typing import Annotated\n",
"from typing_extensions import TypedDict\n",
"\n",
"from langchain_anthropic import ChatAnthropic\n",
"\n",
"from langgraph.types import Send\n",
"from langgraph.graph import END, StateGraph, START\n",
"\n",
"from pydantic import BaseModel, Field\n",
"\n",
"# Model and prompts\n",
"# Define model and prompts we will use\n",
"subjects_prompt = \"\"\"Generate a comma separated list of between 2 and 5 examples related to: {topic}.\"\"\"\n",
"joke_prompt = \"\"\"Generate a joke about {subject}\"\"\"\n",
"best_joke_prompt = \"\"\"Below are a bunch of jokes about {topic}. Select the best one! Return the ID of the best one.\n",
"\n",
"{jokes}\"\"\"\n",
"\n",
"\n",
"class Subjects(BaseModel):\n",
" subjects: list[str]\n",
"\n",
"\n",
"class Joke(BaseModel):\n",
" joke: str\n",
"\n",
"\n",
"class BestJoke(BaseModel):\n",
" id: int = Field(description=\"Index of the best joke, starting with 0\", ge=0)\n",
"\n",
"\n",
"model = ChatAnthropic(model=\"claude-3-5-sonnet-20240620\")\n",
"\n",
"# Graph components: define the components that will make up the graph\n",
"\n",
"\n",
"# This will be the overall state of the main graph.\n",
"# It will contain a topic (which we expect the user to provide)\n",
"# and then will generate a list of subjects, and then a joke for\n",
"# each subject\n",
"class OverallState(TypedDict):\n",
" topic: str\n",
" subjects: list\n",
" # Notice here we use the operator.add\n",
" # This is because we want combine all the jokes we generate\n",
" # from individual nodes back into one list - this is essentially\n",
" # the \"reduce\" part\n",
" jokes: Annotated[list, operator.add]\n",
" best_selected_joke: str\n",
"\n",
"\n",
"# This will be the state of the node that we will \"map\" all\n",
"# subjects to in order to generate a joke\n",
"class JokeState(TypedDict):\n",
" subject: str\n",
"\n",
"\n",
"# This is the function we will use to generate the subjects of the jokes\n",
"def generate_topics(state: OverallState):\n",
" prompt = subjects_prompt.format(topic=state[\"topic\"])\n",
" response = model.with_structured_output(Subjects).invoke(prompt)\n",
" return {\"subjects\": response.subjects}\n",
"\n",
"\n",
"# Here we generate a joke, given a subject\n",
"def generate_joke(state: JokeState):\n",
" prompt = joke_prompt.format(subject=state[\"subject\"])\n",
" response = model.with_structured_output(Joke).invoke(prompt)\n",
" return {\"jokes\": [response.joke]}\n",
"\n",
"\n",
"# Here we define the logic to map out over the generated subjects\n",
"# We will use this an edge in the graph\n",
"def continue_to_jokes(state: OverallState):\n",
" # We will return a list of `Send` objects\n",
" # Each `Send` object consists of the name of a node in the graph\n",
" # as well as the state to send to that node\n",
" return [Send(\"generate_joke\", {\"subject\": s}) for s in state[\"subjects\"]]\n",
"\n",
"\n",
"# Here we will judge the best joke\n",
"def best_joke(state: OverallState):\n",
" jokes = \"\\n\\n\".join(state[\"jokes\"])\n",
" prompt = best_joke_prompt.format(topic=state[\"topic\"], jokes=jokes)\n",
" response = model.with_structured_output(BestJoke).invoke(prompt)\n",
" return {\"best_selected_joke\": state[\"jokes\"][response.id]}\n",
"\n",
"\n",
"# Construct the graph: here we put everything together to construct our graph\n",
"graph = StateGraph(OverallState)\n",
"graph.add_node(\"generate_topics\", generate_topics)\n",
"graph.add_node(\"generate_joke\", generate_joke)\n",
"graph.add_node(\"best_joke\", best_joke)\n",
"graph.add_edge(START, \"generate_topics\")\n",
"graph.add_conditional_edges(\"generate_topics\", continue_to_jokes, [\"generate_joke\"])\n",
"graph.add_edge(\"generate_joke\", \"best_joke\")\n",
"graph.add_edge(\"best_joke\", END)\n",
"app = graph.compile()"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "37ed1f71-63db-416f-b715-4617b33d4b7f",
"metadata": {},
"outputs": [
{
"data": {
"image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/4gHYSUNDX1BST0ZJTEUAAQEAAAHIAAAAAAQwAABtbnRyUkdCIFhZWiAH4AABAAEAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAACRyWFlaAAABFAAAABRnWFlaAAABKAAAABRiWFlaAAABPAAAABR3dHB0AAABUAAAABRyVFJDAAABZAAAAChnVFJDAAABZAAAAChiVFJDAAABZAAAAChjcHJ0AAABjAAAADxtbHVjAAAAAAAAAAEAAAAMZW5VUwAAAAgAAAAcAHMAUgBHAEJYWVogAAAAAAAAb6IAADj1AAADkFhZWiAAAAAAAABimQAAt4UAABjaWFlaIAAAAAAAACSgAAAPhAAAts9YWVogAAAAAAAA9tYAAQAAAADTLXBhcmEAAAAAAAQAAAACZmYAAPKnAAANWQAAE9AAAApbAAAAAAAAAABtbHVjAAAAAAAAAAEAAAAMZW5VUwAAACAAAAAcAEcAbwBvAGcAbABlACAASQBuAGMALgAgADIAMAAxADb/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ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kqRBIH8jM0NLo3adDgHN1HSNUGciIgIsG03y336Gaa21sFfDDPJTSSU8ge1ssbi2RhI/rNcCCOoghZyAiLU47lVryuOvktdSallDWzW+oJiezcniduyM8oDXQ9Y1B6iVA2yIikFj7LjrhFB80k4HzATyaLIWPst+JFD/a1H7+RRe8xPfHpaT0KtEReahq8q+LF4+pzfsFT2NfFy1fVIv2AqHKvixePqc37BU9jXxctX1SL9gL0bnmZ7/snoZla6dlHO6lY2SpEbjEx50a5+nAE+bXReOdl2SX695DgN4pb9l+Q3+mhuVXmdorZ6llFSVEdPK1kfJ6COMichjI26hw8oglocPZbtSDppr86827OO52y/Ec3sVeyptGNWi2VDpJ47FerrUtr4dxzW05pamQwws1c13klxG4N3RVtRNYQm9j9Htbzy14XntJdQ/nSogrrhNPlcs1JNSuf+Hgbbu9BHE5rd5rd1+81zRq93HX8WXHILds2uO0IZfkU92tmdSUMVJNcpHUbqM3nvY07ofgvbuSHRzgXN0aGuDWgDvtk2B4FjmVNyK2WBtFc2Tvqo+SqpxTxzPBa+RlPv8kxxDnAlrAeJWxk2SYnLi1VjjrVrZqq4G6zU3fMvlVRqRUmTe394fhgHboO71aacFGrI88TO2o7X8m2h1uP101DPZL5VWa2GPKpbfDQ8gGiN8tE2kkZOH6iQmRx3g/dG6ArXELPfcz285nTZDkt4ggsdBYqjmq03OaCjNW+OV0rgGkEsLoyCzg14d5QJDdOgZLsCwLLsmlyC6WBst1n3BUSw1U8Danc+By0cb2sl00AG+HcAAqm3YjabTkl4v8AS0nJXa7sgjrajlHnlWwhwiG6Tut3Q93wQNdeOvLine truncated
"text/plain": [
"<IPython.core.display.Image object>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from IPython.display import Image\n",
"\n",
"Image(app.get_graph().draw_mermaid_png())"
]
},
{
"cell_type": "markdown",
"id": "4a0026d8",
"metadata": {},
"source": [
"## Use the graph"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "fd90cace",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'generate_topics': {'subjects': ['Lions', 'Elephants', 'Penguins', 'Dolphins']}}\n",
"{'generate_joke': {'jokes': [\"Why don't elephants use computers? They're afraid of the mouse!\"]}}\n",
"{'generate_joke': {'jokes': [\"Why don't dolphins use smartphones? Because they're afraid of phishing!\"]}}\n",
"{'generate_joke': {'jokes': [\"Why don't you see penguins in Britain? Because they're afraid of Wales!\"]}}\n",
"{'generate_joke': {'jokes': [\"Why don't lions like fast food? Because they can't catch it!\"]}}\n",
"{'best_joke': {'best_selected_joke': \"Why don't dolphins use smartphones? Because they're afraid of phishing!\"}}\n"
]
}
],
"source": [
"# Call the graph: here we call it to generate a list of jokes\n",
"for s in app.stream({\"topic\": \"animals\"}):\n",
" print(s)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
@@ -99,10 +99,10 @@
"\n",
"from langchain_anthropic import ChatAnthropic\n",
"from langchain_core.messages import SystemMessage, RemoveMessage\n",
"from langgraph.checkpoint.memory import MemorySaver\n",
"from langgraph.checkpoint.memory import InMemorySaver\n",
"from langgraph.graph import MessagesState, StateGraph, START, END\n",
"\n",
"memory = MemorySaver()\n",
"memory = InMemorySaver()\n",
"\n",
"\n",
"# We will add a `summary` attribute (in addition to `messages` key,\n",
@@ -106,11 +106,11 @@
"from langchain_anthropic import ChatAnthropic\n",
"from langchain_core.tools import tool\n",
"\n",
"from langgraph.checkpoint.memory import MemorySaver\n",
"from langgraph.graph import MessagesState, StateGraph, START\n",
"from langgraph.checkpoint.memory import InMemorySaver\n",
"from langgraph.graph import MessagesState, StateGraph, START, END\n",
"from langgraph.prebuilt import ToolNode\n",
"\n",
"memory = MemorySaver()\n",
"memory = InMemorySaver()\n",
"\n",
"\n",
"@tool\n",
@@ -127,12 +127,12 @@
"bound_model = model.bind_tools(tools)\n",
"\n",
"\n",
"def should_continue(state: MessagesState) -> Literal[\"action\", \"__end__\"]:\n",
"def should_continue(state: MessagesState):\n",
" \"\"\"Return the next node to execute.\"\"\"\n",
" last_message = state[\"messages\"][-1]\n",
" # If there is no function call, then we finish\n",
" if not last_message.tool_calls:\n",
" return \"__end__\"\n",
" return END\n",
" # Otherwise if there is, we continue\n",
" return \"action\"\n",
"\n",
@@ -162,6 +162,8 @@
" \"agent\",\n",
" # Next, we pass in the function that will determine which node is called next.\n",
" should_continue,\n",
" # Next, we pass in the path map - all the possible nodes this edge could go to\n",
" [\"action\", END],\n",
")\n",
"\n",
"# We now add a normal edge from `tools` to `agent`.\n",
@@ -97,11 +97,11 @@
"from langchain_anthropic import ChatAnthropic\n",
"from langchain_core.tools import tool\n",
"\n",
"from langgraph.checkpoint.memory import MemorySaver\n",
"from langgraph.graph import MessagesState, StateGraph, START\n",
"from langgraph.checkpoint.memory import InMemorySaver\n",
"from langgraph.graph import MessagesState, StateGraph, START, END\n",
"from langgraph.prebuilt import ToolNode\n",
"\n",
"memory = MemorySaver()\n",
"memory = InMemorySaver()\n",
"\n",
"\n",
"@tool\n",
@@ -118,12 +118,12 @@
"bound_model = model.bind_tools(tools)\n",
"\n",
"\n",
"def should_continue(state: MessagesState) -> Literal[\"action\", \"__end__\"]:\n",
"def should_continue(state: MessagesState):\n",
" \"\"\"Return the next node to execute.\"\"\"\n",
" last_message = state[\"messages\"][-1]\n",
" # If there is no function call, then we finish\n",
" if not last_message.tool_calls:\n",
" return \"__end__\"\n",
" return END\n",
" # Otherwise if there is, we continue\n",
" return \"action\"\n",
"\n",
@@ -153,6 +153,8 @@
" \"agent\",\n",
" # Next, we pass in the function that will determine which node is called next.\n",
" should_continue,\n",
" # Next, we pass in the path map - all the possible nodes this edge could go to\n",
" [\"action\", END],\n",
")\n",
"\n",
"# We now add a normal edge from `tools` to `agent`.\n",
@@ -226,11 +228,11 @@
"from langchain_anthropic import ChatAnthropic\n",
"from langchain_core.tools import tool\n",
"\n",
"from langgraph.checkpoint.memory import MemorySaver\n",
"from langgraph.checkpoint.memory import InMemorySaver\n",
"from langgraph.graph import MessagesState, StateGraph, START\n",
"from langgraph.prebuilt import ToolNode\n",
"\n",
"memory = MemorySaver()\n",
"memory = InMemorySaver()\n",
"\n",
"\n",
"@tool\n",
@@ -247,12 +249,12 @@
"bound_model = model.bind_tools(tools)\n",
"\n",
"\n",
"def should_continue(state: MessagesState) -> Literal[\"action\", \"__end__\"]:\n",
"def should_continue(state: MessagesState):\n",
" \"\"\"Return the next node to execute.\"\"\"\n",
" last_message = state[\"messages\"][-1]\n",
" # If there is no function call, then we finish\n",
" if not last_message.tool_calls:\n",
" return \"__end__\"\n",
" return END\n",
" # Otherwise if there is, we continue\n",
" return \"action\"\n",
"\n",
@@ -288,6 +290,8 @@
" \"agent\",\n",
" # Next, we pass in the function that will determine which node is called next.\n",
" should_continue,\n",
" # Next, we pass in the pathmap - all the possible nodes this edge could go to\n",
" [\"action\", END],\n",
")\n",
"\n",
"# We now add a normal edge from `tools` to `agent`.\n",
+34 -20
View File
@@ -6,6 +6,22 @@
"source": [
"# How to add node retry policies\n",
"\n",
"\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/low_level/\">\n",
" LangGraph Glossary\n",
" </a>\n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"\n",
"There are many use cases where you may wish for your node to have a custom retry policy, for example if you are calling an API, querying a database, or calling an LLM, etc. \n",
"\n",
"## Setup\n",
@@ -15,7 +31,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
@@ -25,7 +41,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
@@ -57,21 +73,21 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"In order to configure the retry policy, you have to pass the `retry` parameter to the `add_node` function. The `retry` parameter takes in a `RetryPolicy` named tuple object. Below we instantiate a `RetryPolicy` object with the default parameters:"
"In order to configure the retry policy, you have to pass the `retry` parameter to the [add_node](https://langchain-ai.github.io/langgraph/reference/graphs/#langgraph.graph.state.StateGraph.add_node). The `retry` parameter takes in a `RetryPolicy` named tuple object. Below we instantiate a `RetryPolicy` object with the default parameters:"
]
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"RetryPolicy(initial_interval=0.5, backoff_factor=2.0, max_interval=128.0, max_attempts=3, jitter=True, retry_on=<function default_retry_on at 0x1157419e0>)"
"RetryPolicy(initial_interval=0.5, backoff_factor=2.0, max_interval=128.0, max_attempts=3, jitter=True, retry_on=<function default_retry_on at 0x78b964b89940>)"
]
},
"execution_count": 15,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
@@ -108,16 +124,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"If you want more information on what each of the parameters does, be sure to read the [reference](https://langchain-ai.github.io/langgraph/reference/graphs/#retrypolicy).\n",
"\n",
"## Passing a retry policy to a node\n",
"\n",
"Lastly, we can pass `RetryPolicy` objects when we call the `add_node` function. In the example below we pass two different retry policies to each of our nodes:"
"Lastly, we can pass `RetryPolicy` objects when we call the [add_node](https://langchain-ai.github.io/langgraph/reference/graphs/#langgraph.graph.state.StateGraph.add_node) function. In the example below we pass two different retry policies to each of our nodes:"
]
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
@@ -153,24 +167,24 @@
"\n",
"\n",
"# Define a new graph\n",
"workflow = StateGraph(AgentState)\n",
"workflow.add_node(\n",
"builder = StateGraph(AgentState)\n",
"builder.add_node(\n",
" \"query_database\",\n",
" query_database,\n",
" retry=RetryPolicy(retry_on=sqlite3.OperationalError),\n",
")\n",
"workflow.add_node(\"model\", call_model, retry=RetryPolicy(max_attempts=5))\n",
"workflow.add_edge(START, \"model\")\n",
"workflow.add_edge(\"model\", \"query_database\")\n",
"workflow.add_edge(\"query_database\", END)\n",
"builder.add_node(\"model\", call_model, retry=RetryPolicy(max_attempts=5))\n",
"builder.add_edge(START, \"model\")\n",
"builder.add_edge(\"model\", \"query_database\")\n",
"builder.add_edge(\"query_database\", END)\n",
"\n",
"app = workflow.compile()"
"graph = builder.compile()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "env",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@@ -184,9 +198,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
+115 -104
View File
@@ -11,15 +11,47 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"You may need to pass values to a tool that are only known at runtime. For example, the tool logic may require using the ID of the user who made the request.\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#runnable-interface\">\n",
" Runnable Interface\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\" https://langchain-ai.github.io/langgraph/concepts/agentic_concepts/#tool-calling-agent\">\n",
" Tool calling agent\n",
" </a>\n",
" </li> \n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#tools\">\n",
" Tools\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/streaming/\">\n",
" Streaming\n",
" </a>\n",
" </li> \n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#chat-models/\">\n",
" Chat Models\n",
" </a>\n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"Most of the time, such values should not be controlled by the LLM. In fact, allowing the LLM to control the user ID may lead to a security risk.\n",
"\n",
"Instead, the LLM should only control the parameters of the tool that are meant to be controlled by the LLM, while other parameters (such as user ID) should be fixed by the application logic.\n",
"\n",
"To pass run time information, we will use tools that leverage the LangChain Runnable interface. The standard runnables methods (invoke, batch, stream etc.) accept a 2nd argument which is a RunnableConfig. RunnableConfig has a few standard fields, but allows users to use other fields for run time information.\n",
"At runtime, you may need to pass values to a tool, like a user ID, which should be set by the application logic, not controlled by the LLM, for security reasons. The LLM should only manage its intended parameters.\n",
"\n",
"Here, we will show how to set up a simple agent that has access to three tools for saving, reading, and deleting a list of the user's favorite pets."
"LangChain tools use the `Runnable` interface, where methods like `invoke` accept runtime information through the `RunnableConfig` argument.\n",
"\n",
"In the following example, we’ll set up an agent with tools to manage a user's favorite pets—adding, reading, and deleting entries—while fixing the user ID through application logic and letting the chat model control other parameters"
]
},
{
@@ -43,7 +75,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
@@ -80,7 +112,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
@@ -126,7 +158,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
@@ -143,7 +175,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
@@ -157,38 +189,33 @@
").bind_tools(tools)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## ReAct Agent"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's set up a graph implementation of the [ReAct agent](https://langchain-ai.github.io/langgraph/concepts/agentic_concepts/#react-agent). This agent takes some query as input, then repeatedly call tools until it has enough information to resolve the query. We'll be using prebuilt `ToolNode` and the Anthropic model with tools we just defined"
"## ReAct Agent\n",
"\n",
"Let's set up a graph implementation of the [ReAct agent](https://langchain-ai.github.io/langgraph/concepts/agentic_concepts/#react-agent). This agent takes some query as input, then repeatedly call tools until it has enough information to resolve the query. We'll be using prebuilt `ToolNode` and the Anthropic model with tools we just defined."
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"from typing import Literal\n",
"\n",
"from langgraph.graph import StateGraph, MessagesState\n",
"from langgraph.graph import StateGraph, MessagesState, START, END\n",
"\n",
"\n",
"def should_continue(state: MessagesState) -> Literal[\"tools\", \"__end__\"]:\n",
"def should_continue(state: MessagesState):\n",
" messages = state[\"messages\"]\n",
" last_message = messages[-1]\n",
" if last_message.tool_calls:\n",
" return \"tools\"\n",
" return \"__end__\"\n",
" return END\n",
"\n",
"\n",
"def call_model(state: MessagesState):\n",
@@ -197,25 +224,22 @@
" return {\"messages\": [response]}\n",
"\n",
"\n",
"workflow = StateGraph(MessagesState)\n",
"builder = StateGraph(MessagesState)\n",
"\n",
"# Define the two nodes we will cycle between\n",
"workflow.add_node(\"agent\", call_model)\n",
"workflow.add_node(\"tools\", tool_node)\n",
"builder.add_node(\"agent\", call_model)\n",
"builder.add_node(\"tools\", tool_node)\n",
"\n",
"workflow.add_edge(\"__start__\", \"agent\")\n",
"workflow.add_conditional_edges(\n",
" \"agent\",\n",
" should_continue,\n",
")\n",
"workflow.add_edge(\"tools\", \"agent\")\n",
"builder.add_edge(START, \"agent\")\n",
"builder.add_conditional_edges(\"agent\", should_continue, [\"tools\", END])\n",
"builder.add_edge(\"tools\", \"agent\")\n",
"\n",
"app = workflow.compile()"
"graph = builder.compile()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"metadata": {},
"outputs": [
{
@@ -233,7 +257,7 @@
"from IPython.display import Image, display\n",
"\n",
"try:\n",
" display(Image(app.get_graph().draw_mermaid_png()))\n",
" display(Image(graph.get_graph().draw_mermaid_png()))\n",
"except Exception:\n",
" # This requires some extra dependencies and is optional\n",
" pass"
@@ -256,24 +280,24 @@
"output_type": "stream",
"text": [
"User information prior to run: {}\n",
"Output from node 'agent':\n",
"---\n",
"{'messages': [AIMessage(content=[{'text': \"Okay, let's update your favorite pets:\", 'type': 'text'}, {'id': 'toolu_01LQK6fgtAyEo3xBfzg1fSuv', 'input': {'pets': ['cats', 'dogs']}, 'name': 'update_favorite_pets', 'type': 'tool_use'}], response_metadata={'id': 'msg_014bUFindzuzqqGmNVPX67zH', 'model': 'claude-3-haiku-20240307', 'stop_reason': 'tool_use', 'stop_sequence': None, 'usage': {'input_tokens': 438, 'output_tokens': 70}}, id='run-2c77cfe0-ba1f-4cd5-922c-614330368ca3-0', tool_calls=[{'name': 'update_favorite_pets', 'args': {'pets': ['cats', 'dogs']}, 'id': 'toolu_01LQK6fgtAyEo3xBfzg1fSuv', 'type': 'tool_call'}], usage_metadata={'input_tokens': 438, 'output_tokens': 70, 'total_tokens': 508})]}\n",
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"---\n",
"my favorite pets are cats and dogs\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"Output from node 'tools':\n",
"---\n",
"{'messages': [ToolMessage(content='null', name='update_favorite_pets', tool_call_id='toolu_01LQK6fgtAyEo3xBfzg1fSuv')]}\n",
"[{'text': \"Okay, let's update your favorite pets:\", 'type': 'text'}, {'id': 'toolu_01SU6vhbKDjSsPj2z86QA3wy', 'input': {'pets': ['cats', 'dogs']}, 'name': 'update_favorite_pets', 'type': 'tool_use'}]\n",
"Tool Calls:\n",
" update_favorite_pets (toolu_01SU6vhbKDjSsPj2z86QA3wy)\n",
" Call ID: toolu_01SU6vhbKDjSsPj2z86QA3wy\n",
" Args:\n",
" pets: ['cats', 'dogs']\n",
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
"Name: update_favorite_pets\n",
"\n",
"---\n",
"\n",
"Output from node 'agent':\n",
"---\n",
"{'messages': [AIMessage(content='Your favorite pets have been updated to cats and dogs.', response_metadata={'id': 'msg_01JyfYdPiFHEPyE5PGeBXxqu', 'model': 'claude-3-haiku-20240307', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 521, 'output_tokens': 15}}, id='run-c78b8fce-9358-4823-ac6c-896714860af2-0', usage_metadata={'input_tokens': 521, 'output_tokens': 15, 'total_tokens': 536})]}\n",
"\n",
"---\n",
"null\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"Your favorite pets have been updated to cats and dogs.\n",
"User information after the run: {'123': ['cats', 'dogs']}\n"
]
}
@@ -286,13 +310,10 @@
"print(f\"User information prior to run: {user_to_pets}\")\n",
"\n",
"inputs = {\"messages\": [HumanMessage(content=\"my favorite pets are cats and dogs\")]}\n",
"for output in app.stream(inputs, {\"configurable\": {\"user_id\": \"123\"}}):\n",
" # stream() yields dictionaries with output keyed by node name\n",
" for key, value in output.items():\n",
" print(f\"Output from node '{key}':\")\n",
" print(\"---\")\n",
" print(value)\n",
" print(\"\\n---\\n\")\n",
"for chunk in graph.stream(\n",
" inputs, {\"configurable\": {\"user_id\": \"123\"}}, stream_mode=\"values\"\n",
"):\n",
" chunk[\"messages\"][-1].pretty_print()\n",
"\n",
"print(f\"User information after the run: {user_to_pets}\")"
]
@@ -307,43 +328,39 @@
"output_type": "stream",
"text": [
"User information prior to run: {'123': ['cats', 'dogs']}\n",
"Output from node 'agent':\n",
"---\n",
"{'messages': [AIMessage(content=[{'id': 'toolu_01EsSgrDZ8aRZsg9y7ngroiu', 'input': {}, 'name': 'list_favorite_pets', 'type': 'tool_use'}], response_metadata={'id': 'msg_01Dp1VYH5RssYbReL6KzPfNM', 'model': 'claude-3-haiku-20240307', 'stop_reason': 'tool_use', 'stop_sequence': None, 'usage': {'input_tokens': 437, 'output_tokens': 38}}, id='run-c620472c-ac52-488a-90f5-141fa65f1ce9-0', tool_calls=[{'name': 'list_favorite_pets', 'args': {}, 'id': 'toolu_01EsSgrDZ8aRZsg9y7ngroiu', 'type': 'tool_call'}], usage_metadata={'input_tokens': 437, 'output_tokens': 38, 'total_tokens': 475})]}\n",
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"---\n",
"what are my favorite pets\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"Output from node 'tools':\n",
"---\n",
"{'messages': [ToolMessage(content='cats, dogs', name='list_favorite_pets', tool_call_id='toolu_01EsSgrDZ8aRZsg9y7ngroiu')]}\n",
"[{'id': 'toolu_01DdpiqiCxzbR4RjQdEoR6mJ', 'input': {}, 'name': 'list_favorite_pets', 'type': 'tool_use'}]\n",
"Tool Calls:\n",
" list_favorite_pets (toolu_01DdpiqiCxzbR4RjQdEoR6mJ)\n",
" Call ID: toolu_01DdpiqiCxzbR4RjQdEoR6mJ\n",
" Args:\n",
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
"Name: list_favorite_pets\n",
"\n",
"---\n",
"cats, dogs\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"Output from node 'agent':\n",
"---\n",
"{'messages': [AIMessage(content='Based on the output, your favorite pets are cats and dogs.', response_metadata={'id': 'msg_017heQczfgTMCzAo5qcYdYWW', 'model': 'claude-3-haiku-20240307', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 490, 'output_tokens': 17}}, id='run-c0cb9626-61a1-4151-b194-be0e7d655a8d-0', usage_metadata={'input_tokens': 490, 'output_tokens': 17, 'total_tokens': 507})]}\n",
"\n",
"---\n",
"\n",
"User information after the run: {'123': ['cats', 'dogs']}\n"
"Based on the list_favorite_pets tool, your favorite pets are cats and dogs.\n",
"User information prior to run: {'123': ['cats', 'dogs']}\n"
]
}
],
"source": [
"from langchain_core.messages import HumanMessage\n",
"\n",
"print(f\"User information prior to run: {user_to_pets}\")\n",
"\n",
"inputs = {\"messages\": [HumanMessage(content=\"what are my favorite pets\")]}\n",
"for chunk in graph.stream(\n",
" inputs, {\"configurable\": {\"user_id\": \"123\"}}, stream_mode=\"values\"\n",
"):\n",
" chunk[\"messages\"][-1].pretty_print()\n",
"\n",
"inputs = {\"messages\": [HumanMessage(content=\"what are my favorite pets?\")]}\n",
"for output in app.stream(inputs, {\"configurable\": {\"user_id\": \"123\"}}):\n",
" # stream() yields dictionaries with output keyed by node name\n",
" for key, value in output.items():\n",
" print(f\"Output from node '{key}':\")\n",
" print(\"---\")\n",
" print(value)\n",
" print(\"\\n---\\n\")\n",
"\n",
"\n",
"print(f\"User information after the run: {user_to_pets}\")"
"print(f\"User information prior to run: {user_to_pets}\")"
]
},
{
@@ -356,24 +373,23 @@
"output_type": "stream",
"text": [
"User information prior to run: {'123': ['cats', 'dogs']}\n",
"Output from node 'agent':\n",
"---\n",
"{'messages': [AIMessage(content=[{'id': 'toolu_01EcVWNpWQnoRuRtXXbndeWn', 'input': {}, 'name': 'delete_favorite_pets', 'type': 'tool_use'}], response_metadata={'id': 'msg_01PfMPkCHuV1UvcCKdqT5jXH', 'model': 'claude-3-haiku-20240307', 'stop_reason': 'tool_use', 'stop_sequence': None, 'usage': {'input_tokens': 441, 'output_tokens': 38}}, id='run-eeac69b6-812e-4630-ba6f-9b22b672493b-0', tool_calls=[{'name': 'delete_favorite_pets', 'args': {}, 'id': 'toolu_01EcVWNpWQnoRuRtXXbndeWn', 'type': 'tool_call'}], usage_metadata={'input_tokens': 441, 'output_tokens': 38, 'total_tokens': 479})]}\n",
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"---\n",
"please forget what i told you about my favorite animals\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"Output from node 'tools':\n",
"---\n",
"{'messages': [ToolMessage(content='null', name='delete_favorite_pets', tool_call_id='toolu_01EcVWNpWQnoRuRtXXbndeWn')]}\n",
"[{'id': 'toolu_013TXG6yTxvuWiugbdKGTKSF', 'input': {}, 'name': 'delete_favorite_pets', 'type': 'tool_use'}]\n",
"Tool Calls:\n",
" delete_favorite_pets (toolu_013TXG6yTxvuWiugbdKGTKSF)\n",
" Call ID: toolu_013TXG6yTxvuWiugbdKGTKSF\n",
" Args:\n",
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
"Name: delete_favorite_pets\n",
"\n",
"---\n",
"\n",
"Output from node 'agent':\n",
"---\n",
"{'messages': [AIMessage(content='I have deleted the information about your favorite pets. The list of favorite pets has been cleared.', response_metadata={'id': 'msg_01PvNPmzfgSvGdWQp6ATWs6Q', 'model': 'claude-3-haiku-20240307', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 492, 'output_tokens': 23}}, id='run-0cb06dbb-7d6c-4aa1-9ba7-685b0de62e06-0', usage_metadata={'input_tokens': 492, 'output_tokens': 23, 'total_tokens': 515})]}\n",
"\n",
"---\n",
"null\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"I have deleted the information about your favorite pets. The list of favorite pets has been cleared.\n",
"User information prior to run: {}\n"
]
}
@@ -381,20 +397,15 @@
"source": [
"print(f\"User information prior to run: {user_to_pets}\")\n",
"\n",
"\n",
"inputs = {\n",
" \"messages\": [\n",
" HumanMessage(content=\"please forget what i told you about my favorite animals\")\n",
" ]\n",
"}\n",
"for output in app.stream(inputs, {\"configurable\": {\"user_id\": \"123\"}}):\n",
" # stream() yields dictionaries with output keyed by node name\n",
" for key, value in output.items():\n",
" print(f\"Output from node '{key}':\")\n",
" print(\"---\")\n",
" print(value)\n",
" print(\"\\n---\\n\")\n",
"\n",
"for chunk in graph.stream(\n",
" inputs, {\"configurable\": {\"user_id\": \"123\"}}, stream_mode=\"values\"\n",
"):\n",
" chunk[\"messages\"][-1].pretty_print()\n",
"\n",
"print(f\"User information prior to run: {user_to_pets}\")"
]
@@ -416,7 +427,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
@@ -5,15 +5,93 @@
"id": "51466c8d-8ce4-4b3d-be4e-18fdbeda5f53",
"metadata": {},
"source": [
"# How to pass graph state to tools\n",
"# How to pass runtime values to tools\n",
"\n",
"Sometimes we need to pass in agent state to our tools. This type of stateful tools is useful when a tool's output is affected by past agent steps (e.g. if you're using a sub-agent as a tool, and want to pass the message history in to the sub-agent), or when a tool's input needs to be validated given context from past agent steps. \n",
"Sometimes, you want to let a tool-calling LLM populate a *subset* of the tool functions' arguments and provide the other values for the other arguments at runtime. If you're using LangChain-style [tools](https://python.langchain.com/docs/concepts/#tools), an easy way to handle this is by annotating function parameters with [InjectedArg](https://python.langchain.com/docs/how_to/tool_runtime/). This annotation excludes that parameter from being shown to the LLM.\n",
"\n",
"In this guide we'll demonstrate how to create tools that take agent state as input.\n",
"In LangGraph applications you might want to pass the graph state or [shared memory](https://langchain-ai.github.io/langgraph/how-tos/cross-thread-persistence/) (store) to the tools at runtime. This type of stateful tools is useful when a tool's output is affected by past agent steps (e.g. if you're using a sub-agent as a tool, and want to pass the message history in to the sub-agent), or when a tool's input needs to be validated given context from past agent steps.\n",
"\n",
"This is a special case of [passing runtime arguments to tools](https://python.langchain.com/docs/how_to/tool_runtime/), which you can learn about in the LangChain docs."
"In this guide we'll demonstrate how to do so using LangGraph's prebuilt [ToolNode](https://langchain-ai.github.io/langgraph/how-tos/tool-calling/).\n",
"\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide targets **LangChain tool calling** assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#tools\">\n",
" Tools\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/low_level/#state\">\n",
" State\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/agentic_concepts/#tool-calling-agent\">\n",
" Tool-calling\n",
" </a>\n",
" </li>\n",
" </ul>\n",
" You can still use tool calling in LangGraph using your provider SDK without losing any of LangGraph's core features.\n",
" </p>\n",
"</div> \n",
"\n",
"The core technique the examples below is to **annotate** a parameter as \"injected\", meaning it will be injected by your program and should not be seen or populated by the LLM. Let the following codesnippet serve as a tl;dr:\n",
"\n",
"```python\n",
"from typing import Annotated\n",
"\n",
"from langchain_core.runnables import RunnableConfig\n",
"from langchain_core.tools import InjectedToolArg\n",
"from langgraph.store.base import BaseStore\n",
"\n",
"from langgraph.prebuilt import InjectedState, InjectedStore\n",
"\n",
"\n",
"# Can be sync or async; @tool decorator not required\n",
"async def my_tool(\n",
" # These arguments are populated by the LLM\n",
" some_arg: str,\n",
" another_arg: float,\n",
" # The config: RunnableConfig is always available in LangChain calls\n",
" # This is not exposed to the LLM\n",
" config: RunnableConfig,\n",
" # The following three are specific to the prebuilt ToolNode\n",
" # (and `create_react_agent` by extension). If you are invoking the\n",
" # tool on its own (in your own node), then you would need to provide these yourself.\n",
" store: Annotated[BaseStore, InjectedStore],\n",
" # This passes in the full state.\n",
" state: Annotated[State, InjectedState],\n",
" # You can also inject single fields from your state if you\n",
" messages: Annotated[list, InjectedState(\"messages\")]\n",
" # The following is not compatible with create_react_agent or ToolNode\n",
" # You can also exclude other arguments from being shown to the model.\n",
" # These must be provided manually and are useful if you call the tools/functions in your own node\n",
" # some_other_arg=Annotated[\"MyPrivateClass\", InjectedToolArg],\n",
"):\n",
" \"\"\"Call my_tool to have an impact on the real world.\n",
"\n",
" Args:\n",
" some_arg: a very important argument\n",
" another_arg: another argument the LLM will provide\n",
" \"\"\" # The docstring becomes the description for your tool and is passed to the model\n",
" print(some_arg, another_arg, config, store, state, messages)\n",
" # Config, some_other_rag, store, and state are all \"hidden\" from\n",
" # LangChain models when passed to bind_tools or with_structured_output\n",
" return \"... some response\"\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5c205242",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "7cbd446a-808f-4394-be92-d45ab818953c",
@@ -26,13 +104,13 @@
},
{
"cell_type": "code",
"execution_count": 41,
"execution_count": 1,
"id": "af4ce0ba-7596-4e5f-8bf8-0b0bd6e62833",
"metadata": {},
"outputs": [],
"source": [
"%%capture --no-stderr\n",
"%pip install --quiet -U langgraph langchain langchain-openai"
"%pip install --quiet -U langgraph langchain-openai"
]
},
{
@@ -45,10 +123,18 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"id": "c903a1cf-2977-4e2d-ad7d-8b3946821d89",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"OPENAI_API_KEY: ········\n"
]
}
],
"source": [
"import getpass\n",
"import os\n",
@@ -76,11 +162,40 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "21ac643b-cb06-4724-a80c-2862ba4773f1",
"id": "1a5908ab-7c1f-4832-85ae-511536b89b9f",
"metadata": {},
"source": [
"## Defining the tools\n",
"## Pass graph state to tools\n",
"\n",
"Let's first take a look at how to give our tools access to the graph state. We'll need to define our graph state:"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "a2ded72f-1450-4295-a879-fd213ecfd4b5",
"metadata": {},
"outputs": [],
"source": [
"from typing import List\n",
"\n",
"# this is the state schema used by the prebuilt create_react_agent we'll be using below\n",
"from langgraph.prebuilt.chat_agent_executor import AgentState\n",
"from langchain_core.documents import Document\n",
"\n",
"\n",
"class State(AgentState):\n",
" docs: List[str]"
]
},
{
"cell_type": "markdown",
"id": "75d2d28c-0da3-46c6-9c67-979a71b5f517",
"metadata": {},
"source": [
"### Define the tools\n",
"\n",
"We'll want our tool to take graph state as an input, but we don't want the model to try to generate this input when calling the tool. We can use the `InjectedState` annotation to mark arguments as required graph state (or some field of graph state. These arguments will not be generated by the model. When using `ToolNode`, graph state will automatically be passed in to the relevant tools and arguments.\n",
"\n",
@@ -102,7 +217,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"id": "1d36e782-80f4-4334-b7d7-ee4c79864480",
"metadata": {},
"outputs": [],
@@ -110,68 +225,15 @@
"from typing import List, Tuple\n",
"from typing_extensions import Annotated\n",
"\n",
"from langchain_core.documents import Document\n",
"from langchain_core.messages import ToolMessage\n",
"from langchain_core.tools import tool\n",
"from langgraph.prebuilt import InjectedState\n",
"\n",
"from pydantic import BaseModel\n",
"\n",
"\n",
"@tool(parse_docstring=True, response_format=\"content_and_artifact\")\n",
"def get_context(question: List[str]) -> Tuple[str, List[Document]]:\n",
" \"\"\"Get context on the question.\n",
"\n",
" Args:\n",
" question: The user question\n",
" \"\"\"\n",
" # return constant dummy output\n",
" docs = [\n",
" Document(\n",
" \"FooBar company just raised 1 Billion dollars!\",\n",
" metadata={\"source\": \"twitter\"},\n",
" ),\n",
" Document(\n",
" \"FooBar company is now only hiring AI's\", metadata={\"source\": \"twitter\"}\n",
" ),\n",
" Document(\n",
" \"FooBar company was founded in 2019\", metadata={\"source\": \"wikipedia\"}\n",
" ),\n",
" Document(\n",
" \"FooBar company makes friendly robots\", metadata={\"source\": \"wikipedia\"}\n",
" ),\n",
" ]\n",
" return \"\\n\\n\".join(doc.page_content for doc in docs), docs\n",
"\n",
"\n",
"@tool(parse_docstring=True, response_format=\"content_and_artifact\")\n",
"def cite_context_sources(\n",
" claim: str, state: Annotated[dict, InjectedState]\n",
") -> Tuple[str, List[Document]]:\n",
" \"\"\"Cite which source a claim was based on.\n",
"\n",
" Args:\n",
" claim: The claim that was made.\n",
" \"\"\"\n",
" docs = []\n",
" # We get the potentially cited docs from past ToolMessages in our state.\n",
" for msg in state[\"messages\"]:\n",
" if isinstance(msg, ToolMessage) and msg.name == \"get_context\":\n",
" docs.extend(msg.artifact)\n",
"\n",
" class Cite(BaseModel):\n",
" \"\"\"Return the index(es) of the documents that justify the claim\"\"\"\n",
"\n",
" indexes: List[int]\n",
"\n",
" structured_model = model.with_structured_output(Cite)\n",
" system = f\"Which of the following documents best justifies the claim:\\n\\n{claim}\"\n",
" context = \"\\n\\n\".join(\n",
" f\"Document {i}:\\n\" + doc.page_content for i, doc in enumerate(docs)\n",
" )\n",
" citation = structured_model.invoke([(\"system\", system), (\"human\", context)])\n",
" cited_docs = [docs[i] for i in citation.indexes]\n",
" sources = \", \".join(doc.metadata[\"source\"] for doc in cited_docs)\n",
" return sources, cited_docs"
"@tool\n",
"def get_context(question: str, state: Annotated[dict, InjectedState]):\n",
" \"\"\"Get relevant context for answering the question.\"\"\"\n",
" return \"\\n\\n\".join(doc for doc in state[\"docs\"])"
]
},
{
@@ -184,30 +246,28 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"id": "1092929b-c939-4b2a-9f9c-e725b0e34af2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'description': 'Cite which source a claim was based on.',\n",
" 'properties': {'claim': {'description': 'The claim that was made.',\n",
" 'title': 'Claim',\n",
" 'type': 'string'},\n",
"{'description': 'Get relevant context for answering the question.',\n",
" 'properties': {'question': {'title': 'Question', 'type': 'string'},\n",
" 'state': {'title': 'State', 'type': 'object'}},\n",
" 'required': ['claim', 'state'],\n",
" 'title': 'cite_context_sources',\n",
" 'required': ['question', 'state'],\n",
" 'title': 'get_context',\n",
" 'type': 'object'}"
]
},
"execution_count": 3,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cite_context_sources.get_input_schema().schema()"
"get_context.get_input_schema().schema()"
]
},
{
@@ -220,20 +280,217 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 6,
"id": "3912bb51-3107-4335-a659-021c5d89fb37",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'title': 'cite_context_sources',\n",
" 'description': 'Cite which source a claim was based on.',\n",
" 'type': 'object',\n",
" 'properties': {'claim': {'title': 'Claim',\n",
" 'description': 'The claim that was made.',\n",
" 'type': 'string'}},\n",
" 'required': ['claim']}"
"{'description': 'Get relevant context for answering the question.',\n",
" 'properties': {'question': {'title': 'Question', 'type': 'string'}},\n",
" 'required': ['question'],\n",
" 'title': 'get_context',\n",
" 'type': 'object'}"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"get_context.tool_call_schema.schema()"
]
},
{
"cell_type": "markdown",
"id": "8e8b9211-93d0-4ad5-aa7a-9c09099c53ff",
"metadata": {},
"source": [
"### Define the graph\n",
"\n",
"In this example we will be using a [prebuilt ReAct agent](https://langchain-ai.github.io/langgraph/how-tos/create-react-agent/). We'll first need to define our model and a tool-calling node ([ToolNode](https://langchain-ai.github.io/langgraph/reference/prebuilt/#langgraph.prebuilt.tool_node.ToolNode)):"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "be341be4-bdc3-4e78-9bc1-7486da27fd7c",
"metadata": {},
"outputs": [],
"source": [
"from langchain_openai import ChatOpenAI\n",
"from langgraph.prebuilt import ToolNode, create_react_agent\n",
"from langgraph.checkpoint.memory import InMemorySaver\n",
"\n",
"model = ChatOpenAI(model=\"gpt-4o\", temperature=0)\n",
"tools = [get_context]\n",
"\n",
"# ToolNode will automatically take care of injecting state into tools\n",
"tool_node = ToolNode(tools)\n",
"\n",
"checkpointer = InMemorySaver()\n",
"graph = create_react_agent(model, tools, state_schema=State, checkpointer=checkpointer)"
]
},
{
"cell_type": "markdown",
"id": "547c3931-3dae-4281-ad4e-4b51305594d4",
"metadata": {},
"source": [
"### Use it!"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "c0858273-10f2-45c4-a922-b11321ac3fae",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"what's the latest news about FooBar\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"Tool Calls:\n",
" get_context (call_UkqfR7z2cLJQjhatUpDeEa5H)\n",
" Call ID: call_UkqfR7z2cLJQjhatUpDeEa5H\n",
" Args:\n",
" question: latest news about FooBar\n",
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
"Name: get_context\n",
"\n",
"FooBar company just raised 1 Billion dollars!\n",
"\n",
"FooBar company was founded in 2019\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"The latest news about FooBar is that the company has just raised 1 billion dollars.\n"
]
}
],
"source": [
"docs = [\n",
" \"FooBar company just raised 1 Billion dollars!\",\n",
" \"FooBar company was founded in 2019\",\n",
"]\n",
"\n",
"inputs = {\n",
" \"messages\": [{\"type\": \"user\", \"content\": \"what's the latest news about FooBar\"}],\n",
" \"docs\": docs,\n",
"}\n",
"config = {\"configurable\": {\"thread_id\": \"1\"}}\n",
"for chunk in graph.stream(inputs, config, stream_mode=\"values\"):\n",
" chunk[\"messages\"][-1].pretty_print()"
]
},
{
"cell_type": "markdown",
"id": "09dd6d7d-d8a8-48f9-a30d-fba79fb7cb1e",
"metadata": {},
"source": [
"## Pass shared memory (store) to the graph\n",
"\n",
"You might also want to give tools access to memory that is shared across multiple conversations or users. We can do it by passing LangGraph [Store](https://langchain-ai.github.io/langgraph/how-tos/cross-thread-persistence/) to the tools using a different annotation -- `InjectedStore`.\n",
"\n",
"Let's modify our example to save the documents in an in-memory store and retrieve them using `get_context` tool. We'll also make the documents accessible based on a user ID, so that some documents are only visible to certain users. The tool will then use the `user_id` provided in the [config](https://langchain-ai.github.io/langgraph/how-tos/pass-config-to-tools/) to retrieve a correct set of documents."
]
},
{
"cell_type": "markdown",
"id": "41644e7e-bda2-4c0d-95da-99572554c02d",
"metadata": {},
"source": [
"<div class=\"admonition note\">\n",
" <p class=\"admonition-title\">Note</p>\n",
" <list>\n",
" <li>\n",
" Support for <code>Store</code> API and <code>InjectedStore</code> used in this notebook was added in LangGraph <code>v0.2.34</code>.\n",
" </li>\n",
" <li>\n",
" <code>InjectedStore</code> annotation requires <code>langchain-core >= 0.3.8</code>\n",
" </li>\n",
" <list>\n",
"</div>"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "759186ed-5506-4e9a-80c4-0a2405ff58de",
"metadata": {},
"outputs": [],
"source": [
"from langgraph.store.memory import InMemoryStore\n",
"\n",
"doc_store = InMemoryStore()\n",
"\n",
"namespace = (\"documents\", \"1\") # user ID\n",
"doc_store.put(\n",
" namespace, \"doc_0\", {\"doc\": \"FooBar company just raised 1 Billion dollars!\"}\n",
")\n",
"namespace = (\"documents\", \"2\") # user ID\n",
"doc_store.put(namespace, \"doc_1\", {\"doc\": \"FooBar company was founded in 2019\"})"
]
},
{
"cell_type": "markdown",
"id": "c1a6e4e4-3256-4d42-aa5f-de337bfa6a97",
"metadata": {},
"source": [
"### Define the tools"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "91ab7e2b-7df4-41ea-8b20-e2ba950aacb2",
"metadata": {},
"outputs": [],
"source": [
"from langgraph.store.base import BaseStore\n",
"from langchain_core.runnables import RunnableConfig\n",
"from langgraph.prebuilt import InjectedStore\n",
"\n",
"\n",
"@tool\n",
"def get_context(\n",
" question: str,\n",
" config: RunnableConfig,\n",
" store: Annotated[BaseStore, InjectedStore()],\n",
") -> Tuple[str, List[Document]]:\n",
" \"\"\"Get relevant context for answering the question.\"\"\"\n",
" user_id = config.get(\"configurable\", {}).get(\"user_id\")\n",
" docs = [item.value[\"doc\"] for item in store.search((\"documents\", user_id))]\n",
" return \"\\n\\n\".join(doc for doc in docs)"
]
},
{
"cell_type": "markdown",
"id": "fcd29b33-b647-4e11-8942-2d47f129095b",
"metadata": {},
"source": [
"We can also verify that the tool-calling model will ignore `store` arg of `get_context` tool:"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "07bdc124-06bb-4c25-a18e-700ab7aa6521",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'description': 'Get relevant context for answering the question.',\n",
" 'properties': {'question': {'title': 'Question', 'type': 'string'}},\n",
" 'required': ['question'],\n",
" 'title': 'get_context',\n",
" 'type': 'object'}"
]
},
"execution_count": 11,
@@ -242,298 +499,138 @@
}
],
"source": [
"cite_context_sources.tool_call_schema.schema()"
"get_context.tool_call_schema.schema()"
]
},
{
"cell_type": "markdown",
"id": "8e8b9211-93d0-4ad5-aa7a-9c09099c53ff",
"id": "10622c58-db67-476b-81a3-1b964f5b471f",
"metadata": {},
"source": [
"## Define the agent state\n",
"### Define the graph\n",
"\n",
"The main type of graph in `langgraph` is the `StateGraph`.\n",
"This graph is parameterized by a state object that it passes around to each node.\n",
"Each node then returns operations to update that state.\n",
"These operations can either SET specific attributes on the state (e.g. overwrite the existing values) or ADD to the existing attribute.\n",
"Whether to set or add is denoted by annotating the state object you construct the graph with.\n",
"\n",
"For this example, the state we will track will just be a list of messages.\n",
"We want each node to just add messages to that list.\n",
"Therefore, we will use a `TypedDict` with one key (`messages`) and annotate it so that the `messages` attribute is always added to.\n"
"Let's update our ReAct agent:"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "ea793afa-2eab-4901-910d-6eed90cd6564",
"execution_count": 12,
"id": "10c70125-a105-4103-89d2-2e93b401080c",
"metadata": {},
"outputs": [],
"source": [
"import operator\n",
"from typing import Annotated, Sequence\n",
"from typing_extensions import TypedDict\n",
"tools = [get_context]\n",
"\n",
"from langchain_core.messages import BaseMessage\n",
"# ToolNode will automatically take care of injecting Store into tools\n",
"tool_node = ToolNode(tools)\n",
"\n",
"\n",
"class AgentState(TypedDict):\n",
" messages: Annotated[Sequence[BaseMessage], operator.add]"
"checkpointer = InMemorySaver()\n",
"# NOTE: we need to pass our store to `create_react_agent` to make sure our graph is aware of it\n",
"graph = create_react_agent(model, tools, checkpointer=checkpointer, store=doc_store)"
]
},
{
"cell_type": "markdown",
"id": "e03c5094-9297-4d19-a04e-3eedc75cefb4",
"id": "35ba8adc-c706-48a6-992f-24c03c4cee46",
"metadata": {},
"source": [
"## Define the nodes\n",
"\n",
"We now need to define a few different nodes in our graph.\n",
"In `langgraph`, a node can be either a function or a [runnable](https://python.langchain.com/docs/concepts/#langchain-expression-language-lcel).\n",
"There are two main nodes we need for this:\n",
"\n",
"1. The agent: responsible for deciding what (if any) actions to take.\n",
"2. A function to invoke tools: if the agent decides to take an action, this node will then execute that action.\n",
"\n",
"We will also need to define some edges.\n",
"Some of these edges may be conditional.\n",
"The reason they are conditional is that based on the output of a node, one of several paths may be taken.\n",
"The path that is taken is not known until that node is run (the LLM decides).\n",
"\n",
"1. Conditional Edge: after the agent is called, we should either:\n",
" a. If the agent said to take an action, then the function to invoke tools should be called\n",
" b. If the agent said that it was finished, then it should finish\n",
"2. Normal Edge: after the tools are invoked, it should always go back to the agent to decide what to do next\n",
"\n",
"Let's define the nodes, as well as a function to decide how what conditional edge to take."
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "3b541bb9-900c-40d0-964d-7b5dfee30667",
"metadata": {},
"outputs": [],
"source": [
"from langchain_openai import ChatOpenAI\n",
"\n",
"from langgraph.prebuilt import ToolNode\n",
"\n",
"model = ChatOpenAI(model=\"gpt-4o\", temperature=0)\n",
"\n",
"\n",
"# Define the function that determines whether to continue or not\n",
"def should_continue(state, config):\n",
" messages = state[\"messages\"]\n",
" last_message = messages[-1]\n",
" # If there is no function call, then we finish\n",
" if not last_message.tool_calls:\n",
" return \"end\"\n",
" # Otherwise if there is, we continue\n",
" else:\n",
" return \"continue\"\n",
"\n",
"\n",
"tools = [get_context, cite_context_sources]\n",
"\n",
"\n",
"# Define the function that calls the model\n",
"def call_model(state, config):\n",
" messages = state[\"messages\"]\n",
" model_with_tools = model.bind_tools(tools)\n",
" response = model_with_tools.invoke(messages)\n",
" # We return a list, because this will get added to the existing list\n",
" return {\"messages\": [response]}\n",
"\n",
"\n",
"# ToolNode will automatically take care of injecting state into tools\n",
"tool_node = ToolNode(tools)"
"### Use it!"
]
},
{
"cell_type": "markdown",
"id": "ffd6e892-946c-4899-8cc0-7c9291c1f73b",
"id": "c155ef73-91fe-459d-a3af-7ed254c19e23",
"metadata": {},
"source": [
"## Define the graph\n",
"\n",
"We can now put it all together and define the graph!"
"Let's try running our graph with a `\"user_id\"` in the config."
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "813ae66c-3b58-4283-a02a-36da72a2ab90",
"metadata": {},
"outputs": [],
"source": [
"from langgraph.graph import END, START, StateGraph\n",
"\n",
"# Define a new graph\n",
"workflow = StateGraph(AgentState)\n",
"\n",
"# Define the two nodes we will cycle between\n",
"workflow.add_node(\"agent\", call_model)\n",
"workflow.add_node(\"action\", tool_node)\n",
"\n",
"# Set the entrypoint as `agent`\n",
"# This means that this node is the first one called\n",
"workflow.add_edge(START, \"agent\")\n",
"\n",
"# We now add a conditional edge\n",
"workflow.add_conditional_edges(\n",
" # First, we define the start node. We use `agent`.\n",
" # This means these are the edges taken after the `agent` node is called.\n",
" \"agent\",\n",
" # Next, we pass in the function that will determine which node is called next.\n",
" should_continue,\n",
" # Finally we pass in a mapping.\n",
" # The keys are strings, and the values are other nodes.\n",
" # END is a special node marking that the graph should finish.\n",
" # What will happen is we will call `should_continue`, and then the output of that\n",
" # will be matched against the keys in this mapping.\n",
" # Based on which one it matches, that node will then be called.\n",
" {\n",
" # If `tools`, then we call the tool node.\n",
" \"continue\": \"action\",\n",
" # Otherwise we finish.\n",
" \"end\": END,\n",
" },\n",
")\n",
"\n",
"# We now add a normal edge from `tools` to `agent`.\n",
"# This means that after `tools` is called, `agent` node is called next.\n",
"workflow.add_edge(\"action\", \"agent\")\n",
"\n",
"# Finally, we compile it!\n",
"# This compiles it into a LangChain Runnable,\n",
"# meaning you can use it as you would any other runnable\n",
"app = workflow.compile()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "a8afd6ef",
"metadata": {},
"outputs": [
{
"data": {
"image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/4gHYSUNDX1BST0ZJTEUAAQEAAAHIAAAAAAQwAABtbnRyUkdCIFhZWiAH4AABAAEAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAACRyWF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Di/cT2Iwmts1xI0Ro7W+q8nBaGkr1vJDTuUkrstyx3YY4XmRjY3c3ZyNLnMDCXbj3pIOkP9j9p3Umn9Mxa0ZLqbUWIx0dCTPtsz1LVkBo5+d8UjXOa5wLuVznDcknckk23GcO9O4bMYrKUsaytdxeMOGpvjkeGw0y5jjEGc3LtvFH1I38nv6lTFMjyxPUtcRNM8FG6gzmZsW6mtslg3ZCvkpq080cXt6OORz4nN/C8sDB2nvur+vlu39iUqraNOCsx8sjIY2xh80hke4Abbuc4kuPTqSdyqZf4JaKyekvFmzhQ/Di/JlGRCzM2SK0+V0rpmSh4kY7nked2uGwcQNh0VuxGKrYPFU8dTY6OpUhZBC18jpHBjQGtBc4lzjsLine truncated
"text/plain": [
"<IPython.core.display.Image object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from IPython.display import Image, display\n",
"\n",
"try:\n",
" display(Image(app.get_graph(xray=True).draw_mermaid_png()))\n",
"except Exception:\n",
" # This requires some extra dependencies and is optional\n",
" pass"
]
},
{
"cell_type": "markdown",
"id": "547c3931-3dae-4281-ad4e-4b51305594d4",
"metadata": {},
"source": [
"## Use it!\n",
"\n",
"We can now use it!\n",
"This now exposes the [same interface](https://python.langchain.com/docs/concepts/#langchain-expression-language-lcel) as all other LangChain runnables."
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "8edb04b9-40b6-46f1-a7a8-4b2d8aba7752",
"execution_count": 13,
"id": "d683986f-faf4-4724-a13f-bac39ea9bafe",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Output from node 'agent':\n",
"---\n",
"{'messages': [AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_BidVTw5NiW2wp8Ez7m8dDoHI', 'function': {'arguments': '{\"question\":[\"latest news about FooBar\"]}', 'name': 'get_context'}, 'type': 'function'}]}, response_metadata={'token_usage': {'completion_tokens': 19, 'prompt_tokens': 87, 'total_tokens': 106}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_c4e5b6fa31', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-fcac1b73-563e-4f4c-b1b0-626f55d377be-0', tool_calls=[{'name': 'get_context', 'args': {'question': ['latest news about FooBar']}, 'id': 'call_BidVTw5NiW2wp8Ez7m8dDoHI', 'type': 'tool_call'}], usage_metadata={'input_tokens': 87, 'output_tokens': 19, 'total_tokens': 106})]}\n",
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"---\n",
"what's the latest news about FooBar\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"Tool Calls:\n",
" get_context (call_ocyHBpGgF3LPFOgRKURBfkGG)\n",
" Call ID: call_ocyHBpGgF3LPFOgRKURBfkGG\n",
" Args:\n",
" question: latest news about FooBar\n",
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
"Name: get_context\n",
"\n",
"Output from node 'action':\n",
"---\n",
"{'messages': [ToolMessage(content=\"FooBar company just raised 1 Billion dollars!\\n\\nFooBar company is now only hiring AI's\\n\\nFooBar company was founded in 2019\\n\\nFooBar company makes friendly robots\", name='get_context', tool_call_id='call_BidVTw5NiW2wp8Ez7m8dDoHI', artifact=[Document(metadata={'source': 'twitter'}, page_content='FooBar company just raised 1 Billion dollars!'), Document(metadata={'source': 'twitter'}, page_content=\"FooBar company is now only hiring AI's\"), Document(metadata={'source': 'wikipedia'}, page_content='FooBar company was founded in 2019'), Document(metadata={'source': 'wikipedia'}, page_content='FooBar company makes friendly robots')])]}\n",
"FooBar company just raised 1 Billion dollars!\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"---\n",
"\n",
"Output from node 'agent':\n",
"---\n",
"{'messages': [AIMessage(content='The latest news about FooBar is that the company has just raised 1 billion dollars!', response_metadata={'token_usage': {'completion_tokens': 19, 'prompt_tokens': 150, 'total_tokens': 169}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_c4e5b6fa31', 'finish_reason': 'stop', 'logprobs': None}, id='run-a8407471-7715-4c16-bd46-c29e5751e882-0', usage_metadata={'input_tokens': 150, 'output_tokens': 19, 'total_tokens': 169})]}\n",
"\n",
"---\n",
"\n"
"The latest news about FooBar is that the company has just raised 1 billion dollars.\n"
]
}
],
"source": [
"from langchain_core.messages import HumanMessage\n",
"\n",
"messages = [HumanMessage(\"what's the latest news about FooBar\")]\n",
"for output in app.stream({\"messages\": messages}):\n",
" # stream() yields dictionaries with output keyed by node name\n",
" for key, value in output.items():\n",
" print(f\"Output from node '{key}':\")\n",
" print(\"---\")\n",
" print(value)\n",
" messages.extend(value[\"messages\"])\n",
" print(\"\\n---\\n\")"
"messages = [{\"type\": \"user\", \"content\": \"what's the latest news about FooBar\"}]\n",
"config = {\"configurable\": {\"thread_id\": \"1\", \"user_id\": \"1\"}}\n",
"for chunk in graph.stream({\"messages\": messages}, config, stream_mode=\"values\"):\n",
" chunk[\"messages\"][-1].pretty_print()"
]
},
{
"cell_type": "markdown",
"id": "4fac8ead-a4fa-488f-835d-21872c67ec72",
"metadata": {},
"source": [
"We can see that the tool only retrieved the correct document for user \"1\" when looking up the information in the store. Let's now try it again for a different user:"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "4a2128ed-e23f-4f25-a026-0c6590f01a1c",
"execution_count": 14,
"id": "2e3fd1e2-cc19-4023-8ffa-b0fc13da9e09",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Output from node 'agent':\n",
"---\n",
"{'messages': [AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_EB0zaQypXMqEUzaqwflUr0zH', 'function': {'arguments': '{\"claim\":\"FooBar company just raised 1 Billion dollars!\"}', 'name': 'cite_context_sources'}, 'type': 'function'}]}, response_metadata={'token_usage': {'completion_tokens': 25, 'prompt_tokens': 183, 'total_tokens': 208}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_c4e5b6fa31', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-b4952777-e2b3-4448-be87-200e6e80981b-0', tool_calls=[{'name': 'cite_context_sources', 'args': {'claim': 'FooBar company just raised 1 Billion dollars!'}, 'id': 'call_EB0zaQypXMqEUzaqwflUr0zH', 'type': 'tool_call'}], usage_metadata={'input_tokens': 183, 'output_tokens': 25, 'total_tokens': 208})]}\n",
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"---\n",
"what's the latest news about FooBar\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"Tool Calls:\n",
" get_context (call_zxO9KVlL8UxFQUMb8ETeHNvs)\n",
" Call ID: call_zxO9KVlL8UxFQUMb8ETeHNvs\n",
" Args:\n",
" question: latest news about FooBar\n",
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
"Name: get_context\n",
"\n",
"Output from node 'action':\n",
"---\n",
"{'messages': [ToolMessage(content='twitter', name='cite_context_sources', tool_call_id='call_EB0zaQypXMqEUzaqwflUr0zH', artifact=[Document(metadata={'source': 'twitter'}, page_content='FooBar company just raised 1 Billion dollars!')])]}\n",
"FooBar company was founded in 2019\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"---\n",
"\n",
"Output from node 'agent':\n",
"---\n",
"{'messages': [AIMessage(content='The information that FooBar company just raised 1 billion dollars comes from Twitter.', response_metadata={'token_usage': {'completion_tokens': 17, 'prompt_tokens': 218, 'total_tokens': 235}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_400f27fa1f', 'finish_reason': 'stop', 'logprobs': None}, id='run-a0dede05-dadd-46f6-8654-746520d4cef8-0', usage_metadata={'input_tokens': 218, 'output_tokens': 17, 'total_tokens': 235})]}\n",
"\n",
"---\n",
"\n"
"FooBar company was founded in 2019. If you need more specific or recent news, please let me know!\n"
]
}
],
"source": [
"messages.append(HumanMessage(\"where did you get this information?\"))\n",
"for output in app.stream({\"messages\": messages}):\n",
" # stream() yields dictionaries with output keyed by node name\n",
" for key, value in output.items():\n",
" print(f\"Output from node '{key}':\")\n",
" print(\"---\")\n",
" print(value)\n",
" print(\"\\n---\\n\")"
"messages = [{\"type\": \"user\", \"content\": \"what's the latest news about FooBar\"}]\n",
"config = {\"configurable\": {\"thread_id\": \"2\", \"user_id\": \"2\"}}\n",
"for chunk in graph.stream({\"messages\": messages}, config, stream_mode=\"values\"):\n",
" chunk[\"messages\"][-1].pretty_print()"
]
},
{
"cell_type": "markdown",
"id": "196fd8ec-38e7-4300-88f6-9f8774bba313",
"metadata": {},
"source": [
"We can see that the tool pulled in a different document this time."
]
}
],
+79 -56
View File
@@ -5,19 +5,25 @@
"id": "47ed5db3-bda5-49e1-bf75-23e08c9a3af0",
"metadata": {},
"source": [
"# How to pass private state\n",
"# How to pass private state between nodes\n",
"\n",
"Oftentimes, you may want nodes to be able to pass state to each other that should NOT be part of the main schema of the graph. This is often useful because there may be information that is not needed as input/output (and therefore doesn't really make sense to have in the main schema) but is ABSOLUTELY needed as part of the intermediate working logic.\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/low_level/#multiple-schemas\">\n",
" Multiple Schemas\n",
" </a>\n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"Let's take a look at an example below. In this example, we will create a RAG pipeline that:\n",
"1. Takes in a user question\n",
"2. Uses an LLM to generate a search query\n",
"3. Retrieves documents for that generated query\n",
"4. Generates a final answer based on those documents\n",
"In some cases, you may want nodes to exchange information that is crucial for intermediate logic but doesn’t need to be part of the main schema of the graph. This private data is not relevant to the overall input/output of the graph and should only be shared between certain nodes.\n",
"\n",
"We will have a separate node for each step. We will only have the `question` and `answer` on the overall state. However, we will need separate states for the `search_query` and the `documents` - we will pass these as private state keys. See the conceptual docs [here](https://langchain-ai.github.io/langgraph/concepts/low_level/#multiple-schemas) for more details.\n",
"\n",
"Let's look at an example!\n",
"In this how-to guide, we'll create an example sequential graph consisting of three nodes (node_1, node_2 and node_3), where private data is passed between the first two steps (node_1 and node_2), while the third step (node_3) only has access to the public overall state.\n",
"\n",
"## Setup\n",
"\n",
@@ -26,7 +32,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "32d79ebd",
"metadata": {},
"outputs": [],
@@ -58,19 +64,26 @@
},
{
"cell_type": "code",
"execution_count": 9,
"id": "3114c3ad-0ade-47ba-9488-53d6f7671578",
"execution_count": 1,
"id": "f0323902-ad88-4be1-a557-ac73a4419feb",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'question': 'foo', 'answer': 'fo\\n\\nfo\\n\\nfoo'}"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
"name": "stdout",
"output_type": "stream",
"text": [
"Entered node `node_1`:\n",
"\tInput: {'a': 'set at start'}.\n",
"\tReturned: {'private_data': 'set by node_1'}\n",
"Entered node `node_2`:\n",
"\tInput: {'private_data': 'set by node_1'}.\n",
"\tReturned: {'a': 'set by node_2'}\n",
"Entered node `node_3`:\n",
"\tInput: {'a': 'set by node_2'}.\n",
"\tReturned: {'a': 'set by node_3'}\n",
"\n",
"Output of graph invocation: {'a': 'set by node_3'}\n"
]
}
],
"source": [
@@ -78,55 +91,65 @@
"from typing_extensions import TypedDict\n",
"\n",
"\n",
"# The overall state of the graph\n",
"# The overall state of the graph (this is the public state shared across nodes)\n",
"class OverallState(TypedDict):\n",
" question: str\n",
" answer: str\n",
" a: str\n",
"\n",
"\n",
"# This is what the node that generates the query will return\n",
"class QueryOutputState(TypedDict):\n",
" query: str\n",
"# Output from node_1 contains private data that is not part of the overall state\n",
"class Node1Output(TypedDict):\n",
" private_data: str\n",
"\n",
"\n",
"# This is what the node that retrieves the documents will return\n",
"class DocumentOutputState(TypedDict):\n",
" docs: list[str]\n",
"# The private data is only shared between node_1 and node_2\n",
"def node_1(state: OverallState) -> Node1Output:\n",
" output = {\"private_data\": \"set by node_1\"}\n",
" print(f\"Entered node `node_1`:\\n\\tInput: {state}.\\n\\tReturned: {output}\")\n",
" return output\n",
"\n",
"\n",
"# This is what the node that generates the final answer will take in\n",
"class GenerateInputState(OverallState, DocumentOutputState):\n",
" pass\n",
"# Node 2 input only requests the private data available after node_1\n",
"class Node2Input(TypedDict):\n",
" private_data: str\n",
"\n",
"\n",
"# Node to generate query\n",
"def generate_query(state: OverallState) -> QueryOutputState:\n",
" # Replace this with real logic\n",
" return {\"query\": state[\"question\"][:2]}\n",
"def node_2(state: Node2Input) -> OverallState:\n",
" output = {\"a\": \"set by node_2\"}\n",
" print(f\"Entered node `node_2`:\\n\\tInput: {state}.\\n\\tReturned: {output}\")\n",
" return output\n",
"\n",
"\n",
"# Node to retrieve documents\n",
"def retrieve_documents(state: QueryOutputState) -> DocumentOutputState:\n",
" # Replace this with real logic\n",
" return {\"docs\": [state[\"query\"]] * 2}\n",
"# Node 3 only has access to the overall state (no access to private data from node_1)\n",
"def node_3(state: OverallState) -> OverallState:\n",
" output = {\"a\": \"set by node_3\"}\n",
" print(f\"Entered node `node_3`:\\n\\tInput: {state}.\\n\\tReturned: {output}\")\n",
" return output\n",
"\n",
"\n",
"# Node to generate answer\n",
"def generate(state: GenerateInputState) -> OverallState:\n",
" return {\"answer\": \"\\n\\n\".join(state[\"docs\"] + [state[\"question\"]])}\n",
"# Build the state graph\n",
"builder = StateGraph(OverallState)\n",
"builder.add_node(node_1) # node_1 is the first node\n",
"builder.add_node(\n",
" node_2\n",
") # node_2 is the second node and accepts private data from node_1\n",
"builder.add_node(node_3) # node_3 is the third node and does not see the private data\n",
"builder.add_edge(START, \"node_1\") # Start the graph with node_1\n",
"builder.add_edge(\"node_1\", \"node_2\") # Pass from node_1 to node_2\n",
"builder.add_edge(\n",
" \"node_2\", \"node_3\"\n",
") # Pass from node_2 to node_3 (only overall state is shared)\n",
"builder.add_edge(\"node_3\", END) # End the graph after node_3\n",
"graph = builder.compile()\n",
"\n",
"# Invoke the graph with the initial state\n",
"response = graph.invoke(\n",
" {\n",
" \"a\": \"set at start\",\n",
" }\n",
")\n",
"\n",
"graph = StateGraph(OverallState)\n",
"graph.add_node(generate_query)\n",
"graph.add_node(retrieve_documents)\n",
"graph.add_node(generate)\n",
"graph.add_edge(START, \"generate_query\")\n",
"graph.add_edge(\"generate_query\", \"retrieve_documents\")\n",
"graph.add_edge(\"retrieve_documents\", \"generate\")\n",
"graph.add_edge(\"generate\", END)\n",
"graph = graph.compile()\n",
"\n",
"graph.invoke({\"question\": \"foo\"})"
"print()\n",
"print(f\"Output of graph invocation: {response}\")"
]
}
],
@@ -146,7 +169,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.1"
"version": "3.11.4"
}
},
"nbformat": 4,
+383 -580
View File
@@ -1,583 +1,386 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "51466c8d-8ce4-4b3d-be4e-18fdbeda5f53",
"metadata": {},
"source": [
"# How to add persistence (\"memory\") to your graph\n",
"\n",
"Many AI applications need memory to share context across multiple interactions. In LangGraph, memory is provided for any [StateGraph](https://langchain-ai.github.io/langgraph/reference/graphs/#langgraph.graph.StateGraph) through [Checkpointers](https://github.com/langchain-ai/langgraph/tree/e4ca7ab69c599fd77dd4f0d47280849d715392cc/libs/checkpoint).\n",
"\n",
"When creating any LangGraph workflow, you can set them up to persist their state by doing using the following:\n",
"\n",
"1. A [Checkpointer](https://langchain-ai.github.io/langgraph/reference/checkpoints/#basecheckpointsaver).\n",
"2. Call `compile(checkpointer=my_checkpointer)` when compiling the graph.\n",
"\n",
"There are several options for checkpointers to use.\n",
"\n",
"1. [MemorySaver](https://langchain-ai.github.io/langgraph/reference/checkpoints/#memorysaver) is an in-memory key-value store for Graph state.\n",
"2. [SqliteSaver](https://langchain-ai.github.io/langgraph/reference/checkpoints/#sqlitesaver) allows you to save to a Sqlite db locally or in memory.\n",
"3. There are various external databases that can be used for persistence, such as [Postgres](https://langchain-ai.github.io/langgraph/how-tos/persistence_postgres/), [MongoDB](https://langchain-ai.github.io/langgraph/how-tos/persistence_mongodb/), and [Redis](https://langchain-ai.github.io/langgraph/how-tos/persistence_redis/).\n",
" \n",
"Here is an example using [MemorySaver](https://langchain-ai.github.io/langgraph/reference/checkpoints/#memorysaver) in memory:\n",
"```python\n",
"from langgraph.graph import StateGraph\n",
"from langgraph.checkpoint.memory import MemorySaver\n",
"\n",
"builder = StateGraph(....)\n",
"# ... define the graph\n",
"memory = MemorySaver()\n",
"graph = builder.compile(checkpointer=memory)\n",
"...\n",
"```\n",
"\n",
"This works for [StateGraph](https://langchain-ai.github.io/langgraph/reference/graphs/#langgraph.graph.StateGraph) and all its subclasses, such as [MessageGraph](https://langchain-ai.github.io/langgraph/reference/graphs/#messagegraph).\n",
"\n",
"Below is an example.\n",
"\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Note</p>\n",
" <p>\n",
" In this how-to, we will create our agent from scratch to be transparent (but verbose). You can accomplish similar functionality using the <code>create_react_agent(model, tools=tool, checkpointer=checkpointer)</code> (<a href=\"https://langchain-ai.github.io/langgraph/reference/prebuilt/#create_react_agent\">API doc</a>) constructor. This may be more appropriate if you are used to LangChain’s <a href=\"https://python.langchain.com/docs/how_to/agent_executor/#concepts\">AgentExecutor</a> class.\n",
" </p>\n",
"</div> "
]
},
{
"cell_type": "markdown",
"id": "7cbd446a-808f-4394-be92-d45ab818953c",
"metadata": {},
"source": [
"## Setup\n",
"\n",
"First we need to install the packages required"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "af4ce0ba-7596-4e5f-8bf8-0b0bd6e62833",
"metadata": {},
"outputs": [],
"source": [
"%%capture --no-stderr\n",
"%pip install --quiet -U langgraph langchain_anthropic"
]
},
{
"cell_type": "markdown",
"id": "0abe11f4-62ed-4dc4-8875-3db21e260d1d",
"metadata": {},
"source": [
"Next, we need to set API keys for OpenAI (the LLM we will use) and Tavily (the search tool we will use)"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "c903a1cf-2977-4e2d-ad7d-8b3946821d89",
"metadata": {},
"outputs": [],
"source": [
"import getpass\n",
"import os\n",
"\n",
"\n",
"def _set_env(var: str):\n",
" if not os.environ.get(var):\n",
" os.environ[var] = getpass.getpass(f\"{var}: \")\n",
"\n",
"\n",
"_set_env(\"ANTHROPIC_API_KEY\")"
]
},
{
"cell_type": "markdown",
"id": "f0ed46a8-effe-4596-b0e1-a6a29ee16f5c",
"metadata": {},
"source": [
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Set up <a href=\"https://smith.langchain.com\">LangSmith</a> for LangGraph development</p>\n",
" <p style=\"padding-top: 5px;\">\n",
" Sign up for LangSmith to quickly spot issues and improve the performance of your LangGraph projects. LangSmith lets you use trace data to debug, test, and monitor your LLM apps built with LangGraph — read more about how to get started <a href=\"https://docs.smith.langchain.com\">here</a>. \n",
" </p>\n",
"</div> "
]
},
{
"cell_type": "markdown",
"id": "4cf509bc",
"metadata": {},
"source": [
"## Define graph state\n",
"\n",
"The state is the interface for all the nodes."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "14619607",
"metadata": {},
"outputs": [],
"source": [
"from typing import Annotated\n",
"\n",
"from typing_extensions import TypedDict\n",
"\n",
"from langgraph.graph.message import add_messages\n",
"\n",
"# Add messages essentially does this with more\n",
"# robust handling\n",
"# def add_messages(left: list, right: list):\n",
"# return left + right\n",
"\n",
"\n",
"class State(TypedDict):\n",
" messages: Annotated[list, add_messages]"
]
},
{
"cell_type": "markdown",
"id": "21ac643b-cb06-4724-a80c-2862ba4773f1",
"metadata": {},
"source": [
"## Define tools\n",
"\n",
"We will first define the tools we want to use.\n",
"For this simple example, we will use create a placeholder search engine.\n",
"However, it is really easy to create your own tools - see documentation [here](https://python.langchain.com/docs/how_to/custom_tools) on how to do that.\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "d7ef57dd-5d6e-4ad3-9377-a92201c1310e",
"metadata": {},
"outputs": [],
"source": [
"from langchain_core.tools import tool\n",
"\n",
"\n",
"@tool\n",
"def search(query: str):\n",
" \"\"\"Call to surf the web.\"\"\"\n",
" # This is a placeholder for the actual implementation\n",
" return [\"The answer to your question lies within.\"]\n",
"\n",
"\n",
"tools = [search]"
]
},
{
"cell_type": "markdown",
"id": "01885785-b71a-44d1-b1d6-7b5b14d53b58",
"metadata": {},
"source": [
"Now we can create our [ToolNode](https://langchain-ai.github.io/langgraph/reference/prebuilt/?h=tool+node#toolnode). This \n",
"object actually **runs** the tools (aka functions) that the LLM has asked to use."
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "5cf3331e-ccb3-41c8-aeb9-a840a94d41e7",
"metadata": {},
"outputs": [],
"source": [
"from langgraph.prebuilt import ToolNode\n",
"\n",
"tool_node = ToolNode(tools)"
]
},
{
"cell_type": "markdown",
"id": "5497ed70-fce3-47f1-9cad-46f912bad6a5",
"metadata": {},
"source": [
"## Define the model\n",
"\n",
"Now we need to load the [chat model](https://python.langchain.com/docs/concepts/#chat-models) to power our agent.\n",
"For the design below, it must satisfy two criteria:\n",
"\n",
"1. It should work with **messages** (since our state contains a list of chat messages)\n",
"2. It should work with [**tool calling**](https://python.langchain.com/docs/concepts/#functiontool-calling).\n",
"\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Note</p>\n",
" <p>\n",
" These model requirements are not general requirements for using LangGraph - they are just requirements for this one example.\n",
" </p>\n",
"</div> \n",
" "
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "892b54b9-75f0-4804-9ed0-88b5e5532989",
"metadata": {},
"outputs": [],
"source": [
"from langchain_openai import ChatOpenAI\n",
"\n",
"# We will set streaming=True so that we can stream tokens\n",
"# See the streaming section for more information on this.\n",
"model = ChatOpenAI(temperature=0, streaming=True)"
]
},
{
"cell_type": "markdown",
"id": "a77995c0-bae2-4cee-a036-8688a90f05b9",
"metadata": {},
"source": [
"\n",
"After we've done this, we should make sure the model knows that it has these tools available to call.\n",
"We can do this by converting the LangChain tools into the format for OpenAI function calling, and then bind them to the model class.\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "cd3cbae5-d92c-4559-a4aa-44721b80d107",
"metadata": {},
"outputs": [],
"source": [
"bound_model = model.bind_tools(tools)"
]
},
{
"cell_type": "markdown",
"id": "e03c5094-9297-4d19-a04e-3eedc75cefb4",
"metadata": {},
"source": [
"## Define nodes and edges \n",
"\n",
"We now need to define a few different nodes in our graph.\n",
"In `langgraph`, a node can be either a function or a [runnable](https://python.langchain.com/docs/concepts/#langchain-expression-language-lcel).\n",
"There are two main nodes we need for this:\n",
"\n",
"1. The agent: responsible for deciding what (if any) actions to take.\n",
"2. A function to invoke tools: if the agent decides to take an action, this node will then execute that action.\n",
"\n",
"We will also need to define some edges.\n",
"Some of these edges may be conditional.\n",
"The reason they are conditional is that based on the output of a node, one of several paths may be taken.\n",
"The path that is taken is not known until that node is run (the LLM decides).\n",
"\n",
"1. Conditional Edge: after the agent is called, we should either:\n",
" a. If the agent said to take an action, then the function to invoke tools should be called\n",
" b. If the agent said that it was finished, then it should finish\n",
"2. Normal Edge: after the tools are invoked, it should always go back to the agent to decide what to do next\n",
"\n",
"Let's define the nodes, as well as a function to decide how what conditional edge to take."
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "3b541bb9-900c-40d0-964d-7b5dfee30667",
"metadata": {},
"outputs": [],
"source": [
"# Define the function that determines whether to continue or not\n",
"from typing import Literal\n",
"\n",
"\n",
"def should_continue(state: State) -> Literal[\"action\", \"__end__\"]:\n",
" \"\"\"Return the next node to execute.\"\"\"\n",
" last_message = state[\"messages\"][-1]\n",
" # If there is no function call, then we finish\n",
" if not last_message.tool_calls:\n",
" return \"__end__\"\n",
" # Otherwise if there is, we continue\n",
" return \"action\"\n",
"\n",
"\n",
"# Define the function that calls the model\n",
"def call_model(state: State):\n",
" response = model.invoke(state[\"messages\"])\n",
" # We return a list, because this will get added to the existing list\n",
" return {\"messages\": response}"
]
},
{
"cell_type": "markdown",
"id": "ffd6e892-946c-4899-8cc0-7c9291c1f73b",
"metadata": {},
"source": [
"## Compile the graph\n",
"\n",
"We can now put it all together and define the graph!"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "812b4e70-4956-4415-8880-db48b3dcbad2",
"metadata": {},
"outputs": [],
"source": [
"from langgraph.graph import StateGraph, START\n",
"\n",
"# Define a new graph\n",
"workflow = StateGraph(State)\n",
"\n",
"# Define the two nodes we will cycle between\n",
"workflow.add_node(\"agent\", call_model)\n",
"workflow.add_node(\"action\", tool_node)\n",
"\n",
"# Set the entrypoint as `agent`\n",
"# This means that this node is the first one called\n",
"workflow.add_edge(START, \"agent\")\n",
"\n",
"# We now add a conditional edge\n",
"workflow.add_conditional_edges(\n",
" # First, we define the start node. We use `agent`.\n",
" # This means these are the edges taken after the `agent` node is called.\n",
" \"agent\",\n",
" # Next, we pass in the function that will determine which node is called next.\n",
" should_continue,\n",
")\n",
"\n",
"# We now add a normal edge from `tools` to `agent`.\n",
"# This means that after `tools` is called, `agent` node is called next.\n",
"workflow.add_edge(\"action\", \"agent\")"
]
},
{
"cell_type": "markdown",
"id": "bc9c8536-f90b-44fa-958d-5df016c66d8f",
"metadata": {},
"source": [
"### Persistence\n",
"\n",
"To add in persistence, we pass in a checkpoint when compiling the graph"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "6845ed6a-d155-4105-9160-28849877248b",
"metadata": {},
"outputs": [],
"source": [
"from langgraph.checkpoint.memory import MemorySaver\n",
"\n",
"memory = MemorySaver()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "79d29875-8aa8-434c-9f20-1c58346a6249",
"metadata": {},
"outputs": [],
"source": [
"# Finally, we compile it!\n",
"# This compiles it into a LangChain Runnable,\n",
"# meaning you can use it as you would any other runnable\n",
"app = workflow.compile(checkpointer=memory)"
]
},
{
"cell_type": "markdown",
"id": "7654ebcc-2179-41b4-92d1-6666f6f8634f",
"metadata": {},
"source": [
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Note</p>\n",
" <p>\n",
" If you're using LangGraph Cloud, you <strong>don't need</strong> to pass checkpointer when compiling the graph, since it's done automatically.\n",
" </p>\n",
"</div>"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "0d49697f",
"metadata": {},
"outputs": [
{
"data": {
"image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/4gHYSUNDX1BST0ZJTEUAAQEAAAHIAAAAAAQwAABtbnRyUkdCIFhZWiAH4AABAAEAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAACRyWFlaAAABFAAAABRnWFlaAAABKAAAABRiWFlaAAABPAAAABR3dHB0AAABUAAAABRyVFJDAAABZAAAAChnVFJDAAABZAAAAChiVFJDAAABZAAAAChjcHJ0AAABjAAAADxtbHVjAAAAAAAAAAEAAAAMZW5VUwAAAAgAAAAcAHMAUgBHAEJYWVogAAAAAAAAb6IAADj1AAADkFhZWiAAAAAAAABimQAAt4UAABjaWFlaIAAAAAAAACSgAAAPhAAAts9YWVogAAAAAAAA9tYAAQAAAADTLXBhcmEAAAAAAAQAAAACZmYAAPKnAAANWQAAE9AAAApbAAAAAAAAAABtbHVjAAAAAAAAAAEAAAAMZW5VUwAAACAAAAAcAEcAbwBvAGcAbABlACAASQBuAGMALgAgADIAMAAxADb/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCAD5AOADASIAAhEBAxEB/8QAHQABAAICAwEBAAAAAAAAAAAAAAYHBAUCAwgBCf/EAFAQAAEEAQICAwkLBwoEBwAAAAEAAgMEBQYRBxITITEU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4cOrGUlyD9ODul9wZFnLcsNZXsiQS9NCwScsLy8Al0YaT177gnetcn7nXV9jiHaymJsYjTFSbNd8++2LzWVFkxmfpZGOpOk7mLpBzNcfennceXzLjmmURPCni5xej1FqjT191HJ183cpUel1VLWq0RXnMbYZsc2o+OTyWgu53lzufcFu4A2Wse/+Rqe6Az41hqLHXdIym1iK1HJyR1a0keMgnIMY6pGOcNix+7etxDQXOJu7IcA9BZPVz9TT4BozEliO3LJDaniimnYQWSyQseI3vBAPM5pO47VuLPDHTVunq2rLjeeDVYcMyzp5R3VzQNgPWHbs/Jta3yOXs37etXNkUthdOV9V+6rqZuzfy1e1NonHZboamVsQwmTup4MZja8NdF1AmMgsJc4kbuJPpFQ3NcHtI5/KYHJXMU45DBxtgoWYLU0MkcbS0iNzmPaZGbtaeV/MNx2dZUyWcRYR7X/AMFbP9rB/nMViKu9f/BWz/awf5zFYixyjuqPOf8AVlsERFwMRERAREQEREBERAREQEREBERAREQVxw3+AGnvmMX1QpIoriZMphpLWMxuEt5zEVOTuS/XkjjEjHgPaxvSvaJOVrgOkaS09Q98HAZ/fbPepmV9qpfjr2q7Ylc101RaZvrjqymLzdu0Wk77Z71MyvtVL8dO+2e9TMr7VS/HWGZ+qP3R1LN2ir2DjJWs8Q7OhYsJefqutTbkJcaLFTnbCSAHc3Tcu/WDy777Line truncated
"text/plain": [
"<IPython.core.display.Image object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from IPython.display import Image, display\n",
"\n",
"try:\n",
" display(Image(app.get_graph().draw_mermaid_png()))\n",
"except Exception:\n",
" # This requires some extra dependencies and is optional\n",
" pass"
]
},
{
"cell_type": "markdown",
"id": "2a1b56c5-bd61-4192-8bdb-458a1e9f0159",
"metadata": {},
"source": [
"## Use the graph\n",
"\n",
"We can now interact with the agent and see that it remembers previous messages!\n"
]
},
{
"cell_type": "code",
"execution_count": 33,
"id": "cfd140f0-a5a6-4697-8115-322242f197b5",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"hi! I'm bob\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"Hello Bob! How can I assist you today?\n"
]
}
],
"source": [
"from langchain_core.messages import HumanMessage\n",
"\n",
"config = {\"configurable\": {\"thread_id\": \"2\"}}\n",
"input_message = HumanMessage(content=\"hi! I'm bob\")\n",
"for event in app.stream({\"messages\": [input_message]}, config, stream_mode=\"values\"):\n",
" event[\"messages\"][-1].pretty_print()"
]
},
{
"cell_type": "code",
"execution_count": 34,
"id": "08ae8246-11d5-40e1-8567-361e5bef8917",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"what is my name?\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"Your name is Bob.\n"
]
}
],
"source": [
"input_message = HumanMessage(content=\"what is my name?\")\n",
"for event in app.stream({\"messages\": [input_message]}, config, stream_mode=\"values\"):\n",
" event[\"messages\"][-1].pretty_print()"
]
},
{
"cell_type": "markdown",
"id": "3f47bbfc-d9ef-4288-ba4a-ebbc0136fa9d",
"metadata": {},
"source": [
"If we want to start a new conversation, we can pass in a different thread id. Poof! All the memories are gone!"
]
},
{
"cell_type": "code",
"execution_count": 35,
"id": "273d56a8-f40f-4a51-a27f-7c6bb2bda0ba",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"what is my name?\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"I'm sorry, I do not know your name as I am an AI assistant and do not have access to personal information.\n"
]
}
],
"source": [
"input_message = HumanMessage(content=\"what is my name?\")\n",
"for event in app.stream(\n",
" {\"messages\": [input_message]},\n",
" {\"configurable\": {\"thread_id\": \"3\"}},\n",
" stream_mode=\"values\",\n",
"):\n",
" event[\"messages\"][-1].pretty_print()"
]
},
{
"cell_type": "markdown",
"id": "e833f994",
"metadata": {},
"source": [
"All the checkpoints are persisted to the checkpointer, so you can always resume previous threads."
]
},
{
"cell_type": "code",
"execution_count": 36,
"id": "8578a66d-6489-4e03-8c23-fd0530278455",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"You forgot??\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"I apologize for the confusion. I am an AI assistant and I do not have the ability to remember information from previous interactions. How can I assist you today, Bob?\n"
]
}
],
"source": [
"input_message = HumanMessage(content=\"You forgot??\")\n",
"for event in app.stream(\n",
" {\"messages\": [input_message]},\n",
" {\"configurable\": {\"thread_id\": \"2\"}},\n",
" stream_mode=\"values\",\n",
"):\n",
" event[\"messages\"][-1].pretty_print()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
}
"cells": [
{
"cell_type": "markdown",
"id": "51466c8d-8ce4-4b3d-be4e-18fdbeda5f53",
"metadata": {},
"source": [
"# How to add thread-level persistence to your graph\n",
"\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/persistence/\">\n",
" Persistence\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/memory/\">\n",
" Memory\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#chat-models/\">\n",
" Chat Models\n",
" </a>\n",
" </li> \n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"Many AI applications need memory to share context across multiple interactions. In LangGraph, this kind of memory can be added to any [StateGraph](https://langchain-ai.github.io/langgraph/reference/graphs/#langgraph.graph.StateGraph) using [thread-level persistence](https://langchain-ai.github.io/langgraph/concepts/persistence) .\n",
"\n",
"When creating any LangGraph graph, you can set it up to persist its state by adding a [checkpointer](https://langchain-ai.github.io/langgraph/reference/checkpoints/#basecheckpointsaver) when compiling the graph:\n",
"\n",
"```python\n",
"from langgraph.checkpoint.memory import MemorySaver\n",
"\n",
"checkpointer = MemorySaver()\n",
"graph.compile(checkpointer=checkpointer)\n",
"```\n",
"\n",
"This guide shows how you can add thread-level persistence to your graph.\n",
"\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Note</p>\n",
" <p>\n",
" If you need memory that is <b>shared</b> across multiple conversations or users (cross-thread persistence), check out this <a href=\"https://langchain-ai.github.io/langgraph/how-tos/cross-thread-persistence/\">how-to guide</a>).\n",
" </p>\n",
"</div>"
]
},
"nbformat": 4,
"nbformat_minor": 5
{
"cell_type": "markdown",
"id": "7cbd446a-808f-4394-be92-d45ab818953c",
"metadata": {},
"source": [
"## Setup\n",
"\n",
"First we need to install the packages required"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "af4ce0ba-7596-4e5f-8bf8-0b0bd6e62833",
"metadata": {},
"outputs": [],
"source": [
"%%capture --no-stderr\n",
"%pip install --quiet -U langgraph langchain_anthropic"
]
},
{
"cell_type": "markdown",
"id": "0abe11f4-62ed-4dc4-8875-3db21e260d1d",
"metadata": {},
"source": [
"Next, we need to set API keys for OpenAI (the LLM we will use) and Tavily (the search tool we will use)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "c903a1cf-2977-4e2d-ad7d-8b3946821d89",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ANTHROPIC_API_KEY: ········\n"
]
}
],
"source": [
"import getpass\n",
"import os\n",
"\n",
"\n",
"def _set_env(var: str):\n",
" if not os.environ.get(var):\n",
" os.environ[var] = getpass.getpass(f\"{var}: \")\n",
"\n",
"\n",
"_set_env(\"ANTHROPIC_API_KEY\")"
]
},
{
"cell_type": "markdown",
"id": "f0ed46a8-effe-4596-b0e1-a6a29ee16f5c",
"metadata": {},
"source": [
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Set up <a href=\"https://smith.langchain.com\">LangSmith</a> for LangGraph development</p>\n",
" <p style=\"padding-top: 5px;\">\n",
" Sign up for LangSmith to quickly spot issues and improve the performance of your LangGraph projects. LangSmith lets you use trace data to debug, test, and monitor your LLM apps built with LangGraph — read more about how to get started <a href=\"https://docs.smith.langchain.com\">here</a>. \n",
" </p>\n",
"</div> "
]
},
{
"cell_type": "markdown",
"id": "4cf509bc",
"metadata": {},
"source": [
"## Define graph\n",
"\n",
"We will be using a single-node graph that calls a [chat model](https://python.langchain.com/docs/concepts/#chat-models).\n",
"\n",
"Let's first define the model we'll be using:"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "892b54b9-75f0-4804-9ed0-88b5e5532989",
"metadata": {},
"outputs": [],
"source": [
"from langchain_anthropic import ChatAnthropic\n",
"\n",
"model = ChatAnthropic(model=\"claude-3-5-sonnet-20240620\")"
]
},
{
"cell_type": "markdown",
"id": "7b7a2792-982b-4e47-83eb-0c594725d1c1",
"metadata": {},
"source": [
"Now we can define our `StateGraph` and add our model-calling node:"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "87326ea6-34c5-46da-a41f-dda26ef9bd74",
"metadata": {},
"outputs": [],
"source": [
"from typing import Annotated\n",
"from typing_extensions import TypedDict\n",
"\n",
"from langgraph.graph import StateGraph, MessagesState, START\n",
"\n",
"\n",
"def call_model(state: MessagesState):\n",
" response = model.invoke(state[\"messages\"])\n",
" return {\"messages\": response}\n",
"\n",
"\n",
"builder = StateGraph(MessagesState)\n",
"builder.add_node(\"call_model\", call_model)\n",
"builder.add_edge(START, \"call_model\")\n",
"graph = builder.compile()"
]
},
{
"cell_type": "markdown",
"id": "250d8fd9-2e7a-4892-9adc-19762a1e3cce",
"metadata": {},
"source": [
"If we try to use this graph, the context of the conversation will not be persisted across interactions:"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "6fa9a5e3-7101-43ab-a811-592e222b9580",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"hi! I'm bob\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"Hello Bob! It's nice to meet you. How are you doing today? Is there anything I can help you with or would you like to chat about something in particular?\n",
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"what's my name?\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"I apologize, but I don't have access to your personal information, including your name. I'm an AI language model designed to provide general information and answer questions to the best of my ability based on my training data. I don't have any information about individual users or their personal details. If you'd like to share your name, you're welcome to do so, but I won't be able to recall it in future conversations.\n"
]
}
],
"source": [
"input_message = {\"type\": \"user\", \"content\": \"hi! I'm bob\"}\n",
"for chunk in graph.stream({\"messages\": [input_message]}, stream_mode=\"values\"):\n",
" chunk[\"messages\"][-1].pretty_print()\n",
"\n",
"input_message = {\"type\": \"user\", \"content\": \"what's my name?\"}\n",
"for chunk in graph.stream({\"messages\": [input_message]}, stream_mode=\"values\"):\n",
" chunk[\"messages\"][-1].pretty_print()"
]
},
{
"cell_type": "markdown",
"id": "bc9c8536-f90b-44fa-958d-5df016c66d8f",
"metadata": {},
"source": [
"## Add persistence\n",
"\n",
"To add in persistence, we need to pass in a [Checkpointer](https://langchain-ai.github.io/langgraph/reference/checkpoints/#langgraph.checkpoint.base.BaseCheckpointSaver) when compiling the graph."
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "f088933f-264c-477f-9a7d-03f6e9d4ee3a",
"metadata": {},
"outputs": [],
"source": [
"from langgraph.checkpoint.memory import InMemorySaver\n",
"\n",
"memory = InMemorySaver()\n",
"graph = builder.compile(checkpointer=memory)\n",
"# If you're using LangGraph Cloud or LangGraph Studio, you don't need to pass the checkpointer when compiling the graph, since it's done automatically."
]
},
{
"cell_type": "markdown",
"id": "7654ebcc-2179-41b4-92d1-6666f6f8634f",
"metadata": {},
"source": [
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Note</p>\n",
" <p>\n",
" If you're using LangGraph Cloud or LangGraph Studio, you <strong>don't need</strong> to pass checkpointer when compiling the graph, since it's done automatically.\n",
" </p>\n",
"</div>"
]
},
{
"cell_type": "markdown",
"id": "2a1b56c5-bd61-4192-8bdb-458a1e9f0159",
"metadata": {},
"source": [
"We can now interact with the agent and see that it remembers previous messages!"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "cfd140f0-a5a6-4697-8115-322242f197b5",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"hi! I'm bob\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"Hello Bob! It's nice to meet you. How are you doing today? Is there anything in particular you'd like to chat about or any questions you have that I can help you with?\n"
]
}
],
"source": [
"config = {\"configurable\": {\"thread_id\": \"1\"}}\n",
"input_message = {\"type\": \"user\", \"content\": \"hi! I'm bob\"}\n",
"for chunk in graph.stream({\"messages\": [input_message]}, config, stream_mode=\"values\"):\n",
" chunk[\"messages\"][-1].pretty_print()"
]
},
{
"cell_type": "markdown",
"id": "1bb07bf8-68b7-4049-a0f1-eb67a4879a3a",
"metadata": {},
"source": [
"You can always resume previous threads:"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "08ae8246-11d5-40e1-8567-361e5bef8917",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"what's my name?\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"Your name is Bob, as you introduced yourself at the beginning of our conversation.\n"
]
}
],
"source": [
"input_message = {\"type\": \"user\", \"content\": \"what's my name?\"}\n",
"for chunk in graph.stream({\"messages\": [input_message]}, config, stream_mode=\"values\"):\n",
" chunk[\"messages\"][-1].pretty_print()"
]
},
{
"cell_type": "markdown",
"id": "3f47bbfc-d9ef-4288-ba4a-ebbc0136fa9d",
"metadata": {},
"source": [
"If we want to start a new conversation, we can pass in a different `thread_id`. Poof! All the memories are gone!"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "273d56a8-f40f-4a51-a27f-7c6bb2bda0ba",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"what's is my name?\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"I apologize, but I don't have access to your personal information, including your name. As an AI language model, I don't have any information about individual users unless it's provided within the conversation. If you'd like to share your name, you're welcome to do so, but otherwise, I won't be able to know or guess it.\n"
]
}
],
"source": [
"input_message = {\"type\": \"user\", \"content\": \"what's my name?\"}\n",
"for chunk in graph.stream(\n",
" {\"messages\": [input_message]},\n",
" {\"configurable\": {\"thread_id\": \"2\"}},\n",
" stream_mode=\"values\",\n",
"):\n",
" chunk[\"messages\"][-1].pretty_print()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
+40 -2
View File
@@ -7,11 +7,49 @@
"source": [
"# How to create a custom checkpointer using MongoDB\n",
"\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/persistence/\">\n",
" Persistence\n",
" </a>\n",
" </li> \n",
" <li>\n",
" <a href=\"https://www.mongodb.com/\">\n",
" MongoDB\n",
" </a>\n",
" </li> \n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"When creating LangGraph agents, you can also set them up so that they persist their state. This allows you to do things like interact with an agent multiple times and have it remember previous interactions. \n",
"\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."
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Note</p>\n",
" <p>\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 <a href=\"https://langchain-ai.github.io/langgraph/reference/checkpoints/#langgraph.checkpoint.base.BaseCheckpointSaver\">BaseCheckpointSaver</a> interface.\n",
" </p>\n",
"</div>\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).\n",
"\n",
"In general, you can add a checkpointer to any custom graph that you build like this:\n",
"\n",
"```python\n",
"from langgraph.graph import StateGraph\n",
"\n",
"builder = StateGraph(....)\n",
"# ... define the graph\n",
"checkpointer = # mongodb checkpointer (see examples below)\n",
"graph = builder.compile(checkpointer=checkpointer)\n",
"...\n",
"```"
]
},
{
@@ -922,7 +960,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
+38 -8
View File
@@ -7,15 +7,42 @@
"source": [
"# How to use Postgres checkpointer for persistence\n",
"\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/persistence/\">\n",
" Persistence\n",
" </a>\n",
" </li> \n",
" <li>\n",
" <a href=\"https://www.postgresql.org/about/\">\n",
" Postgresql\n",
" </a>\n",
" </li> \n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"When creating LangGraph agents, you can also set them up so that they persist their state. This allows you to do things like interact with an agent multiple times and have it remember previous interactions.\n",
"\n",
"This example shows how to use `Postgres` as the backend for persisting checkpoint state using [`langgraph-checkpoint-postgres`](https://github.com/langchain-ai/langgraph/tree/main/libs/checkpoint-postgres) library.\n",
"This how-to guide shows how to use `Postgres` as the backend for persisting checkpoint state using the [`langgraph-checkpoint-postgres`](https://github.com/langchain-ai/langgraph/tree/main/libs/checkpoint-postgres) library.\n",
"\n",
"To start a Postgres database to work with you can do the following:\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). \n",
"\n",
"```\n",
"$ cd libs/langgraph\n",
"$ make start-postgres"
"In general, you can add a checkpointer to any custom graph that you build like this:\n",
"\n",
"```python\n",
"from langgraph.graph import StateGraph\n",
"\n",
"builder = StateGraph(....)\n",
"# ... define the graph\n",
"checkpointer = # postgres checkpointer (see examples below)\n",
"graph = builder.compile(checkpointer=checkpointer)\n",
"...\n",
"```"
]
},
{
@@ -25,7 +52,10 @@
"source": [
"## Setup\n",
"\n",
"First, let's install the required packages and set our API keys"
"You will need access to a postgres instance. There are many resources online that can help\n",
"you set up a postgres instance.\n",
"\n",
"Next, let's install the required packages and set our API keys"
]
},
{
@@ -41,7 +71,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "eca9aafb-a155-407a-8036-682a2f1297d7",
"metadata": {},
"outputs": [],
@@ -558,7 +588,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
+41 -5
View File
@@ -7,11 +7,49 @@
"source": [
"# How to create a custom checkpointer using Redis\n",
"\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/persistence/\">\n",
" Persistence\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://redis.io/\">\n",
" Redis\n",
" </a>\n",
" </li> \n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"When creating LangGraph agents, you can also set them up so that they persist their state. This allows you to do things like interact with an agent multiple times and have it remember previous interactions.\n",
"\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."
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Note</p>\n",
" <p>\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 <a href=\"https://langchain-ai.github.io/langgraph/reference/checkpoints/#langgraph.checkpoint.base.BaseCheckpointSaver\">BaseCheckpointSaver</a> interface.\n",
" </p>\n",
"</div>\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).\n",
"\n",
"In general, you can add a checkpointer to any custom graph that you build like this:\n",
"\n",
"```python\n",
"from langgraph.graph import StateGraph\n",
"\n",
"builder = StateGraph(....)\n",
"# ... define the graph\n",
"checkpointer = # redis checkpointer (see examples below)\n",
"graph = builder.compile(checkpointer=checkpointer)\n",
"...\n",
"```"
]
},
{
@@ -256,9 +294,7 @@
" }\n",
" }\n",
"\n",
" checkpoint = serde.loads_typed(\n",
" (data[b\"type\"].decode(), data[b\"checkpoint\"])\n",
" )\n",
" checkpoint = serde.loads_typed((data[b\"type\"].decode(), data[b\"checkpoint\"]))\n",
" metadata = serde.loads(data[b\"metadata\"].decode())\n",
" parent_checkpoint_id = data.get(b\"parent_checkpoint_id\", b\"\").decode()\n",
" parent_config = (\n",
@@ -1006,7 +1042,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
@@ -6,16 +6,46 @@
"source": [
"# How to create a ReAct agent from scratch\n",
"\n",
"Using the prebuilt ReAct agent (`create_react_agent`) is a great way to get started, but sometimes you might want more control and customization. In those cases, you can create a custom ReAct agent. This guide shows how to implement ReAct agent from scratch using LangGraph.\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/agentic_concepts/#tool-calling-agent\">\n",
" Tool calling agent\n",
" </a>\n",
" </li> \n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#chat-models\">\n",
" Chat Models\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#messages\">\n",
" Messages\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/low_level/\">\n",
" LangGraph Glossary\n",
" </a>\n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"\n",
"Using the prebuilt ReAct agent ([create_react_agent](https://langchain-ai.github.io/langgraph/reference/prebuilt/#langgraph.prebuilt.chat_agent_executor.create_react_agent)) is a great way to get started, but sometimes you might want more control and customization. In those cases, you can create a custom ReAct agent. This guide shows how to implement ReAct agent from scratch using LangGraph.\n",
"\n",
"## Setup\n",
"\n",
"First, let's install the required packages and set our API keys"
"First, let's install the required packages and set our API keys:"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
@@ -25,7 +55,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
@@ -70,7 +100,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
@@ -82,9 +112,12 @@
"from langchain_core.messages import BaseMessage\n",
"from langgraph.graph.message import add_messages\n",
"\n",
"\n",
"class AgentState(TypedDict):\n",
" \"\"\"The state of the agent.\"\"\"\n",
"\n",
" # add_messages is a reducer\n",
" # See https://langchain-ai.github.io/langgraph/concepts/low_level/#reducers\n",
" messages: Annotated[Sequence[BaseMessage], add_messages]"
]
},
@@ -99,7 +132,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
@@ -108,16 +141,18 @@
"\n",
"model = ChatOpenAI(model=\"gpt-4o-mini\")\n",
"\n",
"\n",
"@tool\n",
"def get_weather(location: str):\n",
" \"\"\"Call to get the weather from a specific location.\"\"\"\n",
" # This is a placeholder for the actual implementation\n",
" # Don't let the LLM know this though 😊\n",
" if any([city in location.lower() for city in ['sf','san francisco']]):\n",
" if any([city in location.lower() for city in [\"sf\", \"san francisco\"]]):\n",
" return \"It's sunny in San Francisco, but you better look out if you're a Gemini 😈.\"\n",
" else:\n",
" return f\"I am not sure what the weather is in {location}\"\n",
"\n",
"\n",
"tools = [get_weather]\n",
"\n",
"model = model.bind_tools(tools)"
@@ -136,7 +171,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
@@ -145,13 +180,13 @@
"from langchain_core.runnables import RunnableConfig\n",
"\n",
"tools_by_name = {tool.name: tool for tool in tools}\n",
"\n",
"\n",
"# Define our tool node\n",
"def tool_node(state: AgentState):\n",
" outputs = []\n",
" for tool_call in state['messages'][-1].tool_calls:\n",
" tool_result = tools_by_name[tool_call[\"name\"]].invoke(\n",
" tool_call[\"args\"]\n",
" )\n",
" for tool_call in state[\"messages\"][-1].tool_calls:\n",
" tool_result = tools_by_name[tool_call[\"name\"]].invoke(tool_call[\"args\"])\n",
" outputs.append(\n",
" ToolMessage(\n",
" content=json.dumps(tool_result),\n",
@@ -161,17 +196,21 @@
" )\n",
" return {\"messages\": outputs}\n",
"\n",
"\n",
"# Define the node that calls the model\n",
"def call_model(\n",
" state: AgentState,\n",
" config: RunnableConfig,\n",
"):\n",
" # this is similar to customizing the create_react_agent with state_modifier, but is a lot more flexible\n",
" system_prompt = SystemMessage(\"You are a helpful AI assistant, please respond to the users query to the best of your ability!\")\n",
" response = model.invoke([system_prompt] + state['messages'], config)\n",
" system_prompt = SystemMessage(\n",
" \"You are a helpful AI assistant, please respond to the users query to the best of your ability!\"\n",
" )\n",
" response = model.invoke([system_prompt] + state[\"messages\"], config)\n",
" # We return a list, because this will get added to the existing list\n",
" return {\"messages\": [response]}\n",
"\n",
"\n",
"# Define the conditional edge that determines whether to continue or not\n",
"def should_continue(state: AgentState):\n",
" messages = state[\"messages\"]\n",
@@ -195,7 +234,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 7,
"metadata": {},
"outputs": [
{
@@ -272,7 +311,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 8,
"metadata": {},
"outputs": [
{
@@ -284,8 +323,8 @@
"what is the weather in sf\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"Tool Calls:\n",
" get_weather (call_iXNCfcUUc7rkgLYbDBYkPZYM)\n",
" Call ID: call_iXNCfcUUc7rkgLYbDBYkPZYM\n",
" get_weather (call_azW0cQ4XjWWj0IAkWAxq9nLB)\n",
" Call ID: call_azW0cQ4XjWWj0IAkWAxq9nLB\n",
" Args:\n",
" location: San Francisco\n",
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
@@ -294,7 +333,7 @@
"\"It's sunny in San Francisco, but you better look out if you're a Gemini \\ud83d\\ude08.\"\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"The weather in San Francisco is sunny. However, it seems there's a playful warning for Geminis—so keep an eye out!\n"
"The weather in San Francisco is sunny! However, it seems there's a playful warning for Geminis. Enjoy the sunshine!\n"
]
}
],
@@ -308,6 +347,7 @@
" else:\n",
" message.pretty_print()\n",
"\n",
"\n",
"inputs = {\"messages\": [(\"user\", \"what is the weather in sf\")]}\n",
"print_stream(graph.stream(inputs, stream_mode=\"values\"))"
]
@@ -322,7 +362,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@@ -336,9 +376,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
@@ -17,9 +17,43 @@
"source": [
"# How to return structured output with a ReAct style agent\n",
"\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#structured-output\">\n",
" Structured Output\n",
" </a>\n",
" </li> \n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/agentic_concepts/#tool-calling-agent\">\n",
" Tool calling agent\n",
" </a>\n",
" </li> \n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#chat-models\">\n",
" Chat Models\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#messages\">\n",
" Messages\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/low_level/\">\n",
" LangGraph Glossary\n",
" </a>\n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"You might want your agent to return its output in a structured format. For example, if the output of the agent is used by some other downstream software, you may want the output to be in the same structured format every time the agent is invoked to ensure consistency.\n",
"\n",
"This notebook will walk through two different options for forcing a function calling agent to structure its output. We will be using a basic [ReAct agent](https://langchain-ai.github.io/langgraph/how-tos/create-react-agent/) (a model node and a tool-calling node) together with a third node at the end that will format response for the user. Both of the options will use the same graph structure as shown in the diagram below, but will have different mechanisms under the hood.\n",
"This notebook will walk through two different options for forcing a tool calling agent to structure its output. We will be using a basic [ReAct agent](https://langchain-ai.github.io/langgraph/how-tos/create-react-agent/) (a model node and a tool-calling node) together with a third node at the end that will format response for the user. Both of the options will use the same graph structure as shown in the diagram below, but will have different mechanisms under the hood.\n",
"\n",
"![react_diagrams.png](attachment:59e8ed35-f2b4-421e-8d21-880e7ab31e5f.png)\n",
"\n",
@@ -112,22 +146,28 @@
"outputs": [],
"source": [
"from pydantic import BaseModel, Field\n",
"from typing import Literal\n",
"from typing import Literal\n",
"from langchain_core.tools import tool\n",
"from langchain_anthropic import ChatAnthropic\n",
"from langgraph.graph import MessagesState\n",
"\n",
"\n",
"class WeatherResponse(BaseModel):\n",
" \"\"\"Respond to the user with this\"\"\"\n",
"\n",
" temperature: float = Field(description=\"The temperature in fahrenheit\")\n",
" wind_directon: str = Field(description=\"The direction of the wind in abbreviated form\")\n",
" wind_directon: str = Field(\n",
" description=\"The direction of the wind in abbreviated form\"\n",
" )\n",
" wind_speed: float = Field(description=\"The speed of the wind in km/h\")\n",
"\n",
"# Inherit 'messages' key from MessagesState, which is a list of chat messages \n",
"\n",
"# Inherit 'messages' key from MessagesState, which is a list of chat messages\n",
"class AgentState(MessagesState):\n",
" # Final structured response from the agent\n",
" final_response: WeatherResponse\n",
"\n",
"\n",
"@tool\n",
"def get_weather(city: Literal[\"nyc\", \"sf\"]):\n",
" \"\"\"Use this to get weather information.\"\"\"\n",
@@ -137,11 +177,12 @@
" return \"It is 75 degrees and sunny in SF, with 3 mph winds in the South-East direction\"\n",
" else:\n",
" raise AssertionError(\"Unknown city\")\n",
" \n",
"\n",
"\n",
"tools = [get_weather]\n",
" \n",
"\n",
"model = ChatAnthropic(model=\"claude-3-opus-20240229\")\n",
" \n",
"\n",
"model_with_tools = model.bind_tools(tools)\n",
"model_with_structured_output = model.with_structured_output(WeatherResponse)"
]
@@ -170,33 +211,40 @@
"\n",
"tools = [get_weather, WeatherResponse]\n",
"\n",
"# Force the model to use tools by passing tool_choice=\"any\" \n",
"model_with_response_tool = model.bind_tools(tools,tool_choice=\"any\")\n",
"# Force the model to use tools by passing tool_choice=\"any\"\n",
"model_with_response_tool = model.bind_tools(tools, tool_choice=\"any\")\n",
"\n",
"\n",
"# Define the function that calls the model\n",
"def call_model(state: AgentState):\n",
" response = model_with_response_tool.invoke(state['messages'])\n",
" response = model_with_response_tool.invoke(state[\"messages\"])\n",
" # We return a list, because this will get added to the existing list\n",
" return {\"messages\": [response]}\n",
"\n",
"\n",
"# Define the function that responds to the user\n",
"def respond(state: AgentState):\n",
" # Construct the final answer from the arguments of the last tool call\n",
" response = WeatherResponse(**state['messages'][-1].tool_calls[0]['args'])\n",
" response = WeatherResponse(**state[\"messages\"][-1].tool_calls[0][\"args\"])\n",
" # We return the final answer\n",
" return {\"final_response\": response}\n",
"\n",
"\n",
"# Define the function that determines whether to continue or not\n",
"def should_continue(state: AgentState):\n",
" messages = state[\"messages\"]\n",
" last_message = messages[-1]\n",
" # If there is only one tool call and it is the response tool call we respond to the user\n",
" if len(last_message.tool_calls) == 1 and last_message.tool_calls[0]['name'] == \"WeatherResponse\":\n",
" if (\n",
" len(last_message.tool_calls) == 1\n",
" and last_message.tool_calls[0][\"name\"] == \"WeatherResponse\"\n",
" ):\n",
" return \"respond\"\n",
" # Otherwise we will use the tool node again\n",
" else:\n",
" return \"continue\"\n",
"\n",
"\n",
"# Define a new graph\n",
"workflow = StateGraph(AgentState)\n",
"\n",
@@ -239,7 +287,9 @@
"metadata": {},
"outputs": [],
"source": [
"answer = graph.invoke(input={\"messages\": [(\"human\", \"what's the weather in SF?\")]})['final_response']"
"answer = graph.invoke(input={\"messages\": [(\"human\", \"what's the weather in SF?\")]})[\n",
" \"final_response\"\n",
"]"
]
},
{
@@ -292,21 +342,26 @@
"from langgraph.prebuilt import ToolNode\n",
"from langchain_core.messages import HumanMessage\n",
"\n",
"\n",
"# Define the function that calls the model\n",
"def call_model(state: AgentState):\n",
" response = model_with_tools.invoke(state['messages'])\n",
" response = model_with_tools.invoke(state[\"messages\"])\n",
" # We return a list, because this will get added to the existing list\n",
" return {\"messages\": [response]}\n",
"\n",
"\n",
"# Define the function that responds to the user\n",
"def respond(state: AgentState):\n",
" # We call the model with structured output in order to return the same format to the user every time\n",
" # state['messages'][-2] is the last ToolMessage in the convo, which we convert to a HumanMessage for the model to use\n",
" # We could also pass the entire chat history, but this saves tokens since all we care to structure is the output of the tool\n",
" response = model_with_structured_output.invoke([HumanMessage(content=state['messages'][-2].content)])\n",
" response = model_with_structured_output.invoke(\n",
" [HumanMessage(content=state[\"messages\"][-2].content)]\n",
" )\n",
" # We return the final answer\n",
" return {\"final_response\": response}\n",
"\n",
"\n",
"# Define the function that determines whether to continue or not\n",
"def should_continue(state: AgentState):\n",
" messages = state[\"messages\"]\n",
@@ -318,6 +373,7 @@
" else:\n",
" return \"continue\"\n",
"\n",
"\n",
"# Define a new graph\n",
"workflow = StateGraph(AgentState)\n",
"\n",
@@ -361,7 +417,9 @@
"metadata": {},
"outputs": [],
"source": [
"answer = graph.invoke(input={\"messages\": [(\"human\", \"what's the weather in SF?\")]})['final_response']"
"answer = graph.invoke(input={\"messages\": [(\"human\", \"what's the weather in SF?\")]})[\n",
" \"final_response\"\n",
"]"
]
},
{
@@ -408,7 +466,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
+52 -36
View File
@@ -6,11 +6,35 @@
"source": [
"# How to control graph recursion limit\n",
"\n",
"You can set the graph recursion limit when invoking or streaming the graph. The recursion limit sets the number of supersteps that the graph is allowed to execute before it raises an error. Read more about the concept of recursion limits [here](https://langchain-ai.github.io/langgraph/concepts/low_level/#recursion-limit). Let's see an example of this in a simple graph with parallel branches to better understand exactly how the recursion limit works.\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraphjs/concepts/low_level/#graphs\">\n",
" Graphs\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/low_level/#recursion-limit\">\n",
" Recursion Limit\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/low_level/#nodes\">\n",
" Nodes\n",
" </a>\n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"\n",
"You can set the graph recursion limit when invoking or streaming the graph. The recursion limit sets the number of **supersteps** that the graph is allowed to execute before it raises an error. Read more about the concept of recursion limits [here](https://langchain-ai.github.io/langgraph/concepts/low_level/#recursion-limit). Let's see an example of this in a simple graph with parallel branches to better understand exactly how the recursion limit works.\n",
"\n",
"If you want to see an example of how you can return the last value of your state instead of receiving a recursion limit error form your graph, read [this how-to](https://langchain-ai.github.io/langgraph/how-tos/return-when-recursion-limit-hits/).\n",
"\n",
"\n",
"## Setup\n",
"\n",
"First, let's install the required packages"
@@ -18,7 +42,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
@@ -47,7 +71,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
@@ -64,21 +88,28 @@
" aggregate: Annotated[list, operator.add]\n",
"\n",
"\n",
"class ReturnNodeValue:\n",
" def __init__(self, node_secret: str):\n",
" self._value = node_secret\n",
"def node_a(state):\n",
" return {\"aggregate\": [\"I'm A\"]}\n",
"\n",
" def __call__(self, state: State) -> Any:\n",
" print(f\"Adding {self._value} to {state['aggregate']}\")\n",
" return {\"aggregate\": [self._value]}\n",
"\n",
"def node_b(state):\n",
" return {\"aggregate\": [\"I'm B\"]}\n",
"\n",
"\n",
"def node_c(state):\n",
" return {\"aggregate\": [\"I'm C\"]}\n",
"\n",
"\n",
"def node_d(state):\n",
" return {\"aggregate\": [\"I'm A\"]}\n",
"\n",
"\n",
"builder = StateGraph(State)\n",
"builder.add_node(\"a\", ReturnNodeValue(\"I'm A\"))\n",
"builder.add_node(\"a\", node_a)\n",
"builder.add_edge(START, \"a\")\n",
"builder.add_node(\"b\", ReturnNodeValue(\"I'm B\"))\n",
"builder.add_node(\"c\", ReturnNodeValue(\"I'm C\"))\n",
"builder.add_node(\"d\", ReturnNodeValue(\"I'm D\"))\n",
"builder.add_node(\"b\", node_b)\n",
"builder.add_node(\"c\", node_c)\n",
"builder.add_node(\"d\", node_d)\n",
"builder.add_edge(\"a\", \"b\")\n",
"builder.add_edge(\"a\", \"c\")\n",
"builder.add_edge(\"b\", \"d\")\n",
@@ -89,7 +120,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"metadata": {},
"outputs": [
{
@@ -120,17 +151,13 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Adding I'm A to []\n",
"Adding I'm B to [\"I'm A\"]\n",
"Adding I'm C to [\"I'm A\"]\n",
"Adding I'm D to [\"I'm A\", \"I'm B\", \"I'm C\"]\n",
"Recursion Error\n"
]
}
@@ -139,7 +166,7 @@
"from langgraph.errors import GraphRecursionError\n",
"\n",
"try:\n",
" graph.invoke({\"aggregate\": []},{\"recursion_limit\":3})\n",
" graph.invoke({\"aggregate\": []}, {\"recursion_limit\": 3})\n",
"except GraphRecursionError:\n",
" print(\"Recursion Error\")"
]
@@ -153,23 +180,12 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Adding I'm A to []\n",
"Adding I'm B to [\"I'm A\"]\n",
"Adding I'm C to [\"I'm A\"]\n",
"Adding I'm D to [\"I'm A\", \"I'm B\", \"I'm C\"]\n"
]
}
],
"outputs": [],
"source": [
"try:\n",
" graph.invoke({\"aggregate\": []},{\"recursion_limit\":4})\n",
" graph.invoke({\"aggregate\": []}, {\"recursion_limit\": 4})\n",
"except GraphRecursionError:\n",
" print(\"Recursion Error\")"
]
@@ -200,7 +216,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
@@ -6,6 +6,30 @@
"source": [
"# How to return state before hitting recursion limit\n",
"\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraphjs/concepts/low_level/#graphs\">\n",
" Graphs\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/low_level/#recursion-limit\">\n",
" Recursion Limit\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/low_level/#nodes\">\n",
" Nodes\n",
" </a>\n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"[Setting the graph recursion limit](https://langchain-ai.github.io/langgraph/how-tos/recursion-limit/) can help you control how long your graph will stay running, but if the recursion limit is hit your graph returns an error - which may not be ideal for all use cases. Instead you may wish to return the value of the state *just before* the recursion limit is hit. This how-to will show you how to do this."
]
},
@@ -51,7 +75,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
@@ -59,35 +83,40 @@
"from langgraph.graph import StateGraph\n",
"from langgraph.graph import START, END\n",
"\n",
"\n",
"class State(TypedDict):\n",
" value: str\n",
" action_result: str\n",
"\n",
"\n",
"def router(state: State):\n",
" if state['value'] == \"end\":\n",
" return \"__end__\"\n",
" if state[\"value\"] == \"end\":\n",
" return END\n",
" else:\n",
" return \"action\"\n",
"\n",
"\n",
"def decision_node(state):\n",
" return {'value':'keep going!'}\n",
" return {\"value\": \"keep going!\"}\n",
"\n",
"\n",
"def action_node(state: State):\n",
" # Do your action here ...\n",
" return {'action_result':'what a great result!'}\n",
" return {\"action_result\": \"what a great result!\"}\n",
"\n",
"\n",
"workflow = StateGraph(State)\n",
"workflow.add_node('decision',decision_node)\n",
"workflow.add_node('action',action_node)\n",
"workflow.add_edge(START,'decision')\n",
"workflow.add_conditional_edges('decision',router)\n",
"workflow.add_edge('action','decision')\n",
"workflow.add_node(\"decision\", decision_node)\n",
"workflow.add_node(\"action\", action_node)\n",
"workflow.add_edge(START, \"decision\")\n",
"workflow.add_conditional_edges(\"decision\", router, [\"action\", END])\n",
"workflow.add_edge(\"action\", \"decision\")\n",
"app = workflow.compile()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 2,
"metadata": {},
"outputs": [
{
@@ -116,7 +145,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 3,
"metadata": {},
"outputs": [
{
@@ -131,7 +160,7 @@
"from langgraph.errors import GraphRecursionError\n",
"\n",
"try:\n",
" app.invoke({\"value\":\"hi!\"})\n",
" app.invoke({\"value\": \"hi!\"})\n",
"except GraphRecursionError:\n",
" print(\"Recursion Error\")"
]
@@ -153,7 +182,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
@@ -168,40 +197,45 @@
" def __call__(self, step: int) -> bool:\n",
" limit = self.config.get(\"recursion_limit\", 0)\n",
" return step >= limit - 2\n",
" \n",
"\n",
"\n",
"class State(TypedDict):\n",
" value: str\n",
" action_result: str\n",
" is_last_step: Annotated[bool, IsLastOrSecondToLastStepManager]\n",
"\n",
"\n",
"def router(state: State):\n",
" # Force the agent to end if it is on the last step\n",
" if state['is_last_step']:\n",
" return \"__end__\"\n",
" if state['value'] == \"end\":\n",
" return \"__end__\"\n",
" if state[\"is_last_step\"]:\n",
" return END\n",
" if state[\"value\"] == \"end\":\n",
" return END\n",
" else:\n",
" return \"action\"\n",
"\n",
"\n",
"def decision_node(state):\n",
" return {'value':'keep going!'}\n",
" return {\"value\": \"keep going!\"}\n",
"\n",
"\n",
"def action_node(state: State):\n",
" # Do your action here ...\n",
" return {'action_result':'what a great result!'}\n",
" return {\"action_result\": \"what a great result!\"}\n",
"\n",
"\n",
"workflow = StateGraph(State)\n",
"workflow.add_node('decision',decision_node)\n",
"workflow.add_node('action',action_node)\n",
"workflow.add_edge(START,'decision')\n",
"workflow.add_conditional_edges('decision',router)\n",
"workflow.add_edge('action','decision')\n",
"workflow.add_node(\"decision\", decision_node)\n",
"workflow.add_node(\"action\", action_node)\n",
"workflow.add_edge(START, \"decision\")\n",
"workflow.add_conditional_edges(\"decision\", router, [\"action\", END])\n",
"workflow.add_edge(\"action\", \"decision\")\n",
"app = workflow.compile()"
]
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 5,
"metadata": {},
"outputs": [
{
@@ -210,13 +244,13 @@
"{'value': 'keep going!', 'action_result': 'what a great result!'}"
]
},
"execution_count": 25,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"app.invoke({\"value\":\"hi!\"})"
"app.invoke({\"value\": \"hi!\"})"
]
},
{
@@ -229,7 +263,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@@ -243,9 +277,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
+96 -19
View File
@@ -4,11 +4,70 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# How to pass custom LangSmith run ID for graph runs\n",
"# How to pass custom run ID or set tags and metadata for graph runs in LangSmith\n",
"\n",
"Debugging your graph runs can sometimes be difficult to do in your IDE or terminal. LangSmith lets you use trace data to debug, test, and monitor your LLM apps built with LangGraph — read more about how to get started <a href=\"https://docs.smith.langchain.com\">here</a>.\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://docs.smith.langchain.com\">\n",
" LangSmith Documentation\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://smith.langchain.com\">\n",
" LangSmith Platform\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.config.RunnableConfig.html#langchain_core.runnables.config.RunnableConfig\">\n",
" RunnableConfig\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://docs.smith.langchain.com/how_to_guides/tracing/trace_with_langchain#add-metadata-and-tags-to-traces\">\n",
" Add metadata and tags to traces\n",
" </a> \n",
" </li>\n",
" <li>\n",
" <a href=\"https://docs.smith.langchain.com/how_to_guides/tracing/trace_with_langchain#customize-run-name\">\n",
" Customize run name\n",
" </a> \n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"By default LangSmith assigns random UUIDs as `run_id` to each new graph run. However, you might want to provide a custom ID to make it easier to find a particular run in LangSmith. This guide shows how you can do so.\n",
"Debugging graph runs can sometimes be difficult to do in an IDE or terminal. [LangSmith](https://docs.smith.langchain.com) lets you use trace data to debug, test, and monitor your LLM apps built with LangGraph — read the [LangSmith documentation](https://docs.smith.langchain.com) for more information on how to get started.\n",
"\n",
"To make it easier to identify and analyzed traces generated during graph invocation, you can set additional configuration at run time (see [RunnableConfig](https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.config.RunnableConfig.html#langchain_core.runnables.config.RunnableConfig)):\n",
"\n",
"| **Field** | **Type** | **Description** |\n",
"|-------------|---------------------|--------------------------------------------------------------------------------------------------------------------|\n",
"| run_name | `str` | Name for the tracer run for this call. Defaults to the name of the class. |\n",
"| run_id | `UUID` | Unique identifier for the tracer run for this call. If not provided, a new UUID will be generated. |\n",
"| tags | `List[str]` | Tags for this call and any sub-calls (e.g., a Chain calling an LLM). You can use these to filter calls. |\n",
"| metadata | `Dict[str, Any]` | Metadata for this call and any sub-calls (e.g., a Chain calling an LLM). Keys should be strings, values should be JSON-serializable. |\n",
"\n",
"LangGraph graphs implement the [LangChain Runnable Interface](https://python.langchain.com/api_reference/core/runnables/langchain_core.runnables.base.Runnable.html) and accept a second argument (`RunnableConfig`) in methods like `invoke`, `ainvoke`, `stream` etc.\n",
"\n",
"The LangSmith platform will allow you to search and filter traces based on `run_name`, `run_id`, `tags` and `metadata`.\n",
"\n",
"\n",
"## TLDR\n",
"\n",
"```python\n",
"import uuid\n",
"# Generate a random UUID -- it must be a UUID\n",
"config = {\"run_id\": uuid.uuid4()}, \"tags\": [\"my_tag1\"], \"metadata\": {\"a\": 5}}\n",
"# Works with all standard Runnable methods \n",
"# like invoke, batch, ainvoke, astream_events etc\n",
"graph.stream(inputs, config, stream_mode=\"values\")\n",
"```\n",
"\n",
"The rest of the how to guide will show a full agent.\n",
"\n",
"## Setup\n",
"\n",
@@ -17,7 +76,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 28,
"metadata": {},
"outputs": [],
"source": [
@@ -27,7 +86,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 29,
"metadata": {},
"outputs": [],
"source": [
@@ -44,6 +103,18 @@
"_set_env(\"LANGSMITH_API_KEY\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Set up <a href=\"https://smith.langchain.com\">LangSmith</a> for LangGraph development</p>\n",
" <p style=\"padding-top: 5px;\">\n",
" Sign up for LangSmith to quickly spot issues and improve the performance of your LangGraph projects. LangSmith lets you use trace data to debug, test, and monitor your LLM apps built with LangGraph — read more about how to get started <a href=\"https://docs.smith.langchain.com\">here</a>. \n",
" </p>\n",
"</div> "
]
},
{
"cell_type": "markdown",
"metadata": {},
@@ -55,7 +126,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 26,
"metadata": {},
"outputs": [],
"source": [
@@ -102,7 +173,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 27,
"metadata": {},
"outputs": [
{
@@ -114,8 +185,8 @@
"what is the weather in sf\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"Tool Calls:\n",
" get_weather (call_qpjGVrF4bNSJ5NarwjH2FTBJ)\n",
" Call ID: call_qpjGVrF4bNSJ5NarwjH2FTBJ\n",
" get_weather (call_9ZudXyMAdlUjptq9oMGtQo8o)\n",
" Call ID: call_9ZudXyMAdlUjptq9oMGtQo8o\n",
" Args:\n",
" city: sf\n",
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
@@ -129,6 +200,9 @@
}
],
"source": [
"import uuid\n",
"\n",
"\n",
"def print_stream(stream):\n",
" for s in stream:\n",
" message = s[\"messages\"][-1]\n",
@@ -136,16 +210,19 @@
" print(message)\n",
" else:\n",
" message.pretty_print()\n",
"\n",
"\n",
"inputs = {\"messages\": [(\"user\", \"what is the weather in sf\")]}\n",
"config = {\"configurable\": {\"run_id\":\"12345\"}}\n",
"\n",
"config = {\"run_name\": \"agent_007\", \"tags\": [\"cats are awesome\"]}\n",
"\n",
"print_stream(graph.stream(inputs, config, stream_mode=\"values\"))"
]
},
{
"attachments": {
"langsmith_filter_run_id.png": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA8AAAAPOCAYAAADA3HHrAAAMQGlDQ1BJQ0MgUHJvZmlsZQAASImVVwdYU8kWnluSkEAIEEBASuhNEJESQEoILYD0LiohCRBKjIGgYkcXFVy7WMCGrooodpoFRewsir0vFhSUdbFgV96kgK77yvfm++bOf/85858z587cewcA2gmuWJyLagCQJyqQxAT7M5KSUxikbkAEGFAFeoDG5eWLWVFR4QCWwfbv5d0NgMjaqw4yrX/2/9eiyRfk8wBAoiBO5+fz8iA+BABeyRNLCgAg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jpJAQgAAEIQAACEIAABCAAAQggADMHIAABCEAAAhCAAAQgAAEIQKBYEEAALhbDTCchAAEIQAACEIAABCAAAQhAAAGYOQABCEAAAhCAAAQgAAEIQAACxYIAAnCxGGY6CQEIQAACEIAABCAAAQhAAAIIwMwBCEAAAhCAAAQgAAEIQAACECgWBBCAi8Uw00kIQAACEIAABCAAAQhAAAIQQABmDkAAAhCAAAQgAAEIQAACEIBAsSCAAFwshplOQgACEIAABCAAAQhAAAIQgAACMHMAAhCAAAQgAAEIQAACEIAABIoFAQTgYjHMdBICEIAABCAAAQhAAAIQgAAEEICZAxCAAAQgAAEIQAACLine truncated
"d38d1f2b-0f4c-4707-b531-a3c749de987f.png": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABUAAAAHACAIAAADsm1WnAAAAA3NCSVQICAjb4U/gAAAgAElEQVR4XuydB5RURdqGnUTOOUgSBcmgIgiiEiQpiAQRUBFB17y6uuuuYf81u66rrhkUsyhKjiKIBMlBSSIqURBEchjCpP/pqba4dqK7p3ume+btM4fT1K34VN3b96svVEL58pXO0EcEREAEREAEREAEREAEREAEREAERCC2CSTGdvfUOxEQAREQAREQAREQAREQAREQAREQARcBCfBaByIgAiIgAiIgAiIgAiIgAiIgAiIQBwQkwMfBJKmLIiACIiACIiACIiACIiACIiACIiABXmtABERABERABERABERABERABERABOKAgAT4OJgkdVEEREAEREAEREAEREAEREAEREAEJMBrDYiACIiACIiACIiACIiACIiACIhAHBCQAB8Hk6QuioAIiIAIiIAIiIAIiIAIiIAIiIAEeK0BERABERABERABERABERABERABEYgDAhLg42CS1EUREAEREAEREAEREAEREAEREAERkACvNSACIiACIiACIiACIiACIiACIiACcUBAAnwcTJK6KAIiIAIiIAIiIAIiIAIiIAIiIAIS4LUGREAEREAEREAEREAEREAEREAERCAOCEiAj4NJUhdFQAREQAREQAREQAREQAREQAREQAK81oAIiIAIiIAIiIAIiIAIiIAIiIAIxAEBCfBxMEnqogiIgAiIgAiIgAiIgAiIgAiIgAhIgNcaEAEREAEREAEREAEREAEREAEREIE4ICABPg4mSV0UAREQAREQAREQAREQAREQAREQAQnwWgMiIAIiIAIiIAIiIAIiIAIiIAIiEAcEJMDHwSSpiyIgAiIgAiIgAiIgAiIgAiIgAiIgAV5rQAREQAREQAREQAREQAREQAREQATigIAE+DiYJHVRBERABERABERABERABERABERABCTAaw2IgAiIgAiIgAiIgAiIgAiIgAiIQBwQkAAfB5OkLoqACIiACIiACIiACIiACIiACIiABHitAREQAREQAREQAREQAREQAREQARGIAwIS4ONgktRFERABERABERABERABERABERABEZAArzUgAiIgAiIgAiIgAiIgAiIgAiIgAnFAQAJ8HEySuigCIiACIiACIiACIiACIiACIiACEuC1BkRABERABERABERABERABERABEQgDghIgI+DSVIXRUAEREAEREAEREAEREAEREAERCCpWLHioiACIiAC+ZJAuXJle/XqVaFC+S1btubLAWpQIiACIiACIiACIiACBYpAcrRH+9hj/ype3PceQVZWVmrqsd9++239+vULFy5KTU2NdmcKYP2NGjW66aYbwxv4Aw/8Iz093ZTt3r1bx44d+D5v3vyJEyeFV2G8l+ratcvll3diFF9//fX48RPjfTim/xUrVvz73/9mx7Jo0eIxY8YGP7SmTZsOHny9zT9hwsT5878OvnhUcyK9z537VdWqVWnlf/976fHHn4xqc/mj8pIlS7LIu3XrWqdO7UqVKiUkJOzevXvz5i2ffz5jxowvDh8+nD+GqVGIgAiIgAiIgAiIQJwSiLoAf+211/IafVo6x44dGzXq4yeeeEoviKdlFVKGWrVqDh58Q0hFbOYHH3zYCvAXXHC+qef48RMFVoA/77zzDASw5BsBvkyZMs4V0qVL5/HjJ2RkZAS5Zm6//da+ffvYzD/++GPsCPBt2rQx0jvd69u3rwT4wHOalJQ0ZMiN//jHA6VLl3bmhGGzZs169brq4MGDTz/973feeTf45RG4RV0VAREQAREQAREQAREIlUCs+MAXLVp06NCb5s2bc955LUIdg/KLgAhEikCVKlU6deoYZG2lSpW68sorgsyc+9nWrFlz/Phx0+7SpUs9OvD888/NmDGdv4svbpv7fYu1FpOTk99++61nnnnKKb2fdH3SbFe5RIa33hqBqB/Z/lOhmQv+ZVFFtnLVJgIiIAIiIAIiIAL5iUDUNfAhwapR48xRoz5s377Tzp07QyqozP4ILF26rH//Ad5XGzdu/MgjD5l0nxm4lJZ26t3duwal5FcC1103CGPpYEbXp0/vIkWKBJMzT/Js3brtyiuvGjCg/86du0aMeNOjD/Xr1z///PNILFeuXJ50L6Ya/c9/nr3iiu6mS8uXr3jjjeHz5s3bt28/KZUrV77sskvvuOP2hg0b8N8ePa5EjP/rXx+IYP8x1DdzQZ0pKbH1qxTBYaoqERABERABERABEcg5gVx9VcJ9+tln/2M7jW981apVOnbsyItjYqLbFqBChQr/+98L11xzbc7HphogsGfPni+/nO2NwtrGc8lnBu8iSsnfBLZv34G3S7FixXCBxvkZz+fTjve66waaPOvWfdeoUcPT5s/9DN9mf3K/3fhqkUAG118/yPT5lVdeffTRxwlQYofw66+/jh796dix47BZGDjQtRt4442D3333PSY9voap3oqACIiACIiACIhAPiCQqyb0e/fuW7x4if1Dbvzww1FDhgzt2fNqa+kK0w4d2terd04+gKshiEAcEcCx2SjesaYeMOD0O2hI7LhGM8D167//+eef42ik6qoHgb59e5uUVatW/etfjzmld5uTLb+//OX+LVu2kILCvHfvq4VRBERABERABERABEQg9wnkqgbe3/AWL178/PMvPPjgP2wGAp7/8MOP5r+FCqU0bNjIXuIN8sCBA95VIfPbI/H279+/deupU6Nq1qxRrlx5U2Tv3j0//7zdfK9duzax2TCgRU39448/4THrXa13CgalzZs3q1ixQtGixWho+/btK1asLIDW5rzEt2jRHCmucOEi6OjQc1qw3tDOOecccxjBhg0bCFhIhjp16gC/WrVqx48fGz7c07yZDIUKFSIgwtln12Va4bxu3ToERZ+ihXdz9I310LBhw/Lly3O6AR4Za9eu47wD75w+U+rWrcsUU5aQij/99BMWxUG2a2o7++yzMTYmujsOxJBZsmQp0b98NhRTiZguE57w6qt70StU6y+99HLgUQ8a5Fa/T5w4sWXLlkGOpUSJEsx7rV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u58YFb/55oh3330bZ1EP6Z3M6JY5fmnevK8KSAh9dkM+/vhDp/QOBLAQ6Wr27FnIKt4AbQqC3+TJE666qqeNeuCRGXXr1KmTEAA8pHeyIZM//vhjkyZN8HjjtzXQpa+/nvvAA3/zkN5N9y65pN3UqZMDmP7S6LhxYzykd8pS7Zgxn+LZEWBcDIctpDffHO7t/cHi4QiuWbO+iE0vcTuopKRkhKXp0z83Kddff12A8Xbv3t0cD4kCHX2yU4Pqs1T79pfNnz8HD2oP6Z3MqMRxrubWQ03qs6xJZIH5W3hMDQuvfv16AYqHd4necte/8cZrHtI7tbHfwUbA3LmzWcyBK0ctPGXKJCu9B86cJ1fZGjPtej8VQ+oPTF577RWkaA/pnUp4SP7pTzfPmfMl9hch1RnxzDw9eA54j5Qnz5NPPoGczyZgxBtVhSIgAiIgAiIgAiIQKQKxooE3Rq12VMeOpUZqhB71IGjximmMcr2bQLz/z3/+jc2zcfW0GR577F8eWjvUqocPHylb9pSKGNtaQui3bXvJ3r17vWvONykYL9x44w0otGfP/mr27Nl79uytXr167969CGvPGDGsRdrp0OFyf8aod911J0azFF+yZMnq1Wswpzcmr4YPxadPn8oOC/9FD4YlxaJFi4mmhkDeuXNn1OOkt2x5wUcffdCjx1VGNWfBli9fbvz4sVZ0J9TC5MmTt2zZilDB1gziKGo3viNdfPvtKpTqHjNChoceetAk0qtPPhmN1T2hGbC8vfbaa9Aev/76a7NmzfI3Line truncated
}
},
"cell_type": "markdown",
@@ -153,23 +230,23 @@
"source": [
"## View the trace in LangSmith\n",
"\n",
"Now that we've ran our graph, let's head over to LangSmith and view our trace. First click into the project that you traced to (in our case the default project). Next, let's add a filter to search for the run with the id (\"12345\") that we set above. You can do this by clicking the filter button which is near the top left of the project view (right under the \"Runs\" tab), you will then want to set a filter that looks something like this:\n",
"Now that we've ran our graph, let's head over to LangSmith and view our trace. First click into the project that you traced to (in our case the default project). You should see a run with the custom run name \"agent_007\".\n",
"\n",
"![langsmith_filter_run_id.png](attachment:langsmith_filter_run_id.png)"
"![image.png](attachment:d38d1f2b-0f4c-4707-b531-a3c749de987f.png)"
]
},
{
"attachments": {
"langsmith_graph_trace.png": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAADPgAAAbgCAYAAABHngwAAAAMQGlDQ1BJQ0MgUHJvZmlsZQAASImVVwdYU8kWnluSkEAIEEBASuhNEJESQEoILYD0LiohCRBKjIGgYkcXFVy7WMCGrooodpoFRewsir0vFhSUdbFgV96kgK77yvfm++bOf/85858z587cewcA2gmuWJyLagCQJyqQxAT7M5KSUxikbkAEGFAFeoDG5eWLWVFR4QCWwfbv5d0NgMjaqw4yrX/2/9eiyRfk8wBAoiBO5+fz8iA+BABeyRNLCgAgynjzKQViGYYVaEtggBAvlOFMBa6U4XQF3ie3iYthQ9wKgIoalyvJBED9MuQZhbxMqKHeB7GTiC8UAUBjQOyTlzeJD3EaxDbQRgyxTJ+Z/oNO5t8004c0udzMIayYi7yoBAjzxbncaf9nOv53ycuVDvqwglUtSxISI5szzNutnElhMqwGca8oPSISYi2IPwj5cnuIUUqWNCReYY8a8vLZMGdAF2InPjcgDGJDiINEuRHhSj49QxjEgRiuEHSqsIATB7EexAsF+YGxSpvNkkkxSl9oXYaEzVLy57gSuV+ZrwfSnHiWUv91loCj1MfUi7LiEiGmQGxRKEyIgFgdYsf8nNgwpc2Yoix2xKCNRBoji98C4hiBKNhfoY8VZkiCYpT2pXn5g/PFNmcJORFKfKAgKy5EkR+slceVxw/ngl0WiFjxgzqC/KTwwbnwBQGBirlj3QJRfKxS54O4wD9GMRaniHOjlPa4mSA3WMabQeySXxirHIsnFMAFqdDHM8QFUXGKOPGibG5olCIefBkIB2wQABhACms6mASygbC9t74X3il6ggAXSEAmEAAHJTM4IlHeI4LXWFAE/oRIAPKHxvnLewWgEPJfh1jF1QFkyHsL5SNywFOI80AYyIX3Uvko0ZC3BPAEMsJ/eOfCyoPx5sIq6//3/CD7nWFBJlzJSAc9MmiDlsRAYgAxhBhEtMUNcB/cCw+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nxIzphqBwAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAM+KADAAQAAAABAAAG4AAAAAC6cEr6AABAAElEQVR4AeydB3wU1fbHb3pC772EIqCIFMGKUlRQefYGYu9i91mfvXd96rP3gg17RVFsfws2BEGl9yKdhBBS939+d3Mns7Ozmy2zm034nc8nmXbrd+7cmb33nnPSWrZs41M2admqtT5av26t7Sx3SYAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAEvCDQv/8ukkya+uqrL9ROO+2k0r1IlGmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAlESiAtICAVfAJw8IAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAEkkuACj7J5c3cSIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAEtnsCPk0gLS1N+Xw+RQWf7b5BEAAJkAAJkAAJkAAJkAAJLine truncated
"410e0089-2ab8-46bb-a61a-827187fd46b3.png": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA2AAAALMCAIAAAANWUbSAAAAA3NCSVQICAjb4U/gAAAgAElEQVR4XuydB3wU1dbASS8QWkLvvfcOAtIRRUAUUSzYBbE+y3s+P312n90nig2lKL0ogiIgTZAuAqL0Jr1DQnr5/psbLpNtmW3JbnL2t+Lmzq3/uTNz5txzzg2KjS1fTD5CQAgIASEgBISAEBACQuAygWBBIQSEgBAQAkJACAgBISAEjAREQJT5IASEgBAQAkJACAgBIZCLgAiIMiGEgBAQAkJACAgBISAEchEQAVEmhBAQAkJACAgBISAEhEAuAiIgyoQQAkJACAgBISAEhIAQyEVABESZEEJACAgBIS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JQKia2epbt36NWtaDC75cJ91rbDk9jMC2OchNWqZqXGjpvoh6t2eKmcy79ZpsjZeI1f+skxlLls2FnMUkwUlWz4QOHnyxOnTFnutsLDwFi3aOGqxQYNGONBwFGtF23cAR6V0+sCBN+gllBkzpvAWZJQOyYZyYd261V999anSMpC5e3eL6iHQPwWpQby46feMhEvBl9dk3UOZfPhoeoI7RmD4Line truncated
}
},
"cell_type": "markdown",
"metadata": {},
"source": [
"After setting the filter, you will see the corresponding graph run show up, and you can click on it to give you a more detailed view, which would look like this for the case above:\n",
"In addition, you will be able to filter traces after the fact using the tags or metadata provided. For example,\n",
"\n",
"![langsmith_graph_trace.png](attachment:langsmith_graph_trace.png)"
"![image.png](attachment:410e0089-2ab8-46bb-a61a-827187fd46b3.png)\n"
]
}
],
@@ -189,7 +266,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
+173 -331
View File
@@ -7,13 +7,56 @@
"source": [
"# How to use Pydantic model as state\n",
"\n",
"Every [StateGraph](https://langchain-ai.github.io/langgraph/reference/graphs/#langgraph.graph.StateGraph) is a state machine. When initializing, it accepts a `state_schema` that tells it the \"shape\" of its state and how to incorporate updates from the nodes into a shared representation of what work has been done.\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/low_level/#state\">\n",
" State\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/low_level/#nodes\">\n",
" Nodes\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://github.com/pydantic/pydantic\">\n",
" Pydantic\n",
" </a>: this is a popular Python library for run time validation.\n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div>\n",
"\n",
"The `state_schema` can be any [type](https://docs.python.org/3/library/stdtypes.html#type-objects), though we typically use a python-native `TypedDict` in our examples (or in the case of [MessageGraph](https://langchain-ai.github.io/langgraph/reference/graphs/#messagegraph), a [list](https://docs.python.org/3/library/stdtypes.html#list)).\n",
"A [StateGraph](https://langchain-ai.github.io/langgraph/reference/graphs/#langgraph.graph.StateGraph) accepts a `state_schema` argument on initialization that specifies the \"shape\" of the state that the nodes in the graph can access and update.\n",
"\n",
"If you want to apply additional validation on state updates, you could instead opt for a pydantic [BaseModel](https://docs.pydantic.dev/latest/api/base_model/).\n",
"In our examples, we typically use a python-native `TypedDict` for `state_schema` (or in the case of [MessageGraph](https://langchain-ai.github.io/langgraph/reference/graphs/#messagegraph), a [list](https://docs.python.org/3/library/stdtypes.html#list)), but `state_schema` can be any [type](https://docs.python.org/3/library/stdtypes.html#type-objects).\n",
"\n",
"In this example, we will create a ReAct agent using a pydantic base model as the state object. This means all nodes receive an instance of the model as their first arg, and validation is run before each node executes."
"In this how-to guide, we'll see how a [Pydantic BaseModel](https://docs.pydantic.dev/latest/api/base_model/). can be used for `state_schema` to add run time validation on **inputs**.\n",
"\n",
"\n",
"<div class=\"admonition note\">\n",
" <p class=\"admonition-title\">Known Limitations</p>\n",
" <p>\n",
" <ul>\n",
" <li>\n",
" This notebook uses Pydantic v2 <code>BaseModel</code>, which requires <code>langchain-core >= 0.3</code>. Using <code>langchain-core < 0.3</code> will result in errors due to mixing of Pydantic v1 and v2 <code>BaseModels</code>. \n",
" </li> \n",
" <li>\n",
" Currently, the `output` of the graph will **NOT** be an instance of a pydantic model.\n",
" </li>\n",
" <li>\n",
" Run-time validation only occurs on **inputs** into nodes, not on the outputs.\n",
" </li>\n",
" <li>\n",
" The validation error trace from pydantic does not show which node the error arises in.\n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div>"
]
},
{
@@ -28,37 +71,21 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "af4ce0ba-7596-4e5f-8bf8-0b0bd6e62833",
"metadata": {},
"outputs": [],
"source": [
"%%capture --no-stderr\n",
"%pip install --quiet -U langgraph langchain_openai"
]
},
{
"cell_type": "markdown",
"id": "0abe11f4-62ed-4dc4-8875-3db21e260d1d",
"metadata": {},
"source": [
"Next, we need to set API keys for OpenAI (the LLM we will use) and Tavily (the search tool we will use)"
"%pip install --quiet -U langgraph"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "c903a1cf-2977-4e2d-ad7d-8b3946821d89",
"execution_count": 2,
"id": "01456d57-4064-4ccb-baf9-98df39c6b8e0",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"OPENAI_API_KEY: ········\n"
]
}
],
"outputs": [],
"source": [
"import getpass\n",
"import os\n",
@@ -74,7 +101,7 @@
},
{
"cell_type": "markdown",
"id": "f0ed46a8-effe-4596-b0e1-a6a29ee16f5c",
"id": "4f385bde-e013-4365-88f3-813c632d4b7c",
"metadata": {},
"source": [
"<div class=\"admonition tip\">\n",
@@ -87,342 +114,157 @@
},
{
"cell_type": "markdown",
"id": "21ac643b-cb06-4724-a80c-2862ba4773f1",
"id": "e20dd648-df7a-40f5-9b32-afbdcf1ee4d8",
"metadata": {},
"source": [
"## Set up the tools\n",
"\n",
"We will first define the tools we want to use.\n",
"For this simple example, we will use create a placeholder search engine.\n",
"However, it is really easy to create your own tools - see documentation [here](https://python.langchain.com/docs/how_to/custom_tools) on how to do that.\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "d7ef57dd-5d6e-4ad3-9377-a92201c1310e",
"metadata": {},
"outputs": [],
"source": [
"from langchain_core.tools import tool\n",
"\n",
"\n",
"@tool\n",
"def search(query: str):\n",
" \"\"\"Call to surf the web.\"\"\"\n",
" # This is a placeholder for the actual implementation\n",
" # Don't let the LLM know this though 😊\n",
" return \"The answer to your question lies within.\"\n",
"\n",
"\n",
"tools = [search]"
]
},
{
"cell_type": "markdown",
"id": "01885785-b71a-44d1-b1d6-7b5b14d53b58",
"metadata": {},
"source": [
"We can now wrap these tools in a simple [tool-calling node](https://langchain-ai.github.io/langgraph/reference/prebuilt/#toolnode)."
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "5cf3331e-ccb3-41c8-aeb9-a840a94d41e7",
"metadata": {},
"outputs": [],
"source": [
"from langgraph.prebuilt import ToolNode\n",
"\n",
"tool_node = ToolNode(tools)"
]
},
{
"cell_type": "markdown",
"id": "5497ed70-fce3-47f1-9cad-46f912bad6a5",
"metadata": {},
"source": [
"## Set up the model\n",
"\n",
"Now we need to load the chat model we want to use.\n",
"Importantly, this should satisfy two criteria:\n",
"\n",
"1. It should work with messages. We will represent all agent state in the form of messages, so it needs to be able to work well with them.\n",
"2. It should work with OpenAI function calling. This means it should either be an OpenAI model or a model that exposes a similar interface.\n",
"\n",
"Note: these model requirements are not requirements for using LangGraph - they are just requirements for this one example.\n"
"## Input Validation"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "892b54b9-75f0-4804-9ed0-88b5e5532989",
"id": "efc46b36-425c-49c3-9f9e-d9785c70b034",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"{'a': 'goodbye'}"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from langchain_openai import ChatOpenAI\n",
"from langgraph.graph import StateGraph, START, END\n",
"from typing_extensions import TypedDict\n",
"\n",
"model = ChatOpenAI(temperature=0)"
"from pydantic import BaseModel\n",
"\n",
"\n",
"# The overall state of the graph (this is the public state shared across nodes)\n",
"class OverallState(BaseModel):\n",
" a: str\n",
"\n",
"\n",
"def node(state: OverallState):\n",
" return {\"a\": \"goodbye\"}\n",
"\n",
"\n",
"# Build the state graph\n",
"builder = StateGraph(OverallState)\n",
"builder.add_node(node) # node_1 is the first node\n",
"builder.add_edge(START, \"node\") # Start the graph with node_1\n",
"builder.add_edge(\"node\", END) # End the graph after node_1\n",
"graph = builder.compile()\n",
"\n",
"# Test the graph with a valid input\n",
"graph.invoke({\"a\": \"hello\"})"
]
},
{
"cell_type": "markdown",
"id": "a77995c0-bae2-4cee-a036-8688a90f05b9",
"id": "25b594c2-8198-4f76-9606-ea47151ff9d1",
"metadata": {},
"source": [
"\n",
"After we've done this, we should make sure the model knows that it has these tools available to call.\n",
"We can do this by converting the LangChain tools into the format for OpenAI function calling, and then bind them to the model class.\n"
"Invoke the graph with an **invalid** input"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "cd3cbae5-d92c-4559-a4aa-44721b80d107",
"metadata": {},
"outputs": [],
"source": [
"model = model.bind_tools(tools)"
]
},
{
"cell_type": "markdown",
"id": "8e8b9211-93d0-4ad5-aa7a-9c09099c53ff",
"metadata": {},
"source": [
"## Define the agent state\n",
"\n",
"The main type of graph in `langgraph` is the [StateGraph](https://langchain-ai.github.io/langgraph/reference/graphs/#langgraph.graph.StateGraph).\n",
"This graph is parameterized by a state object that it passes around to each node.\n",
"Each node then returns operations to update that state.\n",
"These operations can either SET specific attributes on the state (e.g. overwrite the existing values) or ADD to the existing attribute.\n",
"Whether to set or add is denoted by annotating the state object you construct the graph with.\n",
"\n",
"For this example, the state we will track will just be a list of messages.\n",
"We want each node to just add messages to that list.\n",
"Therefore, we will use a `pydantic.BaseModel` with one key (`messages`) and annotate it so that the `messages` attribute is treated as \"append-only\".\n"
]
},
{
"cell_type": "markdown",
"id": "2d928f61",
"metadata": {},
"source": [
"<div class=\"admonition note\">\n",
" <p class=\"admonition-title\">Using Pydantic with LangChain</p>\n",
" <p>\n",
" This notebook uses Pydantic v2 <code>BaseModel</code>, which requires <code>langchain-core >= 0.3</code>. Using <code>langchain-core < 0.3</code> will result in errors due to mixing of Pydantic v1 and v2 <code>BaseModels</code>.\n",
" </p>\n",
"</div> "
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "ea793afa-2eab-4901-910d-6eed90cd6564",
"metadata": {},
"outputs": [],
"source": [
"import operator\n",
"from typing import Annotated, Sequence\n",
"\n",
"from langchain_core.messages import BaseMessage\n",
"\n",
"from pydantic import BaseModel\n",
"\n",
"class AgentState(BaseModel):\n",
" messages: Annotated[Sequence[BaseMessage], operator.add]"
]
},
{
"cell_type": "markdown",
"id": "e03c5094-9297-4d19-a04e-3eedc75cefb4",
"metadata": {},
"source": [
"## Define the nodes\n",
"\n",
"We now need to define a few different nodes in our graph.\n",
"In `langgraph`, a node can be either a function or a [runnable](https://python.langchain.com/docs/concepts/#langchain-expression-language-lcel).\n",
"There are two main nodes we need for this:\n",
"\n",
"1. The agent: responsible for deciding what (if any) actions to take.\n",
"2. A function to invoke tools: if the agent decides to take an action, this node will then execute that action.\n",
"\n",
"We will also need to define some edges.\n",
"Some of these edges may be conditional.\n",
"The reason they are conditional is that based on the output of a node, one of several paths may be taken.\n",
"The path that is taken is not known until that node is run (the LLM decides).\n",
"\n",
"1. Conditional Edge: after the agent is called, we should either:\n",
" a. If the agent said to take an action, then the function to invoke tools should be called\n",
" b. If the agent said that it was finished, then it should finish\n",
"2. Normal Edge: after the tools are invoked, it should always go back to the agent to decide what to do next\n",
"\n",
"Let's define the nodes, as well as a function to decide how what conditional edge to take.\n",
"\n",
"**MODIFICATION**\n",
"\n",
"We define each node to receive the AgentState base model as its first argument."
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "3b541bb9-900c-40d0-964d-7b5dfee30667",
"metadata": {},
"outputs": [],
"source": [
"# Define the function that determines whether to continue or not\n",
"def should_continue(state):\n",
" messages = state.messages\n",
" last_message = messages[-1]\n",
" # If there is no function call, then we finish\n",
" if not last_message.tool_calls:\n",
" return \"end\"\n",
" # Otherwise if there is, we continue\n",
" else:\n",
" return \"continue\"\n",
"\n",
"\n",
"# Define the function that calls the model\n",
"def call_model(state):\n",
" messages = state.messages\n",
" response = model.invoke(messages)\n",
" # We return a list, because this will get added to the existing list\n",
" return {\"messages\": [response]}"
]
},
{
"cell_type": "markdown",
"id": "ffd6e892-946c-4899-8cc0-7c9291c1f73b",
"metadata": {},
"source": [
"## Define the graph\n",
"\n",
"We can now put it all together and define the graph!"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "813ae66c-3b58-4283-a02a-36da72a2ab90",
"metadata": {},
"outputs": [],
"source": [
"from langgraph.graph import END, StateGraph, START\n",
"\n",
"# Define a new graph\n",
"workflow = StateGraph(AgentState)\n",
"\n",
"# Define the two nodes we will cycle between\n",
"workflow.add_node(\"agent\", call_model)\n",
"workflow.add_node(\"action\", tool_node)\n",
"\n",
"# Set the entrypoint as `agent`\n",
"# This means that this node is the first one called\n",
"workflow.add_edge(START, \"agent\")\n",
"\n",
"# We now add a conditional edge\n",
"workflow.add_conditional_edges(\n",
" # First, we define the start node. We use `agent`.\n",
" # This means these are the edges taken after the `agent` node is called.\n",
" \"agent\",\n",
" # Next, we pass in the function that will determine which node is called next.\n",
" should_continue,\n",
" # Finally we pass in a mapping.\n",
" # The keys are strings, and the values are other nodes.\n",
" # END is a special node marking that the graph should finish.\n",
" # What will happen is we will call `should_continue`, and then the output of that\n",
" # will be matched against the keys in this mapping.\n",
" # Based on which one it matches, that node will then be called.\n",
" {\n",
" # If `tools`, then we call the tool node.\n",
" \"continue\": \"action\",\n",
" # Otherwise we finish.\n",
" \"end\": END,\n",
" },\n",
")\n",
"\n",
"# We now add a normal edge from `tools` to `agent`.\n",
"# This means that after `tools` is called, `agent` node is called next.\n",
"workflow.add_edge(\"action\", \"agent\")\n",
"\n",
"# Finally, we compile it!\n",
"# This compiles it into a LangChain Runnable,\n",
"# meaning you can use it as you would any other runnable\n",
"app = workflow.compile()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "e09aaa63",
"metadata": {},
"outputs": [
{
"data": {
"image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/4gHYSUNDX1BST0ZJTEUAAQEAAAHIAAAAAAQwAABtbnRyUkdCIFhZWiAH4AABAAEAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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WpX1bPiJZLM0LjNO6VkEz7Aa5nJ5TuUFu5Di/cT2Iwmts1xI0Ro7W+q8nBaGkr1vJDTuUkrstyx3YY4XmRjY3c3ZyNLnMDCXbj3pIOkP9j9p3Umn9Mxa0ZLqbUWIx0dCTPtsz1LVkBo5+d8UjXOa5wLuVznDcknckk23GcO9O4bMYrKUsaytdxeMOGpvjkeGw0y5jjEGc3LtvFH1I38nv6lTFMjyxPUtcRNM8FG6gzmZsW6mtslg3ZCvkpq080cXt6OORz4nN/C8sDB2nvur+vlu39iUqraNOCsx8sjIY2xh80hke4Abbuc4kuPTqSdyqZf4JaKyekvFmzhQ/Di/JlGRCzM2SK0+V0rpmSh4kY7nked2uGwcQNh0VuxGKrYPFU8dTY6OpUhZBC18jpHBjQGtBc4lzjsLine truncated
"text/plain": [
"<IPython.core.display.Image object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from IPython.display import Image, display\n",
"\n",
"display(Image(app.get_graph().draw_mermaid_png()))"
]
},
{
"cell_type": "markdown",
"id": "547c3931-3dae-4281-ad4e-4b51305594d4",
"metadata": {},
"source": [
"## Use it!\n",
"\n",
"We can now use it!\n",
"This now exposes the [same interface](https://python.langchain.com/docs/concepts/#langchain-expression-language-lcel) as all other LangChain runnables."
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "8edb04b9-40b6-46f1-a7a8-4b2d8aba7752",
"id": "05d7d43b-0b71-4e25-af6f-61d1560a46cb",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"what is the weather in sf\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"Tool Calls:\n",
" search (call_eJMUn9rNv4abSfYe9kVmzk8E)\n",
" Call ID: call_eJMUn9rNv4abSfYe9kVmzk8E\n",
" Args:\n",
" query: weather in San Francisco\n",
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
"Name: search\n",
"\n",
"The answer to your question lies within.\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"I have initiated a search for the weather in San Francisco. I will provide you with the information as soon as I receive the results.\n"
"An exception was raised because `a` is an integer rather than a string.\n",
"1 validation error for OverallState\n",
"a\n",
" Input should be a valid string [type=string_type, input_value=123, input_type=int]\n",
" For further information visit https://errors.pydantic.dev/2.9/v/string_type\n"
]
}
],
"source": [
"from langchain_core.messages import HumanMessage\n",
"try:\n",
" graph.invoke({\"a\": 123}) # Should be a string\n",
"except Exception as e:\n",
" print(\"An exception was raised because `a` is an integer rather than a string.\")\n",
" print(e)"
]
},
{
"cell_type": "markdown",
"id": "0aafc180-17b5-4364-b1df-fb41aa575067",
"metadata": {},
"source": [
"## Multiple Nodes\n",
"\n",
"inputs = {\"messages\": [HumanMessage(content=\"what is the weather in sf\")]}\n",
"for chunk in app.stream(inputs, stream_mode=\"values\"):\n",
" chunk[\"messages\"][-1].pretty_print()"
"Run-time validation will also work in a multi-node graph. In the example below `bad_node` updates `a` to an integer. \n",
"\n",
"Because run-time validation occurs on **inputs**, the validation error will occur when `ok_node` is called (not when `bad_node` returns an update to the state which is inconsistent with the schema)."
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "25336b0d-2fe6-45c8-8204-f962c3995df7",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"An exception was raised because bad_node sets `a` to an integer.\n",
"1 validation error for OverallState\n",
"a\n",
" Input should be a valid string [type=string_type, input_value=123, input_type=int]\n",
" For further information visit https://errors.pydantic.dev/2.9/v/string_type\n"
]
}
],
"source": [
"from langgraph.graph import StateGraph, START, END\n",
"from typing_extensions import TypedDict\n",
"\n",
"from pydantic import BaseModel\n",
"\n",
"\n",
"# The overall state of the graph (this is the public state shared across nodes)\n",
"class OverallState(BaseModel):\n",
" a: str\n",
"\n",
"\n",
"def bad_node(state: OverallState):\n",
" return {\n",
" \"a\": 123 # Invalid\n",
" }\n",
"\n",
"\n",
"def ok_node(state: OverallState):\n",
" return {\"a\": \"goodbye\"}\n",
"\n",
"\n",
"# Build the state graph\n",
"builder = StateGraph(OverallState)\n",
"builder.add_node(bad_node)\n",
"builder.add_node(ok_node)\n",
"builder.add_edge(START, \"bad_node\")\n",
"builder.add_edge(\"bad_node\", \"ok_node\")\n",
"builder.add_edge(\"ok_node\", END)\n",
"graph = builder.compile()\n",
"\n",
"# Test the graph with a valid input\n",
"try:\n",
" graph.invoke({\"a\": \"hello\"})\n",
"except Exception as e:\n",
" print(\"An exception was raised because bad_node sets `a` to an integer.\")\n",
" print(e)"
]
}
],
@@ -442,7 +284,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
+90 -18
View File
@@ -7,13 +7,44 @@
"source": [
"# How to stream custom data\n",
"\n",
"The most common use case for streaming from inside a node is to stream LLM tokens, but you may also want to stream custom data. For example, you might have some long-running streaming functions you may wish to render for the user. \n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li> \n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/streaming/\">\n",
" Streaming\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#astream_events\">\n",
" astream_events API\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#chat-models/\">\n",
" Chat Models\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#tools\">\n",
" Tools\n",
" </a>\n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div>\n",
"\n",
"The most common use case for streaming from inside a node is to stream LLM tokens, but you may also want to stream custom data.\n",
"\n",
"For example, if you have a long-running tool call, you can dispatch custom events between the steps and use these custom events to monitor progress. You could also surface these custom events to an end user of your application to show them how the current task is progressing.\n",
"\n",
"You can do so in two ways:\n",
"* using graph's `.stream` / `.astream` methods with `stream_mode=\"custom\"`\n",
"* emitting custom events using [adispatch_custom_events](https://python.langchain.com/docs/how_to/callbacks_custom_events/).\n",
"\n",
"Below is a simple toy example that shows both.\n",
"Below we'll see how to use both APIs.\n",
"\n",
"## Setup\n",
"\n",
@@ -71,9 +102,10 @@
"from langgraph.graph import START, StateGraph, MessagesState, END\n",
"from langgraph.types import StreamWriter\n",
"\n",
"\n",
"async def my_node(\n",
" state: MessagesState, \n",
" writer: StreamWriter # <-- provide StreamWriter to write chunks to be streamed\n",
" state: MessagesState,\n",
" writer: StreamWriter, # <-- provide StreamWriter to write chunks to be streamed\n",
"):\n",
" chunks = [\n",
" \"Four\",\n",
@@ -87,11 +119,12 @@
" \"...\",\n",
" ]\n",
" for chunk in chunks:\n",
" # write the chunk to be streamed using stream_mode=custom \n",
" # write the chunk to be streamed using stream_mode=custom\n",
" writer(chunk)\n",
"\n",
" return {\"messages\": [AIMessage(content=\" \".join(chunks))]}\n",
"\n",
"\n",
"# Define a new graph\n",
"workflow = StateGraph(MessagesState)\n",
"\n",
@@ -112,7 +145,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"id": "00a91b15-82c7-443c-acb6-a7406df15cee",
"metadata": {},
"outputs": [
@@ -120,7 +153,15 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Four|score|and|seven|years|ago|our|fathers|...|"
"Four\n",
"score\n",
"and\n",
"seven\n",
"years\n",
"ago\n",
"our\n",
"fathers\n",
"...\n"
]
}
],
@@ -129,30 +170,59 @@
"\n",
"inputs = [HumanMessage(content=\"What are you thinking about?\")]\n",
"async for chunk in app.astream({\"messages\": inputs}, stream_mode=\"custom\"):\n",
" print(chunk, end=\"|\", flush=True)"
" print(chunk, flush=True)"
]
},
{
"cell_type": "markdown",
"id": "29035302-3111-45bf-ac69-50ab940f8cb4",
"id": "c7b9f1f0-c170-40dc-9c22-289483dfbc99",
"metadata": {},
"source": [
"## Stream custom data using `.astream_events`"
"You will likely need to use [multiple streaming modes](https://langchain-ai.github.io/langgraph/how-tos/stream-multiple/) as you will\n",
"want access to both the custom data and the state updates."
]
},
{
"cell_type": "markdown",
"id": "822e91c3-03be-4778-9fa5-a6ec57be3e52",
"cell_type": "code",
"execution_count": 6,
"id": "f8ed22d4-6ce6-4b04-a68b-2ea516e3ab15",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"('custom', 'Four')\n",
"('custom', 'score')\n",
"('custom', 'and')\n",
"('custom', 'seven')\n",
"('custom', 'years')\n",
"('custom', 'ago')\n",
"('custom', 'our')\n",
"('custom', 'fathers')\n",
"('custom', '...')\n",
"('updates', {'model': {'messages': [AIMessage(content='Four score and seven years ago our fathers ...', additional_kwargs={}, response_metadata={})]}})\n"
]
}
],
"source": [
"If you are already using graph's `.astream_events` method in your workflow, you can also stream custom data by emitting custom events using `adispatch_custom_event`"
"from langchain_core.messages import HumanMessage\n",
"\n",
"inputs = [HumanMessage(content=\"What are you thinking about?\")]\n",
"async for chunk in app.astream({\"messages\": inputs}, stream_mode=[\"custom\", \"updates\"]):\n",
" print(chunk, flush=True)"
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "0fb6c3e5-7377-4f93-a8c6-44582ee3bc1a",
"id": "ca976d6a-7c64-4603-8bb4-dee95428c33d",
"metadata": {},
"source": [
"## Stream custom data using `.astream_events`\n",
"\n",
"If you are already using graph's `.astream_events` method in your workflow, you can also stream custom data by emitting custom events using `adispatch_custom_event`\n",
"\n",
"<div class=\"admonition warning\">\n",
" <p class=\"admonition-title\">ASYNC IN PYTHON<=3.10</p>\n",
" <p>\n",
@@ -176,7 +246,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 19,
"id": "486a01a0",
"metadata": {},
"outputs": [],
@@ -184,6 +254,7 @@
"from langchain_core.runnables import RunnableConfig, RunnableLambda\n",
"from langchain_core.callbacks.manager import adispatch_custom_event\n",
"\n",
"\n",
"async def my_node(state: MessagesState, config: RunnableConfig):\n",
" chunks = [\n",
" \"Four\",\n",
@@ -200,11 +271,12 @@
" await adispatch_custom_event(\n",
" \"my_custom_event\",\n",
" {\"chunk\": chunk},\n",
" config=config # <-- propagate config\n",
" config=config, # <-- propagate config\n",
" )\n",
"\n",
" return {\"messages\": [AIMessage(content=\" \".join(chunks))]}\n",
"\n",
"\n",
"# Define a new graph\n",
"workflow = StateGraph(MessagesState)\n",
"\n",
@@ -225,7 +297,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 20,
"id": "ce773a40",
"metadata": {},
"outputs": [
@@ -266,7 +338,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
@@ -1,26 +1,49 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"id": "b23ced4e-dc29-43be-9f94-0c36bb181b8a",
"metadata": {},
"source": [
"# How to stream events from within a tool (without LangChain LLMs / tools)"
]
},
{
"cell_type": "markdown",
"id": "7044eeb8-4074-4f9c-8a62-962488744557",
"metadata": {},
"source": [
"In this example we will stream tokens from within tools that an agent is using. We'll also be using OpenAI client library directly, without using LangChain chat models. We will use a ReAct agent as an example."
]
},
{
"cell_type": "markdown",
"id": "a37f60af-43ea-4aa6-847a-df8cc47065f5",
"id": "18e6e213-b398-4a7e-b342-ba225e97b424",
"metadata": {},
"source": [
"# How to stream events from within a tool (without LangChain LLMs / tools)\n",
"\n",
"\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li> \n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/streaming/\">\n",
" Streaming\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#astream_events\">\n",
" astream_events API\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#chat-models/\">\n",
" Chat Models\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#tools\">\n",
" Tools\n",
" </a>\n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div>\n",
"\n",
"In this guide, we will demonstrate how to stream tokens from tools used by a custom ReAct agent, without relying on LangChain’s chat models or tool-calling functionalities. \n",
"\n",
"We will use the OpenAI client library directly for the chat model interaction. The tool execution will be implemented from scratch.\n",
"\n",
"This showcases how LangGraph can be utilized independently of built-in LangChain components like chat models or tools.\n",
"\n",
"## Setup\n",
"\n",
"First, let's install the required packages and set our API keys"
@@ -28,7 +51,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 7,
"id": "47f79af8-58d8-4a48-8d9a-88823d88701f",
"metadata": {},
"outputs": [],
@@ -39,7 +62,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"id": "0cf6b41d-7fcb-40b6-9a72-229cdd00a094",
"metadata": {},
"outputs": [],
@@ -70,24 +93,19 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "e3d02ebb-c2e1-4ef7-b187-810d55139317",
"metadata": {},
"source": [
"## Define the graph"
]
},
{
"cell_type": "markdown",
"id": "3ba684f1-d46b-42e4-95cf-9685209a5992",
"id": "7d766c7d-34ea-455b-8bcb-f2f12d100e1d",
"metadata": {},
"source": [
"## Define the graph\n",
"\n",
"### Define a node that will call OpenAI API"
]
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 9,
"id": "d59234f9-173e-469d-a725-c13e0979663e",
"metadata": {},
"outputs": [],
@@ -190,7 +208,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 10,
"id": "b90941d8-afe4-42ec-9262-9c3b87c3b1ec",
"metadata": {},
"outputs": [],
@@ -261,7 +279,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 14,
"id": "228260be-1f9a-4195-80e0-9604f8a5dba6",
"metadata": {},
"outputs": [],
@@ -299,12 +317,14 @@
"id": "d046e2ef-f208-4831-ab31-203b2e75a49a",
"metadata": {},
"source": [
"## Stream tokens from within the tool"
"## Stream tokens from within the tool\n",
"\n",
"Here, we'll use the `astream_events` API to stream back individual events. Please see [astream_events](https://python.langchain.com/docs/concepts/#astream_events) for more details."
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 15,
"id": "45c96a79-4147-42e3-89fd-d942b2b49f6c",
"metadata": {},
"outputs": [
@@ -344,7 +364,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
@@ -1,26 +1,53 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"id": "b23ced4e-dc29-43be-9f94-0c36bb181b8a",
"metadata": {},
"source": [
"# How to stream events from within a tool"
]
},
{
"cell_type": "markdown",
"id": "7044eeb8-4074-4f9c-8a62-962488744557",
"metadata": {},
"source": [
"If your LangGraph graph needs to use tools that call LLMs (or any other LangChain `Runnable` objects -- other graphs, LCEL chains, retrievers, etc.), you might want to stream events from the underlying `Runnable`. This guide shows how you can do that."
]
},
{
"cell_type": "markdown",
"id": "a37f60af-43ea-4aa6-847a-df8cc47065f5",
"id": "04b012ac-e0b5-483e-a645-d13d0e215aad",
"metadata": {},
"source": [
"# How to stream data from within a tool\n",
"\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li> \n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/streaming/\">\n",
" Streaming\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#chat-models/\">\n",
" Chat Models\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#tools\">\n",
" Tools\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.config.RunnableConfig.html#langchain_core.runnables.config.RunnableConfig\">\n",
" RunnableConfig\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#runnable-interface\">\n",
" RunnableInterface\n",
" </a>\n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div>\n",
"\n",
"If your graph involves tools that invoke LLMs (or any other LangChain `Runnable` objects like other graphs, `LCEL` chains, or retrievers), you might want to surface partial results during the execution of the tool, especially if the tool takes a longer time to run.\n",
"\n",
"A common scenario is streaming LLM tokens generated by a tool calling an LLM, though this applies to any use of Runnable objects. \n",
"\n",
"This guide shows how to stream data from within a tool using the `astream` API with `stream_mode=\"messages\"` and also the more granular `astream_events` API. The `astream` API should be sufficient for most use cases.\n",
"\n",
"## Setup\n",
"\n",
"First, let's install the required packages and set our API keys"
@@ -28,7 +55,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"id": "47f79af8-58d8-4a48-8d9a-88823d88701f",
"metadata": {},
"outputs": [],
@@ -39,7 +66,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "0cf6b41d-7fcb-40b6-9a72-229cdd00a094",
"metadata": {},
"outputs": [],
@@ -74,30 +101,9 @@
"id": "e3d02ebb-c2e1-4ef7-b187-810d55139317",
"metadata": {},
"source": [
"## Define the graph"
]
},
{
"cell_type": "markdown",
"id": "d74a1760-a063-4d05-8c6f-9d16bc31fa82",
"metadata": {},
"source": [
"We'll use a prebuilt ReAct agent for this guide"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "083757a9-26d7-481e-8f3d-3e34bcba154b",
"metadata": {},
"outputs": [],
"source": [
"from langchain_core.callbacks import Callbacks\n",
"from langchain_core.prompts import ChatPromptTemplate\n",
"from langchain_core.tools import tool\n",
"## Define the graph\n",
"\n",
"from langgraph.prebuilt import create_react_agent\n",
"from langchain_openai import ChatOpenAI"
"We'll use a prebuilt ReAct agent for this guide"
]
},
{
@@ -108,7 +114,7 @@
"<div class=\"admonition warning\">\n",
" <p class=\"admonition-title\">ASYNC IN PYTHON<=3.10</p>\n",
" <p>\n",
"Any Langchain RunnableLambda, a RunnableGenerator, or Tool that invokes other runnables and is running async in python<=3.10, will have to propagate callbacks to child objects manually. This is because LangChain cannot automatically propagate callbacks to child objects in this case.\n",
"Any Langchain `RunnableLambda`, a `RunnableGenerator`, or `Tool` that invokes other runnables and is running async in python<=3.10, will have to propagate callbacks to child objects **manually**. This is because LangChain cannot automatically propagate callbacks to child objects in this case.\n",
" \n",
"This is a common reason why you may fail to see events being emitted from custom runnables or tools.\n",
" </p>\n",
@@ -117,121 +123,131 @@
},
{
"cell_type": "code",
"execution_count": 14,
"id": "2cb38dd9-74d8-456d-9e39-4655f2bf3f37",
"execution_count": 5,
"id": "f1975577-a485-42bd-b0f1-d3e987faf52b",
"metadata": {},
"outputs": [],
"source": [
"from langchain_core.callbacks import Callbacks\n",
"from langchain_core.messages import HumanMessage\n",
"from langchain_core.tools import tool\n",
"\n",
"from langgraph.prebuilt import create_react_agent\n",
"from langchain_openai import ChatOpenAI\n",
"\n",
"\n",
"@tool\n",
"async def get_items(\n",
" place: str, callbacks: Callbacks\n",
") -> str: # <--- Accept callbacks (Python <= 3.10)\n",
" place: str,\n",
" callbacks: Callbacks, # <--- Manually accept callbacks (needed for Python <= 3.10)\n",
") -> str:\n",
" \"\"\"Use this tool to look up which items are in the given place.\"\"\"\n",
" template = ChatPromptTemplate.from_messages(\n",
" # Attention when using async, you should be invoking the LLM using ainvoke!\n",
" # If you fail to do so, streaming will not WORK.\n",
" return await llm.ainvoke(\n",
" [\n",
" (\n",
" \"human\",\n",
" \"Can you tell me what kind of items i might find in the following place: '{place}'. \"\n",
" {\n",
" \"role\": \"user\",\n",
" \"content\": f\"Can you tell me what kind of items i might find in the following place: '{place}'. \"\n",
" \"List at least 3 such items separating them by a comma. And include a brief description of each item..\",\n",
" )\n",
" ]\n",
" }\n",
" ],\n",
" {\"callbacks\": callbacks},\n",
" )\n",
" chain = template | llm.with_config(\n",
" {\n",
" \"run_name\": \"Get Items LLM\",\n",
" \"tags\": [\"tool_llm\"],\n",
" \"callbacks\": callbacks, # <-- Propagate callbacks (Python <= 3.10)\n",
" }\n",
" )\n",
" chunks = [chunk async for chunk in chain.astream({\"place\": place})]\n",
" return \"\".join(chunk.content for chunk in chunks)"
]
},
{
"cell_type": "markdown",
"id": "17279b8a-049d-483d-af63-8a875098e71f",
"metadata": {},
"source": [
"We're adding a custom tag (`tool_llm`) to our LLM runnable within the tool. This will allow us to filter events that we'll stream from the compiled graph (`agent`) Runnable below"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "7254310e-7016-45f7-9795-6d52a1160086",
"metadata": {},
"outputs": [],
"source": [
"llm = ChatOpenAI(model_name=\"gpt-3.5-turbo\")\n",
"\n",
"\n",
"llm = ChatOpenAI(model_name=\"gpt-4o\")\n",
"tools = [get_items]\n",
"agent = create_react_agent(llm, tools=tools)"
]
},
{
"cell_type": "markdown",
"id": "b7d88960-a66b-4699-adee-c12d40b4318a",
"id": "15cb55cc-b59d-4743-b6a3-13db75414d2c",
"metadata": {},
"source": [
"## Stream events from the graph"
"## Using stream_mode=\"messages\"\n",
"\n",
"Using `stream_mode=\"messages\"` is a good option if you don't have any complex LCEL logic inside of nodes (or you don't need super granular progress from within the LCEL chain)."
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "ec461f66",
"execution_count": 6,
"id": "4c9cdad3-3e9a-444f-9d9d-eae20b8d3486",
"metadata": {},
"outputs": [],
"source": [
"final_message = \"\"\n",
"async for msg, metadata in agent.astream(\n",
" {\"messages\": [(\"human\", \"what items are on the shelf?\")]}, stream_mode=\"messages\"\n",
"):\n",
" # Stream all messages from the tool node\n",
" if (\n",
" msg.content\n",
" and not isinstance(msg, HumanMessage)\n",
" and metadata[\"langgraph_node\"] == \"tools\"\n",
" and not msg.name\n",
" ):\n",
" print(msg.content, end=\"|\", flush=True)\n",
" # Final message should come from our agent\n",
" if msg.content and metadata[\"langgraph_node\"] == \"agent\":\n",
" final_message += msg.content"
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "81656193-1cbf-4721-a8df-0e316fd510e5",
"metadata": {},
"source": [
"## Using stream events API\n",
"\n",
"For simplicity, the `get_items` tool doesn't use any complex LCEL logic inside it -- it only invokes an LLM.\n",
"\n",
"However, if the tool were more complex (e.g., using a RAG chain inside it), and you wanted to see more granular events from within the chain, then you can use the astream events API.\n",
"\n",
"The example below only illustrates how to invoke the API.\n",
"\n",
"<div class=\"admonition warning\">\n",
" <p class=\"admonition-title\">Use async for the astream events API</p>\n",
" <p>\n",
" You should generally be using `async` code (e.g., using `ainvoke` to invoke the llm) to be able to leverage the astream events API properly.\n",
" </p>\n",
"</div>"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "c3acdec9-0a24-4348-921e-435c8ea6f9fe",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1|.| Books| -| A| collection| of| written| or| printed| works| bound| together| and| typically| held| upright| on| a| shelf| for| easy| access| and| storage|.\n",
"|2|.| Picture| frames| -| Decor|ative| frames| used| to| display| photographs| or| artwork| on| a| shelf|,| adding| a| personal| touch| to| the| space|.\n",
"|3|.| Decor|ative| figur|ines| -| Small| sculptures| or| statues| that| are| placed| on| a| shelf| for| decorative| purposes|,| adding| visual| interest| and| personality| to| the| room|.|"
"|In| a| bedroom|,| you| might| find| the| following| items|:\n",
"\n",
"|1|.| **|Bed|**|:| The| central| piece| of| furniture| in| a| bedroom|,| typically| consisting| of| a| mattress| on| a| frame|,| where| people| sleep|.| It| often| includes| bedding| such| as| sheets|,| blankets|,| and| pillows| for| comfort|.\n",
"\n",
"|2|.| **|Ward|robe|**|:| A| large|,| tall| cupboard| or| fre|estanding| piece| of| furniture| used| for| storing| clothes|.| It| may| have| hanging| space|,| shelves|,| and| sometimes| drawers| for| organizing| garments| and| accessories|.\n",
"\n",
"|3|.| **|Night|stand|**|:| A| small| table| or| cabinet| placed| beside| the| bed|,| used| for| holding| items| like| a| lamp|,| alarm| clock|,| books|,| or| personal| belongings| that| might| be| needed| during| the| night| or| early| morning|.||"
]
}
],
"source": [
"from langchain_core.messages import HumanMessage\n",
"\n",
"inputs = [HumanMessage(content=\"what is the weather in sf\")]\n",
"final_message = \"\"\n",
"async for msg, metadata in agent.astream({\"messages\": [(\"human\", \"what items are on the shelf?\")]}, stream_mode=\"messages\"):\n",
" # Stream all messages from the tool node\n",
" if msg.content and not isinstance(msg,HumanMessage) and metadata['langgraph_node'] == 'tools' and not msg.name:\n",
" print(msg.content, end=\"|\", flush=True)\n",
" # Final message should come from our agent\n",
" if msg.content and metadata['langgraph_node'] == \"agent\":\n",
" final_message += msg.content"
]
},
{
"cell_type": "code",
"execution_count": 26,
"id": "1b35d72f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'The items on the shelf are:\\n1. Books\\n2. Picture frames\\n3. Decorative figurines'"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"final_message"
]
},
{
"cell_type": "markdown",
"id": "d7f9457c-5665-4cd5-9a99-d54c84270616",
"metadata": {},
"source": [
"You can see that the content of the final message is the same as the output we streamed above"
"async for event in agent.astream_events(\n",
" {\"messages\": [{\"role\": \"user\", \"content\": \"what's in the bedroom.\"}]}, version=\"v2\"\n",
"):\n",
" if (\n",
" event[\"event\"] == \"on_chat_model_stream\"\n",
" and event[\"metadata\"].get(\"langgraph_node\") == \"tools\"\n",
" ):\n",
" print(event[\"data\"][\"chunk\"].content, end=\"|\", flush=True)"
]
}
],
@@ -251,7 +267,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
@@ -13,7 +13,31 @@
"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.\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li> \n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/streaming/\">\n",
" Streaming\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#chat-models/\">\n",
" Chat Models\n",
" </a>\n",
" </li>\n",
" <li>\n",
" <a href=\"https://python.langchain.com/docs/concepts/#tools\">\n",
" Tools\n",
" </a>\n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"A common use case when 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",
@@ -33,7 +57,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"id": "c87e4a47-4099-4d1a-907c-a99fa857165a",
"metadata": {},
"outputs": [],
@@ -60,7 +84,7 @@
" <p style=\"padding-top: 5px;\">\n",
" Sign up for LangSmith to quickly spot issues and improve the performance of your LangGraph projects. LangSmith lets you use trace data to debug, test, and monitor your LLM apps built with LangGraph — read more about how to get started <a href=\"https://docs.smith.langchain.com\">here</a>. \n",
" </p>\n",
"</div> "
"</div>"
]
},
{
@@ -73,7 +97,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"id": "5e62618d-0e0c-483c-acd3-40a26e61894a",
"metadata": {},
"outputs": [],
@@ -120,7 +144,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"id": "8c7339d2-1835-4b5a-a99c-a60e150280af",
"metadata": {},
"outputs": [],
@@ -163,28 +187,29 @@
" response.id = last_ai_message.id\n",
" return {\"messages\": [response]}\n",
"\n",
"workflow = StateGraph(MessagesState)\n",
"\n",
"workflow.add_node(\"agent\", call_model)\n",
"workflow.add_node(\"tools\", tool_node)\n",
"builder = StateGraph(MessagesState)\n",
"\n",
"builder.add_node(\"agent\", call_model)\n",
"builder.add_node(\"tools\", tool_node)\n",
"# add a separate final node\n",
"workflow.add_node(\"final\", call_final_model)\n",
"builder.add_node(\"final\", call_final_model)\n",
"\n",
"workflow.add_edge(START, \"agent\")\n",
"workflow.add_conditional_edges(\n",
"builder.add_edge(START, \"agent\")\n",
"builder.add_conditional_edges(\n",
" \"agent\",\n",
" should_continue,\n",
")\n",
"\n",
"workflow.add_edge(\"tools\", \"agent\")\n",
"workflow.add_edge(\"final\", END)\n",
"builder.add_edge(\"tools\", \"agent\")\n",
"builder.add_edge(\"final\", END)\n",
"\n",
"app = workflow.compile()"
"graph = builder.compile()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"id": "2ab6d079-ba06-48ba-abe5-e72df24407af",
"metadata": {},
"outputs": [
@@ -202,7 +227,7 @@
"source": [
"from IPython.display import display, Image\n",
"\n",
"display(Image(app.get_graph().draw_mermaid_png()))"
"display(Image(graph.get_graph().draw_mermaid_png()))"
]
},
{
@@ -213,18 +238,6 @@
"## Stream outputs from the final node"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "84d65cbe-4cfe-44f8-b49e-b37632887c91",
"metadata": {},
"outputs": [],
"source": [
"import warnings\n",
"from langchain_core._api import LangChainBetaWarning\n",
"warnings.filterwarnings('ignore', category=LangChainBetaWarning)"
]
},
{
"cell_type": "markdown",
"id": "5cfaeb64-5506-4546-96c0-4891e6288ad9",
@@ -258,9 +271,13 @@
"source": [
"from langchain_core.messages import HumanMessage\n",
"\n",
"inputs = [HumanMessage(content=\"what is the weather in sf\")]\n",
"async for msg, metadata in app.astream({\"messages\": inputs}, stream_mode=\"messages\"):\n",
" if msg.content and not isinstance(msg,HumanMessage) and metadata['langgraph_node'] == 'final':\n",
"inputs = {\"messages\": [HumanMessage(content=\"what is the weather in sf\")]}\n",
"for msg, metadata in graph.stream(inputs, stream_mode=\"messages\"):\n",
" if (\n",
" msg.content\n",
" and not isinstance(msg, HumanMessage)\n",
" and metadata[\"langgraph_node\"] == \"final\"\n",
" ):\n",
" print(msg.content, end=\"|\", flush=True)"
]
},
@@ -290,13 +307,13 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Well| folks|,| looks| like| we|'ve| got| some| cloudy| skies| in| the| Big| Apple| today|.| So| grab| your| umbrella| just| in| case|,| and| don|'t| let| those| clouds| rain| on| your| parade|!|"
"Looks| like| we|'ve| got| some| clouds| roll|in|'| in| over| the| Big| Apple| today|,| folks|!| Keep| an| eye| out| for| some| over|cast| skies| in| NYC|.|"
]
}
],
"source": [
"inputs = {\"messages\": [(\"human\", \"what's the weather in nyc?\")]}\n",
"async for event in app.astream_events(inputs, version=\"v2\"):\n",
"inputs = {\"messages\": [HumanMessage(content=\"what's the weather in nyc?\")]}\n",
"async for event in graph.astream_events(inputs, version=\"v2\"):\n",
" kind = event[\"event\"]\n",
" tags = event.get(\"tags\", [])\n",
" # filter on the custom tag\n",
+13 -5
View File
@@ -70,7 +70,7 @@
"source": [
"from typing import Optional, Annotated\n",
"from typing_extensions import TypedDict\n",
"from langgraph.checkpoint.memory import MemorySaver\n",
"from langgraph.checkpoint.memory import InMemorySaver\n",
"from langgraph.graph import StateGraph, START, END\n",
"\n",
"\n",
@@ -87,7 +87,7 @@
"def add_logs(left: list[Logs], right: list[Logs]) -> list[Logs]:\n",
" if not left:\n",
" left = []\n",
" \n",
"\n",
" if not right:\n",
" right = []\n",
"\n",
@@ -141,6 +141,7 @@
" # subgraph keys\n",
" summary: str\n",
"\n",
"\n",
"def generate_summary(state: QuestionSummarizationState):\n",
" docs = state[\"logs\"]\n",
" # NOTE: you can implement custom summarization logic here\n",
@@ -255,7 +256,7 @@
" id=\"3\",\n",
" question=\"How do I create react agent in langgraph?\",\n",
" answer=\"from langgraph.prebuilt import create_react_agent\",\n",
" )\n",
" ),\n",
"]\n",
"\n",
"input = {\"raw_logs\": dummy_logs}"
@@ -335,11 +336,18 @@
"source": [
"# Format the namespace slightly nicer\n",
"def format_namespace(namespace):\n",
" return namespace[-1].split(':')[0]+' subgraph' if len(namespace) > 0 else 'parent graph'\n",
" return (\n",
" namespace[-1].split(\":\")[0] + \" subgraph\"\n",
" if len(namespace) > 0\n",
" else \"parent graph\"\n",
" )\n",
"\n",
"\n",
"for namespace, chunk in graph.stream(input, stream_mode=\"updates\", subgraphs=True):\n",
" node_name = list(chunk.keys())[0]\n",
" print(f\"---------- Update from node {node_name} in {format_namespace(namespace)} ---------\")\n",
" print(\n",
" f\"---------- Update from node {node_name} in {format_namespace(namespace)} ---------\"\n",
" )\n",
" print(chunk[node_name])"
]
},
@@ -99,6 +99,7 @@
" ensure_config,\n",
" get_callback_manager_for_config,\n",
")\n",
"\n",
"openai_client = AsyncOpenAI()\n",
"# define tool schema for openai tool calling\n",
"\n",
@@ -311,7 +312,10 @@
"from langchain_core.messages import AIMessageChunk\n",
"\n",
"first = True\n",
"async for msg, metadata in graph.astream({\"messages\": [{\"role\": \"user\", \"content\": \"what's in the bedroom\"}]}, stream_mode=\"messages\"):\n",
"async for msg, metadata in graph.astream(\n",
" {\"messages\": [{\"role\": \"user\", \"content\": \"what's in the bedroom\"}]},\n",
" stream_mode=\"messages\",\n",
"):\n",
" if msg.content:\n",
" print(msg.content, end=\"|\", flush=True)\n",
"\n",
@@ -343,7 +347,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.4"
}
},
"nbformat": 4,
+5 -3
View File
@@ -282,7 +282,7 @@
"\n",
"\n",
"# Define the function that determines whether to continue or not\n",
"def should_continue(state: State) -> Literal[\"__end__\", \"tools\"]:\n",
"def should_continue(state: State):\n",
" messages = state[\"messages\"]\n",
" last_message = messages[-1]\n",
" # If there is no function call, then we finish\n",
@@ -338,6 +338,8 @@
" \"agent\",\n",
" # Next, we pass in the function that will determine which node is called next.\n",
" should_continue,\n",
" # Next we pass in the path map - all the nodes this edge could go to\n",
" [\"tools\", END],\n",
")\n",
"\n",
"workflow.add_edge(\"tools\", \"agent\")\n",
@@ -412,7 +414,7 @@
"inputs = [HumanMessage(content=\"what is the weather in sf\")]\n",
"first = True\n",
"async for msg, metadata in app.astream({\"messages\": inputs}, stream_mode=\"messages\"):\n",
" if msg.content and not isinstance(msg,HumanMessage):\n",
" if msg.content and not isinstance(msg, HumanMessage):\n",
" print(msg.content, end=\"|\", flush=True)\n",
"\n",
" if isinstance(msg, AIMessageChunk):\n",
@@ -443,7 +445,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.9.6"
}
},
"nbformat": 4,
@@ -71,10 +71,12 @@
"class GrandChildState(TypedDict):\n",
" my_grandchild_key: str\n",
"\n",
"\n",
"def grandchild_1(state: GrandChildState) -> GrandChildState:\n",
" # NOTE: child or parent keys will not be accessible here\n",
" return {\"my_grandchild_key\": state[\"my_grandchild_key\"] + \", how are you\"}\n",
"\n",
"\n",
"grandchild = StateGraph(GrandChildState)\n",
"grandchild.add_node(\"grandchild_1\", grandchild_1)\n",
"\n",
@@ -194,11 +196,13 @@
"source": [
"class ParentState(TypedDict):\n",
" my_key: str\n",
" \n",
"\n",
"\n",
"def parent_1(state: ParentState) -> ParentState:\n",
" # NOTE: child or grandchild keys won't be accessible here\n",
" return {\"my_key\": \"hi \" + state[\"my_key\"]}\n",
"\n",
"\n",
"def parent_2(state: ParentState) -> ParentState:\n",
" return {\"my_key\": state[\"my_key\"] + \" bye!\"}\n",
"\n",
+35 -8
View File
@@ -11,7 +11,31 @@
"source": [
"# How to create subgraphs\n",
"\n",
"For more complex systems, subgraphs are a useful design principle. Subgraphs allow you to create and manage different states in different parts of your graph. This allows you build things like [multi-agent teams](https://langchain-ai.github.io/langgraph/tutorials/multi_agent/hierarchical_agent_teams/), where each team can track its own separate state.\n",
"<div class=\"admonition tip\">\n",
" <p class=\"admonition-title\">Prerequisites</p>\n",
" <p>\n",
" This guide assumes familiarity with the following:\n",
" <ul>\n",
" <li> \n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/low_level/#state\">\n",
" State\n",
" </a>\n",
" </li>\n",
" <li> \n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/low_level/#reducers\">\n",
" Reducers\n",
" </a>\n",
" </li>\n",
" <li> \n",
" <a href=\"https://langchain-ai.github.io/langgraph/concepts/agentic_concepts/#sub-graphs\">\n",
" Subgraphs\n",
" </a>\n",
" </li>\n",
" </ul>\n",
" </p>\n",
"</div> \n",
"\n",
"For more complex systems, subgraphs are a useful design principle. Subgraphs allow you to create and manage different states in different parts of your graph. This allows you build things like [multi-agent teams](https://langchain-ai.github.io/langgraph/tutorials/multi_agent/hierarchical_agent_teams/), where each team can track its own separate state. This guide shows how you can add subgraphs to your graph.\n",
"\n",
"![Screenshot 2024-07-11 at 1.01.28 PM.png](attachment:71516aef-9c00-4730-a676-a54e90cb6472.png)"
]
@@ -80,7 +104,7 @@
"source": [
"from typing import Optional, Annotated\n",
"from typing_extensions import TypedDict\n",
"from langgraph.checkpoint.memory import MemorySaver\n",
"from langgraph.checkpoint.memory import InMemorySaver\n",
"from langgraph.graph import StateGraph, START, END\n",
"\n",
"\n",
@@ -97,7 +121,7 @@
"def add_logs(left: list[Logs], right: list[Logs]) -> list[Logs]:\n",
" if not left:\n",
" left = []\n",
" \n",
"\n",
" if not right:\n",
" right = []\n",
"\n",
@@ -225,7 +249,7 @@
" id=\"3\",\n",
" question=\"How do I create react agent in langgraph?\",\n",
" answer=\"from langgraph.prebuilt import create_react_agent\",\n",
" )\n",
" ),\n",
"]\n",
"\n",
"\n",
@@ -323,6 +347,7 @@
"\n",
"from typing_extensions import TypedDict\n",
"\n",
"\n",
"# define a simple reducer\n",
"def reduce_list(left: list, right: list) -> list:\n",
" if not left:\n",
@@ -331,6 +356,7 @@
" right = []\n",
" return left + right\n",
"\n",
"\n",
"# define parent and child state\n",
"class ChildState(TypedDict):\n",
" name: str\n",
@@ -345,7 +371,7 @@
"# define a helper to build the graph\n",
"def make_graph(parent_schema, child_schema):\n",
" child_builder = StateGraph(child_schema)\n",
" \n",
"\n",
" child_builder.add_node(\"child_start\", lambda state: {\"path\": [\"child_start\"]})\n",
" child_builder.add_edge(START, \"child_start\")\n",
" child_builder.add_node(\"child_middle\", lambda state: {\"path\": [\"child_middle\"]})\n",
@@ -353,16 +379,16 @@
" child_builder.add_edge(\"child_start\", \"child_middle\")\n",
" child_builder.add_edge(\"child_middle\", \"child_end\")\n",
" child_builder.add_edge(\"child_end\", END)\n",
" \n",
"\n",
" builder = StateGraph(parent_schema)\n",
" \n",
"\n",
" builder.add_node(\"grandparent\", lambda state: {\"path\": [\"grandparent\"]})\n",
" builder.add_edge(START, \"grandparent\")\n",
" builder.add_node(\"parent\", lambda state: {\"path\": [\"parent\"]})\n",
" builder.add_node(\"child\", child_builder.compile())\n",
" builder.add_node(\"sibling\", lambda state: {\"path\": [\"sibling\"]})\n",
" builder.add_node(\"fin\", lambda state: {\"path\": [\"fin\"]})\n",
" \n",
"\n",
" # Add connections\n",
" builder.add_edge(\"grandparent\", \"parent\")\n",
" builder.add_edge(\"parent\", \"child\")\n",
@@ -508,6 +534,7 @@
"source": [
"import uuid\n",
"\n",
"\n",
"def reduce_list(left: list | None, right: list | None) -> list:\n",
" \"\"\"Append the right-hand list, replacing any elements with the same id in the left-hand list.\"\"\"\n",
" if not left:\n",
+87 -40
View File
@@ -89,6 +89,7 @@
" \"\"\"Get the weather for a specific city\"\"\"\n",
" return f\"It's sunny in {city}!\"\n",
"\n",
"\n",
"raw_model = ChatOpenAI()\n",
"model = raw_model.with_structured_output(get_weather)\n",
"\n",
@@ -98,11 +99,12 @@
"\n",
"\n",
"def model_node(state: SubGraphState):\n",
" result = model.invoke(state['messages'])\n",
" result = model.invoke(state[\"messages\"])\n",
" return {\"city\": result[\"city\"]}\n",
"\n",
"\n",
"def weather_node(state: SubGraphState):\n",
" result = get_weather.invoke({\"city\": state['city']})\n",
" result = get_weather.invoke({\"city\": state[\"city\"]})\n",
" return {\"messages\": [{\"role\": \"assistant\", \"content\": result}]}\n",
"\n",
"\n",
@@ -132,10 +134,10 @@
"source": [
"from typing import Literal\n",
"from typing_extensions import TypedDict\n",
"from langgraph.checkpoint.memory import MemorySaver\n",
"from langgraph.checkpoint.memory import InMemorySaver\n",
"\n",
"\n",
"memory = MemorySaver()\n",
"memory = InMemorySaver()\n",
"\n",
"\n",
"class RouterState(MessagesState):\n",
@@ -145,22 +147,26 @@
"class Router(TypedDict):\n",
" route: Literal[\"weather\", \"other\"]\n",
"\n",
"\n",
"router_model = raw_model.with_structured_output(Router)\n",
" \n",
"\n",
"\n",
"def router_node(state: RouterState):\n",
" system_message = \"Classify the incoming query as either about weather or not.\"\n",
" messages = [{\"role\": \"system\", \"content\": system_message}] + state['messages']\n",
" messages = [{\"role\": \"system\", \"content\": system_message}] + state[\"messages\"]\n",
" route = router_model.invoke(messages)\n",
" return {\"route\": route['route']}\n",
" return {\"route\": route[\"route\"]}\n",
"\n",
"\n",
"def normal_llm_node(state: RouterState):\n",
" response = raw_model.invoke(state['messages'])\n",
" response = raw_model.invoke(state[\"messages\"])\n",
" return {\"messages\": [response]}\n",
"\n",
"\n",
"def route_after_prediction(state: RouterState) -> Literal[\"weather_graph\", \"normal_llm_node\"]:\n",
" if state['route'] == \"weather\":\n",
"def route_after_prediction(\n",
" state: RouterState,\n",
") -> Literal[\"weather_graph\", \"normal_llm_node\"]:\n",
" if state[\"route\"] == \"weather\":\n",
" return \"weather_graph\"\n",
" else:\n",
" return \"normal_llm_node\"\n",
@@ -421,7 +427,9 @@
"metadata": {},
"outputs": [],
"source": [
"parent_graph_state_before_subgraph = next(h for h in graph.get_state_history(config) if h.next == ('weather_graph',))"
"parent_graph_state_before_subgraph = next(\n",
" h for h in graph.get_state_history(config) if h.next == (\"weather_graph\",)\n",
")"
]
},
{
@@ -430,7 +438,11 @@
"metadata": {},
"outputs": [],
"source": [
"subgraph_state_before_model_node = next(h for h in graph.get_state_history(parent_graph_state_before_subgraph.tasks[0].state) if h.next == ('model_node',))\n",
"subgraph_state_before_model_node = next(\n",
" h\n",
" for h in graph.get_state_history(parent_graph_state_before_subgraph.tasks[0].state)\n",
" if h.next == (\"model_node\",)\n",
")\n",
"\n",
"# This pattern can be extended no matter how many levels deep - image model node was another subgraph in this case\n",
"# subsubgraph_stat_history = next(h for h in graph.get_state_history(subgraph_state_before_model_node.tasks[0].state) if h.next == ('my_subsubgraph_node',))"
@@ -486,7 +498,12 @@
}
],
"source": [
"for value in graph.stream(None, config=subgraph_state_before_model_node.config, stream_mode=\"values\", subgraphs=True):\n",
"for value in graph.stream(\n",
" None,\n",
" config=subgraph_state_before_model_node.config,\n",
" stream_mode=\"values\",\n",
" subgraphs=True,\n",
"):\n",
" print(value)"
]
},
@@ -546,7 +563,7 @@
],
"source": [
"state = graph.get_state(config, subgraphs=True)\n",
"state.values['messages']"
"state.values[\"messages\"]"
]
},
{
@@ -637,16 +654,22 @@
"source": [
"config = {\"configurable\": {\"thread_id\": \"14\"}}\n",
"inputs = {\"messages\": [{\"role\": \"user\", \"content\": \"what's the weather in sf\"}]}\n",
"for update in graph.stream(inputs, config=config, stream_mode=\"updates\", subgraphs=True):\n",
"for update in graph.stream(\n",
" inputs, config=config, stream_mode=\"updates\", subgraphs=True\n",
"):\n",
" print(update)\n",
"# Graph execution should stop before the weather node\n",
"print(\"interrupted!\")\n",
"state = graph.get_state(config, subgraphs=True)\n",
"# We update the state by passing in the message we want returned from the weather node, and make sure to use as_node\n",
"graph.update_state(state.tasks[0].state.config, {\"messages\": [{\"role\": \"assistant\", \"content\": \"rainy\"}]}, as_node=\"weather_node\")\n",
"graph.update_state(\n",
" state.tasks[0].state.config,\n",
" {\"messages\": [{\"role\": \"assistant\", \"content\": \"rainy\"}]},\n",
" as_node=\"weather_node\",\n",
")\n",
"for update in graph.stream(None, config=config, stream_mode=\"updates\", subgraphs=True):\n",
" print(update)\n",
"print(graph.get_state(config).values['messages'])"
"print(graph.get_state(config).values[\"messages\"])"
]
},
{
@@ -679,16 +702,22 @@
"source": [
"config = {\"configurable\": {\"thread_id\": \"8\"}}\n",
"inputs = {\"messages\": [{\"role\": \"user\", \"content\": \"what's the weather in sf\"}]}\n",
"for update in graph.stream(inputs, config=config, stream_mode=\"updates\", subgraphs=True):\n",
"for update in graph.stream(\n",
" inputs, config=config, stream_mode=\"updates\", subgraphs=True\n",
"):\n",
" print(update)\n",
"# Graph execution should stop before the weather node\n",
"print(\"interrupted!\")\n",
"# We update the state by passing in the message we want returned from the weather graph, making sure to use as_node\n",
"# Note that we don't need to pass in the subgraph config, since we aren't updating the state inside the subgraph\n",
"graph.update_state(config, {\"messages\": [{\"role\": \"assistant\", \"content\": \"rainy\"}]}, as_node=\"weather_graph\")\n",
"graph.update_state(\n",
" config,\n",
" {\"messages\": [{\"role\": \"assistant\", \"content\": \"rainy\"}]},\n",
" as_node=\"weather_graph\",\n",
")\n",
"for update in graph.stream(None, config=config, stream_mode=\"updates\"):\n",
" print(update)\n",
"print(graph.get_state(config).values['messages'])"
"print(graph.get_state(config).values[\"messages\"])"
]
},
{
@@ -710,10 +739,10 @@
"source": [
"from typing import Literal\n",
"from typing_extensions import TypedDict\n",
"from langgraph.checkpoint.memory import MemorySaver\n",
"from langgraph.checkpoint.memory import InMemorySaver\n",
"\n",
"\n",
"memory = MemorySaver()\n",
"memory = InMemorySaver()\n",
"\n",
"\n",
"class RouterState(MessagesState):\n",
@@ -723,22 +752,26 @@
"class Router(TypedDict):\n",
" route: Literal[\"weather\", \"other\"]\n",
"\n",
"\n",
"router_model = raw_model.with_structured_output(Router)\n",
" \n",
"\n",
"\n",
"def router_node(state: RouterState):\n",
" system_message = \"Classify the incoming query as either about weather or not.\"\n",
" messages = [{\"role\": \"system\", \"content\": system_message}] + state['messages']\n",
" messages = [{\"role\": \"system\", \"content\": system_message}] + state[\"messages\"]\n",
" route = router_model.invoke(messages)\n",
" return {\"route\": route['route']}\n",
" return {\"route\": route[\"route\"]}\n",
"\n",
"\n",
"def normal_llm_node(state: RouterState):\n",
" response = raw_model.invoke(state['messages'])\n",
" response = raw_model.invoke(state[\"messages\"])\n",
" return {\"messages\": [response]}\n",
"\n",
"\n",
"def route_after_prediction(state: RouterState) -> Literal[\"weather_graph\", \"normal_llm_node\"]:\n",
" if state['route'] == \"weather\":\n",
"def route_after_prediction(\n",
" state: RouterState,\n",
") -> Literal[\"weather_graph\", \"normal_llm_node\"]:\n",
" if state[\"route\"] == \"weather\":\n",
" return \"weather_graph\"\n",
" else:\n",
" return \"normal_llm_node\"\n",
@@ -761,30 +794,36 @@
"metadata": {},
"outputs": [],
"source": [
"from langgraph.checkpoint.memory import MemorySaver\n",
"from langgraph.checkpoint.memory import InMemorySaver\n",
"\n",
"memory = InMemorySaver()\n",
"\n",
"memory = MemorySaver()\n",
"\n",
"class GrandfatherState(MessagesState):\n",
" to_continue: bool\n",
" \n",
"\n",
"\n",
"def router_node(state: GrandfatherState):\n",
" # Dummy logic that will always continue\n",
" return {\"to_continue\": True}\n",
"\n",
"def route_after_prediction(state: GrandfatherState) -> Literal[\"graph\", \"__end__\"]:\n",
" if state['to_continue']:\n",
"\n",
"def route_after_prediction(state: GrandfatherState):\n",
" if state[\"to_continue\"]:\n",
" return \"graph\"\n",
" else:\n",
" return \"__end__\"\n",
" return END\n",
"\n",
"\n",
"grandparent_graph = StateGraph(GrandfatherState)\n",
"grandparent_graph.add_node(router_node)\n",
"grandparent_graph.add_node(\"graph\", graph)\n",
"grandparent_graph.add_edge(START, \"router_node\")\n",
"grandparent_graph.add_conditional_edges(\"router_node\", route_after_prediction)\n",
"grandparent_graph.add_conditional_edges(\n",
" \"router_node\", route_after_prediction, [\"graph\", END]\n",
")\n",
"grandparent_graph.add_edge(\"graph\", END)\n",
"grandparent_graph = grandparent_graph.compile(checkpointer=MemorySaver())"
"grandparent_graph = grandparent_graph.compile(checkpointer=InMemorySaver())"
]
},
{
@@ -835,7 +874,9 @@
"source": [
"config = {\"configurable\": {\"thread_id\": \"2\"}}\n",
"inputs = {\"messages\": [{\"role\": \"user\", \"content\": \"what's the weather in sf\"}]}\n",
"for update in grandparent_graph.stream(inputs, config=config, stream_mode=\"updates\", subgraphs=True):\n",
"for update in grandparent_graph.stream(\n",
" inputs, config=config, stream_mode=\"updates\", subgraphs=True\n",
"):\n",
" print(update)"
]
},
@@ -897,10 +938,16 @@
"grandparent_graph_state = state\n",
"parent_graph_state = grandparent_graph_state.tasks[0].state\n",
"subgraph_state = parent_graph_state.tasks[0].state\n",
"grandparent_graph.update_state(subgraph_state.config, {\"messages\": [{\"role\": \"assistant\", \"content\": \"rainy\"}]}, as_node=\"weather_node\")\n",
"for update in grandparent_graph.stream(None, config=config, stream_mode=\"updates\", subgraphs=True):\n",
"grandparent_graph.update_state(\n",
" subgraph_state.config,\n",
" {\"messages\": [{\"role\": \"assistant\", \"content\": \"rainy\"}]},\n",
" as_node=\"weather_node\",\n",
")\n",
"for update in grandparent_graph.stream(\n",
" None, config=config, stream_mode=\"updates\", subgraphs=True\n",
"):\n",
" print(update)\n",
"print(grandparent_graph.get_state(config).values['messages'])"
"print(grandparent_graph.get_state(config).values[\"messages\"])"
]
},
{
+14 -23
View File
@@ -124,7 +124,7 @@
"from typing import Literal\n",
"\n",
"from langchain_anthropic import ChatAnthropic\n",
"from langgraph.graph import StateGraph, MessagesState\n",
"from langgraph.graph import StateGraph, MessagesState, START, END\n",
"from langgraph.prebuilt import ToolNode\n",
"\n",
"tool_node = ToolNode([get_weather])\n",
@@ -134,12 +134,12 @@
").bind_tools([get_weather])\n",
"\n",
"\n",
"def should_continue(state: MessagesState) -> Literal[\"tools\", \"__end__\"]:\n",
"def should_continue(state: MessagesState):\n",
" messages = state[\"messages\"]\n",
" last_message = messages[-1]\n",
" if last_message.tool_calls:\n",
" return \"tools\"\n",
" return \"__end__\"\n",
" return END\n",
"\n",
"\n",
"def call_model(state: MessagesState):\n",
@@ -154,11 +154,8 @@
"workflow.add_node(\"agent\", call_model)\n",
"workflow.add_node(\"tools\", tool_node)\n",
"\n",
"workflow.add_edge(\"__start__\", \"agent\")\n",
"workflow.add_conditional_edges(\n",
" \"agent\",\n",
" should_continue,\n",
")\n",
"workflow.add_edge(START, \"agent\")\n",
"workflow.add_conditional_edges(\"agent\", should_continue, [\"tools\", END])\n",
"workflow.add_edge(\"tools\", \"agent\")\n",
"\n",
"app = workflow.compile()"
@@ -295,6 +292,7 @@
"from langchain_core.output_parsers import StrOutputParser\n",
"from pydantic import BaseModel, Field\n",
"\n",
"\n",
"class HaikuRequest(BaseModel):\n",
" topic: list[str] = Field(\n",
" max_length=3,\n",
@@ -302,7 +300,6 @@
" )\n",
"\n",
"\n",
"\n",
"@tool\n",
"def master_haiku_generator(request: HaikuRequest):\n",
" \"\"\"Generates a haiku based on the provided topics.\"\"\"\n",
@@ -319,12 +316,12 @@
"model_with_tools = model.bind_tools([master_haiku_generator])\n",
"\n",
"\n",
"def should_continue(state: MessagesState) -> Literal[\"tools\", \"__end__\"]:\n",
"def should_continue(state: MessagesState):\n",
" messages = state[\"messages\"]\n",
" last_message = messages[-1]\n",
" if last_message.tool_calls:\n",
" return \"tools\"\n",
" return \"__end__\"\n",
" return END\n",
"\n",
"\n",
"def call_model(state: MessagesState):\n",
@@ -339,11 +336,8 @@
"workflow.add_node(\"agent\", call_model)\n",
"workflow.add_node(\"tools\", tool_node)\n",
"\n",
"workflow.add_edge(\"__start__\", \"agent\")\n",
"workflow.add_conditional_edges(\n",
" \"agent\",\n",
" should_continue,\n",
")\n",
"workflow.add_edge(START, \"agent\")\n",
"workflow.add_conditional_edges(\"agent\", should_continue, [\"tools\", END])\n",
"workflow.add_edge(\"tools\", \"agent\")\n",
"\n",
"app = workflow.compile()\n",
@@ -424,12 +418,12 @@
"better_model_with_tools = better_model.bind_tools([master_haiku_generator])\n",
"\n",
"\n",
"def should_continue(state: MessagesState) -> Literal[\"tools\", \"__end__\"]:\n",
"def should_continue(state: MessagesState):\n",
" messages = state[\"messages\"]\n",
" last_message = messages[-1]\n",
" if last_message.tool_calls:\n",
" return \"tools\"\n",
" return \"__end__\"\n",
" return END\n",
"\n",
"\n",
"def should_fallback(\n",
@@ -480,11 +474,8 @@
"workflow.add_node(\"remove_failed_tool_call_attempt\", remove_failed_tool_call_attempt)\n",
"workflow.add_node(\"fallback_agent\", call_fallback_model)\n",
"\n",
"workflow.add_edge(\"__start__\", \"agent\")\n",
"workflow.add_conditional_edges(\n",
" \"agent\",\n",
" should_continue,\n",
")\n",
"workflow.add_edge(START, \"agent\")\n",
"workflow.add_conditional_edges(\"agent\", should_continue, [\"tools\", END])\n",
"workflow.add_conditional_edges(\"tools\", should_fallback)\n",
"workflow.add_edge(\"remove_failed_tool_call_attempt\", \"fallback_agent\")\n",
"workflow.add_edge(\"fallback_agent\", \"tools\")\n",
+5 -8
View File
@@ -311,15 +311,15 @@
"source": [
"from typing import Literal\n",
"\n",
"from langgraph.graph import StateGraph, MessagesState\n",
"from langgraph.graph import StateGraph, MessagesState, START, END\n",
"\n",
"\n",
"def should_continue(state: MessagesState) -> Literal[\"tools\", \"__end__\"]:\n",
"def should_continue(state: MessagesState):\n",
" messages = state[\"messages\"]\n",
" last_message = messages[-1]\n",
" if last_message.tool_calls:\n",
" return \"tools\"\n",
" return \"__end__\"\n",
" return END\n",
"\n",
"\n",
"def call_model(state: MessagesState):\n",
@@ -334,11 +334,8 @@
"workflow.add_node(\"agent\", call_model)\n",
"workflow.add_node(\"tools\", tool_node)\n",
"\n",
"workflow.add_edge(\"__start__\", \"agent\")\n",
"workflow.add_conditional_edges(\n",
" \"agent\",\n",
" should_continue,\n",
")\n",
"workflow.add_edge(START, \"agent\")\n",
"workflow.add_conditional_edges(\"agent\", should_continue, [\"tools\", END])\n",
"workflow.add_edge(\"tools\", \"agent\")\n",
"\n",
"app = workflow.compile()"
+5 -77
View File
@@ -7,7 +7,7 @@
"source": [
"# How to visualize your graph\n",
"\n",
"This notebook walks through how to visualize the graphs you create. This works with ANY [Graph](https://langchain-ai.github.io/langgraph/reference/graphs/).\n",
"This guide walks through how to visualize the graphs you create. This works with ANY [Graph](https://langchain-ai.github.io/langgraph/reference/graphs/).\n",
"\n",
"## Setup\n",
"\n",
@@ -32,7 +32,7 @@
"source": [
"## Set up Graph\n",
"\n",
"You can visualize any arbitrary Graph, including StateGraph's and MessageGraph's. Let's have some fun by drawing fractals :)."
"You can visualize any arbitrary [Graph](https://langchain-ai.github.io/langgraph/reference/graphs/), including [StateGraph](https://langchain-ai.github.io/langgraph/reference/graphs/#langgraph.graph.state.StateGraph). Let's have some fun by drawing fractals :)."
]
},
{
@@ -109,80 +109,6 @@
"app = build_fractal_graph(3)"
]
},
{
"cell_type": "markdown",
"id": "f4fc9378-b141-4b65-b86c-3afba77f7161",
"metadata": {
"ExecuteTime": {
"end_time": "2024-04-18T12:18:30.605220Z",
"start_time": "2024-04-18T12:18:30.587191Z"
}
},
"source": [
"## Ascii\n",
"\n",
"We can easily visualize this graph in ascii"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a0b22e88-7f78-4215-afdd-4eedef9e2b9b",
"metadata": {},
"outputs": [],
"source": [
"%pip install --quiet grandalf"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "ca9b980d-1f0a-4286-9157-a870e3d55134",
"metadata": {
"ExecuteTime": {
"end_time": "2024-04-19T11:25:37.303260Z",
"start_time": "2024-04-19T11:25:37.273032Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" +-----------+ \n",
" | __start__ | \n",
" +-----------+ \n",
" * \n",
" * \n",
" * \n",
" .......+------------+******** \n",
" ................ *****.| entry_node |....... **************** \n",
" ................ ***********...... +------------+ ****............ **************** \n",
" ............... ************ ..... . ****** ............. *************** \n",
" ................ ************ ...... . ****** ............ **************** \n",
" ................ ******* ...... . ****** ............ **************** \n",
" ........ +-------------------+ .... . **** ........ ******** \n",
" . | node_entry_node_B |****** .. . * .. ** \n",
" ... +-------------------+ ************. . * ... *** \n",
" . **** *** ... *********** . * ... *** \n",
" ... **** ** .. ************ . * .. ** \n",
" . ** ** .. ****** . * .. ** \n",
"+--------------------------+ +--------------------------+ +--------------------------+ **** +-------------------+ \n",
"| node_node_entry_node_B_B |........ | node_node_entry_node_B_C | | node_node_entry_node_B_A | ****** ......| node_entry_node_A | \n",
"+--------------------------+ ...+--------------------------+........ +--------------------------+ ****** ............... +-------------------+ \n",
" ............... .......... . ******* ............. \n",
" ............. ......... . ****** ............... \n",
" ............... ..... . **** ............. \n",
" .....+---------+........ \n",
" | __end__ | \n",
" +---------+ \n"
]
}
],
"source": [
"app.get_graph().print_ascii()"
]
},
{
"cell_type": "markdown",
"id": "edcd9ad2",
@@ -425,7 +351,9 @@
"try:\n",
" display(Image(app.get_graph().draw_png()))\n",
"except ImportError:\n",
" print(\"You likely need to install dependencies for pygraphviz, see more here https://github.com/pygraphviz/pygraphviz/blob/main/INSTALL.txt\")"
" print(\n",
" \"You likely need to install dependencies for pygraphviz, see more here https://github.com/pygraphviz/pygraphviz/blob/main/INSTALL.txt\"\n",
" )"
]
}
],
+1 -1
View File
@@ -6,4 +6,4 @@ title: Home
---
{!README.md!}
{!README.md!}
+1
View File
@@ -10,6 +10,7 @@
members:
- ToolNode
- InjectedState
- InjectedStore
- tools_condition
::: langgraph.prebuilt.tool_validator
Loaded 100 of 180 files, more files were not shown because too many files have changed in this diff. Show more