-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
answeredπ€ The question has been answered. Will be closed automatically if no new commentsπ€ The question has been answered. Will be closed automatically if no new commentsbugSomething isn't workingSomething isn't workingmodule-metricsthis is part of metrics modulethis is part of metrics modulequestionFurther information is requestedFurther information is requested
Description
from ragas.metrics.critique import harmfulness
from ragas import evaluate
from ragas.metrics import (
answer_relevancy,
faithfulness,
context_recall,
context_precision,
context_relevancy,
answer_correctness,
answer_similarity
)
def create_ragas_dataset(rag_pipeline, eval_dataset):
rag_dataset = []
for row in tqdm(eval_dataset):
answer = rag_pipeline.invoke({"question" : row["question"]})
rag_dataset.append(
{"question" : row["question"],
"answer" : answer["response"].content,
"contexts" : [context.page_content for context in answer["context"]],
"ground_truths" : [row["ground_truth"]]
}
)
rag_df = pd.DataFrame(rag_dataset)
rag_eval_dataset = Dataset.from_pandas(rag_df)
return rag_eval_dataset
def evaluate_ragas_dataset(ragas_dataset):
result = evaluate(
ragas_dataset,
metrics=[
context_precision,
faithfulness,
answer_relevancy,
context_recall,
context_relevancy,
answer_correctness,
answer_similarity
],
)
return result
When i run the above code I give me this error.
ImportError: cannot import name 'context_relevancy' from 'ragas.metrics' (c:\Users\khan\anaconda3\Lib\site-packages\ragas\metrics_init_.py)
dosubot
Metadata
Metadata
Assignees
Labels
answeredπ€ The question has been answered. Will be closed automatically if no new commentsπ€ The question has been answered. Will be closed automatically if no new commentsbugSomething isn't workingSomething isn't workingmodule-metricsthis is part of metrics modulethis is part of metrics modulequestionFurther information is requestedFurther information is requested