using System.Text.Json.Serialization;
namespace AIStudio.Provider.OpenAI;
///
/// The OpenAI's legacy chat completion request model.
///
/// Which model to use for chat completion.
/// The chat messages.
/// Whether to stream the chat completion.
public record ChatCompletionAPIRequest(
string Model,
IList Messages,
bool Stream
)
{
//
// The properties of the parameters, declared again to be settable. The source generation of System.Text.Json
// sets every init-only property while it creates the object, also one missing in the JSON, so its value from
// the parameterless constructor would get lost. Keep them first and in the order of the parameters, which is
// the order they get written in:
//
public string Model { get; set; } = Model;
public IList Messages { get; set; } = Messages;
public bool Stream { get; set; } = Stream;
public ChatCompletionAPIRequest() : this(string.Empty, [], true)
{
}
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IList