-
Couldn't load subscription status.
- Fork 840
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
Conversation
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
FileNameonDataContentwith 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
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