-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace usage of env variables with application config in app state
- Loading branch information
1 parent
2378606
commit 63c39af
Showing
5 changed files
with
163 additions
and
72 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,39 @@ | ||
from typing import Dict, List | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
import aidial_adapter_openai.env as env | ||
|
||
|
||
class ApplicationConfig(BaseModel): | ||
MODEL_ALIASES: Dict[str, str] = Field(default_factory=dict) | ||
DALLE3_DEPLOYMENTS: List[str] = Field(default_factory=list) | ||
GPT4_VISION_DEPLOYMENTS: List[str] = Field(default_factory=list) | ||
MISTRAL_DEPLOYMENTS: List[str] = Field(default_factory=list) | ||
DATABRICKS_DEPLOYMENTS: List[str] = Field(default_factory=list) | ||
GPT4O_DEPLOYMENTS: List[str] = Field(default_factory=list) | ||
GPT4O_MINI_DEPLOYMENTS: List[str] = Field(default_factory=list) | ||
AZURE_AI_VISION_DEPLOYMENTS: List[str] = Field(default_factory=list) | ||
API_VERSIONS_MAPPING: Dict[str, str] = Field(default_factory=dict) | ||
COMPLETION_DEPLOYMENTS_PROMPT_TEMPLATES: Dict[str, str] = Field( | ||
default_factory=dict | ||
) | ||
DALLE3_AZURE_API_VERSION: str = Field(default="2024-02-01") | ||
NON_STREAMING_DEPLOYMENTS: List[str] = Field(default_factory=list) | ||
|
||
@classmethod | ||
def from_env(cls) -> "ApplicationConfig": | ||
return cls( | ||
MODEL_ALIASES=env.MODEL_ALIASES, | ||
DALLE3_DEPLOYMENTS=env.DALLE3_DEPLOYMENTS, | ||
GPT4_VISION_DEPLOYMENTS=env.GPT4_VISION_DEPLOYMENTS, | ||
MISTRAL_DEPLOYMENTS=env.MISTRAL_DEPLOYMENTS, | ||
DATABRICKS_DEPLOYMENTS=env.DATABRICKS_DEPLOYMENTS, | ||
GPT4O_DEPLOYMENTS=env.GPT4O_DEPLOYMENTS, | ||
GPT4O_MINI_DEPLOYMENTS=env.GPT4O_MINI_DEPLOYMENTS, | ||
AZURE_AI_VISION_DEPLOYMENTS=env.AZURE_AI_VISION_DEPLOYMENTS, | ||
API_VERSIONS_MAPPING=env.API_VERSIONS_MAPPING, | ||
COMPLETION_DEPLOYMENTS_PROMPT_TEMPLATES=env.COMPLETION_DEPLOYMENTS_PROMPT_TEMPLATES, | ||
DALLE3_AZURE_API_VERSION=env.DALLE3_AZURE_API_VERSION, | ||
NON_STREAMING_DEPLOYMENTS=env.NON_STREAMING_DEPLOYMENTS, | ||
) |
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
Empty file.
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