File size: 2,439 Bytes
6fc17e7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""
GCAS Search Engine – Configuration
All values can be overridden via environment variables or a .env file.
"""
from __future__ import annotations
from typing import Optional
from pydantic_settings import BaseSettings, SettingsConfigDict


class Settings(BaseSettings):
    model_config = SettingsConfigDict(env_file=".env", extra="ignore")

    # ------------------------------------------------------------------
    # Data paths
    # ------------------------------------------------------------------
    # Folder that contains the .xlsx files to index
    excel_folder: str = "./data"
    # Where FAISS indexes + pickle cache are stored between restarts
    index_cache_folder: str = "./index_cache"

    # ------------------------------------------------------------------
    # Embeddings  ("local" = sentence-transformers, "openai" = OpenAI API)
    # ------------------------------------------------------------------
    embedding_provider: str = "local"
    # Multilingual model supports English + Hindi + Gujarati (50+ languages).
    # Produces 384-dim vectors – compatible with existing FAISS indexes.
    # Switch to "all-MiniLM-L6-v2" if you only need English.
    local_embedding_model: str = "paraphrase-multilingual-MiniLM-L12-v2"
    # Model used when embedding_provider == "openai"
    openai_embedding_model: str = "text-embedding-3-small"

    # ------------------------------------------------------------------
    # LLM reranker  ("openai" | "anthropic")
    # ------------------------------------------------------------------
    llm_provider: str = "openai"
    llm_model: str = "gpt-4o-mini"

    # ------------------------------------------------------------------
    # API keys  (can also be passed per-request)
    # ------------------------------------------------------------------
    openai_api_key: Optional[str] = None
    anthropic_api_key: Optional[str] = None

    # ------------------------------------------------------------------
    # Search defaults
    # ------------------------------------------------------------------
    default_top_k: int = 10
    # How many FAISS candidates to gather before LLM reranking
    rerank_pool_size: int = 50

    # ------------------------------------------------------------------
    # Server
    # ------------------------------------------------------------------
    api_host: str = "0.0.0.0"
    api_port: int = 8000


settings = Settings()