-
Notifications
You must be signed in to change notification settings - Fork 16.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chatconv agent: output parser exception #4923
Conversation
56ef889
to
0229e56
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me - what is the reason for changing the inheritance of the exception?
langchain/schema.py
Outdated
@@ -360,7 +360,7 @@ def dict(self, **kwargs: Any) -> Dict: | |||
return output_parser_dict | |||
|
|||
|
|||
class OutputParserException(Exception): | |||
class OutputParserException(ValueError, Exception): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this needed for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the ValueError as a base class to OutputParserException to avoid breaking code that was relying on ValueError as a way to catch exceptions from the agent. So catching ValuError still works. Not sure if this is a good idea ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea imo. but don't need to inherit from Exception in that case (ValueError already subclass of Exception)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true didn't think about it.
0229e56
to
29c2de1
Compare
29c2de1
to
4e42c73
Compare
thanks @blob42 ! |
the output parser form chat conversational agent now raises
OutputParserException
like the rest.The
raise OutputParserExeption(...) from e
form also carries through the original error details on what went wrong.I added the
ValueError
as a base class toOutputParserException
to avoid breaking code that was relying onValueError
as a way to catch exceptions from the agent. So catching ValuError still works. Not sure if this is a good idea though ?Who can review?