Skip to content

Commit

Permalink
Changed the parameter of evaluate function to data
Browse files Browse the repository at this point in the history
  • Loading branch information
ANANDAPADMANABHA committed May 7, 2024
1 parent 31fec55 commit 6227767
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/ragrank/evaluation/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@validate_call(validate_return=False)
def evaluate(
dataset: Dataset | DataNode | dict,
data: Dataset | DataNode | dict,
*,
llm: Optional[BaseLLM] = None,
metrics: Optional[BaseMetric | List[BaseMetric]] = None,
Expand Down Expand Up @@ -58,10 +58,10 @@ def evaluate(
print(result)
"""
if isinstance(dataset, dict):
dataset = from_dict(dataset)
if isinstance(dataset, DataNode):
dataset = dataset.to_dataset()
if isinstance(data, dict):
data = from_dict(data)
if isinstance(data, DataNode):
data = data.to_dataset()
if llm is None:
llm = default_llm()
if metrics is None:
Expand All @@ -73,7 +73,7 @@ def evaluate(
scores = [
[
metric.score(datanode).score
for datanode in dataset.with_progress("Evaluating")
for datanode in data.with_progress("Evaluating")
]
for metric in metrics
]
Expand All @@ -83,7 +83,7 @@ def evaluate(
result = EvalResult(
llm=llm,
metrics=metrics,
dataset=dataset,
dataset=data,
response_time=delta,
scores=scores,
)
Expand All @@ -94,7 +94,7 @@ def evaluate(
metrics[i].name: mean(scores[i])
for i in range(len(metrics))
},
data_size=len(dataset),
data_size=len(data),
)
trace(evaluation_event)
return result

0 comments on commit 6227767

Please sign in to comment.