Files
agent-framework/python/packages
T
Giles Odigwe 7135ed13eb Python: Add file_ids and data_sources support to get_code_interpreter_tool() (#4201)
* Python: Add file_ids and data_sources support to AzureAIAgentClient.get_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 #4050

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* addressed comments

* addressed comments

* Add per-message file attachment support for AzureAIAgentClient

Add hosted_file handling in _prepare_messages() to convert
Content.from_hosted_file() into MessageAttachment on ThreadMessageOptions.
This enables per-message file scoping for code interpreter, matching the
underlying Azure AI Agents SDK MessageAttachment pattern.

- Add hosted_file case in _prepare_messages() match statement
- Import MessageAttachment from azure.ai.agents.models
- Add sample for per-message CSV file attachment with code interpreter
- Add employees.csv test data file
- Add 3 unit tests for hosted_file attachment conversion

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address PR review: validation, fix assertions, remove MessageAttachment

- Add empty string validation in resolve_file_ids()
- Add test for Content with file_id=None
- Add test for empty string file_ids
- Revert MessageAttachment/hosted_file handling from _prepare_messages()
  (moved to separate issue #4352 for proper design)
- Remove per-message file upload sample and employees.csv
- Keep data_sources assertion as-is (dict keyed by asset_identifier)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
7135ed13eb ยท 2026-03-03 23:01:17 +00:00
History
..