Update rag.py
This commit is contained in:
parent
928a39fd96
commit
9c6c857f28
10
rag.py
10
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)")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user