docs-qa-backend / app /config.py
capcut8128's picture
Upload 12 files
0a19322 verified
Raw History Blame Contribute Delete
1.35 kB
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
# --- LLM (Groq free tier) ---
groq_api_key: str = ""
llm_model: str = "openai/gpt-oss-120b"
use_query_rewrite: bool = True # LLM-based question understanding (pages, doc names, Hinglish)
# --- retrieval models (run locally, free) ---
embed_model: str = "sentence-transformers/all-MiniLM-L6-v2"
use_reranker: bool = True
rerank_model: str = "cross-encoder/ms-marco-MiniLM-L-6-v2"
# --- storage ---
data_dir: str = "./data" # holds data/qdrant (vectors) and data/registry.json (document list)
collection: str = "documents"
# --- ingestion ---
chunk_size: int = 1000
chunk_overlap: int = 150
embed_batch: int = 64
# --- retrieval ---
top_k: int = 6 # chunks sent to the LLM
candidate_k: int = 30 # candidates per search (single group)
per_doc_k: int = 10 # candidates per document when searching several documents
max_doc_groups: int = 10 # above this many documents, search all at once
max_lookup_pages: int = 8 # max pages read directly for "what is on page N"
max_context_chars: int = 14000
cors_origins: str = "http://localhost:3000,http://127.0.0.1:3000"
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
settings = Settings()