Skip to content

Commit

Permalink
Restrict RAGAS compute
Browse files Browse the repository at this point in the history
  • Loading branch information
janheinrichmerker committed Aug 29, 2024
1 parent 91e2c31 commit ff1a353
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions trec_biogen/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
summarization_score,
)
from ragas.metrics.base import Metric as RagasMeasure
from ragas.run_config import RunConfig
from sklearn.metrics import accuracy_score

from trec_biogen.language_models import LanguageModelName, get_langchain_language_model
Expand Down Expand Up @@ -206,6 +207,10 @@ def evaluate_generation(
dataset=dataset,
metrics=[ragas_measure],
llm=language_model,
run_config=RunConfig(
timeout=60,
max_retries=5,
)
)
result_df: DataFrame = result.to_pandas() # type: ignore
return float(result_df[ragas_measure.name].mean())
Expand Down

0 comments on commit ff1a353

Please sign in to comment.