julep-ai / julep

A new DSL and server for AI agents and multi-step tasks
https://julep.ai
Apache License 2.0
2.66k stars 911 forks source link

fix(agents-api): Fix handling error message type #804

Closed Ahmad-mtos closed 3 weeks ago

Ahmad-mtos commented 3 weeks ago

Fix error type handling in web.py


[!IMPORTANT] Fixes error message extraction and type handling in _handler() in web.py to improve error handling robustness.

  • Behavior:
    • Fixes error message extraction in _handler() in web.py to handle cases where msg attribute is missing in error objects.
  • Type Handling:
    • Uses cast to ensure exc is of type Union[ValidationError, RequestValidationError] in _handler() in web.py.

This description was created by Ellipsis for 6ed8d64342cea1e551ce271c153dca0573edb8f4. It will automatically update as commits are pushed.

sweep-ai[bot] commented 3 weeks ago

Hey @Ahmad-mtos, here is an example of how you can ask me to improve this pull request:

@sweep Add unit tests for `_handler` function in `web.py` that verify:
1. Error handling when error objects don't have a 'msg' attribute
2. Error handling when errors are dictionaries vs objects
3. Proper type casting of ValidationError and RequestValidationError exceptions

:book: For more information on how to use Sweep, please read our documentation.