Immutable solution version
ValueError: Could not parse LLM output:
Complete solution
'Could not parse LLM output' from a LangChain agent almost always means the model isn't following the ReAct format: models like google/flan-t5-xl or Bloom don't reliably produce the Thought / Action / Action Input structure the parser expects. Fix: use an instruction-tuned model that follows formatting instructions (OpenAI models worked in this thread).
ValueError: Could not parse LLM output:
'Could not parse LLM output' from a LangChain agent almost always means the model isn't following the ReAct format: models like google/flan-t5-xl or Bloom don't reliably produce the Thought / Action / Action Input structure the parser expects. Fix: use an instruction-tuned model that follows formatting instructions (OpenAI models worked in this thread). The hacks that patch site-packages output parsing are fragile; the model choice is the real fix.
Context from the issue
gh:langchain-ai/langchain#1358: Issue langchain-ai/langchain#1358 (closed, 82 comments): `agentchain = initializeagent( tools=tools, llm= HuggingFaceHub(repo_id="google/flan-t5-xl"), agent="conversational-react-description", memory=memory, verbose=False)
agent_chain.run("Hi")`
throws error. This happens with Bloom as well. Agent only with OpenAI is only working well.
(self, inputs, returnonlyoutputs) 140 except (KeyboardInterrupt, Exception) as e: 141 self.callbackmanager.onchainerror(e, verbose=self.verbose) --> 142 raise e 143 self.callbackmanager.onchain_end(outputs, verbose=self.verbose) ... ---> 83 raise...
Evidence
Issue gh:langchain-ai/langchain#1358: the reporter asked: Issue langchain-ai/langchain#1358 (closed, 82 comments): `agentchain = initializeagent( tools=tools, llm= HuggingFaceHub(repo_id="google/flan-t5-xl"), agent="conversational-react-description", memory=memory, verbose=False)
agent_chain.run("Hi")`
throws error. This happens with Bloom as well. Agent only with OpenAI is only working well.
(self, inputs, returnonlyoutputs) 140 except (KeyboardInterrupt, Exception) as e: 141 self.callbackmanager.onchainerror(e, verbose=self.verbose) --> 142 raise e 143 self.callbackmanager.onchain_end(outputs, verbose=self.verbose) ... ---> 83 raise... The verified answer was: 'Could not parse LLM output' from a LangChain agent almost always means the model isn't following the ReAct format: models like google/flan-t5-xl or Bloom don't reliably produce the Thought / Action / Action Input structure the parser expects. Fix: use an instruction-tuned model that follows formatting instructions (OpenAI models worked in this thread). The hacks that patch site-packages output parsing are fragile; the model choice is the real fix. Evidence thread: https://github.com/langchain-ai/langchain/issues/1358
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_bamOXt_l4np7VWXKcGgjsA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">ValueError: Could not parse LLM output: <span>— Vectle</span></a>