UBCHelper / .env.example
Devdan Schretlen
Added FastAPI app for live HuggingFace demo
024efc3
Raw History Blame Contribute Delete
2.76 kB
# Copy to `.env` and fill in. Real environment variables always win over this file.
# Everything the engine reads is defined in src/config.py; everything the demo reads is in
# web/limits.py and web/bootstrap.py.
# ======================================================================================
# API keys — the engine
# ======================================================================================
# Embeddings (ingest + query) run on OpenAI's hosted embeddings API.
# Required to run `python -m src.ingest` and to answer any question.
OPENAI_API_KEY=sk-...
# Reranker — only the hybrid_rerank retrieval mode uses Cohere. Optional otherwise.
# Trial keys are capped at 10 calls/minute; src/rerank.py backs off and retries on 429.
COHERE_API_KEY=...
# Generation via Claude (the default LLM backend, UBCAL_LLM_BACKEND=anthropic).
ANTHROPIC_API_KEY=sk-ant-...
# ======================================================================================
# Engine overrides (all optional — src/config.py holds the defaults)
# ======================================================================================
# UBCAL_RETRIEVAL_MODE=hybrid_rerank # dense | hybrid | hybrid_rerank
# UBCAL_TOP_K=4
# UBCAL_LLM_BACKEND=anthropic # anthropic | local (LM Studio et al.)
# UBCAL_ANTHROPIC_MODEL=claude-haiku-4-5
# UBCAL_AGENT_MAX_SUBQ=3
# Tier-2 (judged) eval and the ablation need a local OpenAI-compatible server:
# UBCAL_BASE_URL_LLM=http://localhost:1234/v1
# UBCAL_CHAT_MODEL=google/gemma-4-e4b
# ======================================================================================
# Web demo
# ======================================================================================
# Where the prebuilt index is pulled from at startup. Leave DEMO_INDEX_REPO empty to use a
# locally built index/ instead (the normal setup on a dev machine).
# The repo is PRIVATE on purpose: index/metadata.json contains the full text of every
# chunk, and the UBC calendar is not ours to redistribute in bulk.
# DEMO_INDEX_REPO=your-username/ubchelper-index
# DEMO_INDEX_REVISION=main # pin a commit sha; chunk ids are positional
# HF_TOKEN=hf_...
# Spend and abuse controls (web/limits.py). The global cap counts paid API calls, which is
# exact; the dollar figure it displays is only an estimate.
# DEMO_DAILY_LLM_CALLS=400 # ~130-200 questions/day
# DEMO_IP_PER_HOUR=6
# DEMO_IP_PER_DAY=20
# DEMO_MAX_QUESTION_CHARS=300
# DEMO_DB_PATH=/tmp/ubchelper-demo.sqlite3
# MUST be set to a random secret in production: IPs are stored only as sha256(salt + ip),
# and a known salt would make those hashes reversible by brute force.
# DEMO_IP_SALT=change-me
# Enables /docs. Leave unset in production.
# DEMO_DEV=1