Record Class Anthropic3ChatBedrockApi.AnthropicChatRequest
java.lang.Object
java.lang.Record
org.springframework.ai.bedrock.anthropic3.api.Anthropic3ChatBedrockApi.AnthropicChatRequest
- Record Components:
messages
- A list of messages comprising the conversation so far.system
- A system prompt, providing context and instructions to Claude, such as specifying a particular goal or role.temperature
- (default 0.5) The temperature to use for the chat. You should either alter temperature or top_p, but not both.maxTokens
- (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:
- Anthropic3ChatBedrockApi
public static record Anthropic3ChatBedrockApi.AnthropicChatRequest(List<Anthropic3ChatBedrockApi.ChatCompletionMessage> messages, String system, Double temperature, Integer maxTokens, Integer topK, Double topP, List<String> stopSequences, String anthropicVersion)
extends Record
AnthropicChatRequest encapsulates the request parameters for the Anthropic messages model.
https://docs.anthropic.com/claude/reference/messages_post
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Builder forAnthropic3ChatBedrockApi.AnthropicChatRequest
. -
Constructor Summary
ConstructorDescriptionAnthropicChatRequest
(List<Anthropic3ChatBedrockApi.ChatCompletionMessage> messages, String system, Double temperature, Integer maxTokens, Integer topK, Double topP, List<String> stopSequences, String anthropicVersion) Creates an instance of aAnthropicChatRequest
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theanthropicVersion
record component.Create a newAnthropic3ChatBedrockApi.AnthropicChatRequest
instance.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.Returns the value of themaxTokens
record component.messages()
Returns the value of themessages
record component.Returns the value of thestopSequences
record component.system()
Returns the value of thesystem
record component.Returns the value of thetemperature
record component.topK()
Returns the value of thetopK
record component.topP()
Returns the value of thetopP
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
AnthropicChatRequest
public AnthropicChatRequest(List<Anthropic3ChatBedrockApi.ChatCompletionMessage> messages, String system, Double temperature, Integer maxTokens, Integer topK, Double topP, List<String> stopSequences, String anthropicVersion) Creates an instance of aAnthropicChatRequest
record class.- Parameters:
messages
- the value for themessages
record componentsystem
- the value for thesystem
record componenttemperature
- the value for thetemperature
record componentmaxTokens
- the value for themaxTokens
record componenttopK
- the value for thetopK
record componenttopP
- the value for thetopP
record componentstopSequences
- the value for thestopSequences
record componentanthropicVersion
- the value for theanthropicVersion
record component
-
-
Method Details
-
builder
public static Anthropic3ChatBedrockApi.AnthropicChatRequest.Builder builder(List<Anthropic3ChatBedrockApi.ChatCompletionMessage> messages) Create a newAnthropic3ChatBedrockApi.AnthropicChatRequest
instance.- Parameters:
messages
- A list of messages comprising the conversation so far.- Returns:
- the
Anthropic3ChatBedrockApi.AnthropicChatRequest
-
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. -
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. -
equals
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 withObjects::equals(Object,Object)
. -
messages
Returns the value of themessages
record component.- Returns:
- the value of the
messages
record component
-
system
Returns the value of thesystem
record component.- Returns:
- the value of the
system
record component
-
temperature
Returns the value of thetemperature
record component.- Returns:
- the value of the
temperature
record component
-
maxTokens
Returns the value of themaxTokens
record component.- Returns:
- the value of the
maxTokens
record component
-
topK
Returns the value of thetopK
record component.- Returns:
- the value of the
topK
record component
-
topP
Returns the value of thetopP
record component.- Returns:
- the value of the
topP
record component
-
stopSequences
Returns the value of thestopSequences
record component.- Returns:
- the value of the
stopSequences
record component
-
anthropicVersion
Returns the value of theanthropicVersion
record component.- Returns:
- the value of the
anthropicVersion
record component
-