genkit
genkit copied to clipboard
[JS] Create a middleware to stringify data parts when ingesting, apply to Gemini plugins
Describe the bug
From a Discord thread, if Gemini returns data (JSON mode) it chokes on followup messages.
To Reproduce
- Generate structured output with JSON mode Gemini
- Pass that back into
history
Expected behavior It works.
Suggested Fix
Create a new model middleware that will automatically map through input data parts and convert them to text parts using JSON.stringify.