Hello
I have an issue with function calling with the chat API:
it does return the function to call, however, there are no arguments.
For example, this is the data sent for a test:>
{“model”:“gpt-4-0125-preview”,“messages”:[{“role”:“user”,“content”:“What is the weather in Paris”}],“temperature”:0.3,“top_p”:0.5,“stream”:true,“presence_penalty”:0.1,“frequency_penalty”:0.1,“tools”:[{“type”:“function”,“function”:{“name”:“get_weather”,“description”:“Get the weather for a given location”,“parameters”:{“type”:“object”,“properties”:{“location”:{“type”:“string”,“description”:“Location to get the weather for e.g. Paris”,“properties”:{}}},“required”:[“location”]}}}]}
Just figured something out. Turns out since I’m doing streaming, the name of the tool call first comes in, then the argument starts streaming in chunk by chunk. Very peculiar. Gonna go and solve this now.
Seems like there is a bug. It makes sense that on toolCallCreated, there would be no arguments, but when you log out toolCallDone, the arguments are STILL empty.
It seems they can only be accessed by capturing them from the toolCallDelta, which is an unneeded PITA for function calling (where 99% of the time, you’re going to wait until the response is complete to run the function).