"tool_choice": "required" sometimes not supported in Azure OpenAI service in 2024-07-01-preview

schoell 5 Reputation points
2024-09-02T08:20:10.4233333+00:00

I am experimenting with the new API version 2024-07-01-preview which supports "tool_choice": "required" . I noticed that this option is intermittently not supported (i.e. when I send the same request repeatedly, I sometimes receive error 400)

I receive a successful response only in 50% of my requests. In the other cases, I receive

Error code: 400 - {'error': {'message': "Invalid value: 'required'. Supported values are: 'none' and 'auto'.", 'type': 'invalid_request_error', 'param': 'tool_choice', 'code': 'invalid_value'}}

It seems to me the API version hasn't been consistently rolled out yet?

Here is my demo request that I send

{

  "messages": [

    {

      "content": "What's the current time in San Francisco, Tokyo, and Paris?",

      "role": "user"

    }

  ],

  "model": "gpt-4o-2024-05-13",

  "max_tokens": 500,

  "n": 1,

  "stream": false,

  "temperature": 0.0,

  "tool_choice": "required",

  "tools": [

    {

      "type": "function",

      "function": {

        "name": "get_current_time",

        "description": "Get the current time in a given location",

        "parameters": {

          "type": "object",

          "properties": {

            "location": {

              "type": "string",

              "description": "The city name, e.g. San Francisco"

            }

          },

          "required": [

            "location"

          ]

        }

      }

    }

  ]

}
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
2,916 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.