From 430d12807219d364b2af6ba28a1c6327c16f633a Mon Sep 17 00:00:00 2001 From: daavoo Date: Thu, 18 Sep 2025 10:46:49 +0200 Subject: [PATCH] fix(azureopenai): Drop unused `_get_client`. Use `super()._init_client()` instead. - Drop `AZURE_OPENAI_API_BASE` env var. --- .../providers/azureopenai/azureopenai.py | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/any_llm/providers/azureopenai/azureopenai.py b/src/any_llm/providers/azureopenai/azureopenai.py index ca0996a0..90745381 100644 --- a/src/any_llm/providers/azureopenai/azureopenai.py +++ b/src/any_llm/providers/azureopenai/azureopenai.py @@ -1,9 +1,3 @@ -"""Azure OpenAI AnyLLM.""" - -import os - -from openai import AsyncOpenAI, OpenAI - from any_llm.providers.openai.base import BaseOpenAIProvider @@ -16,11 +10,8 @@ class AzureopenaiProvider(BaseOpenAIProvider): SUPPORTS_RESPONSES = True SUPPORTS_LIST_MODELS = True - def _get_client(self, sync: bool = False) -> AsyncOpenAI | OpenAI: - _client_class = OpenAI if sync else AsyncOpenAI - return _client_class( - base_url=self.config.api_base or self.API_BASE or os.getenv("AZURE_OPENAI_API_BASE"), - api_key=self.config.api_key, - **(self.config.client_args if self.config.client_args else {}), - default_query={"api-version": "preview"}, - ) + def _init_client(self) -> None: + if not self.config.client_args: + self.config.client_args = {} + self.config.client_args["default_query"] = {"api-version": "preview"} + return super()._init_client()