
azure-openai
#10055
invalid_property_error
Additional properties are not allowed. Unexpected property found in the input.
This error has been identified and solved.
Reason
The 400 status error in the Azure OpenAI API, specifically the message "Additional properties are not allowed ('functions' was unexpected) - 'messages.0'," indicates a few potential issues:
Invalid Request Structure
The error suggests that the request payload is not correctly formatted according to the API's expectations. This could be due to the presence of unauthorized or unexpected fields in the messages
array, such as the functions
property which is not recognized by the API.
Incorrect Data Types
The API might be expecting specific data types for certain fields, and the provided data does not match those expectations. For example, if the API expects a string for the content
field, but an array or another type is provided instead.
Non-Compliance with API Schema
The request payload may not adhere to the schema defined in the API documentation. The messages
array and its contents must comply with the expected structure and data types as specified in the API reference.
These issues collectively point to a mismatch between the request payload and the API's requirements, leading to a "Bad Request" error with a status code of 400.
Solution
To fix the 400 status error in the Azure OpenAI API due to "Additional properties are not allowed" or "Unexpected property found in the input," you need to ensure your request aligns with the API's expectations. Here are the key steps to take:
Review the API Documentation: Ensure your request payload complies with the schema defined in the API reference.
Remove Unauthorized Fields: Eliminate any fields or properties that are not recognized by the API, such as unexpected properties like
functions
.Verify Data Types: Confirm that the data types of the fields in your request match what the API expects.
Check the Request Structure: Make sure the structure of your request, including arrays and objects, is correctly formatted according to the API's requirements.
By adhering to these guidelines, you can ensure your request is properly formatted and compliant with the API's specifications.