diff --git a/config.py b/config.py index 02b918a..52076c5 100644 --- a/config.py +++ b/config.py @@ -19,18 +19,6 @@ TEMPERATURE = 0.2 # False = ragionamento interno abilitato (più lento ma potenzialmente più accurato) NO_THINK = True -# ── Embedding ───────────────────────────────────────────────────────────────── - -# Modello di embedding usato da Ollama. -# Deve corrispondere al modello usato durante la vettorizzazione (ingest.py). -# Se cambi questo, devi rieseguire ingest.py con --force. -EMBED_MODEL = "bge-m3" - -# Caratteri massimi inviati al modello di embedding. -# Il testo viene troncato SOLO per il vettore; il documento completo -# rimane in ChromaDB. qwen3-embedding: 32768 token — 6000 char è un limite conservativo. -EMBED_MAX_CHARS: int = 6000 - # ── Ollama ──────────────────────────────────────────────────────────────────── # URL del server Ollama (default: locale sulla porta 11434). diff --git a/ingestion/config.py b/ingestion/config.py new file mode 100644 index 0000000..352f12d --- /dev/null +++ b/ingestion/config.py @@ -0,0 +1,14 @@ +# ─── Configurazione embedding ───────────────────────────────────────────────── + +# Modello di embedding usato da Ollama. +# Deve corrispondere al modello usato durante la vettorizzazione. +# Se cambi questo, riesegui ingest.py con --force su tutti gli stem. +EMBED_MODEL = "bge-m3" + +# Caratteri massimi inviati al modello di embedding. +# Il testo viene troncato SOLO per il vettore; il documento completo +# rimane in ChromaDB. +EMBED_MAX_CHARS: int = 6000 + +# URL del server Ollama (default: locale sulla porta 11434). +OLLAMA_URL = "http://localhost:11434" diff --git a/ingestion/ingest.py b/ingestion/ingest.py index 8bd1119..d02383e 100644 --- a/ingestion/ingest.py +++ b/ingestion/ingest.py @@ -38,7 +38,7 @@ CHUNKS_DIR = project_root / "chunks" CHROMA_DIR = project_root / "chroma_db" sys.path.insert(0, str(project_root)) -from config import EMBED_MODEL, EMBED_MAX_CHARS, OLLAMA_URL # noqa: E402 +from ingestion.config import EMBED_MODEL, EMBED_MAX_CHARS, OLLAMA_URL # noqa: E402 EMBED_ENDPOINT = f"{OLLAMA_URL}/api/embeddings" diff --git a/rag.py b/rag.py index 4bc4e36..4bea207 100644 --- a/rag.py +++ b/rag.py @@ -30,12 +30,12 @@ import chromadb sys.path.insert(0, str(Path(__file__).parent)) import config as _cfg +from ingestion.config import EMBED_MODEL project_root = Path(__file__).parent CHROMA_DIR = project_root / "chroma_db" OLLAMA_URL = _cfg.OLLAMA_URL -EMBED_MODEL = _cfg.EMBED_MODEL LLM_MODEL = _cfg.OLLAMA_MODEL TOP_K = _cfg.TOP_K TEMPERATURE = _cfg.TEMPERATURE diff --git a/retrieve.py b/retrieve.py index a2d92ee..946bd4b 100644 --- a/retrieve.py +++ b/retrieve.py @@ -36,12 +36,12 @@ import chromadb sys.path.insert(0, str(Path(__file__).parent)) import config as _cfg +from ingestion.config import EMBED_MODEL project_root = Path(__file__).parent CHROMA_DIR = project_root / "chroma_db" OLLAMA_URL = _cfg.OLLAMA_URL -EMBED_MODEL = _cfg.EMBED_MODEL TOP_K = _cfg.TOP_K