在ReAct实现中,遇到输出解析(output parsing)问题:Parsing LLM output produced both a final answer and a parse-able action

尝试实现ReAct框架的过程中,让大模型调用工具回答问题,但是出现以下报错:

ValueError: An output parsing error occurred. In order to pass this error back to the agent and have it try again, pass handle_parsing_errors=True to the AgentExecutor. This is the error: Parsing LLM output produced both a final answer and a parse-able action:: 为了回答计算594的问题,我会使用multiply这个工具三次来计算乘积。

明明大模型已经把答案给出来了,但是依然有报错,我不是很理解。完整的输出如下:

想求助各位大佬

我解决以上问题了。是因为大模型在回答时多加了引号。正确的输出应该是没有引号的,如下所示:

而之前大模型回答有多余引号的原因是给它的提示词模板中有多余的引号,保证把这些模板中的多余的标点去掉即可: