Skip to content

Migrate AzureOpenAiProvider from Prism to dedicated gateway#404

Merged
taylorotwell merged 13 commits into0.xfrom
migrate-azure-openai-from-prism
Apr 16, 2026
Merged

Migrate AzureOpenAiProvider from Prism to dedicated gateway#404
taylorotwell merged 13 commits into0.xfrom
migrate-azure-openai-from-prism

Conversation

@pushpak1300
Copy link
Copy Markdown
Member

Replaces PrismGateway with a dedicated AzureOpenAiGateway for the Azure OpenAI provider, continuing the ongoing migration away from the Prism abstraction layer. This brings Azure in line with Groq, Mistral, and other providers that already have individual gateways.

Approach

  • Created AzureOpenAiGateway implementing TextGateway and EmbeddingGateway using the Chat Completions API format
  • Azure-specific HTTP client handles api-key header authentication and api-version query parameter
  • Updated the provider to use a custom constructor (like Groq/Mistral) instead of depending on the parent Gateway abstraction
  • Removed the azure mapping from PrismGateway::toPrismProvider()
  • Added 48 tests across 10 test files covering text generation, streaming, embeddings, tool calls, error handling, and Azure-specific URL/auth behavior

@pushpak1300 pushpak1300 force-pushed the migrate-azure-openai-from-prism branch from 84d9ca7 to 6da0703 Compare April 15, 2026 14:25
Drops all Azure-specific Chat Completions concerns and reuses the OpenAI
gateway concerns directly. Keeps only the Azure-specific HTTP client
(api-key header auth, /openai base path with api-version query param).
Embeddings continue to use the deployment-specific path.

Updates all Azure tests and helpers to match the Responses API format.
The cognitiveservices.azure.com endpoint uses /openai/v1/responses and
/openai/v1/embeddings (OpenAI-compatible v1 path, no api-version param).

This matches how Prism was wiring Azure — buildAzureBaseUrl() appended
/openai/v1 to the resource URL before passing it through as the base URL.

Also simplifies embeddingsClient back into client since both text and
embeddings share the same /openai/v1 base path.
Azure rejects tool schemas with strict: true when not all properties
are required. Override mapTool to send parameters without strict or
additionalProperties, matching Prism's previous behaviour.
@pushpak1300 pushpak1300 marked this pull request as ready for review April 15, 2026 15:56
@taylorotwell taylorotwell merged commit 29fc028 into 0.x Apr 16, 2026
5 checks passed
@taylorotwell taylorotwell deleted the migrate-azure-openai-from-prism branch April 16, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants