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()