Skip to content

Conversation

@AhmadYasser1
Copy link
Contributor

Background

streamText and generateText have an experimental_include setting for controlling what data is included in step results (e.g., requestBody, responseBody). The includeRawChunks parameter on streamText serves a similar purpose but lives as a separate top-level option. This PR moves it into the unified experimental_include setting as rawChunks.

Summary

  • Added rawChunks?: boolean option to the experimental_include setting in streamText
  • Deprecated the top-level includeRawChunks parameter with @deprecated JSDoc pointing to the new setting
  • experimental_include.rawChunks takes precedence when both are specified; the deprecated parameter continues to work as a fallback for backward compatibility
  • Added 4 new tests covering the new setting and precedence behavior

Usage:

const result = streamText({
  model,
  prompt: 'test prompt',
  // New way (preferred):
  experimental_include: { rawChunks: true },
  // Old way (deprecated):
  // includeRawChunks: true,
});

Manual Verification

  • All 298 stream-text tests pass
  • Full ai package test suite passes (1,769 tests across 87 files)
  • Lint, typecheck, and prettier all pass

Checklist

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (run pnpm changeset in the project root)
  • I have reviewed this pull request (self-review)

Closes #12132

…rawChunks

Add `rawChunks` option to the `experimental_include` setting in `streamText`,
providing a unified configuration surface for data inclusion settings.

The existing `includeRawChunks` top-level parameter is deprecated in favor of
`experimental_include: { rawChunks: true }`. The new setting takes precedence
when both are specified; the deprecated parameter continues to work as a
fallback for backward compatibility.

Changes:
- Add `rawChunks?: boolean` to `experimental_include` type in streamText
- Deprecate `includeRawChunks` with @deprecated JSDoc annotation
- Resolve value with include.rawChunks taking precedence over deprecated param
- Add 4 new tests covering the new setting and precedence behavior

Closes vercel#12132
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

move includeRawChunks into include setting as rawChunks

1 participant