Function call response is empty despite completion tokens being used

So how should handle the issue in the meanwhile? switch to another region? or we have to use openai endpoints?
was using UK South. Tried US West and also doesn’t work for me.

Also experiencing this issue, works with the OpenAI client. What is everyone doing in the meantime?

I have switched to the GPT-4 32K model version 0613 and it works there.
You have to change 2 things:

  • Change the API call parameters from tools to functions as it uses an older “deprecated” syntax:
    client.chat.completions.create(
    model=model,
    messages=messages,
    temperature=temperature,
    functions=[tools],
    function_call=“auto”
    )

  • Change your function te remove the part where it says the following (don’t forget to unindent the rest of the function and remove the closing brace):
    “type”: “function”,
    “function”: {

    as the older version uses a slightly different function syntax.

These changes worked for me, allowing to use function calls with GPT-4. It just takes some refactoring of the code.

3 Likes

Interesting, this all in azure openai api i assume? And you plan to switch the syntax back when gpt-4-1106 works again? This is just a temporary measure

Yes, correct. All inside Azure and I will switch back once the issue is resolved.

This is what im doing with gpt-4 1106, just use the functions property… but this means you cannot test parallel functions etc

This is working for me when using gpt-4 1106-Preview on Sweden Central but not when using France Central.

Yeah, this is what I have done. You can keep using your tools definition and transform it into functions with something like this node code:

const functions = tools.map(tool => tool.function);

It works with 1106-Preview.

Thanks for the tip. I managed to have a successful response, however Semantic Kernel is doing nothing (not calling the function). I’m using the dotnet SDK.

{
  "id": "chatcmpl-xxx",
  "object": "chat.completion",
  "created": 1705754471,
  "model": "gpt-4",
  "prompt_filter_results": [...],
  "choices": [
    {
      "finish_reason": "function_call",
      "index": 0,
      "message": {
        "role": "assistant",
        "function_call": {
          "name": "TheExpectedPlugin_TheExpectedFunction",
          "arguments": "{}"
        }
      },
      "content_filter_results": {}
    }
  ],
  "usage": {
    "prompt_tokens": 1630,
    "completion_tokens": 10,
    "total_tokens": 1640
  }
}

Any idea @vincentnoteboom / @rollingc ?

Should I try to hack response to have something like

{
      "finish_reason": "tool_calls",
      "index": 0,
      "message": {
        "role": "assistant",
        "tool_calls": [
          {
            "id": "call_8156GRM0fCbCWZdVz4uT48SU",
            "type": "function",
            "function": {
              "name": "TheExpectedPlugin_TheExpectedFunction",
              "arguments": "{}"
            }
          }
        ]
      }

This started working again for me this morning :slight_smile:

1 Like