namespace AIStudio.Tools; /// /// The outcome of processing one content stream event: either content to append, or a reported /// failure. /// /// /// Content and error are kept apart on purpose. A reported failure must never be appended as /// content, because that would hand the failure to the AI as if it were part of the document. /// /// The content to append, or null when this event carries none. /// The reported failure, or null when the event was processed successfully. public readonly record struct ContentStreamProcessedEvent(string? Content, ContentStreamErrorDetails? Error) { /// /// An event which neither produced content nor reported a failure. /// public static readonly ContentStreamProcessedEvent NOTHING = new(null, null); public static ContentStreamProcessedEvent FromContent(string? content) => new(content, null); public static ContentStreamProcessedEvent FromError(ContentStreamErrorDetails? error) => new(null, error); }