Skip to content

Commit

Permalink
update crud ragas evaluation.
Browse files Browse the repository at this point in the history
  • Loading branch information
lkk12014402 committed Sep 26, 2024
1 parent b9e741f commit 1e5cd17
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion evals/evaluation/rag_eval/examples/eval_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from evals.evaluation.rag_eval import Evaluator
from evals.evaluation.rag_eval.template import CRUDTemplate
from evals.metrics.ragas import RagasMetric
from tqdm import tqdm


class CRUD_Evaluator(Evaluator):
Expand Down Expand Up @@ -100,7 +101,7 @@ def get_ragas_metrics(self, results, arguments):
"contexts": [],
}

valid_results = self.remove_invalid(results)
valid_results = self.remove_invalid(results["results"])

for data in tqdm(valid_results):
data = data["original_data"]
Expand Down Expand Up @@ -200,6 +201,10 @@ def main():
results = evaluator.evaluate(
args, show_progress_bar=args.show_progress_bar, contain_original_data=args.contain_original_data
)
print(results["overall"])
if args.ragas_metrics:
ragas_metrics = evaluator.get_ragas_metrics(results, args)
print(ragas_metrics)
print(f"Evaluation results of task {task} saved to {output_save_path}.")


Expand Down

0 comments on commit 1e5cd17

Please sign in to comment.