-
Notifications
You must be signed in to change notification settings - Fork 828
Add DataContent.Name property #6616
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
Merged
Merged
Conversation
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
Enables a file name to optionally be associated with a DataContent. DataContent is often used to represent named entities, such as when uploading files.
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.
Pull Request Overview
Adds an optional FileName property to DataContent so that callers can associate a file name with binary data, and updates serialization, API clients, and tests to honor this new property.
- Introduce
FileName
onDataContent
with XML docs - Update JSON spec and source-gen context to include
fileName
- Modify OpenAI clients to use the provided file name (or fall back to a GUID-based name) when sending PDF parts
- Extend and adjust tests to cover serialization and property behavior
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/DataContent.cs | Add nullable FileName property with docs |
src/Libraries/Microsoft.Extensions.AI.Abstractions/Microsoft.Extensions.AI.Abstractions.json | Include FileName in the API surface JSON spec |
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponseChatClient.cs | Use FileName fallback when composing PDF input parts |
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIChatClient.cs | Use FileName fallback when creating chat file parts |
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Contents/DataContentTests.cs | Add serialization and round-trip tests for FileName |
test/Libraries/Microsoft.Extensions.AI.Integration.Tests/ChatClientIntegrationTests.cs | Supply FileName in a multi-modal integration test |
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/DataContent.cs
Outdated
Show resolved
Hide resolved
94d787b
to
4fab6d8
Compare
eiriktsarpalis
approved these changes
Jul 18, 2025
This was referenced Aug 13, 2025
Merged
This was referenced Aug 15, 2025
Closed
Closed
Closed
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Enables a file name to optionally be associated with a DataContent. DataContent is often used to represent named entities, such as when uploading files.
I went back and forth on whether this should be FileName or just Name. @eiriktsarpalis, @rogerbarreto, do you have an opinion?
Microsoft Reviewers: Open in CodeFlow