From 9c6c857f2817373796d7ef35ab53911e87e9a66a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phan?= Date: Mon, 19 May 2025 09:08:26 +0200 Subject: [PATCH] Update rag.py --- rag.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rag.py b/rag.py index 8bccc82..fa48ced 100644 --- a/rag.py +++ b/rag.py @@ -3,7 +3,7 @@ rag.py — recherche + génération (version robuste, chapitres) ============================================================ • Charge **un ou plusieurs** couples index/meta (FAISS + JSON). Par défaut : - chap.idx / chap.meta.json + rapport.idx / rapport.meta.json • Reconstitue les textes à partir des fichiers `path` indiqués dans la méta. – Les passages sont déjà prêts (1 par fichier court, ou découpés par index.py). • Recherche : embeddings BGE‑M3 (CPU) + FAISS (cosinus IP) sur tous les index. @@ -23,13 +23,13 @@ import faiss, numpy as np, requests from FlagEmbedding import BGEM3FlagModel from rich import print -ROOT = Path("Corpus") +ROOT = Path("Rapport") # ------------------------- CLI ------------------------------------------- p = argparse.ArgumentParser() -p.add_argument("--index", nargs="*", default=["chap.idx"], - help="Liste des fichiers FAISS à charger (déf. chap.idx)") -p.add_argument("--meta", nargs="*", default=["chap.meta.json"], +p.add_argument("--index", nargs="*", default=["rapport.idx"], + help="Liste des fichiers FAISS à charger (déf. rapport.idx)") +p.add_argument("--meta", nargs="*", default=["rapport.meta.json"], help="Liste des méta JSON assortis (même ordre que --index)") p.add_argument("--k", type=int, default=15, help="top‑k cumulés (déf. 15)") p.add_argument("--kw", default="seuil", help="mot‑clé boosté (déf. seuil)")