Function calling not working on AzureOpenAI's gpt-4 model

Hello all,

As the title states, I am not able to get Function Calling to work when using the gpt-4 model. However, if I switch to gpt-35-turbo the exact same code works.
Both models are version 0613 and “2023-10-01-preview”

This is how I am calling the API

res = client.chat.completions.create(
                    model=model_name,
                    messages=messages,
                    tools=tools,
                    tool_choice={"type": "function", "function": {"name": tool_choice}},
                    temperature=temperature
                ) 

It’s as if the feature didn’t exist in gpt-4. Error:
Error code: 400 - {‘error’: {‘message’: ‘Unrecognized request arguments supplied: tool_choice, tools’, ‘type’: ‘invalid_request_error’, ‘param’: None, ‘code’: None}}

Weirdly enough, Microsoft’s documentation states it should work.

Hi and welcome to the Developer Forum!

While you are welcome to post Azure related questions here, Microsoft has a dedicated support team for their services that it may be better to contact.