@tanstack/ai
Version:
Core TanStack AI library - Open source AI SDK
15 lines (14 loc) • 678 B
TypeScript
import { StreamChunk } from '../types.js';
/**
* Wrap a one-shot generation result as a StreamChunk async iterable.
*
* This allows non-streaming activities (image, speech, transcription, summarize)
* to be sent over the same streaming transport as chat.
*
* @param generator - An async function that performs the generation and returns the result
* @param options - Optional configuration (runId)
* @returns An AsyncIterable of StreamChunks with RUN_STARTED, CUSTOM(generation:result), and RUN_FINISHED events
*/
export declare function streamGenerationResult<TResult>(generator: () => Promise<TResult>, options?: {
runId?: string;
}): AsyncIterable<StreamChunk>;