chrisjcc's picture
Strands-Agents SDK Evaluators
d87a140
Raw
History Blame Contribute Delete
887 Bytes
"""
Dataset loader that converts JSON to SDK Case objects.
"""
import json
from typing import List
from strands_evals import Case
def load_cases_from_json(filepath: str) -> List[Case]:
"""
Load test cases from JSON dataset and convert to SDK Case objects.
Args:
filepath: Path to JSON dataset file
Returns:
List of Case objects
"""
with open(filepath) as f:
data = json.load(f)
cases = []
for item in data:
case = Case(
name=item["id"],
input=item["question"],
expected_output=None, # Not used for LLM-based evaluation
metadata={
"expected_key_points": item.get("expected_answer_key_points", []),
"expected_intent": item.get("expected_intent", "")
}
)
cases.append(case)
return cases