GenkitG
Genkit13mo ago
1 reply
dangerous-fuchsia

[JS] Unhelpful error from imagen models ...

I have a suggestion regarding vertex/Imagen.
I would like to send requests to the Imagen API with the includeRaiReason field set to true by default.

When images are not generated due to Gemini's AI filter, response.predictions becomes undefined.
This reproduces the issue mentioned in https://github.com/firebase/genkit/issues/1446 (as undefined.map cannot be executed).

I also believe, as stated in the issue, that cases where generation fails should be included in the error response.
However, simply fixing the .map method will not solve this problem. To obtain the reason for the failure to generate images, adding the includeRaiReason field to the request is necessary.

If this suggestion is acceptable, I would like to try implementing it myself. What do you think about this proposal?
When fixed, a message like the one shown in the attached image will appear.
2024-12-22_21.01.27.webp
GitHub
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 /work...
[JS] Unhelpful error from imagen models in vertexai plugin  · Issue...
Was this page helpful?