Azure AI library with a built-in Statsig SDK.
Statsig helps you move faster with Feature Gates (Feature Flags) and Dynamic Configs. It also allows you to run A/B tests to validate your new features and understand their impact on your KPIs. If you're new to Statsig, create an account at statsig.com.
More docs are available at: https://statsig.com/azureai-docs
- Install the library
npm install @statsig/azure-ai
- Initialize the main AzureAI interface along with the internal Statsig service
import { AzureAI, StatsigOptions } from "@statsig/azure-ai";
const options: StatsigOptions = {
environment: { tier: "development" },
};
await AzureAI.initialize(<STATSIG_SERVER_KEY>, options);
- Create the AzureAI inference client
const client = AzureAI.getModelClientFromEndpoint(
<DEPLOYMENT_ENDPOINT_URL>,
<DEPLOYMENT_KEY>
);
Optionally, use a Statsig Dynamic Config to provide default configurations
const client = AzureAI.getModelClient("azureai_model");
- Call the API
const response = await client.complete([
{
role: "system",
content: "You are a helpful assistant. You will talk like a pirate.",
},
{ role: "user", content: "Can you help me?" },
]);
- Statsig SDK documentation