mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-20 01:49:51 +00:00
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
This commit is contained in:
parent
9a0ed75a95
commit
3a82bd7bdb
@ -37,9 +37,11 @@ class ChatOutputParser(AgentOutputParser):
|
|||||||
response["action"], response.get("action_input", {}), text
|
response["action"], response.get("action_input", {}), text
|
||||||
)
|
)
|
||||||
|
|
||||||
except Exception:
|
except Exception as exc:
|
||||||
if not includes_answer:
|
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()
|
output = text.split(FINAL_ANSWER_ACTION)[-1].strip()
|
||||||
return AgentFinish({"output": output}, text)
|
return AgentFinish({"output": output}, text)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user