ChatJio / config.py
sehscape's picture
deploy: initial ChatJio deployment for HuggingFace Spaces
f3269f9
Raw
History Blame Contribute Delete
1.5 kB
import os
from dotenv import load_dotenv
load_dotenv()
# API Keys
GEMINI_API_KEY = os.getenv("GEMINI_API_KEY")
GROQ_API_KEY = os.getenv("GROQ_API_KEY")
HF_API_KEY = os.getenv("HF_API_KEY")
# Model Names
EMBEDDING_MODEL = "BAAI/bge-small-en-v1.5" # 384-dim, CPU-friendly
RERANKER_MODEL = "cross-encoder/ms-marco-MiniLM-L-6-v2" # lightweight cross-encoder, CPU-friendly
LLM_MODEL = "llama-3.3-70b-versatile"
# Qdrant — local Docker or Qdrant Cloud
QDRANT_HOST = os.getenv("QDRANT_HOST", "localhost")
QDRANT_PORT = int(os.getenv("QDRANT_PORT", 6333))
QDRANT_API_KEY = os.getenv("QDRANT_API_KEY", None)
QDRANT_URL = os.getenv("QDRANT_URL", None) # e.g. https://xyz.qdrant.io for cloud
QDRANT_COLLECTION = "chatjio"
VECTOR_SIZE = 384 # bge-small-en-v1.5 output dimension
# Chunking — 1024 tokens suits dense PDF content; revisit for web-only runs
CHUNK_SIZE = 512
CHUNK_OVERLAP = 64
# Retrieval
RETRIEVAL_TOP_K = 20
RERANK_TOP_K = 10
# Match quality thresholds (cross-encoder ms-marco-MiniLM raw logit scores)
# bge-small dense scores are unreliable for "no match" detection (always 0.5+),
# so the reranker score is used as the sole signal.
# Uruguay (in DB) → +10.3 | Jio Institute (not in DB) → -8.9
NO_MATCH_RERANKER_THRESHOLD = -4.0 # below this AND no keyword hits → ask user before LLM
PARTIAL_MATCH_RERANKER_THRESHOLD = 0.0 # below this (but above NO_MATCH) → auto-switch to LLM
# Data Paths
RAW_DATA_DIR = "data/raw"
PROCESSED_DATA_DIR = "data/processed"