Skip to content

[Bug]: Native Tool Calling failures in Google Gemini Pipeline (v1.15.2) #169

@DediCATeD88

Description

@DediCATeD88

Before submitting

  • I searched existing issues and did not find a matching report.
  • I can reproduce this issue on the latest version of the repository or current main branch.
  • I removed or masked secrets, tokens, and private endpoints from my report.

Affected area

pipelines/google

Bug summary

Native tool calling fails sequentially in google_gemini.py due to introspection errors (__signature__), SDK duplicate declaration errors, and ultimately silent hangs during execution.

Current behavior

When enabling function_calling: "native", the pipeline fails through a cascade of bugs:

  1. Crash during configuration (AttributeError: 'function' object has no attribute '__signature__').
  2. If patched, the Gemini SDK throws a 400 Bad Request: Duplicate function declaration found: tool_function because tools often share the same internal __name__.
  3. If both above are patched, when the model actually decides to use a tool, the streaming request stops/hangs without returning the function_call payload to the Open WebUI frontend. The chat abruptly stops.

Expected behavior

The pipeline should safely introspect tool signatures (falling back if missing), ensure unique tool names are passed to the Gemini SDK, and correctly intercept and stream back function_call responses so Open WebUI can execute the native tools.

Steps to reproduce

  1. Install Open WebUI and the Google Gemini Pipeline.
  2. Attach a custom tool or built-in tool to a chat.
  3. Submit a prompt that explicitly requires the tool to be invoked.
  4. Observe the AttributeError trace in the backend.
  5. Patch line 2585 to use getattr(tool, "__signature__", "").
  6. Submit again, observe the Duplicate function declaration 400 error.
  7. Patch the tool name setting before appending to tools list.
  8. Submit again, observe the chat silently stop/hang right when the tool execution is supposed to be returned.

Relevant logs, errors, or screenshots

**Issue 1 Log:**

File "<string>", line 2585, in _configure_generation
AttributeError: 'function' object has no attribute '__signature__'


**Issue 2 Log:**

"error": {
  "code": 400,
  "message": "Duplicate function declaration found: tool_function",
  "status": "INVALID_ARGUMENT"
}

Environment details

  • Deployment method: Docker
  • Open WebUI version: 0.9.2 and 0.9.5
  • Repository commit or release: Google Gemini Pipeline v1.15.2
  • Provider / model: Google / Gemini 3.1 Flash/Pro

Additional context

The silent failure in step 8 is likely located in the _handle_streaming_response method. The Gemini SDK's streaming iterator is probably yielding a function call chunk that the current async for chunk in response: loop either drops, misinterprets, or fails to yield back to Open WebUI in the expected JSON payload format for native tool execution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions