Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions agentplatform/_genai/_transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,12 @@ def t_metric_for_registry(
"evaluation_function": metric.custom_function
}

# Step-based LLM metric
elif getv(metric, ["steps"]):
metric_payload_item["step_based_llm_metric_spec"] = _step_based_llm_metric_spec(
metric
)

# LLM-based metric
elif (hasattr(metric, "prompt_template") and metric.prompt_template) or (
hasattr(metric, "rubric_group_name") and metric.rubric_group_name
Expand Down
11 changes: 11 additions & 0 deletions tests/unit/agentplatform/genai/test_evals.py
Original file line number Diff line number Diff line change
Expand Up @@ -12350,6 +12350,17 @@ def test_t_metrics_code_preprocessor(self):
assert spec["preprocessor"] == {"code_config": {"code": self._PREPROCESS_CODE}}
assert "autorater_config" not in spec["steps"][0]

def test_t_metric_for_registry_builds_step_based_spec(self):
metric = self._metric()

payload = _transformers.t_metric_for_registry(metric)

assert payload == {
"step_based_llm_metric_spec": _transformers.t_metrics([metric])[0][
"step_based_llm_metric_spec"
]
}

@pytest.mark.parametrize(
"steps,error",
[
Expand Down
Loading