healthcare-rag-api / .env.example
Santhakumar Ramesh
feat: initial deploy to HF Space
3872518
Raw
History Blame Contribute Delete
4.61 kB
# ================================================================
# .env.example β€” copy to .env and fill in your values
# Never commit .env to version control!
# ================================================================
# ── Required ─────────────────────────────────────────────────
OPENAI_API_KEY=sk-your-openai-key-here
OPENAI_MODEL=gpt-4o-mini
# ── Security ────────────────────────────────────────────────
# Generate a strong secret: python -c "import secrets; print(secrets.token_urlsafe(32))"
JWT_SECRET_KEY=your-super-secret-jwt-key-here
# Allowed CORS origins (comma-separated). Use * only in development.
# Production example: https://your-hf-username-healthcare-rag-ui.hf.space
CORS_ORIGINS=http://localhost:8501,http://localhost:3000
# ── Embeddings ───────────────────────────────────────────────
# Production (HF Spaces): uses OpenAI API β€” no torch/sentence-transformers needed
EMBEDDING_MODEL=text-embedding-3-small
# Local fallback (when OPENAI_API_KEY not set): set to sentence-transformers model
# EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
# ── Vector Store ───────────────────────────────────────────────
FAISS_INDEX_PATH=./vectorstore/faiss_index
VECTOR_STORE_TYPE=faiss
# ── Pinecone (optional β€” cloud vector store fallback) ────────────────────────
PINECONE_API_KEY=your-pinecone-key
PINECONE_INDEX_NAME=healthcare-rag
PINECONE_ENVIRONMENT=us-east-1
# ── Retrieval ────────────────────────────────────────────────
MAX_RETRIEVED_DOCS=5
RERANK_TOP_K=3
CONFIDENCE_THRESHOLD=0.6
# ── Error Monitoring (Sentry) ────────────────────────────────────────
# Get your DSN at https://sentry.io β†’ Project β†’ Settings β†’ Client Keys
SENTRY_DSN=https://your-key@oXXXXX.ingest.sentry.io/XXXXXXX
# Performance tracing sample rate (0.0 = off, 0.1 = 10%, 1.0 = 100%)
SENTRY_TRACES_SAMPLE_RATE=0.1
# ── Optional integrations ─────────────────────────────────────────────
# NVIDIA NIM (faster LLM, requires NVIDIA account at build.nvidia.com)
# NVIDIA_API_KEY=nvapi-your-key-here
# NVIDIA_MODEL=meta/llama-3.1-405b-instruct
# Tavily (real-time web search for recent medical news/recalls)
# TAVILY_API_KEY=tvly-your-key-here
# ── Privacy mode (Apple Silicon Mac only) ─────────────────────────────
LOCAL_MODE=false
LOCAL_MODEL_ID=mlx-community/Meta-Llama-3-8B-Instruct-4bit
# ── API server ─────────────────────────────────────────────────
API_HOST=0.0.0.0
API_PORT=8000
# ── App ──────────────────────────────────────────────────────────
APP_ENV=development
LOG_LEVEL=INFO
# ── Evaluation ──────────────────────────────────────────────────
EVAL_SAMPLE_SIZE=20
# ── Hugging Face Spaces (production deployment) ────────────────────────────
# Your HF username (same as github.com/Santhakumarramesh but on HF)
HF_USERNAME=your-hf-username
# HF token with write access β€” for CI/CD auto-sync
# Get it: huggingface.co/settings/tokens β†’ New token β†’ write scope
# Add as GitHub secret: repo β†’ Settings β†’ Secrets β†’ Actions β†’ HF_TOKEN
# HF_TOKEN=hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# API Space URL (set after creating the Space)
HF_API_URL=https://your-hf-username-healthcare-rag-api.hf.space
# ── Streamlit Community Cloud (UI deployment) ───────────────────────────
# Set this as a secret in share.streamlit.io β†’ App settings β†’ Secrets
# API_BASE_URL=https://your-hf-username-healthcare-rag-api.hf.space