How to Use Tools/Function Calling in Azure OpenAI?

micos 0 Reputation points
2024-01-07T06:14:53.9633333+00:00

Hello everyone,

I've been using the Azure OpenAI service and encountered an issue. After adding the parameters tools: tools, tool_choice: "auto" in the request, the API returns a 404 error. The model I'm using is gpt4-turbo-1106-Preview. When I remove these two parameters, the API response is normal.

I am using the openai 0.9.4 node.js library. Everything works fine without the tools parameter, but as soon as I add it, I get a 404 error. Can anyone advise on how to properly support the tools/function calling feature in Azure OpenAI?

User's image

I did an experiment using the Azure OpenAI library files, and with this approach, the call works correctly. Does this mean that when using Azure OpenAI tools, one must use Azure's own library? Does the official OpenAI library support Azure OpenAI tools features? Can I enable support by updating from OpenAI 0.9.4 to a newer version?

Tested using the Azure OpenAI JavaScript library: https://www.npmjs.com/package/@azure/openai (Azure OpenAI client library for JavaScript)

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