Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions eval_protocol/utils/evaluation_row_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from typing import List

from eval_protocol.models import EvaluationRow, Message
from eval_protocol.models import InputMetadata


def serialize_message(msg: Message) -> str:
Expand Down Expand Up @@ -134,3 +135,24 @@ def assistant_to_ground_truth(data: List[EvaluationRow]) -> List[EvaluationRow]:
)

return processed_rows


def create_rows_from_indices(count: int, **metadata) -> List[EvaluationRow]:
"""Create evaluation rows with sequential row_ids.
Useful for remote processors where the server determines content based on row_id.
Args:
count: Number of rows to create
**metadata: Additional metadata to include in each row
Returns:
List of EvaluationRows with row_id set to "0", "1", "2", ...
"""
rows = []
for idx in range(count):
row_metadata = {**metadata, "row_id": str(idx)}
rows.append(
EvaluationRow(
messages=[],
input_metadata=InputMetadata(**row_metadata),
)
)
return rows
Loading