File size: 1,353 Bytes
0a19322
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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()