
openai
#11310000
request_parameter_error
Invalid request: 'functions' and 'tools' cannot both be provided. 'Functions' are deprecated; use the 'tools' parameter instead.
This error has been identified and solved.
Reason
The error you are encountering, where the OpenAI API returns a 400 status code with the message "Invalid request: 'functions' and 'tools' cannot both be provided. 'functions' are deprecated; use the 'tools' parameter instead," is due to the following reasons:
The API request is including both the deprecated
functions
parameter and the newtools
parameter, which is not allowed.The
functions
parameter has been deprecated, and the API expects you to use thetools
parameter instead.
This indicates a mismatch between the deprecated and current API parameters in your request configuration.
Solution
To fix the 400 status error due to the invalid request where both functions
and tools
are provided, you need to adjust your API request configuration as follows:
Remove the
functions
parameter from your request since it is deprecated.Use the
tools
parameter instead to specify the necessary tools.
Here are the key steps:
Ensure your request only includes the
tools
parameter.Update your code to comply with the current API requirements, eliminating any references to the deprecated
functions
parameter.Verify that your API request adheres to the latest OpenAI API documentation guidelines.
Suggested Links
https://cheatsheet.md/chatgpt-cheatsheet/openai-api-error-axioserror-request-failed-status-code-400 https://github.com/openai/openai-python/issues/703 https://community.openai.com/t/getting-400-response-with-already-working-code/509212 https://community.openai.com/t/content-is-required-property-error-400/486260 https://github.com/Nutlope/aicommits/issues/137