Unify One-Sided & Side-by-Side Performance Metrics in the PerformanceEvaluator.
This change isolates system metrics in the system-evaluator and performance-metrics in the performance evaluator.
Note that in order to pass pyink --config pyproject.toml --check, some additional files were reformatted as part of this change.
Fresh follow-up after the existing REQUEST_CHANGES review:
High — bq-agent-sdk evaluate --evaluator=llm-judge is now broken by the same LLMAsJudge / Client.evaluate mismatch.
The review already calls out that Client.evaluate(LLMAsJudge_instance) now raises TypeError, but there is a concrete CLI path still constructing exactly that unsupported object:
src/bigquery_agent_analytics/cli.pymapscorrectness,hallucination, andsentimenttoLLMAsJudge.*()in_LLM_JUDGES.- The command then calls
client.evaluate(evaluator=ev, ...)unconditionally. Client.evaluate()now accepts onlySystemEvaluator | PerformanceEvaluator, so a real CLI invocation with--evaluator=llm-judge --criterion=correctnessfails withUnsupported evaluator type: <class '...LLMAsJudge'>.
The current CLI test misses this because it mocks client.evaluate and only asserts that the constructed object is an LLMAsJudge; it never exercises the real Client.evaluate type gate.
Fix options:
- Keep
LLMAsJudgesupported inClient.evaluate()as a backward-compatible shim, or - Change the CLI to build the new supported
PerformanceEvaluatorpath for LLM judging, and update tests to exercise the real type compatibility instead of only the mock call argument.
Until this is fixed, this PR silently regresses a documented/user-facing CLI evaluation mode, not just the Python API.
Created a new commit that addresses the latest feedback and squashes in pr 122 (https://github.com/GoogleCloudPlatform/BigQuery-Agent-Analytics-SDK/pull/122).
Regarding formatting, below are my thoughts:
- Formatting Cleanup:
dashboard/app.py,examples/agent_improvement_cycle/agent/tools.py, andexamples/agent_improvement_cycle/agent_improvement/improver_agent.pywere reformatted usingpyinkto align with the project style guidelines. There are no logical or functional changes in these files. - Notebook Diffs: The diffs in
e2e_notebook_demo.ipynb,context_graph_adcp_demo.ipynb, andnba_agent_trace_analysis_notebook.ipynbare minimal format synchronizations (cell IDs, JSON metadata, and character escaping). The execution outputs are stripped (empty) in these notebooks to avoid noise.
Fresh review against current head da0332a.
The proposed follow-up comments check out against the source.
Findings:
-
B1: CHANGELOG contradicts the actual
LLMAsJudgecompatibility path. The CHANGELOG saysClient.evaluate(LLMAsJudge)is no longer supported and raisesTypeError, butClient.evaluate()explicitly acceptsLLMAsJudgeand dispatches to_evaluate_legacy_judge. There is also a unit test covering this working path. This should block until the marquee migration line is corrected: either the code should rejectLLMAsJudge, or the CHANGELOG should say it remains supported through the legacy fallback while users are encouraged to migrate toPerformanceEvaluator. -
H1: notebook formatting noise is still large. I counted about 2,825 changed notebook lines, with only 65 matching the evaluator/judge rename surface. The exact total may differ by counting method, but the review issue is real: the rename-relevant diff is a small fraction of the notebook churn.
-
H2: unrelated formatting-only scope leaks remain.
dashboard/app.py,examples/agent_improvement_cycle/agent/tools.py, andexamples/agent_improvement_cycle/agent_improvement/improver_agent.pyare formatting-only/noise for this migration. I found no evaluator/judge rename relevance in those diffs. -
Deprecation nuance: the restored legacy functions now warn correctly, but the template constants are still plain constants and cannot warn on access. If the docs call all of those symbols “deprecated shims,” either clarify that constants are preserved compatibility exports without runtime warnings, or move to an accessor pattern in a later cleanup.
Additional process note: this PR is currently behind main and overlaps heavily with #121/#122 migration surfaces. Before final review, please rebase after removing the notebook/scope noise and make the intended stack/merge order explicit. That will make the code/doc compatibility story much easier to review.
Thanks Haiyuan! All feedback has now been addressed and this PR is ready for review again!