Hello All,
I am building a chatbot using the responses API and am having a problem when GPT-4.1-mini
returns both message
and function_call
. See the example below:
"output": [{
"id": "msg_685434d722c8819b807abcdc03cc9cc80ed0eb9962f32640",
"role": "assistant",
"type": "message",
"status": "completed",
"content": [{
"text": "{\"assistant_message\":\"Please provide your email address used for the order so I can check the delivery status for you.\",\"assistant_quick_replies\":[]}",
"type": "output_text",
"annotations": []
}
]
},
... 7 similar message cut here ...
{
"id": "fc_685434df74d4819b93276af011d65ede0ed0eb9962f32640",
"name": "check_delivery_status",
"type": "function_call",
"status": "completed",
"call_id": "call_HdtDqdWf9jqaKmAPLPJi2iJm",
"arguments": "{\"email\":\"user@example.com\"}"
}
],
Actually, here I have 3 problems:
message
is mixed withfunction_call
, which one should I choose? Should I show the message or call the function? (In my example, showing the message is the right thing to do, as the LLM has not collected the user’s email yet)- I have 8 similar messages. ??? Okay, I can pick up the first one, but I don’t want to pay for all eight. I read and added “Please return one complete response and then stop.” instruction, but as you can see, it does not work.
- The email address in the function call argument is hallucinated (user@example.com)
To give you more context, I am using structured output like the following:
"model": "gpt-4.1-mini",
"text": {
"format": {
"type": "json_schema",
"name": "assistant_response",
"schema": {
"type": "object",
"properties": {
"assistant_message": {
"type": "string",
"description": "Assistant's response"
},
"assistant_quick_replies": {
"type": "array",
"description": "List of suggested quick replies buttons for the user. May contain user's email if mentioned previously. Populated ONLY when returned by a function call (assistant_quick_replies field), otherwise it is [].",
"items": {
"type": "string",
"description": "Short text for a quick reply button."
}
}
},
"required": [
"assistant_message",
"assistant_quick_replies"
],
"additionalProperties": false
},
"strict": true
}
}
Did anyone face these issues with the response API?
I mostly interested in handling mix of message
and function_call