Skip to content

[Bug]: Thought Signature not being returned #16830

@rasswanth-lyzr

Description

@rasswanth-lyzr

What happened?

Gemini 3 pro is not returning the new field Thought Signature

My code -

response =  completion(
            model="gemini/gemini-3-pro-preview",
            messages=[{"role": "user", "content": "What is the capital of France?"}],
            tools=[{"type": "function", "function": {"name": "get_capital", "description": "Get the capital of a country", "parameters": {"type": "object", "properties": {"country": {"type": "string"}}}}}],
            tool_choice="auto",
            temperature=1,
            timeout=120,
            metadata={"run_id": "123"},
        )

My Output

ModelResponse(id='me8dadXQBIzxjuMPqJ7UwAM', created=1763569558, model='gemini-3-pro-preview', object='chat.completion', system_fingerprint=None, choices=[Choices(finish_reason='tool_calls', index=0, message=Message(content=None, role='assistant', tool_calls=[ChatCompletionMessageToolCall(index=0, function=Function(arguments='{"country": "France"}', name='get_capital'), id='call_2ebefc07c5584185a2b8080d3ef1', type='function')], function_call=None, provider_specific_fields=None))], usage=Usage(completion_tokens=82, prompt_tokens=45, total_tokens=127, completion_tokens_details=CompletionTokensDetailsWrapper(accepted_prediction_tokens=None, audio_tokens=None, reasoning_tokens=66, rejected_prediction_tokens=None, text_tokens=16), prompt_tokens_details=PromptTokensDetailsWrapper(audio_tokens=None, cached_tokens=None, text_tokens=45, image_tokens=None)), vertex_ai_grounding_metadata=[], vertex_ai_url_context_metadata=[], vertex_ai_safety_results=[], vertex_ai_citation_metadata=[])

I don't get the thought signature, therefore my system breaks. I need to make further tool calling and i'm currently unable to make it work

When I try to make another call, it throws me an error saying

ERROR:root:Error during process: litellm.BadRequestError: VertexAIException BadRequestError - {
  "error": {
    "code": 400,
    "message": "Function call is missing a thought_signature in functionCall parts. This is required for tools to work correctly, and missing thought_signature may lead to degraded model performance. Additional data, function call `default_api:agent_tool_67e4d6673e456a9f9291203d` , position 2. please refer to https://ai.google.dev/gemini-api/docs/thought-signatures for more details.",
    "status": "INVALID_ARGUMENT"
  }
}

Relevant log output

ModelResponse(id='me8dadXQBIzxjuMPqJ7UwAM', created=1763569558, model='gemini-3-pro-preview', object='chat.completion', system_fingerprint=None, choices=[Choices(finish_reason='tool_calls', index=0, message=Message(content=None, role='assistant', tool_calls=[ChatCompletionMessageToolCall(index=0, function=Function(arguments='{"country": "France"}', name='get_capital'), id='call_2ebefc07c5584185a2b8080d3ef1', type='function')], function_call=None, provider_specific_fields=None))], usage=Usage(completion_tokens=82, prompt_tokens=45, total_tokens=127, completion_tokens_details=CompletionTokensDetailsWrapper(accepted_prediction_tokens=None, audio_tokens=None, reasoning_tokens=66, rejected_prediction_tokens=None, text_tokens=16), prompt_tokens_details=PromptTokensDetailsWrapper(audio_tokens=None, cached_tokens=None, text_tokens=45, image_tokens=None)), vertex_ai_grounding_metadata=[], vertex_ai_url_context_metadata=[], vertex_ai_safety_results=[], vertex_ai_citation_metadata=[])

Are you a ML Ops Team?

No

What LiteLLM version are you on ?

1.75.2

Twitter / LinkedIn details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions