Interface StreamTextOptionsBeta

Options for streaming text data from an API.

interface StreamTextOptions {
    body?: null | object | BodyInit;
    endpoint: string;
    handler: ((line: string) => Promise<void>);
}

Hierarchy (view full)

Properties

body?: null | object | BodyInit

A BodyInit object, object or null to set request's body.

endpoint: string

The API endpoint to hit, starting with a slash.

handler: ((line: string) => Promise<void>)

The asynchronous function to process each line of text.