Skip to content

Azure OpenAI

Use Azure-hosted OpenAI models with the azure: prefix.

Setup

export AZURE_OPENAI_API_KEY="..."
export AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com"
export AZURE_OPENAI_DEPLOYMENT="your-deployment-name"

Usage

from eval_lib import AnswerRelevancyMetric

metric = AnswerRelevancyMetric(model="azure:gpt-4o", threshold=0.7)

Notes

  • The model name after azure: should match your Azure deployment configuration
  • Azure endpoints must be accessible from your environment
  • All standard metrics work with Azure OpenAI