Record Class CohereChatBedrockApi.CohereChatRequest
java.lang.Object
java.lang.Record
org.springframework.ai.bedrock.cohere.api.CohereChatBedrockApi.CohereChatRequest
- Record Components:
prompt
- The input prompt to generate the response from.temperature
- (optional) Use a lower value to decrease randomness in the response.topP
- (optional) Use a lower value to ignore less probable options. Set to 0 or 1.0 to disable.topK
- (optional) Specify the number of token choices the model uses to generate the next token.maxTokens
- (optional) Specify the maximum number of tokens to use in the generated response.stopSequences
- (optional) 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.returnLikelihoods
- (optional) Specify how and if the token likelihoods are returned with the response.stream
- (optional) Specify true to return the response piece-by-piece in real-time and false to return the complete response after the process finishes.numGenerations
- (optional) The maximum number of generations that the model should return.logitBias
- (optional) prevents the model from generating unwanted tokens or incentivize the model to include desired tokens. The format is {token_id: bias} where bias is a float between -10 and 10. Tokens can be obtained from text using any tokenization service, such as Cohere’s Tokenize endpoint.truncate
- (optional) Specifies how the API handles inputs longer than the maximum token length.
- Enclosing class:
- CohereChatBedrockApi
public static record CohereChatBedrockApi.CohereChatRequest(String prompt, Double temperature, Double topP, Integer topK, Integer maxTokens, List<String> stopSequences, CohereChatBedrockApi.CohereChatRequest.ReturnLikelihoods returnLikelihoods, boolean stream, Integer numGenerations, CohereChatBedrockApi.CohereChatRequest.LogitBias logitBias, CohereChatBedrockApi.CohereChatRequest.Truncate truncate)
extends Record
CohereChatRequest encapsulates the request parameters for the Cohere command model.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builder for the CohereChatRequest.static final record
Prevents the model from generating unwanted tokens or incentivize the model to include desired tokens.static enum
(optional) Specify how and if the token likelihoods are returned with the response.static enum
Specifies how the API handles inputs longer than the maximum token length. -
Constructor Summary
ConstructorDescriptionCohereChatRequest
(String prompt, Double temperature, Double topP, Integer topK, Integer maxTokens, List<String> stopSequences, CohereChatBedrockApi.CohereChatRequest.ReturnLikelihoods returnLikelihoods, boolean stream, Integer numGenerations, CohereChatBedrockApi.CohereChatRequest.LogitBias logitBias, CohereChatBedrockApi.CohereChatRequest.Truncate truncate) Creates an instance of aCohereChatRequest
record class. -
Method Summary
Modifier and TypeMethodDescriptionGet CohereChatRequest builder.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 thelogitBias
record component.Returns the value of themaxTokens
record component.Returns the value of thenumGenerations
record component.prompt()
Returns the value of theprompt
record component.Returns the value of thereturnLikelihoods
record component.Returns the value of thestopSequences
record component.boolean
stream()
Returns the value of thestream
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.truncate()
Returns the value of thetruncate
record component.
-
Constructor Details
-
CohereChatRequest
public CohereChatRequest(String prompt, Double temperature, Double topP, Integer topK, Integer maxTokens, List<String> stopSequences, CohereChatBedrockApi.CohereChatRequest.ReturnLikelihoods returnLikelihoods, boolean stream, Integer numGenerations, CohereChatBedrockApi.CohereChatRequest.LogitBias logitBias, CohereChatBedrockApi.CohereChatRequest.Truncate truncate) Creates an instance of aCohereChatRequest
record class.- Parameters:
prompt
- the value for theprompt
record componenttemperature
- the value for thetemperature
record componenttopP
- the value for thetopP
record componenttopK
- the value for thetopK
record componentmaxTokens
- the value for themaxTokens
record componentstopSequences
- the value for thestopSequences
record componentreturnLikelihoods
- the value for thereturnLikelihoods
record componentstream
- the value for thestream
record componentnumGenerations
- the value for thenumGenerations
record componentlogitBias
- the value for thelogitBias
record componenttruncate
- the value for thetruncate
record component
-
-
Method Details
-
builder
Get CohereChatRequest builder.- Parameters:
prompt
- compulsory request prompt parameter.- Returns:
- CohereChatRequest builder.
-
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
prompt
Returns the value of theprompt
record component.- Returns:
- the value of the
prompt
record component
-
temperature
Returns the value of thetemperature
record component.- Returns:
- the value of the
temperature
record component
-
topP
Returns the value of thetopP
record component.- Returns:
- the value of the
topP
record component
-
topK
Returns the value of thetopK
record component.- Returns:
- the value of the
topK
record component
-
maxTokens
Returns the value of themaxTokens
record component.- Returns:
- the value of the
maxTokens
record component
-
stopSequences
Returns the value of thestopSequences
record component.- Returns:
- the value of the
stopSequences
record component
-
returnLikelihoods
Returns the value of thereturnLikelihoods
record component.- Returns:
- the value of the
returnLikelihoods
record component
-
stream
public boolean stream()Returns the value of thestream
record component.- Returns:
- the value of the
stream
record component
-
numGenerations
Returns the value of thenumGenerations
record component.- Returns:
- the value of the
numGenerations
record component
-
logitBias
Returns the value of thelogitBias
record component.- Returns:
- the value of the
logitBias
record component
-
truncate
Returns the value of thetruncate
record component.- Returns:
- the value of the
truncate
record component
-