Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get raw finish reason from provider #5307

Open
egoist opened this issue Mar 21, 2025 · 2 comments
Open

Get raw finish reason from provider #5307

egoist opened this issue Mar 21, 2025 · 2 comments
Labels
ai/provider enhancement New feature or request

Comments

@egoist
Copy link
Contributor

egoist commented Mar 21, 2025

Feature Description

when using google gemini, ai sdk would treat IMAGE_SAFETY and some other reasons as unknown finish reason in streamText

data: {"candidates": [{"finishReason": "IMAGE_SAFETY","index": 0}],"usageMetadata": {"promptTokenCount": 8,"totalTokenCount": 8,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 8}]},"modelVersion": "gemini-2.0-flash-exp"}

Use Cases

need the underlying finish reason to display warnings to user properly

Additional context

No response

@lgrammel
Copy link
Collaborator

lgrammel commented Mar 21, 2025

#5311 maps IMAGE_SAFETY to content-filter. Leaving the issue open since the raw finish reason is not exposed.

@lgrammel
Copy link
Collaborator

Release @ai-sdk/[email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai/provider enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants