File size: 973 Bytes
9c84f9d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Abstract result store protocol for runner persistence."""

from typing import Any, Protocol, runtime_checkable


@runtime_checkable
class ResultStore(Protocol):
    """Protocol for persisting run results.

    The runner calls these methods during execution. Implementations can
    persist to MongoDB, JSONL files, or any other backend.
    """

    async def update_run(self, run_id: str, data: dict[str, Any]) -> None:
        """Update run metadata (status, timestamps, sample counts)."""
        ...

    async def insert_run_result(self, data: dict[str, Any]) -> str:
        """Save a single inference result. Returns result ID."""
        ...

    async def create_evaluation(self, data: dict[str, Any]) -> str:
        """Save aggregated evaluation scores. Returns evaluation ID."""
        ...

    async def insert_eval_details(self, details: list[dict[str, Any]]) -> int:
        """Save per-sample evaluation details. Returns count inserted."""
        ...