using System.Text.Json;
using System.Text.Json.Serialization;
namespace AIStudio.Provider.OpenAI;
///
/// What one choice of a streamed Chat Completions answer adds in this line.
///
///
/// This is the delta of the plain text path plus the two fields that path has no use for: the
/// reasoning some providers send alongside, and the tool calls the model asks for.
///
public sealed record ChatCompletionStreamDelta
{
///
/// The content as it arrived: a string for most providers, a list of parts for some.
///
[JsonPropertyName("content")]
public JsonElement? RawContent { get; init; }
///
/// The text of this fragment, whichever shape it arrived in.
///
[JsonIgnore]
public string Content => ChatCompletionContent.GetText(this.RawContent) ?? string.Empty;
///
/// The reasoning text some providers stream next to the answer.
///
public string? ReasoningContent { get; init; }
///
/// The fragments of the tool calls the model is asking for.
///
public IList? ToolCalls { get; init; }
}