File size: 1,069 Bytes
f039f41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from __future__ import annotations

from dataclasses import asdict, dataclass, field
from typing import Any


@dataclass(frozen=True)
class BenchCase:
    case_id: str
    suite_id: str
    lane: str
    messages: list[dict[str, Any]]
    scorer: str
    expected: Any
    max_output_tokens: int = 256
    tools: list[dict[str, Any]] | None = None
    request_overrides: dict[str, Any] = field(default_factory=dict)
    metadata: dict[str, Any] = field(default_factory=dict)

    def to_dict(self, *, include_expected: bool = True) -> dict[str, Any]:
        value = asdict(self)
        if not include_expected:
            value.pop("expected", None)
        return value


@dataclass
class CaseResult:
    schema_version: str
    run_id: str
    suite_id: str
    case_id: str
    lane: str
    variant: str
    passed: bool
    score: float
    score_max: float
    error: str | None
    response: dict[str, Any]
    telemetry: dict[str, Any]
    metadata: dict[str, Any]
    request_hash: str

    def to_dict(self) -> dict[str, Any]:
        return asdict(self)