Record Class ResponseMetadata.TokenUsage
java.lang.Object
java.lang.Record
com.vaadin.flow.component.ai.provider.ResponseMetadata.TokenUsage
- Record Components:
inputTokens- tokens in the input, ornullwhen unknownoutputTokens- tokens in the generated output, ornullwhen unknowntotalTokens- total tokens, ornullwhen unknown
- All Implemented Interfaces:
Serializable
- Enclosing class:
ResponseMetadata
public static record ResponseMetadata.TokenUsage(Integer inputTokens, Integer outputTokens, Integer totalTokens)
extends Record
implements Serializable
Token usage of a turn. Counts cover every round trip of the turn, as far
as the underlying framework reports them.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTokenUsage(Integer inputTokens, Integer outputTokens, Integer totalTokens) Creates an instance of aTokenUsagerecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theinputTokensrecord component.Returns the value of theoutputTokensrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thetotalTokensrecord component.
-
Constructor Details
-
TokenUsage
Creates an instance of aTokenUsagerecord class.- Parameters:
inputTokens- the value for theinputTokensrecord componentoutputTokens- the value for theoutputTokensrecord componenttotalTokens- the value for thetotalTokensrecord 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). -
inputTokens
Returns the value of theinputTokensrecord component.- Returns:
- the value of the
inputTokensrecord component
-
outputTokens
Returns the value of theoutputTokensrecord component.- Returns:
- the value of the
outputTokensrecord component
-
totalTokens
Returns the value of thetotalTokensrecord component.- Returns:
- the value of the
totalTokensrecord component
-