Skip to content

Feat/gemini eval - #226

Merged
raghavm243512 merged 13 commits into
mainfrom
feat/gemini-eval
Sep 24, 2026
Merged

raghavm243512 merged 13 commits into
mainfrom
feat/gemini-eval

Conversation

@raghavm243512

@raghavm243512 raghavm243512 commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

Bring over changes from google for new Gemini Live model. Original branch was conflicting and pretty old, so this has all the changes integrated

Some changes related to tool scheduling for new gemini live models, a couple additional diagnostic metrics, and a white noise addition that I disabled since we don't have global testing with this change (but is easy to turn on).

I also updated the Dockerfile and this small reorder should have better reuse of built content, so smaller updates when we make changes

rfan-debug and others added 9 commits September 15, 2026 10:57
(cherry picked from commit 6bb56c7)
Cherry-picked from fae5426 (rfan-debug/eva feat/gemini-eval).
Adaptations for our current main:
- Dropped the global TextJudgeMetric max_tokens 100000->65536 change
  (Vertex-specific workaround; kept our 100000 + service_tier=flex).
- Made s2s endpoint optional (.get) so non-Vertex Gemini S2S configs
  without an explicit endpoint keep working.

Co-authored-by: Ruixi Fan <[email protected]>
Cherry-picked from 8e982cc (rfan-debug/eva feat/gemini-eval).
Adapted to our refactored system-prompt path (_build_system_prompt)
and kept the optional-endpoint handling from the prior commit.

Co-authored-by: Ruixi Fan <[email protected]>
…92fc81)

Hand-ported from rfan-debug/eva feat/gemini-eval 392fc81, whose target
audio_interface.py was renamed to audio_bridge.py (~500 commits diverged).

Adapted for our current main:
- Only the ORIGINAL half is ported: the trailing white-noise block that
  gives S2S assistant VADs (e.g. Gemini Live) an unambiguous end-of-speech.
  The commit's other half — fallback end-of-turn detection — is already
  covered on our side by the _user_turn_complete exact-boundary path.
- Per review decision: the wire gets white noise, but the saved user_clean
  track records plain silence, so it stays aligned in time yet unpolluted
  for speech-fidelity / audio metrics.

Co-authored-by: Ruixi Fan <[email protected]>
gemini-*-live-preview models exist only on Vertex AI
(aiplatform.googleapis.com). The client factory checked api_key first, so a
Developer key (AIza...) in s2s_params sent them to
generativelanguage.googleapis.com/v1beta -> '1008 ... not found for API
version v1beta'.

- Prefer Vertex whenever a project is resolvable (GOOGLE_CLOUD_PROJECT /
  VERTEXAI_PROJECT / s2s_params['project']) or GOOGLE_GENAI_USE_VERTEXAI is set;
  ignore the Developer key in that mode.
- Never use location='global' for Live (unsupported for bidiGenerateContent);
  fall back to a region with a warning.
- Support optional s2s_params 'api_version' and 'endpoint' via HttpOptions.
- Add routing unit tests.

Co-authored-by: Ruixi Fan <[email protected]>
The trailing white-noise block only exists to nudge a slow assistant VAD into
detecting end-of-speech. Once the assistant actually starts responding it has
served its purpose, so cancel any remaining frames in _on_assistant_audio_start.

Without this, noise kept streaming into the assistant's mic during its own turn
(the drain is gated on user-inactive, not assistant-active), which normal
silence never does — risking false barge-in on models with server-side
interruption. This makes the trailing-noise behavior safe to keep enabled for
all assistant models, not just Gemini.
Comment thread README.md Outdated
Comment thread Dockerfile
Comment thread src/eva/assistant/gemini_live_server.py Outdated
Comment on lines +251 to +270
# Thinking config: controls Gemini's internal reasoning budget.
# Accepts a dict with optional keys:
# "thinking_budget": int (0=disabled, -1=auto, or token count)
# "include_thoughts": bool
# "thinking_level": str ("MINIMAL", "LOW", "MEDIUM", "HIGH")
# Example: {"thinking_budget": 1024, "include_thoughts": false}
# If not set, defaults to ThinkingConfig() (model-dependent defaults).
thinking_raw = s2s_params.get("thinking_config", {})
if isinstance(thinking_raw, dict) and thinking_raw:
tc_kwargs: dict[str, Any] = {}
if "thinking_budget" in thinking_raw:
tc_kwargs["thinking_budget"] = int(thinking_raw["thinking_budget"])
if "include_thoughts" in thinking_raw:
tc_kwargs["include_thoughts"] = bool(thinking_raw["include_thoughts"])
if "thinking_level" in thinking_raw:
tc_kwargs["thinking_level"] = thinking_raw["thinking_level"]
self._thinking_config = types.ThinkingConfig(**tc_kwargs)
logger.info(f"Thinking config: {tc_kwargs}")
else:
self._thinking_config = types.ThinkingConfig()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think thinking_budget is deprecated so we should remove that option.
also, if include_thoughts is True, I don't think we are saving/capturing the thoughts anywhere. Could you check if can do that?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed thinking_budget support (kept include_thoughts + thinking_level). Also wired up capturing thoughts: when include_thoughts is set, parts with part.thought=True are now logged via a new FrameworkLogWriter.thought() call (framework_logs.jsonl, type="thought") instead of being silently dropped.

Comment thread src/eva/assistant/gemini_live_server.py Outdated
description=f"{tool.name}: {tool.description}",
parameters=params_schema,
behavior=types.Behavior.BLOCKING,
# behavior=types.Behavior.BLOCKING,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the blocking behaviour is supported by gemini 3.8 live but not 3.8 live extended thinking, so can we either enable for the or remove this line if it is not needed anymore

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked — Behavior.BLOCKING/NON_BLOCKING is explicitly documented as unsupported in Vertex AI in the google-genai SDK, and this server always creates its client with vertexai=True (see _create_genai_client, Vertex-only Live-preview models require it). Since Vertex is our only path here, I removed the line rather than conditionally enabling it, and left a comment explaining why.

Comment thread src/eva/metrics/diagnostic/time_to_completion.py

@katstankiewicz katstankiewicz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for addressing all of the comments!

@raghavm243512
raghavm243512 added this pull request to the merge queue Sep 24, 2026
Merged via the queue into main with commit 0ce8598 Sep 24, 2026
2 checks passed
@raghavm243512
raghavm243512 deleted the feat/gemini-eval branch September 24, 2026 16:50
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.

4 participants