Class BaseMessageRequest
- Namespace
- AnthropicClient.Models
- Assembly
- AnthropicClient.dll
Represents a message request.
public abstract class BaseMessageRequest
- Inheritance
-
BaseMessageRequest
- Derived
- Inherited Members
Constructors
BaseMessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?, bool, List<string>?)
Initializes a new instance of the BaseMessageRequest class.
protected BaseMessageRequest(string model, List<Message> messages, int maxTokens = 1024, string? system = null, Dictionary<string, object>? metadata = null, decimal temperature = 0.0, int? topK = null, decimal? topP = null, ToolChoice? toolChoice = null, List<Tool>? tools = null, bool stream = false, List<string>? stopSequences = null)
Parameters
modelstringThe model ID to use for the request.
messagesList<Message>The messages to send to the model.
maxTokensintThe maximum number of tokens to generate.
systemstringThe system ID to use for the request.
metadataDictionary<string, object>The metadata to include with the request.
temperaturedecimalThe temperature to use for the request.
topKint?The top-K value to use for the request.
topPdecimal?The top-P value to use for the request.
toolChoiceToolChoiceThe tool choice mode to use for the request.
toolsList<Tool>The tools to use for the request.
streamboolA value indicating whether the message should be streamed.
stopSequencesList<string>The prompt stop sequences.
Exceptions
- ArgumentException
Thrown when the model ID is invalid.
- ArgumentNullException
Thrown when the model or messages is null.
- ArgumentException
Thrown when the messages contain no messages.
- ArgumentException
Thrown when the max tokens is less than one.
- ArgumentException
Thrown when the temperature is less than zero or greater than one.
Properties
MaxTokens
Gets the maximum number of tokens to generate.
[JsonPropertyName("max_tokens")]
public int MaxTokens { get; init; }
Property Value
Messages
Gets the messages to send to the model.
public List<Message> Messages { get; init; }
Property Value
Metadata
Gets the metadata to include with the request.
public Dictionary<string, object>? Metadata { get; init; }
Property Value
Model
Gets the model ID to use for the request.
public string Model { get; init; }
Property Value
StopSequences
Gets the prompt stop sequences.
[JsonPropertyName("stop_sequences")]
public List<string> StopSequences { get; init; }
Property Value
Stream
Gets a value indicating whether the message should be streamed.
public bool Stream { get; init; }
Property Value
System
Gets the system prompt to use for the request.
public string? System { get; init; }
Property Value
Temperature
Gets the temperature to use for the request.
public decimal Temperature { get; init; }
Property Value
ToolChoice
Gets the tool choice mode to use for the request.
[JsonPropertyName("tool_choice")]
public ToolChoice? ToolChoice { get; init; }
Property Value
Tools
Gets the tools to use for the request.
public List<Tool>? Tools { get; init; }
Property Value
TopK
Gets the top-K value to use for the request.
public int? TopK { get; init; }
Property Value
- int?
TopP
Gets the top-P value to use for the request.
public decimal? TopP { get; init; }