-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add first-class support for Azure OpenAI
- Loading branch information
Showing
5 changed files
with
59 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from httpx import Timeout | ||
from openai import AsyncAzureOpenAI | ||
|
||
from core.config import LLMProvider | ||
from core.llm.openai_client import OpenAIClient | ||
from core.log import get_logger | ||
|
||
log = get_logger(__name__) | ||
|
||
|
||
class AzureClient(OpenAIClient): | ||
provider = LLMProvider.AZURE | ||
stream_options = None | ||
|
||
def _init_client(self): | ||
azure_deployment = self.config.extra.get("azure_deployment") | ||
api_version = self.config.extra.get("api_version") | ||
|
||
self.client = AsyncAzureOpenAI( | ||
api_key=self.config.api_key, | ||
azure_endpoint=self.config.base_url, | ||
azure_deployment=azure_deployment, | ||
api_version=api_version, | ||
timeout=Timeout( | ||
max(self.config.connect_timeout, self.config.read_timeout), | ||
connect=self.config.connect_timeout, | ||
read=self.config.read_timeout, | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters