refactor: separa config embedding in ingestion/config.py

- ingestion/config.py (nuovo): EMBED_MODEL, EMBED_MAX_CHARS, OLLAMA_URL
- config.py radice: rimossi EMBED_MODEL e EMBED_MAX_CHARS — resta solo la config RAG
- ingest.py: importa da ingestion.config
- rag.py, retrieve.py: importano EMBED_MODEL da ingestion.config

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-09 09:14:58 +02:00
parent 2939d2f8ca
commit 295fb3faa6
5 changed files with 17 additions and 15 deletions
-12
View File
@@ -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).
+14
View File
@@ -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"
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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