Download app/core/config.py from Housable/LangChain: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/spaces/Housable/LangChain/resolve/main/app/core/config.py
- Command line
-
hf download hf://spaces/Housable/LangChain/app/core/config.py
-
curl -L -o config.py https://huggingface.co/spaces/Housable/LangChain/resolve/main/app/core/config.py
1.26 kB
| from typing import Any, Dict, Optional | |
| from pydantic import BaseSettings, PostgresDsn, HttpUrl, validator | |
| class Settings(BaseSettings): | |
| API_V1_STR: str = "/api/v1" | |
| POSTGRES_SERVER: str | |
| POSTGRES_USER: str | |
| POSTGRES_PASSWORD: str | |
| POSTGRES_DB: str | |
| LABEL_STUDIO_URL: str | |
| LABEL_STUDIO_API_KEY: str | |
| LABEL_STUDIO_PROJECT_ID: str | |
| PROJECT_NAME: Optional[str] = "LangChain" | |
| DESCRIPTION: Optional[str] = "LLM chain" | |
| SQLALCHEMY_DATABASE_URI: Optional[PostgresDsn] = None | |
| SENTRY_DSN: Optional[HttpUrl] = None | |
| def sentry_dsn_can_be_blank(cls, v: str) -> Optional[str]: | |
| if len(v) == 0: | |
| return None | |
| return v | |
| def assemble_db_connection(cls, v: Optional[str], values: Dict[str, Any]) -> Any: | |
| if isinstance(v, str): | |
| return v | |
| return PostgresDsn.build( | |
| scheme="postgresql", | |
| user=values.get("POSTGRES_USER"), | |
| password=values.get("POSTGRES_PASSWORD"), | |
| host=values.get("POSTGRES_SERVER"), | |
| path=f"/{values.get('POSTGRES_DB') or ''}", | |
| ) | |
| class Config: | |
| case_sensitive = True | |
| settings = Settings() | |