better error message on parsing errors (#11342)

pull/11348/head
Harrison Chase 9 months ago committed by GitHub
parent b3c83fdd33
commit bdf865d8e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -931,7 +931,12 @@ class AgentExecutor(Chain):
else:
raise_error = False
if raise_error:
raise e
raise 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. "
f"This is the error: {str(e)}"
)
text = str(e)
if isinstance(self.handle_parsing_errors, bool):
if e.send_to_llm:
@ -1027,7 +1032,12 @@ class AgentExecutor(Chain):
else:
raise_error = False
if raise_error:
raise e
raise 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. "
f"This is the error: {str(e)}"
)
text = str(e)
if isinstance(self.handle_parsing_errors, bool):
if e.send_to_llm:

Loading…
Cancel
Save