Skip to content

The agent engineering platform.

updated llm response parsing action (#3058)

__Jay__2984ad39645c
diff --git a/langchain/agents/chat/output_parser.py b/langchain/agents/chat/output_parser.py
index 7c79a5b26d..0d07e7e0c2 100644
--- a/langchain/agents/chat/output_parser.py
+++ b/langchain/agents/chat/output_parser.py
@@ -14,7 +14,7 @@ class ChatOutputParser(AgentOutputParser):
{"output": text.split(FINAL_ANSWER_ACTION)[-1].strip()}, text
)
try:
- _, action, _ = text.split("```")
+ action = text.split("```")[1]
response = json.loads(action.strip())
return AgentAction(response["action"], response["action_input"], text)