using System.Text.Json.Serialization; namespace AIStudio.Provider.Anthropic; /// /// The Anthropic chat request model. /// /// Which model to use for chat completion. /// The chat messages. /// The maximum number of tokens to generate. /// Whether to stream the chat completion. /// The system prompt for the chat completion. /// /// Not readonly, so that its properties can be settable: the source generation of System.Text.Json refuses to /// write extension data which is init-only. /// public record struct ChatRequest( string Model, IList Messages, int MaxTokens, bool Stream, string System ) { /// /// The tools the model may call, or null when it should answer without them. /// /// /// Omitted from the request when null: sending an empty list is not the same as sending no /// tools at all, and the final round of a tool conversation has to offer none. /// [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public IList? Tools { get; set; } // // Attention: The "required" modifier is not supported for [JsonExtensionData], and neither is init: the source // generation of System.Text.Json refuses to write the request at all then. // [JsonExtensionData] public IDictionary AdditionalApiParameters { get; set; } = new Dictionary(); }