# Class MessageRequest

Namespace
  AnthropicClient.Models

Assembly
  AnthropicClient.dll

Represents a message request.

    public class MessageRequest : BaseMessageRequest

Inheritance
  object
  BaseMessageRequest
  MessageRequest

Inherited Members
  BaseMessageRequest.Model
  BaseMessageRequest.System
  BaseMessageRequest.SystemMessages
  BaseMessageRequest.SystemPrompt
  BaseMessageRequest.Messages
  BaseMessageRequest.MaxTokens
  BaseMessageRequest.Metadata
  BaseMessageRequest.StopSequences
  BaseMessageRequest.Temperature
  BaseMessageRequest.TopK
  BaseMessageRequest.TopP
  BaseMessageRequest.ToolChoice
  BaseMessageRequest.Tools
  BaseMessageRequest.Stream
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)
  object.ToString()

## Constructors

### MessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?, List<string>?, List<TextContent>?)

Initializes a new instance of the MessageRequest class.

    public MessageRequest(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, List<string>? stopSequences = null, List<TextContent>? systemMessages = null)

#### Parameters

`model` string

  The model ID to use for the request.

`messages` List<Message>

  The messages to send to the model.

`maxTokens` int

  The maximum number of tokens to generate.

`system` string

  The system prompt to use for the request.

`metadata` Dictionary<string, object>

  The metadata to include with the request.

`temperature` decimal

  The temperature to use for the request.

`topK` int?

  The top-K value to use for the request.

`topP` decimal?

  The top-P value to use for the request.

`toolChoice` ToolChoice

  The tool choice mode to use for the request.

`tools` List<Tool>

  The tools to use for the request.

`stopSequences` List<string>

  The prompt stop sequences.

`systemMessages` List<TextContent>

  The system messages to include with the request.

#### 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.