Files
anthropic-client/src/AnthropicClient/Models/MessageRequest.cs
T

63 lines
2.3 KiB
C#
Raw Normal View History

2024-06-28 10:54:00 -05:00
using System.Text.Json.Serialization;
2024-06-27 23:26:53 -05:00
namespace AnthropicClient.Models;
/// <summary>
/// Represents a message request.
/// </summary>
2024-07-03 16:57:27 -05:00
public class MessageRequest : BaseMessageRequest
2024-06-27 23:26:53 -05:00
{
2024-06-28 10:54:00 -05:00
[JsonConstructor]
2024-07-03 16:57:27 -05:00
internal MessageRequest() : base() { }
2024-06-28 10:54:00 -05:00
2024-06-27 23:26:53 -05:00
/// <summary>
/// Initializes a new instance of the <see cref="MessageRequest"/> class.
/// </summary>
2024-06-28 10:54:00 -05:00
/// <param name="model">The model ID to use for the request.</param>
/// <param name="messages">The messages to send to the model.</param>
/// <param name="maxTokens">The maximum number of tokens to generate.</param>
/// <param name="system">The system prompt to use for the request.</param>
2024-06-28 10:54:00 -05:00
/// <param name="metadata">The metadata to include with the request.</param>
/// <param name="temperature">The temperature to use for the request.</param>
/// <param name="topK">The top-K value to use for the request.</param>
/// <param name="topP">The top-P value to use for the request.</param>
/// <param name="toolChoice">The tool choice mode to use for the request.</param>
/// <param name="tools">The tools to use for the request.</param>
2024-07-10 08:57:23 -05:00
/// <param name="stopSequences">The prompt stop sequences.</param>
/// <param name="systemMessages">The system messages to include with the request.</param>
2024-06-28 10:54:00 -05:00
/// <exception cref="ArgumentNullException">Thrown when the model or messages is null.</exception>
/// <exception cref="ArgumentException">Thrown when the messages contain no messages.</exception>
/// <exception cref="ArgumentException">Thrown when the max tokens is less than one.</exception>
/// <exception cref="ArgumentException">Thrown when the temperature is less than zero or greater than one.</exception>
2024-06-27 23:26:53 -05:00
/// <returns>A new instance of the <see cref="MessageRequest"/> class.</returns>
2024-07-03 16:57:27 -05:00
public MessageRequest(
2024-06-28 10:54:00 -05:00
string model,
2024-07-03 16:57:27 -05:00
List<Message> messages,
2024-06-28 10:54:00 -05:00
int maxTokens = 1024,
string? system = null,
Dictionary<string, object>? metadata = null,
decimal temperature = 0.0m,
int? topK = null,
decimal? topP = null,
ToolChoice? toolChoice = null,
2024-07-10 08:57:23 -05:00
List<Tool>? tools = null,
List<string>? stopSequences = null,
List<TextContent>? systemMessages = null
2024-07-03 16:57:27 -05:00
) : base(
model,
messages,
maxTokens,
system,
metadata,
temperature,
topK,
topP,
toolChoice,
tools,
2024-07-10 08:57:23 -05:00
false,
stopSequences,
systemMessages
2024-06-28 10:54:00 -05:00
)
2024-06-27 23:26:53 -05:00
{
}
}