
openai
#10114
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, specifically the message "Invalid request: 'functions' and 'tools' cannot both be provided. 'functions' are deprecated; use the 'tools' parameter instead," indicates a few key issues:
The API request is including both the
functions
andtools
parameters, which is not allowed.The
functions
parameter is deprecated and should no longer be used.
This error occurs because the OpenAI API has updated its parameters, and the deprecated functions
parameter is no longer compatible with the current API version.
Solution
To fix the error, you need to adjust your API request to comply with the current OpenAI API specifications. Here are the steps to take:
Remove the
functions
parameter from your API request.Use the
tools
parameter instead, as it is the replacement for the deprecatedfunctions
parameter.Ensure that your request only includes the
tools
parameter and does not mix it with thefunctions
parameter.
By making these changes, you should be able to resolve the "Invalid request" error and successfully interact with the OpenAI API.
Suggested Links
https://cheatsheet.md/chatgpt-cheatsheet/openai-api-error-axioserror-request-failed-status-code-400
https://community.openai.com/t/content-is-required-property-error-400/486260
https://community.openai.com/t/getting-400-response-with-already-working-code/509212
https://github.com/Nutlope/aicommits/issues/137
https://community.openai.com/t/request-failed-with-status-code-400/39242
https://learn.microsoft.com/en-us/answers/questions/1476122/for-how-long-will-the-functions-parameter-be-suppo
https://discuss.ai.google.dev/t/gemini-openai-compatibility-multiple-functions-support-in-function-calling-error-400/49431
https://community.openai.com/t/i-am-receiving-an-error-status-code-400/351121
https://github.com/langchain-ai/langchainjs/issues/5237