mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-17 11:45:05 +02:00
setup RAG (#6146)
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
"""Configuration models and loaders for the Stirling AI service."""
|
||||
|
||||
from .settings import AppSettings, load_settings
|
||||
from .settings import ENGINE_ROOT, AppSettings, RagBackend, load_settings
|
||||
|
||||
__all__ = [
|
||||
"ENGINE_ROOT",
|
||||
"AppSettings",
|
||||
"RagBackend",
|
||||
"load_settings",
|
||||
]
|
||||
|
||||
@@ -2,6 +2,7 @@ from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import logging.handlers
|
||||
from enum import StrEnum
|
||||
from functools import lru_cache
|
||||
from pathlib import Path
|
||||
|
||||
@@ -13,6 +14,11 @@ ENGINE_ROOT = Path(__file__).resolve().parents[3]
|
||||
ENV_FILE = ENGINE_ROOT / ".env"
|
||||
|
||||
|
||||
class RagBackend(StrEnum):
|
||||
SQLITE = "sqlite"
|
||||
PGVECTOR = "pgvector"
|
||||
|
||||
|
||||
class AppSettings(BaseSettings):
|
||||
model_config = SettingsConfigDict(env_file=ENV_FILE, extra="ignore", populate_by_name=True)
|
||||
|
||||
@@ -21,6 +27,15 @@ class AppSettings(BaseSettings):
|
||||
smart_model_max_tokens: int = Field(validation_alias="STIRLING_SMART_MODEL_MAX_TOKENS")
|
||||
fast_model_max_tokens: int = Field(validation_alias="STIRLING_FAST_MODEL_MAX_TOKENS")
|
||||
|
||||
# RAG settings — always on; the backend picks between embedded sqlite-vec and external pgvector.
|
||||
rag_backend: RagBackend = Field(validation_alias="STIRLING_RAG_BACKEND")
|
||||
rag_embedding_model: str = Field(validation_alias="STIRLING_RAG_EMBEDDING_MODEL")
|
||||
rag_store_path: Path = Field(validation_alias="STIRLING_RAG_STORE_PATH")
|
||||
rag_pgvector_dsn: str = Field(validation_alias="STIRLING_RAG_PGVECTOR_DSN")
|
||||
rag_chunk_size: int = Field(validation_alias="STIRLING_RAG_CHUNK_SIZE")
|
||||
rag_chunk_overlap: int = Field(validation_alias="STIRLING_RAG_CHUNK_OVERLAP")
|
||||
rag_default_top_k: int = Field(validation_alias="STIRLING_RAG_TOP_K")
|
||||
|
||||
log_level: str = Field(default="INFO", validation_alias="STIRLING_LOG_LEVEL")
|
||||
log_file: str = Field(default="", validation_alias="STIRLING_LOG_FILE")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user