Files
rag-technical-docs-assistant/.env.example
T
11linear11 a73a496c54 feat(backend): deliver Phase 3 document and voice integration
Add authenticated upload, review, retry and knowledge-selection HTTP flows with bounded JSON processing and frozen OCR policy.

Preserve Gemini/OpenAI provider selection and fenced lifecycle semantics; retain FAQ preambles and uncertain vision candidates, and expose opt-in uncalibrated voice transport diagnostics.

Include frontend integration examples, aligned contracts and deterministic regressions. Validation: 1767 provider-free tests passed; all 404 PostgreSQL scenarios have passing evidence across the documented runs.
2026-10-09 17:43:52 -04:00

108 lines
4.3 KiB
Bash

# App Config
APP_NAME="Technical Documentation Assistant"
APP_VERSION="1.0.0"
APP_ENVIRONMENT="development"
# LLM Config
API_KEY="your-api-key-here"
LLM_BASE_URL="https://openrouter.ai/api/v1"
LLM_MODEL="gpt-4o-mini"
LLM_TEMPERATURE=0.0
LLM_MAX_TOKENS=2048
LLM_MAX_ITERATIONS=3
# RAG Config
CHUNK_SIZE=1000
CHUNK_OVERLAP=200
DOCS_DIR="./data/documents"
CHROMA_PERSIST_DIR="./data/vector_db"
# Independent ingestion settings. Choose the real deployment profile explicitly.
INGEST_DATABASE_URL="postgresql+psycopg://user:password@localhost:5432/rag"
INGEST_EMBEDDING_PROVIDER=""
# HTTP(S) host/optional port/path only; no userinfo/query/fragment/encoded components.
INGEST_EMBEDDING_ENDPOINT=""
INGEST_EMBEDDING_MODEL=""
INGEST_EMBEDDING_DIMENSIONS=
# Not needed for schema/bootstrap; required by the hosted embedding adapter.
INGEST_EMBEDDING_API_KEY=""
INGEST_EMBEDDING_PREPROCESSING_VERSION="v1"
INGEST_EMBEDDING_TIMEOUT_SECONDS=60
INGEST_ORIGINAL_DIRECTORY="data/originals"
INGEST_ACCEPTED_FORMATS='[".pdf", ".md", ".docx", ".jpg", ".jpeg", ".png"]'
INGEST_MAX_ORIGINAL_BYTES=20971520
INGEST_MAX_PDF_PAGES=200
INGEST_MAX_NORMALIZED_CHARACTERS=1000000
INGEST_MAX_CHUNKS=2000
INGEST_CHUNK_SIZE_CHARACTERS=1000
INGEST_CHUNK_OVERLAP_CHARACTERS=200
INGEST_EMBEDDING_BATCH_SIZE=32
INGEST_MAX_STAGED_BYTES=134217728
INGEST_WORKER_CONCURRENCY=1
INGEST_POLL_SECONDS=2
INGEST_HEARTBEAT_SECONDS=20
INGEST_LEASE_SECONDS=120
INGEST_MAX_AUTOMATIC_ATTEMPTS=3
INGEST_RETRY_BASE_SECONDS=2
INGEST_RETRY_CAP_SECONDS=300
# Engineering deployment defaults, not product-owner approval. No OCR at intake.
INGEST_EXTRACTION_DIRECTORY="data/extractions"
INGEST_MAX_DOCX_ENTRIES=2048
INGEST_MAX_DOCX_MEMBER_BYTES=16777216
INGEST_MAX_DOCX_EXPANDED_BYTES=67108864
INGEST_MAX_DOCX_COMPRESSION_RATIO=200
INGEST_MAX_IMAGE_WIDTH=12000
INGEST_MAX_IMAGE_HEIGHT=12000
INGEST_MAX_IMAGE_PIXELS=40000000
INGEST_EXTRACTION_STRATEGY="direct-quality-fallback-v1"
# Optional identity: configure all three together; credentials are needed only for opt-in Phase 3 vision.
# INGEST_VISION_PROVIDER="<chosen-provider>"
# INGEST_VISION_ENDPOINT="https://provider.example.invalid/v1"
# INGEST_VISION_MODEL="<chosen-model>"
# INGEST_VISION_API_KEY="<secret>"
INGEST_VISION_TIMEOUT_SECONDS=60
INGEST_FALLBACK_POLICY="affected-pages-v1"
INGEST_QUALITY_POLICY="bounded-checks-manual-review-v1"
# Preserve existing embedding preprocessing. New Persian normalization requires migration/reindex design.
INGEST_NORMALIZATION_POLICY="unicode-line-endings-v1"
INGEST_CHUNKING_POLICY="paragraph-v1"
INGEST_RENDER_DPI=144
INGEST_MAX_RENDERED_PAGE_PIXELS=20000000
INGEST_MAX_EXTRACTION_ARTIFACT_BYTES=33554432
INGEST_MAX_EXTRACTED_BLOCKS=10000
# Phase 4: select endpoint/model limits explicitly; no character-to-token estimate.
# INGEST_EMBEDDING_LIMITS='{"unit":"tokens","max_input_units":8192,"max_batch_units":300000,"max_batch_inputs":2048,"tokenizer":"tiktoken:cl100k_base"}'
# The example is NOT compatibility approval for an arbitrary endpoint/model.
INGEST_EMBEDDING_SEND_DIMENSIONS=false
INGEST_EMBEDDING_MAX_RESPONSE_BYTES=16777216
# Backend voice selection; Gemini is the temporary default. No automatic fallback.
# Legacy PROVIDER is accepted; do not set it differently from VOICE_PROVIDER.
VOICE_PROVIDER=gemini
GEMINI_API_KEY=
GEMINI_MODEL=gemini-2.0-flash-exp
GEMINI_VOICE=Aoede
# GEMINI_PROXY=https://trusted-proxy.example:443
# Required only when VOICE_PROVIDER=openai. Independent of embedding/LLM OPENAI_API_KEY.
OPENAI_REALTIME_API_KEY=
OPENAI_REALTIME_MODEL=gpt-realtime-mini
OPENAI_REALTIME_VOICE=shimmer
# OPENAI_REALTIME_PROXY=https://trusted-proxy.example:443
TRUSTED_ORIGINS=["http://localhost:8000","http://127.0.0.1:8000"]
TRUSTED_HOSTS=["localhost:8000","127.0.0.1:8000"]
# Explicit local development only. Production requires HTTPS and true.
COOKIE_SECURE=false
AUTH_SESSION_SECONDS=28800
LIVE_SESSION_SECONDS=600
# Path to a measured, profile-compatible calibrated report; never a status placeholder.
# SEARCH_CALIBRATION_REPORT=/absolute/path/measured-report.json
# Explicit connectivity testing only; no uncalibrated document evidence is admitted.
# Sessions expose calibration_status=uncalibrated. Production default remains false.
VOICE_TRANSPORT_TESTING=false
# OCR supervisor gate for NEW jobs only; false admits only automatically validated OCR.
# Existing/legacy jobs keep their frozen policy. Factual/non-OCR review remains required.
INGEST_OCR_REVIEW_REQUIRED=true