Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions src/any_llm/providers/azureopenai/azureopenai.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
"""Azure OpenAI AnyLLM."""

import os

from openai import AsyncOpenAI, OpenAI

from any_llm.providers.openai.base import BaseOpenAIProvider


Expand All @@ -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"}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not really sure where this argument is coming from but I left it to match previous behavior.

return super()._init_client()