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
Adding re-raise flag at OpenAI Agent level #12674
Adding re-raise flag at OpenAI Agent level #12674
Conversation
…t to allow the re-raise of exception when needed.
I see some checks failed due to a 503 Service Unavailable, any idea why or if this is a regular situation? I am not able to re-trigger the failed checks. |
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.
LGTM
@@ -54,6 +54,7 @@ def __init__( | |||
verbose: bool = False, | |||
max_function_calls: int = DEFAULT_MAX_FUNCTION_CALLS, | |||
default_tool_choice: str = "auto", | |||
raise_error: bool = False, |
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.
My general feedback is this arg is pretty generic, but its actual use only covers one very specific use-case, which is kind of misleading
Is there any way we can think of to improve this? A better name? Handle more scenarios where errors are caught?
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.
Also, please double check the unit tests
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.
Hi Logan! Thank you for the comments! :)
So regarding this feature, absolutely! I understand there are multiple places where exceptions are raised which are captured by llama-index code.
This was motivated by Azure filtering error exception while streaming, I needed to capture in my side the exception.
I noticed the functionality (i.e. the flag to re-reaise the exception) was there, although not end-to-end implemented.
My main objective was to introduce the parameter at an Agent level, as this was recommended in a thread in Discord.
I'm no expert of the whole llama-index codebase, but I am sure that with this small step, any other in need of this kind of feature will be able to adjust, in future PRs, the code to get exception in particular scenarios if they need!
Regarding the naming of the variable at an Agent level, wdyt of capture_exception
or rethrow_exception
, to be more explicit of not an error, but an exception.
And to finish, I checked the unit tests, they neither pass in the main branch (at least on my setup). I would take a look.
Please let me know about your thought on this! ✨
In order to avoid hiding actual errors, I've removed this option altogether, and errors will always be raised. Going to close this for now. |
Description
Added
raise_error
congif argument at an Agent level in the OpenAI Agent class to allow the re-raise of exception when needed (an implemented feature, although not end-to-end).Type of Change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Suggested Checklist:
make format; make lint
to appease the lint gods