Skip to content

lilac adapter#389

Merged
shreymodi1 merged 3 commits intomainfrom
shrey/lilac
Jan 5, 2026
Merged

lilac adapter#389
shreymodi1 merged 3 commits intomainfrom
shrey/lilac

Conversation

@shreymodi1
Copy link
Contributor

@shreymodi1 shreymodi1 commented Dec 29, 2025

Note

Adds pandas-based data interchange for evaluation rows and serialization helpers.

  • New adapters/dataframe.py with evaluation_rows_to_dataframe and dataframe_to_evaluation_rows converting via EvaluationRow.to_dict()/from_dict()
  • EvaluationRow gains to_dict (JSON under data_json plus convenience fields) and from_dict (validates/deserializes) for stable round-tripping
  • Exposes DataFrame adapter functions in adapters/__init__.py behind optional pandas import

Written by Cursor Bugbot for commit e529f7f. This will update automatically on new commits. Configure here.

@dphuang2
Copy link
Collaborator

this PR isn't specific to lilac in any way—its an adapter for pandas dataframe. Can we rename the module to reflect that?

Comment on lines +74 to +94
def _evaluation_row_to_dict(row: EvaluationRow) -> dict[str, Any]:
"""Convert a single EvaluationRow to a dictionary.

The output contains JSON-serialized fields that can be reconstructed back
to EvaluationRow. Users can add their own text columns for clustering.
"""
return {
# Identifiers
"row_id": row.input_metadata.row_id if row.input_metadata else None,
# Full data as JSON (for reconstruction)
"messages_json": json.dumps([_serialize_message(m) for m in row.messages]),
"tools_json": json.dumps(row.tools) if row.tools else None,
"ground_truth_json": json.dumps(row.ground_truth) if row.ground_truth else None,
"input_metadata_json": row.input_metadata.model_dump_json() if row.input_metadata else None,
"execution_metadata_json": row.execution_metadata.model_dump_json() if row.execution_metadata else None,
"evaluation_result_json": row.evaluation_result.model_dump_json() if row.evaluation_result else None,
# Scalar fields for filtering
"score": row.evaluation_result.score if row.evaluation_result else None,
"message_count": len(row.messages),
"has_tools": bool(row.tools),
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this helper just live on the EvaluationRow for discovery? Also, how was the final set of keys decided? Why don't we just generically serialize the entire EvaluationRow?

@shreymodi1 shreymodi1 merged commit 3322e5f into main Jan 5, 2026
31 of 32 checks passed
@shreymodi1 shreymodi1 deleted the shrey/lilac branch January 5, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants