Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/google-llm-service-tier.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@livekit/agents-plugin-google': patch
---

feat(google): add `serviceTier` option to LLM (e.g. `ServiceTier.PRIORITY`)
8 changes: 8 additions & 0 deletions plugins/google/src/llm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface LLMOptions {
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 👍 / 👎.

}

export class LLM extends llm.LLM {
Expand Down Expand Up @@ -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(
{
Expand All @@ -105,6 +107,7 @@ export class LLM extends llm.LLM {
geminiTools,
httpOptions,
seed,
serviceTier,
}: LLMOptions = {
model: 'gemini-2.0-flash-001',
},
Expand Down Expand Up @@ -175,6 +178,7 @@ export class LLM extends llm.LLM {
geminiTools,
httpOptions,
seed,
serviceTier,
apiKey,
};
}
Expand Down Expand Up @@ -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, {
Expand Down
Loading