This repository was archived by the owner on Oct 23, 2023. It is now read-only.
Function Call: Bad Request #31
Unanswered
rooislangwtf
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm trying to recreate the python example of function calling in php (https://platform.openai.com/docs/guides/gpt/function-calling).
The example has 2 parts: part 1 does the call to ChatCompletion that includes the user message as well as the function(s) and part 2 that then gets a response from the suggested function which gets sent to ChatCompletion again to get a response based on the results from the function call. When I do part 2 I get an "Unsuccessful response. HTTP status code: 400 (Bad Request). on line 150 in ChatCompletions.php".
For the first successful call the request looks like this:
And I get the expected response of:
So for the second call I then make a response chain of:
So the request looks like this which then causes the 400 error:
I don't think the error is related to tokens etc. since I also did the python example and that works and if I remove the array that contains the "function_call" (array index 1) from the response chain I can get a response of "The current weather in Boston, MA is sunny and windy with a temperature of 72°F.".
I've also hard coded a response chain in python and sent that to the chat completions endpoint and I also can get a response of "The current weather in Boston, MA is sunny and windy with a temperature of 72 degrees."
So I can get it to work in php if I remove the message that contains the "function_call" response from the response chain, but I'm worried that would remove some needed context when I do real functions' responses. Just wanted to hear if there's a glaring error I'm making / if it's a bug?
Beta Was this translation helpful? Give feedback.
All reactions