From 43816e5a1b259e1e6c035e3874f55a8fd3a81297 Mon Sep 17 00:00:00 2001 From: "open-swe[bot]" Date: Wed, 30 Jul 2025 18:35:29 +0000 Subject: [PATCH] Apply patch [skip ci] --- libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py b/libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py index 844edda36..bbc784d1f 100644 --- a/libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py +++ b/libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py @@ -285,12 +285,13 @@ def create_react_agent( - **Static model**: A chat model instance (e.g., `ChatOpenAI()`) or string identifier (e.g., `"openai:gpt-4"`) - **Dynamic model**: A callable with signature - `(state, runtime) -> BaseChatModel` that returns different models + `(state, runtime) -> LanguageModelLike` that returns different models based on runtime context Dynamic functions receive graph state and runtime, enabling - context-dependent model selection. Must return a `BaseChatModel` - instance. For tool calling, bind tools using `.bind_tools()`. + context-dependent model selection. Must return a `LanguageModelLike` + instance (e.g., `BaseChatModel` or result of `model.bind_tools()`). + For tool calling, bind tools using `.bind_tools()`. Bound tools must be a subset of the `tools` parameter. Dynamic model example: @@ -953,3 +954,4 @@ __all__ = [ "AgentStateWithStructuredResponsePydantic", ] +