Skip to content

[LiteLlm] Google tool crash if we use llmproxy pointing to gemini 2.x models #2177

@pretbc

Description

@pretbc

** Please make sure you read the contribution guide and file the issues in the right place. **
Contribution guide.

Describe the bug
gemini models from Litellm via llmproxy cannot use google search tool

due to parser:

def extract_model_name(model_string: str) -> str:
  """Extract the actual model name from either simple or path-based format.

  Args:
    model_string: Either a simple model name like "gemini-2.5-pro" or
                  a path-based model name like "projects/.../models/gemini-2.0-flash-001"

  Returns:
    The extracted model name (e.g., "gemini-2.5-pro")
  """
  # Pattern for path-based model names
  path_pattern = (
      r'^projects/[^/]+/locations/[^/]+/publishers/[^/]+/models/(.+)$'
  )
  match = re.match(path_pattern, model_string)
  if match:
    return match.group(1)

  # If it's not a path-based model, return as-is (simple model name)
  return model_string

logs

/google/adk/tools/google_search_tool.py", line 64, in process_llm_request
    raise ValueError(
        f'Google search tool is not supported for model {llm_request.model}'
    )
ValueError: Google search tool is not supported for model litellm_proxy/vertex_ai/gemini-2.0-flash
ERROR:a2a.server.apps.jsonrpc.jsonrpc_app:Request Error (ID: e8992a46-18c1-4d5e-acaf-1000572f3940): Code=-32603, Message='Google search tool is not supported for model litellm_proxy/vertex_ai/gemini-2.0-flash'

To Reproduce

  1. create LLMAgent Object using model = LiteLlm(model="litellm_proxy/vertex_ai/gemini-2.0-flash")
  2. Add google search as tool
  3. Run and ask model to search..

Expected behavior
It is gemini model, it should work

Desktop (please complete the following information):

  • OS: Mac
  • Python version(python -V): 13.3
  • ADK version(pip show google-adk): 1.8.0

Model Information:
litellm_proxy/vertex_ai/gemini-2.0-flash

Additional context
Add any other context about the problem here.

Metadata

Metadata

Labels

answered[Status] This issue has been answered by the maintainermodels[Component] Issues related to model supportrequest clarification[Status] The maintainer need clarification or more information from the author

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions