Spaces:
Running on Zero
Running on Zero
| """ | |
| Free-tier configuration for Week 8 — The Price is Right. | |
| Set GROQ_API_KEY in .env for cloud LLM calls (local run + Hugging Face Spaces). | |
| Set USE_MODAL_SPECIALIST=true only if you want the GPU fine-tuned model on Modal. | |
| By default Modal is OFF — Specialist uses Groq instead (free). | |
| """ | |
| import os | |
| from env_utils import load_project_env | |
| load_project_env() | |
| GROQ_MODEL = os.getenv("GROQ_MODEL", "llama-3.1-8b-instant") | |
| LITELLM_GROQ_MODEL = f"groq/{GROQ_MODEL}" | |
| # Default false: Modal free credits are often only ~$1/month — not enough for regular GPU use. | |
| USE_MODAL_SPECIALIST = os.getenv("USE_MODAL_SPECIALIST", "false").lower() in ("true", "1", "yes") | |
| # Groq when an API key is present; otherwise local Ollama (local dev only). | |
| PREPROCESSOR_MODEL = os.getenv( | |
| "PRICER_PREPROCESSOR_MODEL", | |
| LITELLM_GROQ_MODEL if os.getenv("GROQ_API_KEY") else "ollama/llama3.2", | |
| ) | |
| MESSAGING_MODEL = os.getenv("MESSAGING_MODEL", LITELLM_GROQ_MODEL) | |
| # Ensemble weights when Modal specialist is unavailable. | |
| WEIGHTS_WITH_SPECIALIST = (0.8, 0.1, 0.1) # frontier, specialist, neural_network | |
| WEIGHTS_WITHOUT_SPECIALIST = (0.85, 0.15) # frontier, neural_network | |
| PUSHOVER_CONFIGURED = bool( | |
| os.getenv("PUSHOVER_USER") | |
| and os.getenv("PUSHOVER_TOKEN") | |
| and not os.getenv("PUSHOVER_USER", "").startswith("your-") | |
| ) | |