From 79da3563748336cf430fe1b5ad19b193c3c3a033 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 8 May 2026 06:29:41 +0000 Subject: [PATCH] feat(google): add serviceTier option to LLM Ports livekit/agents#5680 to add a `serviceTier` option (e.g. `ServiceTier.PRIORITY`) that is passed through to the Gemini GenerateContentConfig. --- .changeset/google-llm-service-tier.md | 5 +++++ plugins/google/src/llm.ts | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 .changeset/google-llm-service-tier.md diff --git a/.changeset/google-llm-service-tier.md b/.changeset/google-llm-service-tier.md new file mode 100644 index 000000000..52ad7cc9c --- /dev/null +++ b/.changeset/google-llm-service-tier.md @@ -0,0 +1,5 @@ +--- +'@livekit/agents-plugin-google': patch +--- + +feat(google): add `serviceTier` option to LLM (e.g. `ServiceTier.PRIORITY`) diff --git a/plugins/google/src/llm.ts b/plugins/google/src/llm.ts index d36815b1e..ebd8b1f42 100644 --- a/plugins/google/src/llm.ts +++ b/plugins/google/src/llm.ts @@ -37,6 +37,7 @@ export interface LLMOptions { geminiTools?: LLMTools; httpOptions?: types.HttpOptions; seed?: number; + serviceTier?: types.ServiceTier; } export class LLM extends llm.LLM { @@ -85,6 +86,7 @@ export class LLM extends llm.LLM { * @param geminiTools - The Gemini-specific tools to use for the session. * @param httpOptions - The HTTP options to use for the session. * @param seed - Random seed for reproducible results. Defaults to undefined. + * @param serviceTier - The service tier for the request (e.g. ServiceTier.PRIORITY). Defaults to undefined. */ constructor( { @@ -105,6 +107,7 @@ export class LLM extends llm.LLM { geminiTools, httpOptions, seed, + serviceTier, }: LLMOptions = { model: 'gemini-2.0-flash-001', }, @@ -175,6 +178,7 @@ export class LLM extends llm.LLM { geminiTools, httpOptions, seed, + serviceTier, apiKey, }; } @@ -266,6 +270,10 @@ export class LLM extends llm.LLM { extras.automaticFunctionCalling = this.#opts.automaticFunctionCallingConfig; } + if (this.#opts.serviceTier !== undefined) { + extras.serviceTier = this.#opts.serviceTier; + } + geminiTools = geminiTools !== undefined ? geminiTools : this.#opts.geminiTools; return new LLMStream(this, {