Weird behaviour when Retool AI is using Gemini

,
  • Goal: Just trying to use Retool AI with Gemini. I bring my own API key.

  • Details: I'm running on Retool managed instance, not self hosted. When Retool AI chat is set to Gemini, it is repeating answers of previous message. Please see screenshot. It is absurd.

  • Screenshots:
    Behaviour:

Chat Component Setting:

Hello @qinfeng,

You're seeing duplicated or repeated responses which suggests that:

  • The messageHistory is being included in the input in a way that's not handled correctly by Gemini.
  • Gemini is interpreting both chat1.lastMessage and the full chat1.messageHistory as part of the prompt.

Remove messageHistory from Input (if unnecessary)

If your Retool AI setup does not require multi-turn memory (i.e., you’re fine with stateless responses), try just using {{ chat1.lastMessage }}.


5 Likes

Hi @qinfeng,

Thank you for reporting this!

It looks like it is a bug where as @WidleStudioLLP pointed out that the chat's history is being passed in a way where the Gemini believes that this is part of the prompt and not simply previous context.

As soon as I removed message history it did not answer the previous question. While is this is only a short term fix, I will make a bug report right now for our engineers to fix this.

1 Like

quick tip for the fix, Gemini is expecting "model" instead of "assistant" in the conversation history data strucutre

1 Like

@qinfeng Thank you for that detail!

I will relay that to our AI engineering team :raised_hands: