Spaces:
Sleeping
Sleeping
| from pathlib import Path | |
| from typing import Any, Dict | |
| import yaml | |
| from pydantic_settings import BaseSettings | |
| from functools import lru_cache | |
| BASE_DIR = Path(__file__).parent.parent | |
| CONFIG_DIR = BASE_DIR / "config" | |
| class Settings(BaseSettings): | |
| groq_api_key: str | |
| huggingface_api_key: str = "" | |
| tavily_api_key: str = "" | |
| langsmith_api_key: str = "" | |
| jwt_secret_key: str | |
| mongodb_username: str = "" | |
| mongodb_password: str = "" | |
| redis_password: str = "" | |
| qdrant_api_key: str = "" | |
| class Config: | |
| env_file = BASE_DIR / ".env" | |
| case_sensitive = False | |
| def load_yaml(file_path: Path) -> Dict[str, Any]: | |
| with open(file_path, "r") as f: | |
| return yaml.safe_load(f) | |
| def get_settings() -> Settings: | |
| return Settings() | |
| def load_config() -> Dict[str, Any]: | |
| config = {} | |
| config["app"] = load_yaml(CONFIG_DIR / "app.yaml") | |
| config["database"] = load_yaml(CONFIG_DIR / "database.yaml") | |
| config["models"] = load_yaml(CONFIG_DIR / "models.yaml") | |
| config["rag"] = load_yaml(CONFIG_DIR / "rag.yaml") | |
| config["security"] = load_yaml(CONFIG_DIR / "security.yaml") | |
| config["celery"] = load_yaml(CONFIG_DIR / "celery.yaml") | |
| config["langchain"] = load_yaml(CONFIG_DIR / "langchain.yaml") | |
| return config | |
| settings = get_settings() | |
| config = load_config() | |