IStreamingGenerator<T>
Interfaces · AiDotNet.Interfaces
A generator that can stream its output incrementally (token/chunk deltas) as it is produced,
in addition to the buffered Generate.
Implements: IGenerator<T>
Known implementations: ChatClientGenerator<T>
For Beginners
instead of waiting for the whole answer, you get it piece by piece — like watching text appear as an assistant “types” — by iterating the returned async stream.
How It Works
Streaming lets a RAG answer render as it is generated rather than after the whole response is complete, which is the standard low-latency UX for chat/RAG systems.
Methods
| Method | Summary |
|---|---|
IAsyncEnumerable<string> GenerateStreamAsync(string prompt, CancellationToken cancellationToken) |
Generates a response to prompt, yielding incremental text deltas as they arrive. |