Skip to content

[Bug] Raw JSON/AIMessage object displayed in chat when Gemini Model triggers Retriever Tool #5982

@alfaroukhesham

Description

@alfaroukhesham

Describe the bug

Description

When using the ChatGemini (Google Generative AI) node in a chatflow connected to a Knowledge Base/Retriever Tool, the chat interface displays the raw AIMessage JSON object (including tool_calls and thoughtSignature) instead of hiding the intermediate thought process and showing only the final retrieved answer.

To Reproduce

Steps to Reproduce

  1. Create an Agentflow using the ChatGemini model.
  2. Add a Custom Tool or Retriever Tool (e.g., linked to a Vector Store knowledge base).
  3. Connect the tool to the Gemini Agent.
  4. Ask a question that triggers the knowledge base (e.g., asking for specific prices or data located in a PDF).
  5. Observe the chat output.

Expected behavior

Expected Behavior

The UI should only display the final natural language response. The tool_calls, kwargs, and thoughtSignature should be handled internally and not rendered in the chat bubble.

Actual Behavior

The chat displays the full technical response object:

{ 
  "lc": 1, 
  "type": "constructor", 
  "id": [ "langchain_core", "messages", "AIMessage" ], 
  "kwargs": { 
    "content": [ { "functionCall": { ... }, "thoughtSignature": "..." } ],
    "tool_calls": [...]
  }
}

Followed by the actual answer.

Environment

  • Flowise Version: Flowise Cloud [Latest]
  • Node: ChatGemini / Multi-Prompt Selection / Agent
  • Browser: [e.g., Chrome]

Screenshots

Image

Flow

No response

Use Method

None

Flowise Version

No response

Operating System

None

Browser

None

Additional context

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