Record Class CohereChatBedrockApi.CohereChatResponse.Generation
java.lang.Object
java.lang.Record
org.springframework.ai.bedrock.cohere.api.CohereChatBedrockApi.CohereChatResponse.Generation
- Record Components:
id
- An identifier for the generation. (Always returned).eventType
- The type of event that occurred. (Always returned).likelihood
- The likelihood of the output. The value is the average of the token likelihoods in token_likelihoods. Returned if you specify the return_likelihoods input parameter.tokenLikelihoods
- An array of per token likelihoods. Returned if you specify the return_likelihoods input parameter.finishReason
- states the reason why the model finished generating tokens.isFinished
- A boolean field used only when stream is true, signifying whether or not there are additional tokens that will be generated as part of the streaming response. (Not always returned).text
- The generated text.index
- In a streaming response, use to determine which generation a given token belongs to. When only one response is streamed, all tokens belong to the same generation and index is not returned. index therefore is only returned in a streaming request with a value for num_generations that is larger than one.amazonBedrockInvocationMetrics
- Encapsulates the metrics about the model invocation.
- Enclosing class:
- CohereChatBedrockApi.CohereChatResponse
public static record CohereChatBedrockApi.CohereChatResponse.Generation(String id, String eventType, Float likelihood, List<CohereChatBedrockApi.CohereChatResponse.Generation.TokenLikelihood> tokenLikelihoods, CohereChatBedrockApi.CohereChatResponse.Generation.FinishReason finishReason, Boolean isFinished, String text, Integer index, AbstractBedrockApi.AmazonBedrockInvocationMetrics amazonBedrockInvocationMetrics)
extends Record
Generated result along with the likelihoods for tokens requested.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The reason the response finished being generated.static final record
Token likelihood. -
Constructor Summary
ConstructorDescriptionGeneration
(String id, String eventType, Float likelihood, List<CohereChatBedrockApi.CohereChatResponse.Generation.TokenLikelihood> tokenLikelihoods, CohereChatBedrockApi.CohereChatResponse.Generation.FinishReason finishReason, Boolean isFinished, String text, Integer index, AbstractBedrockApi.AmazonBedrockInvocationMetrics amazonBedrockInvocationMetrics) Creates an instance of aGeneration
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theamazonBedrockInvocationMetrics
record component.final boolean
Indicates whether some other object is "equal to" this one.Returns the value of theeventType
record component.Returns the value of thefinishReason
record component.final int
hashCode()
Returns a hash code value for this object.id()
Returns the value of theid
record component.index()
Returns the value of theindex
record component.Returns the value of theisFinished
record component.Returns the value of thelikelihood
record component.text()
Returns the value of thetext
record component.Returns the value of thetokenLikelihoods
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
Generation
public Generation(String id, String eventType, Float likelihood, List<CohereChatBedrockApi.CohereChatResponse.Generation.TokenLikelihood> tokenLikelihoods, CohereChatBedrockApi.CohereChatResponse.Generation.FinishReason finishReason, Boolean isFinished, String text, Integer index, AbstractBedrockApi.AmazonBedrockInvocationMetrics amazonBedrockInvocationMetrics) Creates an instance of aGeneration
record class.- Parameters:
id
- the value for theid
record componenteventType
- the value for theeventType
record componentlikelihood
- the value for thelikelihood
record componenttokenLikelihoods
- the value for thetokenLikelihoods
record componentfinishReason
- the value for thefinishReason
record componentisFinished
- the value for theisFinished
record componenttext
- the value for thetext
record componentindex
- the value for theindex
record componentamazonBedrockInvocationMetrics
- the value for theamazonBedrockInvocationMetrics
record component
-
-
Method Details
-
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)
. -
id
Returns the value of theid
record component.- Returns:
- the value of the
id
record component
-
eventType
Returns the value of theeventType
record component.- Returns:
- the value of the
eventType
record component
-
likelihood
Returns the value of thelikelihood
record component.- Returns:
- the value of the
likelihood
record component
-
tokenLikelihoods
Returns the value of thetokenLikelihoods
record component.- Returns:
- the value of the
tokenLikelihoods
record component
-
finishReason
Returns the value of thefinishReason
record component.- Returns:
- the value of the
finishReason
record component
-
isFinished
Returns the value of theisFinished
record component.- Returns:
- the value of the
isFinished
record component
-
text
Returns the value of thetext
record component.- Returns:
- the value of the
text
record component
-
index
Returns the value of theindex
record component.- Returns:
- the value of the
index
record component
-
amazonBedrockInvocationMetrics
Returns the value of theamazonBedrockInvocationMetrics
record component.- Returns:
- the value of the
amazonBedrockInvocationMetrics
record component
-