Skip to content

Conversation

stephentoub
Copy link
Member

@stephentoub stephentoub commented Jul 16, 2025

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

Enables a file name to optionally be associated with a DataContent. DataContent is often used to represent named entities, such as when uploading files.
@Copilot Copilot AI review requested due to automatic review settings July 16, 2025 15:10
@stephentoub stephentoub requested a review from a team as a code owner July 16, 2025 15:10
@github-actions github-actions bot added the area-ai Microsoft.Extensions.AI libraries label Jul 16, 2025
Copy link
Contributor

@Copilot Copilot AI left a 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 on DataContent 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

@stephentoub stephentoub force-pushed the datacontentfilename branch from 94d787b to 4fab6d8 Compare July 18, 2025 02:15
@stephentoub stephentoub enabled auto-merge (squash) July 18, 2025 03:04
@stephentoub stephentoub changed the title Add DataContent.FileName property Add DataContent.Name property Jul 18, 2025
@stephentoub stephentoub disabled auto-merge July 18, 2025 03:08
@stephentoub stephentoub enabled auto-merge (squash) July 18, 2025 03:08
This was referenced Aug 15, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Aug 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-ai Microsoft.Extensions.AI libraries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants