The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
ConversationalChatAgent: Allow customizing `TEMPLATE_TOOL_RESPONSE` (#2361)
Emil Ahlbäck5c9205d5f421
diff --git a/langchain/agents/conversational_chat/base.py b/langchain/agents/conversational_chat/base.pyindex 171285431c..0e103720c4 100644--- a/langchain/agents/conversational_chat/base.py+++ b/langchain/agents/conversational_chat/base.py@@ -37,6 +37,7 @@ class ConversationalChatAgent(Agent):"""An agent designed to hold a conversation in addition to using tools."""output_parser: AgentOutputParser = Field(default_factory=ConvoOutputParser)+ template_tool_response: str = TEMPLATE_TOOL_RESPONSE@classmethoddef _get_default_output_parser(cls, **kwargs: Any) -> AgentOutputParser:@@ -99,7 +100,7 @@ class ConversationalChatAgent(Agent):for action, observation in intermediate_steps:thoughts.append(AIMessage(content=action.log))human_message = HumanMessage(- content=TEMPLATE_TOOL_RESPONSE.format(observation=observation)+ content=self.template_tool_response.format(observation=observation))thoughts.append(human_message)return thoughts