From b36234ad4fec54ac834ac274e438d5ca709bf2d4 Mon Sep 17 00:00:00 2001 From: Harrison Chase Date: Mon, 23 Dec 2024 14:59:07 -0800 Subject: [PATCH] mark system prompt configurable --- libs/langgraph/langgraph/prebuilt/chat_agent_executor.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/langgraph/langgraph/prebuilt/chat_agent_executor.py b/libs/langgraph/langgraph/prebuilt/chat_agent_executor.py index b5207d167..43fc3d1a8 100644 --- a/libs/langgraph/langgraph/prebuilt/chat_agent_executor.py +++ b/libs/langgraph/langgraph/prebuilt/chat_agent_executor.py @@ -66,9 +66,8 @@ def _get_state_modifier_runnable( lambda state: state["messages"], name=STATE_MODIFIER_RUNNABLE_NAME ) elif isinstance(state_modifier, str): - _system_message: BaseMessage = SystemMessage(content=state_modifier) state_modifier_runnable = RunnableCallable( - lambda state: [_system_message] + state["messages"], + lambda state, config: [SystemMessage(config['configurable'].get('system_prompt', state_modifier))] + state["messages"], name=STATE_MODIFIER_RUNNABLE_NAME, ) elif isinstance(state_modifier, SystemMessage):