Could not parse LLM output: #10741
Replies: 2 comments
-
🤖 The error you're encountering, The expected format of the output from the language model that the
{
If the output of the language model is not in this expected format, or if it includes both a final answer and a parse-able action, the In your case, the error message indicates that the output from the language model was "Hello! How can I assist you today?". This output does not match the expected format, hence the error. You can try to debug this issue by checking the output of the language model. Make sure it's in the expected format and does not include both a final answer and a parse-able action. I hope this helps! If you have any other questions, feel free to ask. Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
-
🤖 Based on the traceback you've provided, it seems like the error is being raised by the The expected format of the output from the language model that the Here is the relevant code: def parse(self, text: str) -> Union[AgentAction, AgentFinish]:
includes_answer = FINAL_ANSWER_ACTION in text
try:
found = self.pattern.search(text)
if not found:
# Fast fail to parse Final Answer.
raise ValueError("action not found")
action = found.group(1)
response = json.loads(action.strip())
includes_action = "action" in response
if includes_answer and includes_action:
raise OutputParserException(
"Parsing LLM output produced a final answer "
f"and a parse-able action: {text}"
)
return AgentAction(
response["action"], response.get("action_input", {}), text
)
except Exception:
if not includes_answer:
raise OutputParserException(f"Could not parse LLM output: {text}")
output = text.split(FINAL_ANSWER_ACTION)[-1].strip()
return AgentFinish({"output": output}, text) If the output of the language model is not in the expected format (matches the regex pattern and can be parsed into JSON), or if it includes both a final answer and a parse-able action, the You can find more details in the LangChain repository, specifically in the ChatOutputParser class. I hope this helps! If you have any other questions or need further clarification, feel free to ask. Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
what's wrong with this?
Beta Was this translation helpful? Give feedback.
All reactions