Class AnthropicCountTokensRequest

java.lang.Object
dev.langchain4j.model.anthropic.internal.api.AnthropicCountTokensRequest

public class AnthropicCountTokensRequest extends Object
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.

  • Constructor Details

    • AnthropicCountTokensRequest

      public AnthropicCountTokensRequest()
      Default constructor.
  • Method Details

    • getModel

      public String getModel()
      Gets the model name.
      Returns:
      the model name
    • setModel

      public void setModel(String model)
      Sets the model name.
      Parameters:
      model - the model name
    • getMessages

      public List<AnthropicMessage> getMessages()
      Gets the list of messages.
      Returns:
      the list of messages
    • setMessages

      public void setMessages(List<AnthropicMessage> messages)
      Sets the list of messages.
      Parameters:
      messages - the list of messages
    • getSystem

      public List<AnthropicTextContent> getSystem()
      Gets the system prompt content.
      Returns:
      the system prompt content
    • setSystem

      public void setSystem(List<AnthropicTextContent> system)
      Sets the system prompt content.
      Parameters:
      system - the system prompt content
    • getTools

      public List<AnthropicTool> getTools()
      Gets the list of tools.
      Returns:
      the list of tools
    • setTools

      public void setTools(List<AnthropicTool> tools)
      Sets the list of tools.
      Parameters:
      tools - the list of tools
    • getThinking

      public AnthropicThinking getThinking()
      Gets the thinking configuration.
      Returns:
      the thinking configuration
    • setThinking

      public void setThinking(AnthropicThinking thinking)
      Sets the thinking configuration.
      Parameters:
      thinking - the thinking configuration
    • builder

      public static AnthropicCountTokensRequest.Builder builder()
      Creates a new builder for constructing AnthropicCountTokensRequest instances.
      Returns:
      a new AnthropicCountTokensRequest.Builder instance
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object