I want to be able to call functions based on the user input, I could do this with the openai library but can't find a way to do so in the azure openai library
Below is the code from azure openai in python that is able to do what I want to accomplish
As such I want to replicate this code using the javascript sdk link
import openai
openai.api_type = "azure"
openai.api_base = "https://XXXXXXXX.openai.azure.com/"
openai.api_version = "2023-07-01-preview"
openai.api_key = os.getenv("OPENAI_API_KEY")
response = openai.ChatCompletion.create(
engine="gpt-35-turbo-XXX",
model="gpt-35-turbo-0613-XXXX"
messages=messages,
functions=functions,
function_call="auto",
)
I tried this
const response = await openai.getChatCompletions(
deploymentid,
messages,
{ function_call: functions }
and
const response = await openai.getChatCompletions(
deploymentid,
messages,
functions )
I couldn't find anything on the documentation for this as well
The updated Azure OpenAI Javascript documentation now incorporates support for functions and function calls.
You can find the relevant documentation at the following link, https://learn.microsoft.com/en-us/javascript/api/@azure/openai/getchatcompletionsoptions?view=azure-node-preview
It is recommended that you ensure your Azure OpenAI library is updated to the most recent version.(https://www.npmjs.com/package/@azure/openai?activeTab=readme)