Python: Add file_ids support to AzureAIAgentClient.get_code_interpreter_tool()#4201
Open
giles17 wants to merge 2 commits intomicrosoft:mainfrom
Open
Python: Add file_ids support to AzureAIAgentClient.get_code_interpreter_tool()#4201giles17 wants to merge 2 commits intomicrosoft:mainfrom
file_ids support to AzureAIAgentClient.get_code_interpreter_tool()#4201giles17 wants to merge 2 commits intomicrosoft:mainfrom
Conversation
…et_code_interpreter_tool() Update the factory method to accept file_ids and data_sources keyword arguments, matching the underlying azure.ai.agents SDK CodeInterpreterTool constructor. This enables users to attach uploaded files for code interpreter analysis. Fixes microsoft#4050 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
file_ids support to AzureAIAgentClient.get_code_interpreter_tool()
Member
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds file_ids and data_sources support to AzureAIAgentClient.get_code_interpreter_tool(), enabling users to attach uploaded files to the code interpreter for analysis. This addresses issue #4050 where users couldn't provide file attachments through the framework's factory method.
Changes:
- Extended
get_code_interpreter_tool()to acceptfile_idsanddata_sourceskeyword arguments that are forwarded to the Azure Agents SDK'sCodeInterpreterTool - Added
VectorStoreDataSourceimport to support the new parameter type - Added comprehensive test coverage for basic instantiation, file_ids forwarding, and integration with the tool preparation pipeline
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
python/packages/azure-ai/agent_framework_azure_ai/_chat_client.py |
Added file_ids and data_sources parameters to get_code_interpreter_tool() method with updated docstring and examples; imported VectorStoreDataSource type |
python/packages/azure-ai/tests/test_azure_ai_agent_client.py |
Added three test cases: basic tool creation, file_ids parameter forwarding, and tool_resources population in run options |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
file_idsanddata_sourceskeyword arguments toAzureAIAgentClient.get_code_interpreter_tool(), matching the underlyingazure.ai.agentsSDKCodeInterpreterToolconstructor. This enables users to attach uploaded files for code interpreter analysis.Problem
AzureAIAgentClient.get_code_interpreter_tool()accepted no parameters and always returned aCodeInterpreterTool()without file references. Users had no way to attach uploaded CSV/data files through the framework's factory method.Changes
_chat_client.py: Updatedget_code_interpreter_tool()to acceptfile_idsanddata_sourceskeyword-only parameters, forwarding them to the SDK'sCodeInterpreterTool(...). AddedVectorStoreDataSourceimport.test_azure_ai_agent_client.py: Added 3 tests covering basic instantiation,file_idsforwarding, and_prepare_tools_for_azure_aicorrectly populatingtool_resources.Usage
Fixes #4050