
azure-openai
#10481
value_not_supported_error
Invalid value provided. Supported values are: 'text', 'image_url', 'audio_url', and 'refusal'.
This error has been identified and solved.
Reason
The 400 status error in the Azure OpenAI API, with the specific message "Invalid value: 'image'. Supported values are: 'text', 'image_url', 'audio_url', and 'refusal'," is likely due to several possible reasons:
Incorrect Content Type
The error indicates that the value 'image' is not supported. This suggests that the type
field in your request payload may be incorrectly set to 'image', which is not one of the accepted types ('text', 'image_url', 'audio_url', and 'refusal').
Model Limitations
The GPT-4o model, for example, only supports text input and does not support image URLs directly. If you are trying to use an image, you might be using the wrong model or configuration.
Request Payload Structure
The structure of your request payload might be incorrect, particularly in how the content is specified. The API expects specific formats for different types of content, and 'image' is not a valid type in this context.
Solution
To resolve the 400 status error in the Azure OpenAI API with the message "Invalid value: 'image'. Supported values are: 'text', 'image_url', 'audio_url', and 'refusal'," you need to adjust the content type and request payload accordingly.
Ensure the
type
field in your request payload is set to one of the supported values: 'text', 'image_url', 'audio_url', or 'refusal'.Verify that you are using a model that supports the type of content you are providing.
Correct the request payload structure to match the expected format for the chosen content type.
By making these adjustments, you should be able to resolve the error and successfully submit your request.
Suggested Links
https://portkey.ai/error-library/prompt-error-10016
https://learn.microsoft.com/en-us/answers/questions/2057435/azure-openai-api-with-gpt-4o-deployment-fails-to-c
https://cheatsheet.md/chatgpt-cheatsheet/openai-api-error-axioserror-request-failed-status-code-400
https://community.openai.com/t/image-url-for-gpt-4o-api-giving-error-expected-an-object-but-got-a-string-instead/748188
https://learn.microsoft.com/en-us/answers/questions/1479386/azure-openai-api-calling-issue
https://community.openai.com/t/how-can-i-write-a-post-request-for-azure-openai-that-uses-structured-output/898569
https://learn.microsoft.com/en-us/azure/ai-services/openai/references/on-your-data