You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.1 KiB
40 lines
1.1 KiB
"""
|
|
settings.py — RAG API configuration loaded from environment variables.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(env_file='.env', extra='ignore')
|
|
|
|
# App
|
|
app_title: str = 'Second Brain RAG API'
|
|
app_version: str = '1.0.0'
|
|
log_level: str = 'INFO'
|
|
|
|
# Database
|
|
database_url: str = 'postgresql://brain:brain@postgres:5432/second_brain'
|
|
db_pool_min: int = 2
|
|
db_pool_max: int = 20
|
|
|
|
# Ollama
|
|
ollama_url: str = 'http://ollama:11434'
|
|
embedding_model: str = 'nomic-embed-text'
|
|
chat_model: str = 'mistral'
|
|
embedding_dimensions: int = 768
|
|
|
|
# Search defaults
|
|
search_top_k: int = 10
|
|
search_threshold: float = 0.01 # Low threshold - embeddings seem normalized differently
|
|
rerank_enabled: bool = False
|
|
|
|
# CORS (comma-separated origins)
|
|
cors_origins: str = 'http://localhost:3000'
|
|
|
|
@property
|
|
def cors_origins_list(self) -> list[str]:
|
|
return [o.strip() for o in self.cors_origins.split(',') if o.strip()]
|