From 0ca37e613c7ff3e0518f7a15bc53aa1fee006689 Mon Sep 17 00:00:00 2001 From: Daniel Grittner Date: Sat, 10 Jun 2023 23:38:20 +0200 Subject: [PATCH] Fix handling of missing action & input for async MRKL agent (#5985) Hi, This is a fix for https://github.com/hwchase17/langchain/pull/5014. This PR forgot to add the ability to self solve the ValueError(f"Could not parse LLM output: {llm_output}") error for `_atake_next_step`. --- langchain/agents/agent.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/langchain/agents/agent.py b/langchain/agents/agent.py index a1da5e7a24..0056d10fbc 100644 --- a/langchain/agents/agent.py +++ b/langchain/agents/agent.py @@ -864,7 +864,11 @@ class AgentExecutor(Chain): raise e text = str(e) if isinstance(self.handle_parsing_errors, bool): - observation = "Invalid or incomplete response" + if e.send_to_llm: + observation = str(e.observation) + text = str(e.llm_output) + else: + observation = "Invalid or incomplete response" elif isinstance(self.handle_parsing_errors, str): observation = self.handle_parsing_errors elif callable(self.handle_parsing_errors):