using AIStudio.Provider.OpenAI; namespace AIStudio.Provider.Fireworks; /// /// Data model for a line in the response stream, for streaming completions. /// /// The id of the response. /// The object describing the response. /// The timestamp of the response. /// The model used for the response. /// The choices made by the AI. public readonly record struct ResponseStreamLine(string Id, string Object, uint Created, string Model, IList Choices) : IResponseStreamLine { /// public bool ContainsContent() => this != default && this.Choices.Count > 0; /// public ContentStreamChunk GetContent() => new(this.Choices[0].Delta.Content, []); /// /// What Fireworks says the request cost, on the one line which carries it. /// /// /// The same block the OpenAI chat completion API sends, because this is that wire format. /// Not a positional parameter: the struct is built from JSON, and a further parameter would /// only be a value nobody passes. /// public ChatCompletionUsage? Usage { get; init; } /// public TokenUsage GetUsage() => this.Usage?.ToTokenUsage() ?? TokenUsage.UNKNOWN; #region Implementation of IAnnotationStreamLine // // Currently, Fireworks does not provide source citations in their response stream. // /// public bool ContainsSources() => false; /// public IList GetSources() => []; #endregion }