feat: consolida backend RAG e documentação
This commit is contained in:
parent
7c18727f62
commit
d72572ee6f
28 changed files with 2193 additions and 275 deletions
36
rag-api/config.py
Normal file
36
rag-api/config.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
"""Canonical defaults and environment parsing for the RAG API runtime."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Settings:
|
||||
qdrant_url: str
|
||||
ollama_url: str
|
||||
collection: str
|
||||
embed_model: str
|
||||
chat_model: str
|
||||
api_key: str
|
||||
score_threshold: float
|
||||
max_context_chars: int
|
||||
max_question_chars: int
|
||||
|
||||
@classmethod
|
||||
def from_environment(cls) -> "Settings":
|
||||
return cls(
|
||||
qdrant_url=os.getenv("QDRANT_URL", "http://192.168.0.153:6333").rstrip("/"),
|
||||
ollama_url=os.getenv("OLLAMA_URL", "http://192.168.0.106:11434").rstrip("/"),
|
||||
collection=os.getenv("QDRANT_COLLECTION", "ativa_knowledge"),
|
||||
embed_model=os.getenv("EMBED_MODEL", "nomic-embed-text"),
|
||||
chat_model=os.getenv("CHAT_MODEL", "ativa-assistente"),
|
||||
api_key=os.getenv("ATIVA_RAG_API_KEY", "").strip(),
|
||||
score_threshold=float(os.getenv("RAG_SCORE_THRESHOLD", "0.55")),
|
||||
max_context_chars=int(os.getenv("RAG_MAX_CONTEXT_CHARS", "18000")),
|
||||
max_question_chars=int(os.getenv("RAG_MAX_QUESTION_CHARS", "2000")),
|
||||
)
|
||||
|
||||
|
||||
settings = Settings.from_environment()
|
||||
Loading…
Add table
Add a link
Reference in a new issue