Agents v2 (branch-to-branch): port workarounds for AOAI (FDP) openai files quirks #53621
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.
When (and only when) using
fine-tuneas thepurposefor uploading files, the OpenAI "Create File" operation behaves differently in AOAI/FDP relative to OpenAI:Content-Typeheader is required on the multipart/form-data part forfileThe Azure OpenAI library, by virtue of its
[InternalsVisibleTo]relationship with the OpenAI library, implements a full replacement of some of the logic to account for this. We don't want to and can't have this kind of relationship going forward, so we need to achieve the same workarounds in a different way.With this change, we use a pipeline policy to:
Content-Typeheader in create file requestsMirroring Azure OpenAI, an extension method is also provided for
OpenAIFilethat can retrieve the wire value initially received.Net effect: an OpenAIClient retrieved via an AgentsClient can now successfully use create/get file operations.