Skip to content

Commit 72bdf44

Browse files
authored
Merge branch 'main' into release-please--branches--main
2 parents a9b9ece + 16489d3 commit 72bdf44

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

‎agentplatform/_genai/_evals_visualization.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,9 @@ def _extract_dataset_rows(dataset: types.EvaluationDataset) -> list[dict[str, An
232232
return processed_rows
233233

234234

235+
extract_dataset_rows = _extract_dataset_rows
236+
237+
235238
def get_evaluation_html(eval_result_json: str) -> str:
236239
"""Returns a self-contained HTML for single evaluation visualization."""
237240
payload_b64 = _encode_to_base64(eval_result_json)

‎tests/unit/agentplatform/genai/test_evals.py‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,36 @@ def test_get_inference_html(self):
844844
assert payload_b64 in html
845845
assert "DOMPurify" in html
846846

847+
def test_extract_dataset_rows(self):
848+
dataset = common_types.EvaluationDataset(
849+
eval_cases=[
850+
common_types.EvalCase(
851+
prompt=genai_types.Content(
852+
parts=[genai_types.Part(text="What is 2+2?")]
853+
),
854+
responses=[
855+
common_types.ResponseCandidate(
856+
response=genai_types.Content(
857+
parts=[genai_types.Part(text="4")]
858+
)
859+
)
860+
],
861+
reference=common_types.ResponseCandidate(
862+
response=genai_types.Content(
863+
parts=[genai_types.Part(text="Four")]
864+
)
865+
),
866+
)
867+
]
868+
)
869+
870+
rows = _evals_visualization.extract_dataset_rows(dataset)
871+
872+
assert len(rows) == 1
873+
assert rows[0]["prompt_display_text"] == "What is 2+2?"
874+
assert rows[0]["response_display_text"] == "4"
875+
assert rows[0]["reference"] == "Four"
876+
847877
def test_display_loss_clusters_response_no_ipython(self):
848878
"""Tests graceful fallback when not in IPython."""
849879
from agentplatform._genai import _evals_visualization

0 commit comments

Comments
 (0)