Namespace Mythosia.AI.Models.Streaming
Classes
- StreamBuilder
Fluent builder for streaming structured output. Created by BeginStream(string).
var run = service.BeginStream(prompt) .WithStructuredOutput(new StructuredOutputPolicy { MaxRepairAttempts = 2 }) .As<MyDto>();
- StreamOptions
Options for controlling streaming behavior
- StructuredStreamRun<T>
Represents a running streaming request whose final response will be deserialized to
T.The stream starts eagerly in the background on construction. Call Stream(CancellationToken) to observe text chunks in real-time (optional). Await Result to get the deserialized object after the stream completes (with auto-repair retries if the JSON is invalid).
Usage:
var run = service.BeginStream(prompt) .WithStructuredOutput(new StructuredOutputPolicy { MaxRepairAttempts = 2 }) .As<MyDto>();await foreach (var chunk in run.Stream(ct)) Console.Write(chunk);
MyDto dto = await run.Result;
- TokenUsage
Unified token usage information across all AI providers. Always populated from the official API response data.