LemonAi.Providers.AzureOpenAIResponses (lemon_ai v0.1.0)

View Source

Azure OpenAI Responses API provider.

This provider implements the Azure-hosted OpenAI Responses API with support for reasoning models and prompt caching.

Key Differences from Standard OpenAI Responses

  • Uses Azure-specific endpoint format
  • Requires Azure API key and resource configuration
  • Supports deployment name mapping for model IDs
  • Uses Azure API versioning

Configuration

Azure-specific settings should be resolved by the caller before requests reach this provider. Stream options still take precedence for per-request overrides.

Usage

model = %Model{
  id: "gpt-4o",
  api: :azure_openai_responses,
  provider: :"azure-openai-responses",
  base_url: "https://myresource.openai.azure.com/openai/v1",
  reasoning: false
}

context = Context.new(
  system_prompt: "You are a helpful assistant.",
  messages: [%UserMessage{content: "Hello!"}]
)

opts = %StreamOptions{
  thinking_budgets: %{
    azure_deployment_name: "my-deployment",
    azure_api_version: "2024-12-01-preview"
  }
}

{:ok, stream} = AzureOpenAIResponses.stream(model, context, opts)