Class AnthropicCountTokensRequest
java.lang.Object
dev.langchain4j.model.anthropic.internal.api.AnthropicCountTokensRequest
Request object for counting tokens in a message using the Anthropic API.
This class is used to estimate token usage before sending a request, allowing for cost estimation and message size validation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for constructingAnthropicCountTokensRequestinstances. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a new builder for constructingAnthropicCountTokensRequestinstances.booleanGets the list of messages.getModel()Gets the model name.Gets the system prompt content.Gets the thinking configuration.getTools()Gets the list of tools.inthashCode()voidsetMessages(List<AnthropicMessage> messages) Sets the list of messages.voidSets the model name.voidsetSystem(List<AnthropicTextContent> system) Sets the system prompt content.voidsetThinking(AnthropicThinking thinking) Sets the thinking configuration.voidsetTools(List<AnthropicTool> tools) Sets the list of tools.toString()
-
Constructor Details
-
AnthropicCountTokensRequest
public AnthropicCountTokensRequest()Default constructor.
-
-
Method Details
-
getModel
-
setModel
-
getMessages
Gets the list of messages.- Returns:
- the list of messages
-
setMessages
Sets the list of messages.- Parameters:
messages- the list of messages
-
getSystem
Gets the system prompt content.- Returns:
- the system prompt content
-
setSystem
Sets the system prompt content.- Parameters:
system- the system prompt content
-
getTools
-
setTools
Sets the list of tools.- Parameters:
tools- the list of tools
-
getThinking
Gets the thinking configuration.- Returns:
- the thinking configuration
-
setThinking
Sets the thinking configuration.- Parameters:
thinking- the thinking configuration
-
builder
Creates a new builder for constructingAnthropicCountTokensRequestinstances.- Returns:
- a new
AnthropicCountTokensRequest.Builderinstance
-
hashCode
-
equals
-
toString
-