Use raise from statement so that users can find detailed error message (#11461)

- **Description:** Use `raise from` statement so that users can find
detailed error message
  - **Tag maintainer:** @baskaryan, @eyurtsev, @hwchase17
pull/11638/head
Yang, Bo 9 months ago committed by GitHub
parent 9a0ed75a95
commit 3a82bd7bdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -37,9 +37,11 @@ class ChatOutputParser(AgentOutputParser):
response["action"], response.get("action_input", {}), text
)
except Exception:
except Exception as exc:
if not includes_answer:
raise OutputParserException(f"Could not parse LLM output: {text}")
raise OutputParserException(
f"Could not parse LLM output: {text}"
) from exc
output = text.split(FINAL_ANSWER_ACTION)[-1].strip()
return AgentFinish({"output": output}, text)

Loading…
Cancel
Save