Is there any way to obtain a text response when a function is called in a chat?

What I’m trying to do is for the assistant to run a function and obtain the JSON and a message in response , but when obtaining the response of the function always returns null in the message content:

  "id": "chatcmpl-7UqXoNfemle3LHikyQWLWHK09DSxR",
  "object": "chat.completion",
  "created": 1687586176,
  "model": "gpt-3.5-turbo-0613",
  "choices": [
      "index": 0,
      "message": {
        "role": "assistant",
        "content": null,
        "function_call": {
          "name": "give_item",
          "arguments": "{\n  \"item\": \"hat\"\n}"
      "finish_reason": "function_call"
  "usage": {
    "prompt_tokens": 137,
    "completion_tokens": 16,
    "total_tokens": 153

Is there a way to get an response on the content parameter like: “Sure, there is the item you requested”?

1 Like

Afaik when it detects a function needs to be called, it only sends back the json function parameters. You have to pass the results of the function (or some confirmation or whatever) back in to the model to get a natural language reply to give to the user. It’s a shame, would have been nice to have some natural language confirmation at the same time, but I guess that’s just not how it works…

1 Like

Yes you can, but needs to be formulated in the request as such or via system message.
Something like: “Give a proper response to the user and then call the appropriate function when all requirements and/or parameters for a function are given. Avoid calling a function with made up parameters. Ask the user for clarification to meet all the requirements of a function.”

Some commands seems to be redundant. You have to trial and error. It is because of the attention mechanism of GPT.

But this should give you an overall insight how it might work.


I have not been able to make it work, I’m currently using gpt-3.5-turbo-0613 do you have any example prompts that gives an text respone on a function call?

Function calling is about getting back a json that you use to call the api in your code … as you can see in the documentation you don’t pass a url in the payload … so how could the ai call your api ?
Once you get the response back from the api, call ai again putting the json response in the request (with role = function) … and you will get a human readable text to return to the user.

1 Like

Hi @LucasGaspar, is there any solution? I’m also facing the same issue.

Yeah when I tried function calling I also thought the model would call the function on a URL to get extra informations before it creates an answer.

But it does not work like that. It really just gives you what it thinks which function with what kind of parameters might be usefull and you have to call it by yourself or whatever… When I found out there is no URL I just gave up on that thing completely.

Came months to late for me. I already solved that by prompting to give me the right json which works in close to 100% of the times at least on second try (doing some json validation and when the json is wrong or when there are parameters missing I mark it as “repeat” and raise the repeat count).

I passed “auto” value in the function_call parameter and it worked for me. For auto value, gpt handle function calling according to intent. If gpt is not calling the function then it passes value in content otherwise it gives value in the function_call key of response.

1 Like

Is there a solution, cause I am getting Null response on both message and fucntion call (tool)