diff --git a/.claude/commands/post-chunk.md b/.claude/commands/post-chunk.md index 9a6ce50..05a139e 100644 --- a/.claude/commands/post-chunk.md +++ b/.claude/commands/post-chunk.md @@ -50,7 +50,7 @@ except Exception as e: print(f'ERRORE lettura report: {e}') ``` โœ… Chunk pronti โ€” procedi con la vettorizzazione: - python step-8/ingest.py --stem $ARGUMENTS + python ingestion/ingest.py --stem $ARGUMENTS ``` Se ci sono solo ๐ŸŸก, spiega brevemente i warning e chiedi se l'utente vuole risolverli prima o procedere. @@ -105,7 +105,7 @@ Se verdict finale รจ `ok` o `warnings_only` senza ๐Ÿ”ด: ``` โœ… Chunk pronti in chunks/$ARGUMENTS/chunks.json Procedi con la vettorizzazione: - python step-8/ingest.py --stem $ARGUMENTS + python ingestion/ingest.py --stem $ARGUMENTS ``` Se rimangono ๐Ÿ”ด dopo il fix (testo non spezzabile o struttura anomala nel sorgente): diff --git a/chunks/verify_chunks.py b/chunks/verify_chunks.py index 7452baa..561638a 100644 --- a/chunks/verify_chunks.py +++ b/chunks/verify_chunks.py @@ -263,11 +263,11 @@ def verify_stem(stem: str, project_root: Path, min_chars: int, max_chars: int) - if not blockers and not warnings: print(f" โœ… Tutto OK โ€” procedi alla vettorizzazione:") - print(f" python step-8/ingest.py --stem {stem}") + print(f" python ingestion/ingest.py --stem {stem}") elif not blockers: print(f" ๐ŸŸก Solo avvisi minori โ€” puoi procedere alla vettorizzazione:") - print(f" python step-8/ingest.py --stem {stem}") + print(f" python ingestion/ingest.py --stem {stem}") print() print(f" Oppure, per ottimizzare prima:") if too_short: diff --git a/step-8/README.md b/ingestion/README.md similarity index 91% rename from step-8/README.md rename to ingestion/README.md index afcef49..aed571d 100644 --- a/step-8/README.md +++ b/ingestion/README.md @@ -23,7 +23,7 @@ EMBED_MODEL = "nomic-embed-text" # โ† cambia qui ``` > Il modello scelto qui deve corrispondere a quello usato in rag.py. -> Se lo cambi dopo aver giร  vettorizzato, devi rieseguire step-8 con `--force`. +> Se lo cambi dopo aver giร  vettorizzato, devi rieseguire ingestion con `--force`. --- @@ -31,16 +31,16 @@ EMBED_MODEL = "nomic-embed-text" # โ† cambia qui ```bash # Vettorizza un singolo documento -python step-8/ingest.py --stem +python ingestion/ingest.py --stem # Vettorizza tutti i documenti trovati in step-6/ -python step-8/ingest.py +python ingestion/ingest.py # Sovrascrive una collection giร  esistente -python step-8/ingest.py --stem --force +python ingestion/ingest.py --stem --force # Override modello (senza modificare config.py) -python step-8/ingest.py --stem --model bge-m3 +python ingestion/ingest.py --stem --model bge-m3 ``` --- @@ -94,7 +94,7 @@ Senza `--force` lo script salta la collection giร  esistente โ€” i vecchi vettor ```bash # Cambio modello โ†’ ricrea sempre la collection -python step-8/ingest.py --stem --force +python ingestion/ingest.py --stem --force ``` ### Quando usare `--force` diff --git a/step-8/ingest.py b/ingestion/ingest.py similarity index 96% rename from step-8/ingest.py rename to ingestion/ingest.py index 7dda557..3b6b501 100644 --- a/step-8/ingest.py +++ b/ingestion/ingest.py @@ -13,10 +13,10 @@ Input: step-6//chunks.json Output: chroma_db/ (collection ChromaDB) Uso: - python step-8/ingest.py --stem # singolo documento - python step-8/ingest.py # tutti gli stem trovati - python step-8/ingest.py --stem --force # sovrascrive collection - python step-8/ingest.py --model bge-m3 # override modello + python ingestion/ingest.py --stem # singolo documento + python ingestion/ingest.py # tutti gli stem trovati + python ingestion/ingest.py --stem --force # sovrascrive collection + python ingestion/ingest.py --model bge-m3 # override modello """ import argparse diff --git a/ollama/README.md b/ollama/README.md index 6faea9d..f52b24b 100644 --- a/ollama/README.md +++ b/ollama/README.md @@ -57,7 +57,7 @@ Alternative supportate: - `bge-m3` - `nomic-embed-text` -Se cambi embedding model rispetto a quello usato in step-8, riesegui ingest con `--force` e aggiorna `EMBED_MODEL` in `config.py`. +Se cambi embedding model rispetto a quello usato in ingestion, riesegui ingest con `--force` e aggiorna `EMBED_MODEL` in `config.py`. ### Modello LLM (consigliato per 8 GB RAM) @@ -101,7 +101,7 @@ Output atteso (esempio): โœ… LLM disponibile: qwen3.5:4b โœ… chromadb importabile โœ… Ambiente pronto โ€” procedi con la vettorizzazione: - python step-8/ingest.py --stem + python ingestion/ingest.py --stem ``` --- @@ -109,5 +109,5 @@ Output atteso (esempio): ## Prossimo step ```bash -python step-8/ingest.py --stem +python ingestion/ingest.py --stem ``` diff --git a/rag.py b/rag.py index f8f406e..8749427 100644 --- a/rag.py +++ b/rag.py @@ -197,7 +197,7 @@ def _build_epilog() -> str: if names: lines += ["", f"Collection disponibili: {', '.join(names)}"] else: - lines += ["", "Nessuna collection trovata โ€” eseguire prima: python step-8/ingest.py"] + lines += ["", "Nessuna collection trovata โ€” eseguire prima: python ingestion/ingest.py"] except Exception: pass return "\n".join(lines) @@ -208,7 +208,7 @@ def main() -> int: description=( "Pipeline RAG interattiva\n\n" "Risponde a domande in linguaggio naturale su un documento\n" - "indicizzato in ChromaDB da step-8/ingest.py." + "indicizzato in ChromaDB da ingestion/ingest.py." ), epilog=_build_epilog(), formatter_class=argparse.RawDescriptionHelpFormatter, @@ -218,7 +218,7 @@ def main() -> int: required=True, help=( "Nome della collection ChromaDB da interrogare. " - "Le collection vengono create da: python step-8/ingest.py --stem " + "Le collection vengono create da: python ingestion/ingest.py --stem " ), ) args = parser.parse_args() @@ -231,14 +231,14 @@ def main() -> int: print() if not CHROMA_DIR.exists(): - print("โŒ chroma_db/ non trovata โ€” esegui prima step-8") + print("โŒ chroma_db/ non trovata โ€” esegui prima ingestion") return 1 client = chromadb.PersistentClient(path=str(CHROMA_DIR)) collections = [c.name for c in client.list_collections()] if args.stem not in collections: print(f"โŒ Collection '{args.stem}' non trovata in chroma_db/") - print(f" โ†’ python step-8/ingest.py --stem {args.stem}") + print(f" โ†’ python ingestion/ingest.py --stem {args.stem}") return 1 collection = client.get_collection(args.stem) diff --git a/retrieve.py b/retrieve.py index 03b26a1..7e9644e 100644 --- a/retrieve.py +++ b/retrieve.py @@ -159,7 +159,7 @@ def _build_epilog() -> str: if names: lines += ["", f"Collection disponibili: {', '.join(names)}"] else: - lines += ["", "Nessuna collection trovata โ€” eseguire prima: python step-8/ingest.py"] + lines += ["", "Nessuna collection trovata โ€” eseguire prima: python ingestion/ingest.py"] except Exception: pass return "\n".join(lines) @@ -196,14 +196,14 @@ def main() -> int: print() if not CHROMA_DIR.exists(): - print("โŒ chroma_db/ non trovata โ€” esegui prima step-8", file=sys.stderr) + print("โŒ chroma_db/ non trovata โ€” esegui prima ingestion", file=sys.stderr) return 1 client = chromadb.PersistentClient(path=str(CHROMA_DIR)) collections = [c.name for c in client.list_collections()] if args.stem not in collections: print(f"โŒ Collection '{args.stem}' non trovata in chroma_db/", file=sys.stderr) - print(f" โ†’ python step-8/ingest.py --stem {args.stem}", file=sys.stderr) + print(f" โ†’ python ingestion/ingest.py --stem {args.stem}", file=sys.stderr) return 1 collection = client.get_collection(args.stem)