
azure-openai
#10056
invalid_property_error
Additional properties are not allowed. Unexpected property found in the input.
This error has been identified and solved.
Reason
The "400 Bad Request" error with the message "Additional properties are not allowed ('functions' was unexpected) - 'messages.0'" in the Azure OpenAI API is likely due to several possible reasons:
Invalid Request Configuration
The request payload may contain properties that are not allowed or expected by the API. Specifically, the presence of a 'functions' property within the 'messages' array is unexpected and violates the API's schema requirements.
Incorrect Payload Structure
The structure of the payload, particularly the 'messages' array, may not conform to the expected format defined by the OpenAI API. This could include having additional or unexpected fields that are not recognized by the API.
API Schema Compliance
The request may be violating the specific schema or constraints defined by the OpenAI API, which does not allow certain properties like 'functions' in the context of the 'messages' array.
API Version and Endpoint Issues
There could be discrepancies between the API version or endpoint being used and the expectations of the API, leading to incompatible request structures.
Solution
To fix the "400 Bad Request" error with the message "Additional properties are not allowed ('functions' was unexpected) - 'messages.0'" in the Azure OpenAI API, you need to ensure your request payload complies with the API's expected schema.
Here are the key steps to resolve this issue:
Remove unexpected properties: Ensure that the 'messages' array does not contain any properties that are not allowed, such as 'functions'.
Correct payload structure: Verify that the structure of the 'messages' array conforms to the expected format defined by the OpenAI API.
Check API version and endpoint: Make sure you are using the correct API version and endpoint to avoid compatibility issues.
Refer to API documentation: Consult the Azure OpenAI API documentation to ensure your request body matches the required schema.
Suggested Links
https://portkey.ai/error-library/prompt-error-10016
https://github.com/Azure/azure-sdk-for-net/issues/43953
https://cheatsheet.md/chatgpt-cheatsheet/openai-api-error-axioserror-request-failed-status-code-400
https://github.com/Azure/azure-sdk-for-js/issues/27039
https://learn.microsoft.com/en-us/answers/questions/1479386/azure-openai-api-calling-issue
https://learn.microsoft.com/en-us/answers/questions/2139738/openai-badrequesterror-error-code-400-((error-((me
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