Document-Audit-RAG / .env.example
Mayank Chugh
Deploy DocuAudit AI to Hugging Face Space (no binaries)
d44b33d
# DocuAudit AI β€” environment template (see docs/DOCUAUDIT_AI_REQUIREMENTS.md)
# LLM Provider: ollama | anthropic | openai | huggingface
LLM_PROVIDER=ollama
# OpenAI (optional)
OPENAI_API_KEY=
OPENAI_MODEL=gpt-4o
OPENAI_EMBEDDING_MODEL=text-embedding-3-small
# Anthropic (optional)
ANTHROPIC_API_KEY=
ANTHROPIC_MODEL=claude-3-5-sonnet-20241022
# Hugging Face Inference API (when LLM_PROVIDER=huggingface β€” typical on Hugging Face Spaces)
# Use a fine-grained token with "Make calls to Inference Providers" / Inference API where required.
HUGGINGFACE_API_KEY=
# Use a model your Hub gates allow (e.g. Llama 3.8B under β€œMeta Llama 3”, or Mistral instruct). Llama 3.1 needs its own gate. Chat: hf-inference then router auto.
#HUGGINGFACE_MODEL=mistralai/Mistral-7B-Instruct-v0.3
#HUGGINGFACE_MODEL=meta-llama/Meta-Llama-3.1-8B-Instruct
HUGGINGFACE_MODEL=meta-llama/Meta-Llama-3-8B-Instruct
HUGGINGFACE_EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
# Optional: huggingface_hub InferenceClient provider. Leave unset: primary hf-inference, then router auto for chat (Mistral instruct ids also try Novita).
# Use `auto` for router-only primary client (may pick Novita and break some models).
HUGGINGFACE_INFERENCE_PROVIDER=
# On Hugging Face Spaces you can omit HUGGINGFACE_API_KEY if the Space provides HF_TOKEN (mapped
# automatically when LLM_PROVIDER=huggingface). For local .env you can set HF_TOKEN instead.
# Ollama (recommended local default)
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_CHAT_MODEL=llama3.1:8b
OLLAMA_EMBEDDING_MODEL=nomic-embed-text
# App
APP_NAME=DocuAudit AI
APP_VERSION=1.0.0
DEBUG=false
MAX_FILE_SIZE_MB=50
# Spec name alias (optional; mapped to MAX_FILE_SIZE_MB in settings)
MAX_UPLOAD_SIZE_MB=
# ChromaDB
CHROMA_PERSIST_DIRECTORY=./data/chroma
CHROMA_PERSIST_DIR=
CHROMA_COLLECTION_NAME=docuaudit_docs
# Chunking
CHUNK_SIZE=1000
CHUNK_OVERLAP=200
# Retrieval default (overridable per request on /query/ask via top_k)
TOP_K_RESULTS=5
# Audit + jobs SQLite
AUDIT_DB_PATH=./audit.db
JOBS_DB_PATH=./data/jobs.db
# Limits
MAX_DOCUMENTS_PER_BATCH=100
# URL ingest (POST /ingest/url). SEC.gov blocks undeclared bots β€” use "Company Name you@email.com".
# INGEST_USER_AGENT=DocuAudit AI you@example.com
# Streamlit β†’ API (Streamlit process reads these when set in the shell / OS env)
STREAMLIT_BACKEND_URL=http://localhost:8000
DOC_AUDI_API_BASE=http://127.0.0.1:8000
# Read timeout (seconds) for Ask/Summarise HTTP calls; default in code is 3600 if unset
DOC_AUDI_HTTP_READ_TIMEOUT=3600
# --- Docker Compose (Milestone 12) ---
# Copy this file to `.env` before `docker compose up` (Compose loads `.env` for substitution and `env_file`).
#
# Persistent paths below are overridden in docker-compose.yml to a single volume mount at /data:
# CHROMA_PERSIST_DIRECTORY=/data/chroma, AUDIT_DB_PATH=/data/audit.db, JOBS_DB_PATH=/data/jobs.db
# You do not need to duplicate those in .env for compose unless you use a custom override file.
#
# Ollama from the API container cannot reach localhost on your machine; default in compose is:
# OLLAMA_BASE_URL=http://host.docker.internal:11434
# (extra_hosts host-gateway is set for Linux.) Run `ollama serve` on the host, or start the bundled
# Ollama service: docker compose --profile ollama up -d
# When using the compose `ollama` profile, set in .env:
# OLLAMA_BASE_URL=http://ollama:11434
#
# Compose sets DOC_AUDI_API_BASE / STREAMLIT_BACKEND_URL to http://api:8000 for the Streamlit service
# so server-side HTTP calls reach the API on the Docker network (do not override for UI in compose).
#
# Optional port overrides: API_PORT=8000, STREAMLIT_PORT=8501, OLLAMA_HOST_PORT=11434
# --- Hugging Face Spaces ---
# Recommended for CPU Spaces (no Ollama): set in Space Settings β†’ Repository secrets β†’ Variables
# LLM_PROVIDER=huggingface
# HUGGINGFACE_API_KEY=<token> OR rely on built-in HF_TOKEN (same value as a Hub token secret)
# HUGGINGFACE_MODEL / HUGGINGFACE_EMBEDDING_MODEL as needed
# If the API runs in a second Space or external URL, set for the Streamlit Space:
# DOC_AUDI_API_BASE=https://your-api....hf.space (or your FastAPI public URL)
# Streamlit on Spaces must listen on port 8501 (default). Entry file: app.py (see docs/HUGGING_FACE_SPACES.md).
# On Streamlit SDK Spaces, only Streamlit starts by default; app.py auto-starts uvicorn on 127.0.0.1:8000 when
# SPACE_ID is set (built-in Hub env). Set DOC_AUDI_EMBED_API=0 to disable if you use a separate API URL above.
# Repository secrets (HF_TOKEN / HUGGINGFACE_API_KEY) are copied from st.secrets into the API subprocess env.