Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/ragas/testset/synthesizers/testset_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,19 @@ def upload(self, base_url: str = RAGAS_API_URL, verbose: bool = True) -> str:
if verbose:
print(f"Testset uploaded! View at {testset_endpoint}")
return testset_endpoint

@classmethod
def from_annotated(cls, path: str) -> Testset:
"""
Loads a testset from an annotated JSON file from app.ragas.io.
"""
import json

with open(path, "r") as f:
annotated_testset = json.load(f)

samples = []
for sample in annotated_testset:
if sample["approval_status"] == "approved":
samples.append(TestsetSample(**sample))
return cls(samples=samples)
Loading