// #nullable disable using System; using System.ClientModel.Primitives; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text.Json.Serialization; using OpenAI; namespace OpenAI.Chat { public partial class ChatCompletion { [Experimental("SCME0001")] private JsonPatch _patch; internal ChatCompletion(string id, IEnumerable choices, DateTimeOffset createdAt, string model) { Id = id; Choices = choices.ToList(); CreatedAt = createdAt; Model = model; } #pragma warning disable SCME0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. internal ChatCompletion(string id, IReadOnlyList choices, DateTimeOffset createdAt, string model, ChatServiceTier? serviceTier, string systemFingerprint, string @object, ChatTokenUsage usage, in JsonPatch patch) { // Plugin customization: ensure initialization of collections Id = id; Choices = choices ?? new ChangeTrackingList(); CreatedAt = createdAt; Model = model; ServiceTier = serviceTier; SystemFingerprint = systemFingerprint; Object = @object; Usage = usage; _patch = patch; _patch.SetPropagators(PropagateSet, PropagateGet); } #pragma warning restore SCME0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. [JsonIgnore] [EditorBrowsable(EditorBrowsableState.Never)] [Experimental("SCME0001")] public ref JsonPatch Patch => ref _patch; public string Id { get; } public string Model { get; } [Experimental("OPENAI001")] public ChatServiceTier? ServiceTier { get; } public string SystemFingerprint { get; } public ChatTokenUsage Usage { get; } } }