I’m trying to get my bot to give an intermediate message when it makes a function call.
I’m trying to catch the call - item.type === “function_call” and send response.create which will create an intermediate message.
I’m getting the following error:
{
“type”: “error”,
“event_id”: “event_Cwm4BHiEh5z4mATleImvu”,
“error”: {
“type”: “invalid_request_error”,
“code”: “conversation_already_has_active_response”,
“message”: “Conversation already has an active response in progress: resp_Cwm4Bg04YjnONeUvKQfpi. Wait until the response is finished before creating a new one.”,
“param”: null,
“event_id”: null
}
}
I’ve also tried catching other events - like response.function_call_arguments.done and more, I always get this error.
Does anyone have an idea how I can make this work???
I believe this has been discussed extensively here before and I’m not the first to come across this, but I couldn’t find a suitable topic for me.
If anyone can answer me from their experience or point me to a relevant topic - I would be very grateful.
If something is unclear - I apologize, English is not my native language, please ask me for clarification.
A tool call to a function must be immediately paired with a “tool” response returned back to the AI with matching ID.
Thus, you cannot “inject” something in the middle or have the AI alternately act, unless you were to make a separate call with a tool return that was also re-prompted to talk about the function and not answer the user, and could not use the “conversations” endpoint. An anti-pattern.
You have two primary options for the behavior I think you want:
Have a programmatic option that catches a tool call and places information in the UI during the processing - a progress display;
By prompt or by tool description, have the AI announce its intention to use a function tool, what will call to and how it will be used to satisfy a request.
You will see the AI displaying text to be seen before the OpenAI playground shows the function that was called (not internal thinking, which also is separate).
The “instructions” (system message) that I used is just one example of how to promote this behavior.
# Tools: announce to user final channel any intention to call a function tool BEFORE you send to a function, describing which you will employ and the reasoning. Then automatically use *any* tool in any way applicable to a user question.
I’m building a voice bot, so I don’t have any visual UI where I can show progress messages.
I’ll try the approach of using instructions so the model announces the intent before calling the function.
Thanks for the explanation — I’ll let you know how it goes.
In that case, if you are relaying the audio output yourself, you could use a “thinking sound”, the audio equivalent of a progress bar, instead of having the AI generate audio itself “hold on while I research…” which would delay the start.
It’s only appropriate on an AI forum that I not open up a rompler synthesizer VST and play and record some sounds, but instead, have ChatGPT make audio files with a little melody to my specification that are a familiar “processing your command” sound…24 kHz, mono, 16-bit PCM WAV like the stream.