Skip to content

feat(google): add serviceTier option to LLM#1428

Merged
toubatbrian merged 1 commit intomainfrom
claude/quirky-galileo-oCQLE
May 8, 2026
Merged

feat(google): add serviceTier option to LLM#1428
toubatbrian merged 1 commit intomainfrom
claude/quirky-galileo-oCQLE

Conversation

@toubatbrian
Copy link
Copy Markdown
Contributor

Summary

Ports livekit/agents#5680 from the Python livekit-agents repo into agents-js.

This adds a new serviceTier option to the Google Gemini LLM, allowing users to opt into the Gemini API's service tiers (e.g. ServiceTier.PRIORITY for priority inference).

What changed

  • New serviceTier?: types.ServiceTier field on LLMOptions (plugins/google/src/llm.ts).
  • Wired through the constructor (destructured + persisted on #opts).
  • When set, it is forwarded into the GenerateContentConfig passed to client.models.generateContentStream({ config }) via extras.serviceTier.
  • JSDoc updated for the new constructor parameter.

Implementation notes / parity with Python

Closely mirrors the Python implementation in livekit-plugins-google/llm.py:

Python (livekit/agents#5680) TypeScript (this PR)
service_tier: NotGivenOr[types.ServiceTier] on _LLMOptions serviceTier?: types.ServiceTier on LLMOptions
if is_given(self._opts.service_tier): extra["service_tier"] = self._opts.service_tier if (this.#opts.serviceTier !== undefined) { extras.serviceTier = this.#opts.serviceTier; }

Naming differences vs. Python (camelCase vs. snake_case) follow the existing JS plugin conventions:

  • The option name is serviceTier to match other agents-js plugins (openai, baseten, openai/ws, openai/responses) which already expose serviceTier?: string.
  • The wire field on GenerateContentConfig is serviceTier (camelCase) in @google/genai ≥ 1.50, while the Python google-genai SDK accepts service_tier. The locked version in pnpm-lock.yaml (@google/genai@1.50.1) introduces this field, and the package range (^1.44.0) resolves to a compatible version.
  • The TS port is strongly typed using types.ServiceTier from @google/genai (rather than the loose string typing used by other plugins) since the enum is exported by the SDK, matching how the Python upstream uses types.ServiceTier.

No behavioural changes when serviceTier is not provided.

Changeset

Added .changeset/google-llm-service-tier.md as a patch change to @livekit/agents-plugin-google.

Test plan

  • pnpm build:agents and pnpm --filter @livekit/agents-plugin-google build succeed (the plugin's own source compiles cleanly; remaining errors in the build output are in unrelated beta/realtime/realtime_api.ts and unbuilt test-only deps, not introduced by this PR).
  • pnpm prettier --check passes for the changed files.
  • pnpm --filter @livekit/agents-plugin-google lint produces no new warnings (3 pre-existing warnings in beta/realtime/realtime_api.ts only).
  • Manual verification of priority inference end-to-end against the Gemini API (requires API key; not run here).

This PR was generated by an automated Claude Code Routine created by @toubatbrian, currently in experimentation. cc @toubatbrian @livekit/agent-devs for review.

Closes parity gap with livekit/agents#5680.


Generated by Claude Code

Ports livekit/agents#5680 to add a `serviceTier` option (e.g.
`ServiceTier.PRIORITY`) that is passed through to the Gemini
GenerateContentConfig.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 8, 2026

🦋 Changeset detected

Latest commit: 79da356

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 31 packages
Name Type
@livekit/agents-plugin-google Patch
@livekit/agents Patch
@livekit/agents-plugin-anam Patch
@livekit/agents-plugin-assemblyai Patch
@livekit/agents-plugin-baseten Patch
@livekit/agents-plugin-bey Patch
@livekit/agents-plugin-cartesia Patch
@livekit/agents-plugin-cerebras Patch
@livekit/agents-plugin-deepgram Patch
@livekit/agents-plugin-elevenlabs Patch
@livekit/agents-plugin-fishaudio Patch
@livekit/agents-plugin-hedra Patch
@livekit/agents-plugin-hume Patch
@livekit/agents-plugin-inworld Patch
@livekit/agents-plugin-lemonslice Patch
@livekit/agents-plugin-liveavatar Patch
@livekit/agents-plugin-livekit Patch
@livekit/agents-plugin-minimax Patch
@livekit/agents-plugin-mistral Patch
@livekit/agents-plugin-mistralai Patch
@livekit/agents-plugin-neuphonic Patch
@livekit/agents-plugin-openai Patch
@livekit/agents-plugin-phonic Patch
@livekit/agents-plugin-resemble Patch
@livekit/agents-plugin-rime Patch
@livekit/agents-plugin-runway Patch
@livekit/agents-plugin-sarvam Patch
@livekit/agents-plugin-silero Patch
@livekit/agents-plugin-trugen Patch
@livekit/agents-plugin-xai Patch
@livekit/agents-plugins-test Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 79da356374

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread plugins/google/src/llm.ts
geminiTools?: LLMTools;
httpOptions?: types.HttpOptions;
seed?: number;
serviceTier?: types.ServiceTier;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Raise @google/genai minimum for serviceTier

This option depends on SDK support that was only added in @google/genai 1.47.0 (“Add service tier to GenerateContent”), but plugins/google/package.json still allows ^1.44.0. In projects that already resolve or override @google/genai to 1.44–1.46, this exported type references types.ServiceTier that does not exist, and the older SDK will not know how to forward the new config field. Please bump the dependency floor alongside adding this option so the advertised API is actually available wherever the plugin installs.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@toubatbrian toubatbrian merged commit 34df3d8 into main May 8, 2026
8 of 9 checks passed
@toubatbrian toubatbrian deleted the claude/quirky-galileo-oCQLE branch May 8, 2026 07:02
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