Files
chunking_strategies_evaluation/src/core/config.py
Mahdi Bazrafshan 5fd19c12d9 feat(chunking): add embedding model registry and ollama config
Why:
- Operators need Cloud and Local Embedding Models with stable ids, dimensions, and defaults.

Changes:
- Add Embedding Model Registry; Ollama client; env defaults for model, Ollama host, and Neighbor Expansion knobs.

Impact:
- New installs default to text-embedding-3-large; OLLAMA_BASE_URL required for Local provider.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-10 14:12:36 +03:30

49 lines
1.3 KiB
Python

"""Application configuration loaded from .env via pydantic-settings."""
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
"""All environment variables with defaults and validation."""
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8")
# OpenAI
openai_api_key: str
embedding_model: str = "text-embedding-3-large"
llm_model: str = "gpt-4o-mini"
# Local embeddings (Ollama) — Admin switches models; host stays in config
ollama_base_url: str = "http://192.168.10.10:11435"
# Qdrant
qdrant_url: str = "http://localhost:6333"
qdrant_api_key: str | None = None
# Retrieval
top_k: int = 5
# Neighbor Expansion for fixed_size (ADR-0023); 0/0 = off
neighbor_prev: int = 0
neighbor_next: int = 0
# LLM generation
temperature: float = 0.0
max_tokens: int = 1024
# Chunking defaults
chunk_size: int = 512
chunk_overlap: int = 50
# Semantic chunking
semantic_threshold: float = 0.3
semantic_min_chunk_size: int = 3
# Database
database_url: str = "sqlite:///./data/chunking_benchmark.db"
# Text PDF gate (reject Scanned PDFs with near-empty text layer)
pdf_min_total_chars: int = 100
pdf_min_median_chars_per_page: int = 40
settings = Settings()