huzaifa-dangote's picture
Upload folder using huggingface_hub
0876544 verified
import json
from pathlib import Path
from pydantic import BaseModel, Field
TEST_FILE = str(Path(__file__).parent / "tests.jsonl")
class TestQuestion(BaseModel):
question: str = Field(description="The question to ask the RAG system")
keywords: list[str] = Field(description="Keywords that must appear in the retrieved context")
reference_answer: str = Field(description="The answer to the question")
category: str = Field(description="The category of the question")
def load_tests() -> list[TestQuestion]:
tests = []
with open(TEST_FILE, "r", encoding="utf-8") as f:
for line in f:
data = json.loads(line.strip())
tests.append(TestQuestion(**data))
return tests