SIGN IN SIGN UP

fix: parse structured output when the provider omits the finish reason (#19234)

## Background

generateText returned valid schema-matching JSON text but
Output.object() threw NoOutputGeneratedError when the provider omitted
the unified finish reason.

## Root Cause

generateText only parsed completed output when lastStep.finishReason was
exactly "stop". The reproduction confirmed that an omitted unified
reason left resolvedOutput undefined despite valid text, while unified
"stop" with a missing raw reason succeeded.

## Summary

Allowed non-empty final text to be parsed when the unified finish reason
is missing, added regression coverage, and added an ai package patch
changeset.

## Testing

Added a generateText Output.object() regression test using valid JSON
with omitted unified and raw finish reasons.

## End-to-end Validation

- `pnpm -C examples/ai-functions exec tsx
src/reproduction/issue-11348-generate-text-output-object-undefined-finish-reason.ts`
exited successfully and returned the schema-matching output without
NoOutputGeneratedError.

## Related Issues

Fixes #11348

Closes #17015

---------

Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com>
Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
Co-authored-by: pheuter <92698+pheuter@users.noreply.github.com>
A
ai-sdk-factory[bot] committed
9de0baf1cb98580e66138e10a056d676a3c24890
Parent: 0e36ab5
Committed by GitHub <noreply@github.com> on 8/25/2026, 12:03:19 AM