fix: make detail parameter optional in ResponseInputImage interface#1575
Open
princeaden1 wants to merge 1 commit intoopenai:masterfrom
Open
fix: make detail parameter optional in ResponseInputImage interface#1575princeaden1 wants to merge 1 commit intoopenai:masterfrom
princeaden1 wants to merge 1 commit intoopenai:masterfrom
Conversation
tetraprod
approved these changes
Jul 18, 2025
tetraprod
approved these changes
Jul 18, 2025
Author
|
@RobertCraigie this part of the code / docs needs to be addressed, because the current example can lead to confusion when working with image URL. The OpenAI documentation example (below) doesn’t address the typing requirements for content, so when someone follows it directly, TypeScript throws errors. It took some digging to understand what was wrong and how to structure the content array correctly. Approve the two PRs (#1575) and (#1571) to save others from stress OpenAI documentation example:
Documentation from my PR #1571 |
1 task
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Summary
Makes the
detailparameter optional in theResponseInputImageinterface to align with the documented behavior that states it "Defaults toauto".Problem
The
detailparameter was marked as required in the TypeScript interface despite the comment indicating it has a default value of'auto'. This created unnecessary friction for developers who want to rely on the default behaviour. When the detail is omitted from the code, the openai api perform as expected but IDE will always flagdetailas required (typescript). From all the examples provided on openai documentation pages,detailis optional.Solution
Added the optional modifier (
?) to thedetailparameter in theResponseInputImageinterface.Changes
?todetailparameter inResponseInputImageinterfaceType of Change
Impact
This change will improve developer experience by allowing developers to omit the
detailparameter when they want to use the default'auto'behaviour.Additional context & links