+Class CountMessageTokensRequest +
+ +- Namespace
- AnthropicClient.Models
- Assembly
- AnthropicClient.dll
Represents a request to count the number of tokens in a message.
+public class CountMessageTokensRequest
+ -
+
- Inheritance +
-
+
+ CountMessageTokensRequest+
+
-
+
- Inherited Members +
-
+
+
+
+ + object.GetType() ++ + + +
Constructors +
+ + + + ++ CountMessageTokensRequest(string, List<Message>, ToolChoice?, List<Tool>?, List<TextContent>?) + +
+ +Initializes a new instance of the CountMessageTokensRequest class.
+public CountMessageTokensRequest(string model, List<Message> messages, ToolChoice? toolChoice = null, List<Tool>? tools = null, List<TextContent>? systemPrompt = null)
+ Parameters
+-
+
modelstring
+ The model ID to use for the request.
+
+ messagesList<Message>
+ The messages to count the number of tokens in.
+
+ toolChoiceToolChoice
+ The tool choice mode to use for the request.
+
+ toolsList<Tool>
+ The tools to use for the request.
+
+ systemPromptList<TextContent>
+ The system prompt to use for the request.
+
+
Exceptions
+-
+
- ArgumentNullException +
Thrown when
+modelormessagesis null.
+ - ArgumentException +
Thrown when
+messagesis empty.
+
Properties +
+ + + + ++ Messages + +
+ +Gets the messages to count the number of tokens in.
+public List<Message> Messages { get; init; }
+ Property Value
+ + + + + + + + + + + ++ Model + +
+ +Gets the model ID to be used for the request.
+public string Model { get; init; }
+ Property Value
+-
+
- string + +
+ SystemPrompt + +
+ +Gets the system prompt to use for the request.
+[JsonPropertyName("system")]
+public List<TextContent>? SystemPrompt { get; init; }
+ Property Value
+-
+
- List<TextContent> + +
+ ToolChoice + +
+ +Gets the tool choice mode to use for the request.
+[JsonPropertyName("tool_choice")]
+public ToolChoice? ToolChoice { get; init; }
+ Property Value
+-
+
- ToolChoice + +
+ Tools + +
+ +Gets the tools to use for the request.
+public List<Tool>? Tools { get; init; }
+