Hi, I am using a function calling for one of my use cases. In the function definition, I have not passed any arguments. But when the GPT returns the function name then it also returns the arguments.
This above is implemented in stream=True condition in GPT 3.5 Turbo 16K.
Code Sample:-
function = [
{
"name": "not_interested_buying_iphone_decision",
"description": "Triggers when the user expresses disinterest in purchasing the iPhone. This function is called based on the ongoing conversation.",
"parameters": {
"type": "object",
"properties": {}
}
},
]
for chunk in response:
print(chunk)
try:
if chunk['choices'] and chunk['choices'][0] and chunk['choices'][0].get('delta') and chunk['choices'][0]['delta'].get("content"):
print(chunk['choices'][0]['delta']["content"], end="")
complete_streamed_text += chunk['choices'][0]['delta']["content"]
elif chunk['choices'] and chunk['choices'][0] and chunk['choices'][0].get('delta') and chunk['choices'][0]['delta'].get("function_call") and chunk['choices'][0]['delta']["function_call"].get("name"):
function_name = chunk['choices'][0]['delta']["function_call"]["name"].strip()
elif chunk['choices'] and chunk['choices'][0] and chunk['choices'][0].get('delta') and chunk['choices'][0]['delta'].get("function_call") and chunk['choices'][0]['delta']["function_call"].get("arguments"):
print("INSIDE ARGUMENTS")
argument += chunk['choices'][0]['delta']["function_call"]["arguments"].strip()
except:
print("Error")
pass
Please help, its a bit urgent