namespace AIStudio.Provider.Perplexity; /// /// 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 system fingerprint; together with the seed, this allows you to reproduce the response. /// The choices made by the AI. public readonly record struct ResponseStreamLine(string Id, string Object, uint Created, string Model, string SystemFingerprint, IList Choices, IList SearchResults) : IResponseStreamLine { /// public bool ContainsContent() => this != default && this.Choices.Count > 0; /// public ContentStreamChunk GetContent() => new(this.Choices[0].Delta.Content, this.GetSources()); /// public bool ContainsSources() => this != default && this.SearchResults.Count > 0; /// public IList GetSources() => this.SearchResults.Cast().ToList(); } /// /// Data model for a choice made by the AI. /// /// The index of the choice. /// The delta text of the choice. public readonly record struct Choice(int Index, Delta Delta); /// /// The delta text of a choice. /// /// The content of the delta text. public readonly record struct Delta(string Content); /// /// Data model for a search result. /// /// The title of the search result. /// The URL of the search result. public sealed record SearchResult(string Title, string URL) : Source(Title, URL);