BigQuery-Agent-Analytics-SDK icon indicating copy to clipboard operation
BigQuery-Agent-Analytics-SDK copied to clipboard

Unify One-Sided & Side-by-Side Performance Metrics in the PerformanceEvaluator.

Open gigistark-google opened this issue 6 months ago • 3 comments

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.

gigistark-google avatar May 06 '26 18:05 gigistark-google

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.py maps correctness, hallucination, and sentiment to LLMAsJudge.*() in _LLM_JUDGES.
  • The command then calls client.evaluate(evaluator=ev, ...) unconditionally.
  • Client.evaluate() now accepts only SystemEvaluator | PerformanceEvaluator, so a real CLI invocation with --evaluator=llm-judge --criterion=correctness fails with Unsupported 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:

  1. Keep LLMAsJudge supported in Client.evaluate() as a backward-compatible shim, or
  2. Change the CLI to build the new supported PerformanceEvaluator path 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.

caohy1988 avatar May 11 '26 22:05 caohy1988

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, and examples/agent_improvement_cycle/agent_improvement/improver_agent.py were reformatted using pyink to 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, and nba_agent_trace_analysis_notebook.ipynb are minimal format synchronizations (cell IDs, JSON metadata, and character escaping). The execution outputs are stripped (empty) in these notebooks to avoid noise.

gigistark-google avatar Jun 05 '26 21:06 gigistark-google

Fresh review against current head da0332a.

The proposed follow-up comments check out against the source.

Findings:

  1. B1: CHANGELOG contradicts the actual LLMAsJudge compatibility path. The CHANGELOG says Client.evaluate(LLMAsJudge) is no longer supported and raises TypeError, but Client.evaluate() explicitly accepts LLMAsJudge and 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 reject LLMAsJudge, or the CHANGELOG should say it remains supported through the legacy fallback while users are encouraged to migrate to PerformanceEvaluator.

  2. 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.

  3. H2: unrelated formatting-only scope leaks remain. dashboard/app.py, examples/agent_improvement_cycle/agent/tools.py, and examples/agent_improvement_cycle/agent_improvement/improver_agent.py are formatting-only/noise for this migration. I found no evaluator/judge rename relevance in those diffs.

  4. 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.

caohy1988 avatar Jun 05 '26 23:06 caohy1988

Thanks Haiyuan! All feedback has now been addressed and this PR is ready for review again!

gigistark-google avatar Jun 26 '26 16:06 gigistark-google