Skip to content

Add Gemini priority service tier support to the agent#19

Open
tw0b33rs wants to merge 2 commits into
android:mainfrom
tw0b33rs:feature/gemini-service-tier
Open

Add Gemini priority service tier support to the agent#19
tw0b33rs wants to merge 2 commits into
android:mainfrom
tw0b33rs:feature/gemini-service-tier

Conversation

@tw0b33rs

Copy link
Copy Markdown

What

Adds a selectable Gemini API service tier (Standard or Priority) for the agent's LLM calls.

  • Priority sends service_tier: "priority" for lower-latency processing (requires a Tier 2+ billing account).
  • Standard omits the field to use the API default.
  • The served tier is logged, with a warning when a priority request is downgraded (priority quota exhausted).

How

  • New ServiceTier enum, persisted via DataStore settings.
  • serviceTier plumbed through LlmProvider.generateResponse and the AgentOrchestrator interaction loop.
  • Tier selector added to the Settings screen.

Testing

  • Unit tests for the provider, repository, and view model; screenshot test for the new setting.
  • Manually verified on device: logs show served (service_tier)=priority.

Allow selecting a Gemini API service tier (Standard or Priority) for the
agent's LLM calls. Priority requests lower-latency, higher-priority
processing via the `service_tier` request field; Standard omits the field
to use the API default.

- Add ServiceTier enum and persist the selection in DataStore settings
- Plumb serviceTier through LlmProvider.generateResponse and the
  AgentOrchestrator interaction loop
- Send `service_tier` in the Gemini request, log the served tier, and warn
  when a priority request is downgraded (priority quota exhausted)
- Add a tier selector to the Settings screen
- Cover the new behaviour with unit tests and a screenshot test

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for selecting and requesting a specific service tier (Standard or Priority) for Gemini API calls. It adds a new ServiceTier enum, updates the settings repository to persist this preference, integrates the parameter into the GeminiProviderImpl request payload, and provides a dropdown UI in the settings screen. The feedback highlights two robustness improvements: using a locale-safe, case-insensitive lookup when parsing the stored service tier to avoid locale-dependent issues with uppercase(), and utilizing safe casting with contentOrNull when extracting the served service tier from the JSON response to prevent potential exceptions.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread agent/app/src/main/java/com/example/appfunctions/agent/data/GeminiProviderImpl.kt Outdated
- Use case-insensitive ServiceTier.entries lookup instead of
  locale-dependent uppercase() when reading the stored tier
- Safely cast the served service_tier to JsonPrimitive and use
  contentOrNull to avoid throwing on non-primitive/JsonNull values
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.

1 participant