from typing import List, Optional, Any, Dict
from pydantic import BaseModel, Field

class TestCase(BaseModel):
    """
    The standard unit of evaluation.
    Using Pydantic ensures data validation and prevents runtime errors.
    """
    input_text: str = Field(..., description="The original user query.")
    actual_output: str = Field(..., description="The response generated by the LLM.")
    retrieval_context: Optional[List[str]] = Field(default=None, description="Chunks retrieved from the vector DB.")
    expected_output: Optional[str] = Field(default=None, description="The 'Gold Standard' answer (optional).")
    metadata: Dict[str, Any] = Field(default_factory=dict, description="Extra tags like 'model_name' or 'latency'.")

class MetricResult(BaseModel):
    """
    Standardized output for any metric.
    """
    metric_name: str
    score: float
    reason: str
    passed: bool