Skip to content

GoogleSearchTool rejects valid -latest model aliases (e.g., gemini-flash-latest) #1203

@koverholt

Description

@koverholt

🔴 Required Information

Describe the Bug:

The GoogleSearchTool checks model.startsWith("gemini-2") || model.startsWith("gemini-3"), which rejects all -latest model aliases (gemini-flash-latest, gemini-pro-latest, gemini-flash-lite-latest). These are officially documented aliases: https://ai.google.dev/gemini-api/docs/models#latest

Steps to Reproduce:

  1. Add com.google.adk:google-adk:1.2.0
  2. Run the repro below
  3. Observe: gemini-2.5-flash passes, gemini-flash-latest throws

Expected Behavior:

GoogleSearchTool accepts all valid Gemini model aliases.

Observed Behavior:

IllegalArgumentException: Google search tool is not supported for model gemini-flash-latest

Environment Details:

  • ADK Library Version: 1.2.0
  • OS: macOS
  • Java: OpenJDK 17

Model Information:

  • gemini-flash-latest

🟡 Optional Information

Regression:
Did this work in a previous version of ADK? (Yes/No) If so, which one?

Minimal Reproduction Code:

import com.google.adk.tools.GoogleSearchTool;
import com.google.adk.models.LlmRequest;
import com.google.genai.types.GenerateContentConfig;
public class ReproBug {
    public static void main(String[] args) {
        var tool = new GoogleSearchTool();
        var working = LlmRequest.builder()
            .config(GenerateContentConfig.builder().build())
            .model("gemini-2.5-flash").build();
        tool.processLlmRequest(working.toBuilder(), null).blockingAwait();
        System.out.println("PASS: gemini-2.5-flash");
        try {
            var broken = LlmRequest.builder()
                .config(GenerateContentConfig.builder().build())
                .model("gemini-flash-latest").build();
            tool.processLlmRequest(broken.toBuilder(), null).blockingAwait();
            System.out.println("PASS: gemini-flash-latest");
        } catch (Exception e) {
            System.out.println("FAIL: " + e.getMessage());
        }
    }
}

How often has this issue occurred?:

  • Always (100%)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions