@PJ @Chris G Hi! Regarding the case with

@PJ @Chris G Hi! Regarding the case with the undefined response – maybe it's not directly an issue with the Gemini model.

As you can see in the screenshot and the attached traces, the model actually calls the correct tool (functionCall within parts with a correct argument), but it also returns undefined as the text response. Strangely, in this case, there is no tool call after that – it seems that Genkit doesn't execute it. As a result, the stream ends, and I only see undefined (which is the last text response from the model).

Perhaps the issue with Gemini is that sometimes it returns undefined as a text response along with functionCall, and Genkit doesn't process this correctly. I'm not a developer, so I can't check the source code myself, but I figured it’s better to send this to you rather than not.
Was this page helpful?