Azure OpenAI
Before you start
- Head over to Azure OpenAI (opens in a new tab) and create an instance if you don't have one.
- Create a new model deployment on Azure AI and configure it as you wish.
- Set the following environment variables:
AZURE_OPENAI_ENDPOINT
- your Azure OpenAI endpointAZURE_OPENAI_API_KEY
- your Azure OpenAI API key
Usage
import { UniLLM } from 'unillm';
/*
Make sure the following environment variables are set:
AZURE_OPENAI_ENDPOINT - your Azure OpenAI endpoint
AZURE_OPENAI_API_KEY - your Azure OpenAI API key
*/
// Setup UniLLM
const unillm = new UniLLM();
// Use any LLM provider and model
const response = await unillm.createChatCompletion("azure/openai/<deployment-name>", {
temperature: 0,
messages: [
{
role: "user",
content: "How are you?"
}
]
})
Last updated on