Skip to content

fix(google): keep declared property order in Live API tool schemas - #7387

Merged
JustinScitech merged 2 commits into
mainfrom
thoughts-franc-yucked
Sep 21, 2026
Merged

JustinScitech merged 2 commits into
mainfrom
thoughts-franc-yucked

Conversation

@rosetta-livekit-bot

@rosetta-livekit-bot rosetta-livekit-bot Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Ports livekit/agents-js#2551 so Gemini Live API tool schemas preserve declared property order, including nested objects, instead of allowing Gemini to reorder arguments alphabetically.

Source diff coverage
  • Not applicable: .changeset/gemini-live-property-ordering.md. The Python repository does not use Changesets and package versions are updated by synchronized release commits, so there is no target counterpart.
  • Adapted: plugins/google/src/utils.ts -> livekit-plugins/livekit-plugins-google/livekit/plugins/google/utils.py. The Python Gemini schema simplifier now sets property_ordering from each object schema's property insertion order after recursively simplifying its children.
  • Adapted: plugins/google/src/utils.test.ts -> tests/test_schema_gemini.py. Updated affected schema expectations and ported the Live API declaration test for top-level and nested property ordering through the Python create_tools_config path.

Validation

  • uv run pytest tests/test_schema_gemini.py (14 passed)
  • Full Google package test selection excluding the known failing Gemini TTS teardown test (173 passed)
  • uv build --package livekit-plugins-google
  • make check

The unfiltered Google package test selection completed 174 test bodies successfully but reports one teardown error in pre-existing tests/test_plugin_google_gemini_tts.py::test_gemini_tts_success: the test leaves TTS._synthesize_task and TTS._metrics_task pending. The same teardown error reproduces when that file is run alone and is unrelated to schema conversion.


Ported from livekit/agents-js#2551

Original PR description

Fixes livekit/agents-js#2529

What

Gemini generates a tool call's arguments in alphabetical order unless the schema carries propertyOrdering. A Live API tool declared as { reasoning, answer } was generated answer first.

This sets propertyOrdering from each object schema's own property order (nested objects included) when building the Live API Schema.

Tests

Test Command Result
uses legacy parameters on the Live API (updated: expects propertyOrdering: ['fields']) pnpm vitest run plugins/google/src/utils.test.ts ✅ pass
orders Live API parameters as declared, nested objects included (new: ['reasoning', 'answer', 'details'], nested ['zeta', 'alpha']) pnpm vitest run plugins/google/src/utils.test.ts ✅ pass
Full utils.test.ts suite (6 tests) pnpm vitest run plugins/google/src/utils.test.ts ✅ 6/6 pass
Lint / format pnpm exec eslint plugins/google/src/utils.ts plugins/google/src/utils.test.ts / pnpm exec prettier --check ... ✅ clean

@rosetta-livekit-bot
rosetta-livekit-bot Bot requested a review from a team as a code owner September 21, 2026 21:09
devin-ai-integration[bot]

This comment was marked as resolved.

A raw tool that already sets propertyOrdering failed FunctionDeclaration
validation with a duplicate alias, and one that set property_ordering had
its order overwritten. Only derive the order when neither spelling is set.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@JustinScitech
JustinScitech merged commit 63919cc into main Sep 21, 2026
25 checks passed
@JustinScitech
JustinScitech deleted the thoughts-franc-yucked branch September 21, 2026 21:33
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.

google plugin: tool schemas never send Gemini propertyOrdering, so arguments generate alphabetically

1 participant