Config
Settings
Bases: BaseSettings
Application configuration and environment variables.
This class defines the global settings for the API, including file paths,
external API keys, and model parameters. Values are loaded from a .env file
or system environment variables.
Attributes:
| Name | Type | Description |
|---|---|---|
API_TITLE |
str
|
Title used in the OpenAPI documentation. |
API_VERSION |
str
|
Current API version. |
DATA_URL |
str
|
Source URL for the raw SRAG CSV data. |
FORCE_UPDATE |
bool
|
If True, forces re-download of data even if cached. |
RAW_DATA_PATH |
Path
|
Local path to store the raw CSV. |
DB_PATH |
Path
|
Local path for the processed SQLite database. |
PLOTS_DIR |
Path
|
Directory where generated charts are saved. |
OPENAI_API_KEY |
SecretStr
|
Key for OpenAI API access. |
TAVILY_API_KEY |
SecretStr
|
Key for Tavily Search API access. |
OPENAI_MODEL |
str
|
The specific LLM model identifier (e.g., 'openai:gpt-4.1-mini'). |
TEMPERATURE |
float
|
Determinism setting for the LLM (0.0 for maximum determinism). |
MLFLOW_TRACKING_URI |
str
|
URI for the MLflow tracking server. |
MLFLOW_ENABLE |
bool
|
Master switch to enable/disable MLflow logging. |
Source code in api/src/config.py
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 56 57 58 59 | |
get_settings()
cached
Retrieves the cached application settings.
Uses functools.lru_cache to ensure the settings are loaded from the environment
only once per process, improving performance.
Returns:
| Name | Type | Description |
|---|---|---|
Settings |
Settings
|
The singleton instance of the application configuration. |
Source code in api/src/config.py
62 63 64 65 66 67 68 69 70 71 72 73 | |