Julia Ostheimer
Add easy auth implementation with shared credentials via Secrets in HF Space
285d1cd
| from pydantic_settings import ( | |
| BaseSettings, | |
| PydanticBaseSettingsSource, | |
| SettingsConfigDict, | |
| PyprojectTomlConfigSettingsSource, | |
| ) | |
| from typing import Tuple, Type | |
| class Settings(BaseSettings): | |
| 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() |