Record Class AnthropicChatBedrockApi.AnthropicChatRequest

java.lang.Object
java.lang.Record
org.springframework.ai.bedrock.anthropic.api.AnthropicChatBedrockApi.AnthropicChatRequest
Record Components:
prompt - The prompt to use for the chat.
temperature - (default 0.5) The temperature to use for the chat. You should either alter temperature or top_p, but not both.
maxTokensToSample - (default 200) Specify the maximum number of tokens to use in the generated response. Note that the models may stop before reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate. We recommend a limit of 4,000 tokens for optimal performance.
topK - (default 250) Specify the number of token choices the model uses to generate the next token.
topP - (default 1) Nucleus sampling to specify the cumulative probability of the next token in range [0,1]. In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by top_p. You should either alter temperature or top_p, but not both.
stopSequences - (defaults to "\n\nHuman:") Configure up to four sequences that the model recognizes. After a stop sequence, the model stops generating further tokens. The returned text doesn't contain the stop sequence.
anthropicVersion - The version of the model to use. The default value is bedrock-2023-05-31.
Enclosing class:
AnthropicChatBedrockApi

public static record AnthropicChatBedrockApi.AnthropicChatRequest(String prompt, Double temperature, Integer maxTokensToSample, Integer topK, Double topP, List<String> stopSequences, String anthropicVersion) extends Record
AnthropicChatRequest encapsulates the request parameters for the Anthropic chat model. https://docs.anthropic.com/claude/reference/complete_post
  • Constructor Details

    • AnthropicChatRequest

      public AnthropicChatRequest(String prompt, Double temperature, Integer maxTokensToSample, Integer topK, Double topP, List<String> stopSequences, String anthropicVersion)
      Creates an instance of a AnthropicChatRequest record class.
      Parameters:
      prompt - the value for the prompt record component
      temperature - the value for the temperature record component
      maxTokensToSample - the value for the maxTokensToSample record component
      topK - the value for the topK record component
      topP - the value for the topP record component
      stopSequences - the value for the stopSequences record component
      anthropicVersion - the value for the anthropicVersion record component
  • Method Details

    • builder

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • prompt

      public String prompt()
      Returns the value of the prompt record component.
      Returns:
      the value of the prompt record component
    • temperature

      public Double temperature()
      Returns the value of the temperature record component.
      Returns:
      the value of the temperature record component
    • maxTokensToSample

      public Integer maxTokensToSample()
      Returns the value of the maxTokensToSample record component.
      Returns:
      the value of the maxTokensToSample record component
    • topK

      public Integer topK()
      Returns the value of the topK record component.
      Returns:
      the value of the topK record component
    • topP

      public Double topP()
      Returns the value of the topP record component.
      Returns:
      the value of the topP record component
    • stopSequences

      public List<String> stopSequences()
      Returns the value of the stopSequences record component.
      Returns:
      the value of the stopSequences record component
    • anthropicVersion

      public String anthropicVersion()
      Returns the value of the anthropicVersion record component.
      Returns:
      the value of the anthropicVersion record component