2024-05-04 09:11:23 +00:00
|
|
|
namespace AIStudio.Provider.OpenAI;
|
|
|
|
|
|
|
|
/// <summary>
|
2025-09-01 20:36:33 +00:00
|
|
|
/// Data model for a line in the response stream, for streaming chat completions.
|
2024-05-04 09:11:23 +00:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="Id">The id of the response.</param>
|
|
|
|
/// <param name="Object">The object describing the response.</param>
|
|
|
|
/// <param name="Created">The timestamp of the response.</param>
|
|
|
|
/// <param name="Model">The model used for the response.</param>
|
|
|
|
/// <param name="SystemFingerprint">The system fingerprint; together with the seed, this allows you to reproduce the response.</param>
|
|
|
|
/// <param name="Choices">The choices made by the AI.</param>
|
2025-09-02 20:14:43 +00:00
|
|
|
public record ChatCompletionResponseStreamLine(string Id, string Object, uint Created, string Model, string SystemFingerprint, IList<ChatCompletionChoice> Choices) : IResponseStreamLine
|
2025-01-04 13:11:32 +00:00
|
|
|
{
|
2025-09-01 20:41:51 +00:00
|
|
|
public ChatCompletionResponseStreamLine() : this(string.Empty, string.Empty, 0, string.Empty, string.Empty, [])
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2025-01-04 13:11:32 +00:00
|
|
|
/// <inheritdoc />
|
2025-09-01 20:41:51 +00:00
|
|
|
public bool ContainsContent() => this.Choices.Count > 0;
|
2025-01-04 13:11:32 +00:00
|
|
|
|
|
|
|
/// <inheritdoc />
|
2025-08-31 12:27:35 +00:00
|
|
|
public ContentStreamChunk GetContent() => new(this.Choices[0].Delta.Content, []);
|
2024-05-04 09:11:23 +00:00
|
|
|
|
2025-09-02 20:14:43 +00:00
|
|
|
#region Implementation of IAnnotationStreamLine
|
2024-05-04 09:11:23 +00:00
|
|
|
|
2025-09-02 20:14:43 +00:00
|
|
|
/// <inheritdoc />
|
|
|
|
public bool ContainsSources() => false;
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public IList<ISource> GetSources() => [];
|
|
|
|
|
|
|
|
#endregion
|
2025-09-01 20:41:51 +00:00
|
|
|
}
|