Created
July 4, 2023 07:49
-
-
Save shahules786/550049169a2eaa34905a58035902ffbe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ragas import evaluate | |
from datasets import Dataset | |
import os | |
os.environ["OPENAI_API_KEY"] = "your-openai-key" | |
# prepare your huggingface dataset in the format | |
# Dataset({ | |
# features: ['question','contexts','answer'], | |
# num_rows: 25 | |
# }) | |
dataset: Dataset | |
results = evaluate(dataset) | |
# {'ragas_score': 0.860, 'context_relavency': 0.817, | |
# 'factuality': 0.892, 'answer_relevancy': 0.874} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment