QQ: return content text during tool_calls


My goal is to inform the user to wait until the function completes.

In most cases, when gpt detects that a tool needs to be called, it returns a response with content=null.

Analyzing the logs with OpenAI responses, I discovered that sometimes when the function needs to be called “content” it also has text.

But how can I instruct gpt to always return the text inside the function call?

I tried using the system prompt and the function description to instruct gpt to also “mandatory” add a warning text to the user before calling the function, but nothing, the returned “content” is null.

Any help?

You said you also add instruction inside your function. This is more dependable than waiting for having content in my experience. If there is text in content, use it, if not, use the one inside your function. Here is how I define mine:

"waiting_message": {
                "type": "string",
                "description": "A message to tell the user while the image is being created"
1 Like

Thanks for your response and sorry for my late reply.

I was testing your example, but I don’t like having multiple waiting_messages when GTP triggers multiple functions.

So, digging further, I found another possible solution (but will increase the cost because multiple calls are done):

When there are functions that need to be queued (so there is not yet a response) I re-prompt the GPT with the following text in the response to those functions:
“Action not completed yet. Mandatory: inform user this action will take some seconds.”

In this way also with multiple functions I will have only one response and it is in the same output stream, so I don’t have to manage these things separately.

Then after the function is complete I retrigger the GPT interaction again with new information and all works smoothly in my tests.

Let me know if something is unclear or your thoughts about it.

I also send a similar message for pending functions but it never occurred to me to tell it to inform the user about it. I will try and test it, thank you!