| import sys |
| import argparse |
| from pathlib import Path |
|
|
| REPO_ROOT = Path(__file__).resolve().parents[1] |
| if str(REPO_ROOT) not in sys.path: |
| sys.path.insert(0, str(REPO_ROOT)) |
|
|
|
|
| def main(): |
| parser = argparse.ArgumentParser(description="Evaluate RAG with RAGAS") |
| parser.add_argument("--samples", type=int, default=10, help="Number of samples (0 = all)") |
| parser.add_argument("--mode", type=str, default="hybrid_rerank", |
| choices=["vector_only", "bm25_only", "hybrid", "hybrid_rerank", "all"], |
| help="Retrieval mode") |
| args = parser.parse_args() |
| |
| from evaluation.ragas_eval import run_evaluation |
| |
| if args.mode == "all": |
| |
| print("\n" + "=" * 60) |
| print("RUNNING ALL RETRIEVAL MODES") |
| print("=" * 60) |
| for mode in ["vector_only", "bm25_only", "hybrid", "hybrid_rerank"]: |
| run_evaluation(args.samples, mode) |
| else: |
| run_evaluation(args.samples, args.mode) |
|
|
|
|
| if __name__ == "__main__": |
| main() |
|
|