Spaces:
Runtime error
Runtime error
Download config/settings.py from utkarsh134/FastAPIExperience2: direct link, hf CLI and curl.
- Browser
- Download file 1.19 kB
-
https://huggingface.co/spaces/utkarsh134/FastAPIExperience2/resolve/main/config/settings.py
- Command line
-
hf download hf://spaces/utkarsh134/FastAPIExperience2/config/settings.py
-
curl -L -o settings.py https://huggingface.co/spaces/utkarsh134/FastAPIExperience2/resolve/main/config/settings.py
1.19 kB
| import os | |
| from dotenv import load_dotenv | |
| DEFAULT_CHUNK_SIZE = 1000 | |
| DEFAULT_CHUNK_OVERLAP = 200 | |
| DEFAULT_LLM_MODEL = "gemini-2.0-flash" | |
| DEFAULT_EMBEDDING_MODEL = "models/embedding-001" | |
| DEFAULT_TEMPERATURE = 0 | |
| def init_settings(): | |
| load_dotenv() | |
| required_env_vars = [ | |
| "GOOGLE_API_KEY", | |
| "SUPABASE_URL", | |
| "SUPABASE_KEY" | |
| ] | |
| missing_vars = [var for var in required_env_vars if not os.getenv(var)] | |
| if missing_vars: | |
| raise ValueError(f"Missing required environment variables: {', '.join(missing_vars)}") | |
| def get_settings(): | |
| return { | |
| "chunk_size": int(os.getenv("CHUNK_SIZE", DEFAULT_CHUNK_SIZE)), | |
| "chunk_overlap": int(os.getenv("CHUNK_OVERLAP", DEFAULT_CHUNK_OVERLAP)), | |
| "llm_model": os.getenv("LLM_MODEL", DEFAULT_LLM_MODEL), | |
| "embedding_model": os.getenv("EMBEDDING_MODEL", DEFAULT_EMBEDDING_MODEL), | |
| "temperature": float(os.getenv("TEMPERATURE", DEFAULT_TEMPERATURE)), | |
| "google_api_key": os.getenv("GOOGLE_API_KEY"), | |
| "supabase_url": os.getenv("SUPABASE_URL"), | |
| "supabase_key": os.getenv("SUPABASE_KEY"), | |
| "store_analysis_result": True, | |
| } |