Skip to content

Support for the promptFeedback.blockReason in the Gemini streaming output #4235

Description

@xukecheng

Description

During the use of Gemini API, it is possible to encounter a return blockReason.

{
  "promptFeedback": {
    "blockReason": "PROHIBITED_CONTENT"
  },
  "usageMetadata": {
    "promptTokenCount": 12559,
    "totalTokenCount": 12559
  },
  "modelVersion": "gemini-1.5-flash-002"
}

However, it currently seems that there is no way to obtain the blockReason in the streaming output.

Code example

No response

AI provider

https://esm.sh/ai@4.0.1

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions