interface AIStreamCallbacks { onStart?: () => Promise; onCompletion?: (completion: string) => Promise; onToken?: (token: string) => Promise; } interface AIStreamParser { (data: string): string | void; } declare function createEventStreamTransformer(customParser: AIStreamParser): TransformStream; /** * This stream forks input stream, allowing us to use the result as a * bytestream of the messages and pass the messages to our callback interface. */ declare function createCallbacksTransformer(callbacks: AIStreamCallbacks | undefined): TransformStream; declare function trimStartOfStreamHelper(): (text: string) => string; declare function AIStream(res: Response, customParser: AIStreamParser, callbacks?: AIStreamCallbacks): ReadableStream; export { AIStream, AIStreamCallbacks, AIStreamParser, createCallbacksTransformer, createEventStreamTransformer, trimStartOfStreamHelper };