-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
👔 Project settings is now encapsulated into
guidellm.config
module
* The module is currently has only `__init__` file * All `os.getenv` replaced with `pydantic_settings` facade * `GUIDELLM__` env prefix is set
- Loading branch information
Dmytro Parfeniuk
committed
Jul 24, 2024
1 parent
361f7c6
commit 9047075
Showing
10 changed files
with
98 additions
and
80 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
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,52 @@ | ||
from typing import Optional | ||
|
||
from pydantic import BaseModel | ||
from pydantic_settings import BaseSettings, SettingsConfigDict | ||
|
||
__all__ = ["settings"] | ||
|
||
|
||
class LoggingSettings(BaseModel): | ||
disabled: bool = False | ||
clear_loggers: bool = True | ||
console_log_level: Optional[str] = "INFO" | ||
log_file: Optional[str] = None | ||
log_file_level: Optional[str] = None | ||
|
||
|
||
class OpenAISettings(BaseModel): | ||
|
||
# OpenAI API key. | ||
api_key: str = "invalid" | ||
|
||
# OpenAI-compatible server URL | ||
# NOTE: The default value is default address of llama.cpp web server | ||
base_url: str = "http://localhost:8080" | ||
|
||
|
||
class Settings(BaseSettings): | ||
""" | ||
All the settings are powered by pydantic_settings and could be | ||
populated from the .env file. | ||
The format to populate the settings is next | ||
```sh | ||
export GUIDELLM__LOGGING__DISABLED=true | ||
export GUIDELLM__OPENAI__API_KEY=****** | ||
``` | ||
""" | ||
|
||
model_config = SettingsConfigDict( | ||
env_prefix="GUIDELLM", | ||
env_nested_delimiter="__", | ||
env_file=".env", | ||
extra="ignore", | ||
) | ||
|
||
logging: LoggingSettings = LoggingSettings() | ||
openai: OpenAISettings = OpenAISettings() | ||
|
||
|
||
settings = Settings() |
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
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
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