Not sure if something has changed in the last month but my tool calling has completely broken in my app. Even thought multiple functions are called and responses are given back to gemini e.g.
```
{
},
```
it still says: I have previously called list_all_dentists, list_all_insurance_providers, and list_all_payment_methods. These calls returned empty objects, which indicates that I need to ask the user for help to get the necessary IDs.
What is going on?? Can someone help
Most likely this is happening due to thought signatures.
For newer models, you need to pass the Thought Signatures during function calling. Gemini Thought Signatures (Refer to initial note)
Also you can try passing JSON Object(Struct) directly instead of string and see if it works.
Please let us know if you face any challenges on these.
This bug created lots of product issues for our company. the only workaround I found is using vertex AI auth.
Gemini Token Hallucination Bug
Issue
Gemini 2.5 models do not correctly pass tool response values to subsequent tool calls when PDF attachments are present. Instead of using the actual returned values, the model hallucinates values.
Root Cause
Bug in Gemini API endpoint (NOT Vertex AI) - confirmed by:
Intercepting raw HTTP requests (SDK sends correct data)
Testing across model versions (2.0 works on Gemini API, 2.5+ fail)
scripts/gemini_pdf_memory_test.py - Full agent test with GeminiAgent
scripts/gemini_token_test_raw.py - Raw API test with HTTP interception
Test PDF
Located at /Users/mingyangjin/Downloads/test.pdf with content:
Supplier: Acme Corporation
Product: Enterprise Widget Pro
Start Date: 2024-01-15
End Date: 2025-01-14
Hallucination Patterns Observed
Depending on response format, model hallucinates different values:
Response Format
Hallucinated Value
{"result": {...}}
token_a_value
{"token_a": "..."}
capture_supplier_name_response
{"output": {...}}
token_a
Impact
Any workflow relying on passing values between sequential tool calls with PDF attachments is unreliable on Gemini 2.5. This affects Hermione document processing workflows.
Workarounds
Use Vertex AI instead of Gemini API - all models work correctly
Use gemini-2.0-flash on Gemini API - only 2.0 works correctly
Vertex AI Setup
from google import genai
client = genai.Client(
vertexai=True,
api_key=os.environ.get("VERTEX_API_KEY"),
)