"""Central configuration for the Medical RAG Chatbot. Every other module imports its settings from here, so we only change things in one place. Values can be overridden with environment variables. """ from pathlib import Path import os from dotenv import load_dotenv # Load variables from a local .env file (e.g. GROQ_API_KEY) if present. load_dotenv() # --- Paths --------------------------------------------------------------- PROJECT_ROOT = Path(__file__).resolve().parent.parent DATA_DIR = PROJECT_ROOT / "data" # source PDFs live here CHROMA_DIR = PROJECT_ROOT / "chroma_db" # persisted vector database # --- Chunking (how documents are split before embedding) ---------------- # ~512 tokens with 50 overlap, per the briefing. We measure in characters # here (~4 chars per token) which is what LangChain's splitter uses. CHUNK_SIZE = 2000 # characters (~500 tokens) CHUNK_OVERLAP = 200 # characters (~50 tokens) # --- Embeddings (turns text into vectors) ------------------------------- # all-MiniLM-L6-v2 is small, fast, free, and runs on CPU. EMBED_MODEL = os.getenv("EMBED_MODEL", "sentence-transformers/all-MiniLM-L6-v2") # --- Retrieval ----------------------------------------------------------- TOP_K = 4 # how many chunks to retrieve per question # --- LLM (Groq, free tier — Llama 3.3 70B) ------------------------------ LLM_MODEL = os.getenv("LLM_MODEL", "llama-3.3-70b-versatile") LLM_TEMPERATURE = 0.1 # low = factual, less creative GROQ_API_KEY = os.getenv("GROQ_API_KEY") # Name of the collection inside ChromaDB COLLECTION_NAME = "medical_docs"