Metric.create() metrics score an empty string — agent_response_data_fields defaults to all-False · Issue #1170 · aixplain/aiXplain · GitHub
Skip to content

Metric.create() metrics score an empty string — agent_response_data_fields defaults to all-False #1170

Open

Description

@elbadrashiny

A metric created with Metric.create(...) and used through measure() sends an empty string to the judge model, so the resulting scores are judgments of nothing. There is no error — the run completes and returns numbers that look valid.

Verified against aixplain==0.2.48 (Python 3.13) by introspection and local execution. No network calls needed to reproduce the core of it.

The chain

  1. Metric.agent_response_data_fields defaults to AgentResponseDataFields(query=False, trace=False, output=False) — all three flags off.
  2. Metric.create(...) never sets agent_response_data_fields (the name does not appear in its body).
  3. measure() builds its payload from those flags:
def measure(self, agent_response):
    metric_input = self.agent_response_data_fields.give_metric_input(agent_response)
    if self.additional_input_prompt:
        metric_input = self.additional_input_prompt + "\n\n" + metric_input
    metric_payload = {"data": metric_input}
    return self.run(data=metric_payload)
  1. give_metric_input() appends only the enabled fields, so with all three False it returns "".

Reproduction (no API key required)

from aixplain.v2.agent_evaluator import AgentResponseDataFields

class R:  # stand-in for AgentResponseData
    input = "What is 2+2?"; output = "4"; steps = []

print(repr(AgentResponseDataFields().give_metric_input(R())))         # ''
print(repr(AgentResponseDataFields(output=True).give_metric_input(R())))  # 'Output: 4\n'

The first line is what a Metric.create(...) metric sends as {"data": ""}.

Impact

Any evaluation built on Metric.create + measure() silently scores an empty prompt unless the caller knows to set agent_response_data_fields themselves. Because the call succeeds and returns a score, there is nothing to alert the user that the judge never saw the agent's output.

Suggested fixes (any one would do)

  • Default AgentResponseDataFields to output=True (the minimum useful payload), or
  • have Metric.create(...) set agent_response_data_fields from its arguments, or
  • raise in measure() when the resulting metric_input is empty.

Secondary, same method

Metric.create(...) begins with del allowed_actions, kwargs — the allowed_actions parameter is accepted and silently discarded. Either honour it or drop it from the signature.

Related note: the Eval docstring states each metric is invoked with a payload containing output and reference; in the current code EvalCase.reference never reaches the metric at all.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions