Stream HelpersAnthropicStream
AnthropicStream
It is a utility function that transforms the output from Anthropic's SDK into a ReadableStream. It uses AIStream under the hood, applying a specific parser for the Anthropic's response data structure.
Import
React
import { AnthropicStream } from "ai"
Parameters
response:
The response object returned by a call made by the Provider SDK.
callback?:
An object containing callback functions to handle the start, each token, and completion of the AI response. In the absence of this parameter, default behavior is implemented.
Returns
A ReadableStream.