
azure-openai
#10477
invalid_value_error
Invalid value provided. Supported values include: 'system', 'assistant', 'user', 'function', 'tool', and others depending on context.
This error has been identified and solved.
Reason
The 400 status error in the Azure OpenAI API, specifically the error message "Invalid value: 'Tel...st.'. Supported values are: 'system', 'assistant', 'user', 'function', and 'tool'," is likely due to an issue with the messages
array in your request payload.
Here are the key reasons for this error:
Incorrect Role in Messages: The error indicates that the
role
field in one of the messages does not match the supported values ('system', 'assistant', 'user', 'function', or 'tool').Invalid Request Configuration: The request payload may contain invalid or mismatched values for required properties, such as the
role
field in themessages
array.
This error suggests that the payload you are passing to the API is not conforming to the expected schema for the messages
array.
Solution
To fix the 400 status error in the Azure OpenAI API due to the "Invalid value" error in the role
field, you need to ensure that the roles used in the prompt messages are valid. Here are the steps to resolve this issue:
Verify that the
role
field in each message is set to one of the supported values: 'system', 'assistant', 'user', 'function', or 'tool'.Ensure the request payload conforms to the expected schema for the
messages
array.Check for any typos or incorrect values in the
role
fields.
By correcting the role
values to match the supported ones, you should be able to resolve the error.
Suggested Links
https://portkey.ai/error-library/prompt-error-10016
https://github.com/danny-avila/LibreChat/discussions/3115
https://cheatsheet.md/chatgpt-cheatsheet/openai-api-error-axioserror-request-failed-status-code-400
https://community.openai.com/t/getting-400-response-with-already-working-code/509212
https://learn.microsoft.com/en-us/answers/questions/1479386/azure-openai-api-calling-issue
https://learn.microsoft.com/en-us/azure/ai-services/openai/reference-preview
https://github.com/langgenius/dify/issues/4686
https://learn.microsoft.com/en-us/answers/questions/1721425/azure-openai-cant-add-assistants-message-content-a