-
Notifications
You must be signed in to change notification settings - Fork 849
Add Image Detail support for Image DataContent to OpenAIResponsesChatClient. #7042
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
Add Image Detail support for Image DataContent to OpenAIResponsesChatClient. #7042
Conversation
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
This PR adds image detail level support to OpenAIResponsesChatClient, enabling users to specify detail levels (like "high" or "low") for image content in chat messages. This feature was already available in OpenAIChatClient and is now being added for consistency.
- Implements a
GetImageDetailhelper method that extracts detail level fromAIContent.AdditionalProperties - Updates image content handling to pass the detail level to OpenAI's
CreateInputImagePartmethods - Adds comprehensive test coverage for both URI and data-based image content with detail levels
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponsesChatClient.cs | Adds GetImageDetail helper method and updates image content conversion to include detail level parameter |
| test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientTests.cs | Adds test cases for image content with both string and ResponseImageDetailLevel type detail levels |
Similar how it is handled by the
OpenAIChatClientthis allows setting the ImageDetail forOpenAIResponsesChatClient.Microsoft Reviewers: Open in CodeFlow