[firebase_vertexai]: VertexAISdkException: “Unhandled format for Content” when response is blocked by safety settings #17306
Labels
blocked: customer-response
Waiting for customer response, e.g. more information was requested.
platform: all
Issues / PRs which are for all platforms.
plugin: vertexai
label issues for vertexai plugin
type: bug
Something isn't working
Is there an existing issue for this?
Which plugins are affected?
No response
Which platforms are affected?
No response
Description
When using
FirebaseVertexAI
to generate content with safety settings enabled, if the model blocks the output for safety reasons (finishReason: SAFETY
), thecontent
field in the response is returned as an empty object ({}
).The SDK attempts to parse this
content
inparseContent()
, but it doesn't match any of the expected structures. This results in an exception:Unhandled Exception: Unhandled format for Content: {}
Reproducing the issue
Steps to reproduce
FirebaseVertexAI
to call.generateContent()
with strictSafetySettings
(e.g.HarmBlockThreshold.low
)VertexAISdkException: Unhandled format for Content
Firebase Core version
3.13.0
Flutter Version
3.27.1
Relevant Log Output
Flutter dependencies
Expand
Flutter dependencies
snippetAdditional context and comments
No response
The text was updated successfully, but these errors were encountered: