-
Notifications
You must be signed in to change notification settings - Fork 3.2k
refine foundry tools support for agent framework #44652
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
refine foundry tools support for agent framework #44652
Conversation
|
Thank you for your contribution @melionel! We will review the pull request and get back to you soon. |
| tools = await self._foundry_tool_client.list_tools() | ||
| base = context.chat_options or ChatOptions() | ||
| base_tools = base.tools or [] | ||
| context.chat_options.tools = base_tools + tools |
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.
chat_options may be None
| :ivar Any value: The result value from the tool invocation. | ||
| """ | ||
| value: Any = Field(serialization_alias="toolResult") | ||
| value: Any = Field(validation_alias="toolResult", serialization_alias="toolResult") |
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.
we can remove serialization_alias="toolResult" since we only do deserialize
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.
| ], | ||
| Discriminator( | ||
| lambda payload: "ErrorType" if isinstance(payload, dict) and "type" in payload else "ResultType" | ||
| lambda payload: "ErrorType" if isinstance(payload, dict) and |
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.
in service code, only error related response has field 'type'
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.
that's not true. even the success response contains the 'type' field
| payload_text = response.text() | ||
| payload_json = json.loads(payload_text) if payload_text else {} | ||
| except AttributeError as e: | ||
| payload_bytes = response.body() |
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 scenario will trigger this 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.
just in case the response has no text()
| async with response: | ||
| invoke_response = InvokeFoundryConnectedToolsResponse.model_validate(response.json()) | ||
| try: | ||
| payload_text = response.text() |
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.
seems we can move them to base operations if we need do the same thing on every response

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 API spec, a link to the pull request containing these API spec changes should be included above.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines