Skip to content

Cannot use Gemini 3 with litellm / vertex AI #3627

Closed

Description

@lambda72453

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

Describe the bug
Unable to call tools when using litellm to access gemini 3 [model=LiteLlm(model="vertex_ai/gemini-3-pro-preview") ]

Works when you query the llm without tools calls. Fails when it calls a tool .

Confirmed this works as expected with other gemini models [model=LiteLlm(model="vertex_ai/gemini-2.5-flash") ]

To Reproduce
Please share a minimal code and data to reproduce your problem.

Add gemini 3 to litellm , have it call a tool.

`
from google.adk.agents.llm_agent import Agent
from google.adk.tools import FunctionTool
from google.adk.models.lite_llm import LiteLlm

def get_weather_report(city: str) -> dict:
"""Retrieves the current weather report for a specified city.

Returns:
    dict: A dictionary containing the weather information with a 'status' key ('success' or 'error') and a 'report' key with the weather details if successful, or an 'error_message' if an error occurred.
"""
if city.lower() == "london":
    return {"status": "success", "report": "The current weather in London is cloudy with a temperature of 18 degrees Celsius and a chance of rain."}
elif city.lower() == "paris":
    return {"status": "success", "report": "The weather in Paris is sunny with a temperature of 25 degrees Celsius."}
else:
    return {"status": "error", "error_message": f"Weather information for '{city}' is not available."}

weather_tool = FunctionTool(func=get_weather_report)

root_agent = Agent(
model=LiteLlm(model="vertex_ai/gemini-3-pro-preview"),
name='root_agent',
description='A helpful assistant for user questions.',
instruction='Answer user questions to the best of your knowledge',
tools=[weather_tool],
)

`

Snippet of Output:
...<11 lines>...
)
litellm.exceptions.BadRequestError: litellm.BadRequestError: Vertex_aiException BadRequestError - {
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
}

Expected behavior
This should not fail calling tools

Desktop (please complete the following information):

  • OS: [e.g. macOS, Linux, Windows] mac
  • Python version(python -V): 3.13
  • ADK version(pip show google-adk): 1.19

Model Information:

  • Are you using LiteLLM: Yes
  • Which model is being used(e.g. gemini-3-pro-preview)

Activity

  1. DeanChensj commented on Nov 20, 2025

    @DeanChensj
    Collaborator

    Hi @lambda72453 , could you try use Gemini model directly, for vertex you should use the global endpoint

  2. surajksharma07 commented on Nov 20, 2025

    @surajksharma07
    Collaborator

    @lambda72453 This appears to be a compatibility issue between Gemini 3's tool calling API and LiteLLM's current implementation.
    As a workaround, you can use LiteLlm(model="vertex_ai/gemini-2.5-flash") which you've confirmed works, or alternatively try using ADK's native Gemini integration with Gemini(model="gemini-3-pro-preview") instead of going through LiteLLM.
    We're investigating more into it like whether this requires changes in ADK's LiteLLM adapter or if it's a limitation in LiteLLM's Gemini 3 support.
    Thanks!

  3. xuguozhi commented on Nov 20, 2025

    @xuguozhi

    A more detailed info might help:
    litellm.llms.openai.common_utils.OpenAIError: Error code: 400 - {'error': {'message': 'Unable to submit request because function call default_apiin the 2. content block is missing athought_signature. Learn more: https://docs.cloud.google.com/vertex-ai/generative-ai/docs/thought-signatures', 'type': '', 'param': '', 'code': 400}} @surajksharma07

  4. surajksharma07 commented on Nov 20, 2025

    @surajksharma07
    Collaborator

    Thanks @xuguozhi for the detailed error.That clarifies the root cause - Gemini 3 requires thought_signature for function calling, which LiteLLM currently doesn't handle.
    This is a Gemini 3-specific requirement that's automatically managed by Google's native SDKs.
    The best solution is to use ADK's native Gemini integration: Gemini(model="gemini-3-pro-preview") instead of LiteLlm(model="vertex_ai/gemini-3-pro-preview").
    This will handle thought signatures automatically and resolve the issue.

  5. xuguozhi commented on Nov 20, 2025

    @xuguozhi

    Thanks @xuguozhi for the detailed error.That clarifies the root cause - Gemini 3 requires thought_signature for function calling, which LiteLLM currently doesn't handle. This is a Gemini 3-specific requirement that's automatically managed by Google's native SDKs. The best solution is to use ADK's native Gemini integration: Gemini(model="gemini-3-pro-preview") instead of LiteLlm(model="vertex_ai/gemini-3-pro-preview"). This will handle thought signatures automatically and resolve the issue.

    Thanks @surajksharma07 Gemini(model="gemini-3-pro-preview" could help in no-streaming way. However, in streaming mode it will stop with none following response

  6. surajksharma07 commented on Nov 20, 2025

    @surajksharma07
    Collaborator

    Thanks for testing @xuguozhi Could you provide more details about the streaming issue?
    Specifically: (1) how are you enabling streaming mode (code snippet would help),
    (2) does it throw an error or just stop producing output, and
    (3) does this happen with all queries or only when function calling is involved?
    This sounds like a separate issue with Gemini 3's streaming implementation in ADK that we should investigate.

  7. lambda72453 commented on Nov 21, 2025

    @lambda72453
    Author

    @surajksharma07 thanks , i've been using that solution in the mean time .

  8. added
    models[Component] This issue is related to model support
    on Dec 3, 2025
  9. surajksharma07 commented on Feb 4, 2026

    @surajksharma07
    Collaborator

    Checked against latest ADK (post v1.23.0) — this issue persists.

    The root cause is that Gemini 3 requires thought_signature for function calling, which LiteLLM doesn't handle.

    ADK's native Gemini integration supports thought signatures (streaming_utils.py:51,166-168, interactions_utils.py:153-156) but the LiteLLM adapter in lite_llm.py has no such handling.

    Commit 6a1efee ("disable grounding tools for Gemini 3") addresses a different issue.

    Workaround: use Gemini(model="gemini-3-pro-preview") instead of LiteLlm(model="vertex_ai/gemini-3-pro-preview").

    this is fundamentally a LiteLLM dependency limitation.

  10. added
    needs review[Status] The PR/issue is awaiting review from the maintainer
    and removed
    request clarification[Status] The maintainer need clarification or more information from the author
    on Feb 4, 2026
  11. removed their assignment
    on Feb 28, 2026
  12. removed
    needs review[Status] The PR/issue is awaiting review from the maintainer
    on May 5, 2026
  13. surajksharma07 commented on May 5, 2026

    @surajksharma07
    Collaborator

    @lambda72453 The thought_signature handling for LiteLLM + Gemini 3 tool calls was fixed in ADK v1.27.0 (commit ae565be), so LiteLlm(model="vertex_ai/gemini-3-pro-preview") with tools should work correctly on v1.27.0 and later.

    Since it's been a while and the fix has been in for a few releases now (latest is v1.32.0),
    feel free to reopen if you're still hitting the issue after upgrading!

  14. added
    answered[Status] This issue has been answered by the maintainer
    on May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

answered[Status] This issue has been answered by the maintainergoogle support[Status] This issue is hand offed to google support teammodels[Component] This issue is related to model support

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions