-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix toolcall error #40547
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
base: main
Are you sure you want to change the base?
Fix toolcall error #40547
Conversation
* Add Prompty as dependency * Ignore linters * Fix linter issues * Address PR review comments
This reverts commit 47eea99.
* [AI] [Projects] add latest TypeSpec commit * auto-genned code in PR branch * update custom code with openapi optional parameter * update openapi sample to use default_parameters param * add bing custom search tool definition * add bing custom search sample * mypy error * revert bad doc strings * fix tox sphinx * add content * revert operations upload_file methods * fix one lint issue * make default_parameter an optional * fix lint error - line too long * add type annotation to default_params * update snippets
* [AI] [Projects] List Threads operation commit from TypeSpec * generated code * show sample usage of list_threads API * add doc link for sample * review feedback
* Redesign automatic toolcalls * fix test
Image input support for assistants create message
* Fixes * Suppress Pylint errors
@@ -734,7 +734,7 @@ def execute(self, tool_call: RequiredFunctionToolCall) -> Any: | |||
try: | |||
function, parsed_arguments = self._get_func_and_args(tool_call) | |||
return function(**parsed_arguments) if parsed_arguments else function() | |||
except TypeError as e: | |||
except Exception as e: |
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.
Notes both execute function are only called by the following code:
for tool_call in tool_calls:
try:
if tool_call.type == "function":
tool = self.get_tool(FunctionTool)
output = tool.execute(tool_call)
tool_output = {
"tool_call_id": tool_call.id,
"output": output,
}
tool_outputs.append(tool_output)
except Exception as e: # pylint: disable=broad-exception-caught
tool_output = {"tool_call_id": tool_call.id, "output": str(e)}
tool_outputs.append(tool_output)
With that said, before this change, output field is the error message for non-TypeError exception. With this change all exceptions will cause the output to be {error = }
API change check API changes are not detected in this pull request. |
Description
Please add an informative description that covers that changes made by the pull request and link all relevant issues.
If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines