genkit
genkit copied to clipboard
[JS] Unhelpful error from imagen models in vertexai plugin
When imagen model fails to generate any predictions, the error is obscure instead of throwing a reasonable exception.
TypeError: Cannot read properties of undefined (reading 'map')
at /workspace/node_modules/@genkit-ai/vertexai/lib/imagen.js:249:47
Expected behavior A clear and concise description of what you expected to happen.
As for Gemini models
throw new Error('No valid candidates returned.')
Streaming the image result largely resolved this issue for me.
@devchas can you share an example of your workaround?