using AIStudio.Tools.RAG;
namespace AIStudio.Provider;
///
/// A chunk of content from a content stream, along with its associated sources.
///
///
/// The usage rides along on the chunk rather than being reported next to the stream, because a
/// provider states it as one more line of that same stream. It is unknown on every chunk but the
/// one which carries it, and unknown on all of them at the providers which report nothing.
///
/// The text content of the chunk.
/// The list of sources associated with the chunk.
/// What the provider said the request cost, where it said anything.
public sealed record ContentStreamChunk(string Content, IList Sources, TokenUsage Usage = default)
{
///
/// The passages of the sources, as the model received them from a tool.
///
///
/// They travel with the sources they belong to, the way the tools hand both over at the end
/// of their conversation, cf. ToolCallingLoop. A provider's own stream brings none.
///
public IReadOnlyList Passages { get; init; } = [];
///
/// Implicit conversion to string.
///
/// The content stream chunk.
/// The text content of the chunk.
public static implicit operator string(ContentStreamChunk chunk) => chunk.Content;
}