File size: 1,432 Bytes
2eeb3a4 77a5434 2eeb3a4 77a5434 7e508e0 2eeb3a4 627ec3c 2eeb3a4 77a5434 6b02b62 285d1cd 2eeb3a4 627ec3c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
PyprojectTomlConfigSettingsSource,
)
from typing import Tuple, Type
class Settings(BaseSettings):
@classmethod
def settings_customise_sources(
cls,
settings_cls: Type[BaseSettings],
init_settings: PydanticBaseSettingsSource,
env_settings: PydanticBaseSettingsSource,
dotenv_settings: PydanticBaseSettingsSource,
file_secret_settings: PydanticBaseSettingsSource,
) -> Tuple[PydanticBaseSettingsSource, ...]:
return (
init_settings,
PyprojectTomlConfigSettingsSource(settings_cls),
env_settings,
dotenv_settings,
file_secret_settings,
)
class AppSettings(Settings):
# backend
llm_model: str
llm_region: str
model_provider: str
embedding_model: str
embedding_size: int
vector_db_url: str
vector_db_collection_name: str
# secrets
aws_access_key_id: str
aws_secret_access_key: str
langfuse_public_api_key: str
langfuse_secret_api_key: str
langfuse_host: str
test_user_name: str
test_user_password: str
model_config = SettingsConfigDict(
pyproject_toml_table_header=("tool", "app_config"),
env_file=".env",
env_file_encoding="utf-8",
extra="ignore",
)
app_settings = AppSettings() |