Repository navigation
fix(google): keep declared property order in Live API tool schemas - #7387
Merged
Merged
Conversation
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
approved these changes
Sep 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
.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.plugins/google/src/utils.ts->livekit-plugins/livekit-plugins-google/livekit/plugins/google/utils.py. The Python Gemini schema simplifier now setsproperty_orderingfrom each object schema's property insertion order after recursively simplifying its children.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 Pythoncreate_tools_configpath.Validation
uv run pytest tests/test_schema_gemini.py(14 passed)uv build --package livekit-plugins-googlemake checkThe 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 leavesTTS._synthesize_taskandTTS._metrics_taskpending. 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 generatedanswerfirst.This sets
propertyOrderingfrom each object schema's own property order (nested objects included) when building the Live APISchema.Tests
uses legacy parameters on the Live API(updated: expectspropertyOrdering: ['fields'])pnpm vitest run plugins/google/src/utils.test.tsorders Live API parameters as declared, nested objects included(new:['reasoning', 'answer', 'details'], nested['zeta', 'alpha'])pnpm vitest run plugins/google/src/utils.test.tsutils.test.tssuite (6 tests)pnpm vitest run plugins/google/src/utils.test.tspnpm exec eslint plugins/google/src/utils.ts plugins/google/src/utils.test.ts/pnpm exec prettier --check ...