Module azure_openai

Module azure_openai 

Source
Expand description

The Azure OpenAI provider adapter (AI-01).

Azure OpenAI speaks the SAME chat-completions body dialect as OpenAI (the request/response JSON is identical), but differs in two transport-level details:

  • URL format: Azure uses deployment-based URLs /openai/deployments/{deployment}/chat/completions?api-version=... instead of OpenAI’s /v1/chat/completions. The {deployment} is the provider model identifier (the provider_model the alias maps to), and the api-version query parameter is required.
  • Authentication: Azure uses api-key: {key} instead of Authorization: Bearer {key}. The auth header is still configured verbatim via ai.providers[].auth (the adapter does not touch credentials); the operator sets header: api-key + value: ....

This adapter DELEGATES the body translation to the OpenAI adapter (the body is identical) and OVERRIDES the path to the Azure deployment format. The default API version is 2024-10-21 (a stable GA version); the operator can override it via the other map key api_version (a dialect-specific parameter preserved by the canonical request).

Streaming: Azure uses the same SSE format as OpenAI, including the data: [DONE] sentinel, so the OpenAI stream-event parser applies unchanged.

Structs§

AzureOpenAiAdapter
The Azure OpenAI adapter (AI-01). Stateless singleton; delegates body translation to the OpenAI adapter and overrides the path.