Skip to content

Commit

Permalink
Merge branch 'ragaaf' of https://github.com/adkakne/GenAIEval into ra…
Browse files Browse the repository at this point in the history
…gaaf
  • Loading branch information
adkakne committed Oct 11, 2024
2 parents 045eed6 + ccc864b commit 348e947
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions evals/metrics/ragaaf/rag_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ def load_local_data(self):
return Dataset.from_list(data)

def load_unit_data(self, examples):
assert len(examples) >= 1, "Please provide atleast one example"
assert len(examples) >= 1, "Please provide at least one example"
data = [self.load_example(obj) for obj in examples]
return Dataset.from_list(data)

def load_benchmarking_data(self):
dataset = load_dataset(self.dataset)["train"]
data = [self.load_example(obj) for obj in dataset]
Expand All @@ -50,7 +50,7 @@ def load_data(self, examples):
return self.load_unit_data(examples)
else:
return self.load_benchmarking_data()

def validate_dataset(self):
for i, example in enumerate(self.data):
for out_field in self.field_map:
Expand Down
2 changes: 1 addition & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ langchain_community
langchain_huggingface
lm-eval==0.4.3
openai
ragas==0.1.19
ragas==0.1.19
8 changes: 5 additions & 3 deletions tests/test_ragaaf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ def test_ragaaf(self):

question = "What if these shoes don't fit?"
actual_output = "We offer a 30-day full refund at no extra cost."
contexts = ["All customers are eligible for a 30 day full refund at no extra cost.",
"We can only process full refund upto 30 day after the purchase."]
examples = [{"question" : question, "actual_output" : actual_output, "contexts" : contexts}]
contexts = [
"All customers are eligible for a 30 day full refund at no extra cost.",
"We can only process full refund upto 30 day after the purchase.",
]
examples = [{"question": question, "actual_output": actual_output, "contexts": contexts}]

evaluation_mode = "endpoint"
model_name = f"http://{host_ip}:{port}"
Expand Down

0 comments on commit 348e947

Please sign in to comment.