Hi, I noticed that the failure rate of function calls of gpt-4o-mini is increasing today while gpt-4o not. I used the example https://platform.openai.com/docs/guides/function-calling to test whether gpt-4o-mini can return func_call. However, only 3 succeeded when I sent 10 requests. Why is that? The failure rate of gpt-4o-mini was not so high before today. Will the failure rate of function calls decrease for gpt-4o-mini? Thanks.
1 Like
Specifically, the example is as belows:
tools = [
{
"type": "function",
"function": {
"name": "get_delivery_date",
"description": "Get the delivery date for a customer's order. Call this whenever you need to know the delivery date, for example when a customer asks 'Where is my package'",
"parameters": {
"type": "object",
"properties": {
"order_id": {
"type": "string",
"description": "The customer's order ID."
}
},
"required": ["order_id"],
"additionalProperties": False
}
}
}
]
messages = []
messages.append({"role": "system", "content": "You are a helpful customer support assistant. Use the supplied tools to assist the user."})
messages.append({"role": "user", "content": "Hi, can you tell me the delivery date for my order?"})
messages.append({"role": "assistant", "content": "Hi there! I can help with that. Can you please provide your order ID?"})
messages.append({"role": "user", "content": "i think it is order_12345"})
response = client.chat.completions.create(
model='gpt-4o-mini',
messages=messages,
tools=tools
)
Welcome @jutextile6
The code you shared isn’t meant for function calling with structured outputs, because to enable structured outputs, you need to set the property 'strict': True
in your function json schema.
Here’s the example for function calling with structured output