Repository navigation
Python: Accept input_file file_data in the Responses hosting parser - #10284
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit intoNov 12, 2026
Conversation
Signed-off-by: NNIIOVO <haimingni44@gmail.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the inline file-data parsing change.
No open issues 🎉
What changed in this PR
Adds inline file_data support to the Python Responses hosting parser, allowing hosted agents to receive local files sent by OpenAIChatClient and addressing #10283.
Changes:
- Accepts base64 data URIs and plain base64, inferring the latter’s media type from the filename with an
application/octet-streamfallback. - Validates base64 payloads while preserving existing
file_urlandfile_idprecedence. - Adds tests for supported formats, media-type fallback, and invalid inputs.
| File | Description |
|---|---|
python/packages/hosting-responses/tests/hosting_responses/test_parsing.py |
Tests inline file parsing and malformed-input rejection. |
python/packages/hosting-responses/agent_framework_hosting_responses/_parsing.py |
Adds inline file decoding validation and data-content conversion. |
Review effort: Balanced
2 tasks done
Eduard van Valkenburg (eavanvalkenburg)
approved these changes
Nov 12, 2026
This branch was successfully deployed
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.
Motivation & Context
The Responses hosting parser rejected
input_fileparts with inlinefile_data, which is whatOpenAIChatClientsends for a local file. So Agent Framework's own OpenAI client couldn't send a PDF to an agent hosted withagent-framework-hosting-responses. Repro is in #10283.Description & Review Guide
_content_from_input_itemgets afile_databranch next tofile_urlandfile_id. A data URI becomes data content as is. Plain base64 (nodata:prefix) is wrapped in a data URI, with the media type guessed fromfilenameorapplication/octet-stream. The payload is checked withbase64.b64decode(validate=True), and a bad or non-base64 value raisesValueErrorlike the other malformed inputs.file_urlandfile_idparts are unchanged and still take precedence if more than one is sent.Tests: I added tests for
file_dataas a data URI and as plain base64 (they fail on main), theapplication/octet-streamfallback, and malformed or non-base64 values.Related Issue
Fixes #10283
AI Assistance
AI assistance details: issue analysis, implementation, tests, and this description.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.