Function call response should not have a user role

Why do function call responses have a user role? It’s confusing the model and making it reply to itself.

1 Like

Hello @beetroit

Welcome to the community.

  • Role Assignment:
    Function call responses are tagged with the “user” role to preserve conversation context. This design choice helps maintain a complete dialogue history.

  • Model Behavior:
    The model is trained to process conversation turns. When it sees a “user” role, it treats that message as an input from the user—even if it comes from a function call—prompting it to generate another response.

For more details about function calling you can read the documentation:

1 Like

I know about this, my prompt does nothing to prevent this behaviour unfortunately. I gave gemini 2.0 flash tools for sending a message and thinking, but it just keeps making up stuff and chatting with itself inside the tool call history.
Do you have any sample prompt that works?

Could you share more about your use case and what you’re trying to achieve?

Generally model query 2 time to answer using tools