Skip to content

fix: Scope custom eval metrics per registry and resolve their function path from the eval config (v1) - #6792

Merged
GWeale merged 1 commit into
v1from
backport-v1-pr19
Aug 19, 2026
Merged

fix: Scope custom eval metrics per registry and resolve their function path from the eval config (v1)#6792
GWeale merged 1 commit into
v1from
backport-v1-pr19

Conversation

@GWeale

@GWeale GWeale commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Ports one eval metric fix to the v1 branch:

  1. Per-registry custom metrics and config-driven path resolution (5d2aca08)
    • MetricEvaluatorRegistry holds _registry per instance, seeded with the twelve standard v1 metrics.
    • get_evaluator takes a custom metric's function path from the registration or from the metric's config-set private attribute, and raises NotFoundError when neither has one.
    • adk eval passes the path declared in the eval config when registering.

Breaking change. Custom metrics must be declared in an eval config; a path carried only on an EvalMetric raises NotFoundError. Registrations are scoped to a single registry instance rather than the MetricEvaluatorRegistry._registry class attribute.

Re-implemented rather than ported: the config registration loop, which lives inline in cli/cli_tools_click.py on v1.

… path (v1)

Ports "fix: scope custom metrics per registry and trust only the config path"
to the v1 branch.

MetricEvaluatorRegistry declared _registry in the class body, so every
instance ever constructed shared one dict and a custom metric registered
anywhere in the process resolved from every other registry. It is now built
in __init__, and each new instance is seeded with the standard metrics.

get_evaluator read the module path for a custom metric off the EvalMetric it
was handed, which on a serving deployment is built from the request body and
then passed to importlib.import_module. It now uses only a path recorded on
the registry at registration time, or one carried on the metric as a private
attribute written by get_eval_metrics_from_config. The public
custom_function_path field is no longer consulted.

Adapted for v1: upstream reworks register_custom_metrics_from_config, which
does not exist on this branch. The equivalent registration loop in
cli_tools_click.py is updated instead, so `adk eval` passes the config's
declared path through when it registers a custom metric. The
RubricBasedMultiTurnTrajectory registration is omitted, as that evaluator is
not on v1.

Breaking change. A custom metric whose function path was not declared in an
eval config now raises NotFoundError from get_evaluator instead of importing
the path supplied with the metric. Code that reads or writes
MetricEvaluatorRegistry._registry on the class, or that relies on one
registry instance seeing another's registrations, also breaks.
@GWeale GWeale changed the title fix: Scope custom eval metrics per registry and trust only the config path (v1) fix: Scope custom eval metrics per registry and resolve their function path from the eval config (v1) Aug 19, 2026
@GWeale
GWeale merged commit 9886410 into v1 Aug 19, 2026
14 checks passed
@GWeale
GWeale deleted the backport-v1-pr19 branch August 20, 2026 00:04
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.

3 participants