-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
feat: select errors that will be caught when raised within a tool #5488
base: main
Are you sure you want to change the base?
Conversation
@@ -37,6 +37,9 @@ def description(self) -> str: ... | |||
@property | |||
def schema(self) -> ToolSchema: ... | |||
|
|||
@property | |||
def return_errors(self) -> tuple[type[Exception], ...] | type[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.
Let's rename it return_error_types
? This makes it align with the return_type
property that already exists.
Let's also add API doc comment to each field of Tool
and BaseTool
as a good Samaritan 😄
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.
Let's also add API doc comment to each field of Tool and BaseTool as a good Samaritan
Not sure what you mean by this. Do you want me to add docstrings to every function in Tool/BaseTool?
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.
Yes. I was asking if you would be willing to add the docstrings.
I think there was some confusion on the Issue regarding what this feature should do. Do we want to keep adding the error types to the Tool or is there now a preference to add it to the agent? Former has the advantage that you can deal differently with each tool, latter allows you to only define it once and it is applied automatically for every tool. |
So sorry I am going back-and-forth here. My initial thought for #5274 is that we want to configure how However, I think there could be some issues:
So I am more inclined to configure how the errors raised from So, we need to update However, I do think we need to wait for a bit because it is an important API change, and overlaps with concepts discussed in #4721. Let's wait on this PR and consider multiple ideas together. |
My proposal is to pass the |
Conversation starter to agree on the implementation. When we are aligned, I'll add tests.
Why are these changes needed?
Not every tool error should be returned to the agent. This change allows to cherry-pick which exceptions we want to share with the agent.
Related issue number
Closes: #5274
Checks