Skip to content

Commit

Permalink
chore: renamed files and added tqdm (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjmachan authored Jul 15, 2023
1 parent 3cf07c4 commit eefb0ca
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
src="./docs/assets/logo.png">
</h1>
<p align="center">
<i>SOTA metrics for evaluating Retrieval Augmented Generation (RAG)</i>
<i>Evaluation framework for your Retrieval Augmented Generation (RAG) pipelines</i>
</p>

<p align="center">
Expand Down
2 changes: 1 addition & 1 deletion src/ragas/metrics/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from ragas.metrics.answer_relevance import AnswerRelevancy, answer_relevancy
from ragas.metrics.context_relevance import ContextRelevancy, context_relevancy
from ragas.metrics.factual import Faithfulness, faithfulness
from ragas.metrics.faithfulnes import Faithfulness, faithfulness

__all__ = [
"Faithfulness",
Expand Down
3 changes: 2 additions & 1 deletion src/ragas/metrics/context_relevance.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import numpy as np
from datasets import Dataset
from sentence_transformers import CrossEncoder
from tqdm import tqdm

from ragas.metrics.base import Metric
from ragas.metrics.llms import openai_completion
Expand Down Expand Up @@ -135,7 +136,7 @@ def score(self: t.Self, dataset: Dataset) -> Dataset:
prompts.append(prompt)

responses = []
for batch_idx in range(0, len(prompts), 20):
for batch_idx in tqdm(range(0, len(prompts), 20)):
batch_responses = openai_completion(
prompts[batch_idx : batch_idx + 20], n=self.strictness
)
Expand Down
File renamed without changes.
10 changes: 2 additions & 8 deletions tests/benchmarks/benchmark_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,8 @@

DEVICE = "cuda" if is_available() else "cpu"

PATH_TO_DATSET_GIT_REPO = "../../../datasets/fiqa/"
dataset_dir = os.environ.get("DATASET_DIR", PATH_TO_DATSET_GIT_REPO)
if os.path.isdir(dataset_dir):
ds = Dataset.from_csv(os.path.join(dataset_dir, "baseline.csv"))
assert isinstance(ds, Dataset)
else:
# data
ds = load_dataset("explodinggradients/fiqa", "ragas_eval")["baseline"]
# data
ds = load_dataset("explodinggradients/fiqa", "ragas_eval")["baseline"]

if __name__ == "__main__":
result = evaluate(
Expand Down

0 comments on commit eefb0ca

Please sign in to comment.