Use create_react_agent (#441)

This commit is contained in:
William FH
2024-05-13 14:32:26 -07:00
committed by GitHub
parent 1100360ea6
commit 2c32a38c42
7 changed files with 157 additions and 115 deletions
+8 -2
View File
@@ -49,5 +49,11 @@ jobs:
- name: Check links in notebooks
env:
LANGCHAIN_API_KEY: test
shell: bash
run: poetry run pytest -o python_files=non_python_only --check-links --ignore="*.py" -k .ipynb --check-links-ignore "https://(api|web)\.smith\.langchain\.com/.*" --check-links-ignore "https://x.com/.*" --check-links-ignore "*.dcbadge.vercel.app*"./examples
shell: bash
run: |
if [ "${{ github.event_name }}" != "schedule" ]; then
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep '\.ipynb$')
poetry run pytest -o python_files=non_python_only --check-links $CHANGED_FILES --check-links-ignore "https://(api|web)\.smith\.langchain\.com/.*" --check-links-ignore "https://x.com/.*"
else
poetry run pytest -o python_files=non_python_only --check-links --ignore="*.py" -k .ipynb --check-links-ignore "https://(api|web)\.smith\.langchain\.com/.*" --check-links-ignore "https://x.com/.*" ./examples
+2 -1
View File
@@ -1,3 +1,4 @@
{
"aliveStatusCodes": [200, 206, 402]
"aliveStatusCodes": [200, 206, 402],
"ignorePatterns": ["*dcbadge.vercel.app*"]
}
-1
View File
@@ -51,7 +51,6 @@ plugins:
- search:
separator: '[\s\u200b\-_,:!=\[\]()"`/]+|\.(?!\d)|&[lg]t;|(?!\b)(?=[A-Z][a-z])'
- autorefs
- meta
- mkdocstrings:
handlers:
python:
+7 -1
View File
@@ -7,9 +7,15 @@
"source": [
"# (Deprecated) Agent Executor\n",
"\n",
"The `create_agent_executor` function is deprecated in favor of [create_tool_calling_executor](../chat_agent_executor_with_function_calling/high-level-tools.ipynb).\n",
"The `create_agent_executor` function is deprecated in favor of [create_react_agent](../chat_agent_executor_with_function_calling/high-level-tools.ipynb).\n",
"This was done to better align with the underlying model providers' migration from \"function calling\" to \"tool calling\", which typically supports parallel tool usage."
]
},
{
"cell_type": "markdown",
"id": "8aa31ac5",
"metadata": {},
"source": []
}
],
"metadata": {
@@ -5,7 +5,7 @@
"id": "8bcd1a3d-7c50-4f58-be4e-1ed654aa33be",
"metadata": {},
"source": [
"# Chat Executor: with tool calling\n",
"# ReAct agent with tool calling\n",
"\n",
"This notebook walks through an example creating a ReAct Agent that uses tool calling.\n",
"This is useful for getting started quickly.\n",
@@ -32,7 +32,7 @@
"source": [
"from langchain_openai import ChatOpenAI\n",
"from langchain_community.tools.tavily_search import TavilySearchResults\n",
"from langgraph.prebuilt import chat_agent_executor\n",
"from langgraph.prebuilt import create_react_agent\n",
"from langchain_core.messages import HumanMessage"
]
},
@@ -64,7 +64,7 @@
"metadata": {},
"outputs": [],
"source": [
"app = chat_agent_executor.create_tool_calling_executor(model, tools)"
"app = create_react_agent(model, tools=tools)"
]
},
{
@@ -7,9 +7,15 @@
"source": [
"# (Deprecated) Chat Executor: with function calling\n",
"\n",
"The function calling executor is deprecated in favor of [create_tool_calling_executor](../chat_agent_executor_with_function_calling/high-level-tools.ipynb).\n",
"The function calling executor is deprecated in favor of [create_react_agent](../chat_agent_executor_with_function_calling/high-level-tools.ipynb).\n",
"This was done to better align with the underlying model providers' migration from \"function calling\" to \"tool calling\", which typically supports parallel tool usage."
]
},
{
"cell_type": "markdown",
"id": "0a96f735",
"metadata": {},
"source": []
}
],
"metadata": {
File diff suppressed because one or more lines are too long