diff --git a/docs/docs/how-tos/agent-handoffs.ipynb b/docs/docs/how-tos/agent-handoffs.ipynb index 579892208..5be0501e9 100644 --- a/docs/docs/how-tos/agent-handoffs.ipynb +++ b/docs/docs/how-tos/agent-handoffs.ipynb @@ -828,13 +828,13 @@ "addition_expert = create_react_agent(\n", " model,\n", " [add, make_handoff_tool(agent_name=\"multiplication_expert\")],\n", - " state_modifier=\"You are an addition expert, you can ask the multiplication expert for help with multiplication.\",\n", + " prompt=\"You are an addition expert, you can ask the multiplication expert for help with multiplication.\",\n", ")\n", "\n", "multiplication_expert = create_react_agent(\n", " model,\n", " [multiply, make_handoff_tool(agent_name=\"addition_expert\")],\n", - " state_modifier=\"You are a multiplication expert, you can ask an addition expert for help with addition.\",\n", + " prompt=\"You are a multiplication expert, you can ask an addition expert for help with addition.\",\n", ")\n", "\n", "builder = StateGraph(MessagesState)\n", diff --git a/docs/docs/how-tos/autogen-integration.ipynb b/docs/docs/how-tos/autogen-integration.ipynb index 207a3b6f3..2f77b1444 100644 --- a/docs/docs/how-tos/autogen-integration.ipynb +++ b/docs/docs/how-tos/autogen-integration.ipynb @@ -134,7 +134,7 @@ "model = ChatOpenAI(model=\"gpt-4o\")\n", "tools = [TavilySearchResults(max_results=1)]\n", "web_search_agent = create_react_agent(\n", - " model, tools, state_modifier=\"You are an agent specializing in web search\"\n", + " model, tools, prompt=\"You are an agent specializing in web search\"\n", ")" ] }, diff --git a/docs/docs/how-tos/create-react-agent-system-prompt.ipynb b/docs/docs/how-tos/create-react-agent-system-prompt.ipynb index d9a6d10c2..a3965eb10 100644 --- a/docs/docs/how-tos/create-react-agent-system-prompt.ipynb +++ b/docs/docs/how-tos/create-react-agent-system-prompt.ipynb @@ -39,7 +39,7 @@ "\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" + "You can add a custom system prompt by passing a string to the `prompt` param.\n" ] }, { @@ -144,7 +144,7 @@ "\n", "from langgraph.prebuilt import create_react_agent\n", "\n", - "graph = create_react_agent(model, tools=tools, state_modifier=prompt)" + "graph = create_react_agent(model, tools=tools, prompt=prompt)" ] }, { diff --git a/docs/docs/how-tos/memory/semantic-search.ipynb b/docs/docs/how-tos/memory/semantic-search.ipynb index e7f4fc11f..293445007 100644 --- a/docs/docs/how-tos/memory/semantic-search.ipynb +++ b/docs/docs/how-tos/memory/semantic-search.ipynb @@ -195,7 +195,7 @@ "source": [ "## Using in `create_react_agent`\n", "\n", - "Add semantic search to your tool calling agent by injecting the store in the `state_modifier`. You can also use the store in a tool to let your agent manually store or search for memories." + "Add semantic search to your tool calling agent by injecting the store in the `prompt` function. You can also use the store in a tool to let your agent manually store or search for memories." ] }, { @@ -248,9 +248,9 @@ "agent = create_react_agent(\n", " init_chat_model(\"openai:gpt-4o-mini\"),\n", " tools=[upsert_memory],\n", - " # The state_modifier is run to prepare the messages for the LLM. It is called\n", + " # The 'prompt' function is run to prepare the messages for the LLM. It is called\n", " # right before each LLM call\n", - " state_modifier=prepare_messages,\n", + " prompt=prepare_messages,\n", " store=store,\n", ")" ] @@ -524,7 +524,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.2" + "version": "3.12.3" } }, "nbformat": 4, diff --git a/docs/docs/how-tos/multi-agent-multi-turn-convo.ipynb b/docs/docs/how-tos/multi-agent-multi-turn-convo.ipynb index fb73d3151..336c6ab85 100644 --- a/docs/docs/how-tos/multi-agent-multi-turn-convo.ipynb +++ b/docs/docs/how-tos/multi-agent-multi-turn-convo.ipynb @@ -229,7 +229,7 @@ "travel_advisor = create_react_agent(\n", " model,\n", " travel_advisor_tools,\n", - " state_modifier=(\n", + " prompt=(\n", " \"You are a general travel expert that can recommend travel destinations (e.g. countries, cities, etc). \"\n", " \"If you need hotel recommendations, ask 'hotel_advisor' for help. \"\n", " \"You MUST include human-readable response before transferring to another agent.\"\n", @@ -254,7 +254,7 @@ "hotel_advisor = create_react_agent(\n", " model,\n", " hotel_advisor_tools,\n", - " state_modifier=(\n", + " prompt=(\n", " \"You are a hotel expert that can provide hotel recommendations for a given destination. \"\n", " \"If you need help picking travel destinations, ask 'travel_advisor' for help.\"\n", " \"You MUST include human-readable response before transferring to another agent.\"\n", diff --git a/docs/docs/how-tos/multi-agent-network.ipynb b/docs/docs/how-tos/multi-agent-network.ipynb index f1be9ad17..1805e9b6c 100644 --- a/docs/docs/how-tos/multi-agent-network.ipynb +++ b/docs/docs/how-tos/multi-agent-network.ipynb @@ -555,7 +555,7 @@ "travel_advisor = create_react_agent(\n", " model,\n", " travel_advisor_tools,\n", - " state_modifier=(\n", + " prompt=(\n", " \"You are a general travel expert that can recommend travel destinations (e.g. countries, cities, etc). \"\n", " \"If you need hotel recommendations, ask 'hotel_advisor' for help. \"\n", " \"You MUST include human-readable response before transferring to another agent.\"\n", @@ -579,7 +579,7 @@ "hotel_advisor = create_react_agent(\n", " model,\n", " hotel_advisor_tools,\n", - " state_modifier=(\n", + " prompt=(\n", " \"You are a hotel expert that can provide hotel recommendations for a given destination. \"\n", " \"If you need help picking travel destinations, ask 'travel_advisor' for help.\"\n", " \"You MUST include human-readable response before transferring to another agent.\"\n", diff --git a/docs/docs/how-tos/react-agent-from-scratch.ipynb b/docs/docs/how-tos/react-agent-from-scratch.ipynb index eb5cee77d..dde37a30b 100644 --- a/docs/docs/how-tos/react-agent-from-scratch.ipynb +++ b/docs/docs/how-tos/react-agent-from-scratch.ipynb @@ -180,7 +180,7 @@ " 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", + " # this is similar to customizing the create_react_agent with 'prompt' parameter, but is more flexible\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", diff --git a/docs/docs/how-tos/update-state-from-tools.ipynb b/docs/docs/how-tos/update-state-from-tools.ipynb index 29a513904..0a7311342 100644 --- a/docs/docs/how-tos/update-state-from-tools.ipynb +++ b/docs/docs/how-tos/update-state-from-tools.ipynb @@ -220,7 +220,7 @@ "metadata": {}, "outputs": [], "source": [ - "def state_modifier(state: State):\n", + "def prompt(state: State):\n", " user_info = state.get(\"user_info\")\n", " if user_info is None:\n", " return state[\"messages\"]\n", @@ -265,7 +265,7 @@ " [lookup_user_info],\n", " state_schema=State,\n", " # pass dynamic prompt function\n", - " state_modifier=state_modifier,\n", + " prompt=prompt,\n", ")" ] }, diff --git a/docs/docs/tutorials/multi_agent/agent_supervisor.ipynb b/docs/docs/tutorials/multi_agent/agent_supervisor.ipynb index 930c0e989..80aa01e2d 100644 --- a/docs/docs/tutorials/multi_agent/agent_supervisor.ipynb +++ b/docs/docs/tutorials/multi_agent/agent_supervisor.ipynb @@ -201,7 +201,7 @@ "\n", "\n", "research_agent = create_react_agent(\n", - " llm, tools=[tavily_tool], state_modifier=\"You are a researcher. DO NOT do any math.\"\n", + " llm, tools=[tavily_tool], prompt=\"You are a researcher. DO NOT do any math.\"\n", ")\n", "\n", "\n", diff --git a/docs/docs/tutorials/multi_agent/hierarchical_agent_teams.ipynb b/docs/docs/tutorials/multi_agent/hierarchical_agent_teams.ipynb index c46074831..7187bed2c 100644 --- a/docs/docs/tutorials/multi_agent/hierarchical_agent_teams.ipynb +++ b/docs/docs/tutorials/multi_agent/hierarchical_agent_teams.ipynb @@ -525,7 +525,7 @@ "doc_writer_agent = create_react_agent(\n", " llm,\n", " tools=[write_document, edit_document, read_document],\n", - " state_modifier=(\n", + " prompt=(\n", " \"You can read, write and edit documents based on note-taker's outlines. \"\n", " \"Don't ask follow-up questions.\"\n", " ),\n", @@ -548,7 +548,7 @@ "note_taking_agent = create_react_agent(\n", " llm,\n", " tools=[create_outline, read_document],\n", - " state_modifier=(\n", + " prompt=(\n", " \"You can read documents and create outlines for the document writer. \"\n", " \"Don't ask follow-up questions.\"\n", " ),\n", diff --git a/docs/docs/tutorials/multi_agent/multi-agent-collaboration.ipynb b/docs/docs/tutorials/multi_agent/multi-agent-collaboration.ipynb index 3ee863cda..225e56b22 100644 --- a/docs/docs/tutorials/multi_agent/multi-agent-collaboration.ipynb +++ b/docs/docs/tutorials/multi_agent/multi-agent-collaboration.ipynb @@ -190,7 +190,7 @@ "research_agent = create_react_agent(\n", " llm,\n", " tools=[tavily_tool],\n", - " state_modifier=make_system_prompt(\n", + " prompt=make_system_prompt(\n", " \"You can only do research. You are working with a chart generator colleague.\"\n", " ),\n", ")\n", @@ -220,7 +220,7 @@ "chart_agent = create_react_agent(\n", " llm,\n", " [python_repl_tool],\n", - " state_modifier=make_system_prompt(\n", + " prompt=make_system_prompt(\n", " \"You can only generate charts. You are working with a researcher colleague.\"\n", " ),\n", ")\n", diff --git a/docs/docs/tutorials/plan-and-execute/plan-and-execute.ipynb b/docs/docs/tutorials/plan-and-execute/plan-and-execute.ipynb index 6ab6b46c9..c029f5a7a 100644 --- a/docs/docs/tutorials/plan-and-execute/plan-and-execute.ipynb +++ b/docs/docs/tutorials/plan-and-execute/plan-and-execute.ipynb @@ -143,7 +143,7 @@ "# Choose the LLM that will drive the agent\n", "llm = ChatOpenAI(model=\"gpt-4-turbo-preview\")\n", "prompt = \"You are a helpful assistant.\"\n", - "agent_executor = create_react_agent(llm, tools, state_modifier=prompt)" + "agent_executor = create_react_agent(llm, tools, prompt=prompt)" ] }, {