Package akka.javasdk.agent.autonomous
Record Class AutonomousAgent.TokenUsage
- Record Components:
inputTokens- the input token count as the provider reports itoutputTokens- tokens in the responses returned by the modelcacheReadInputTokens- prompt tokens served from the provider's prompt cachecacheWriteInputTokens- prompt tokens written to the provider's prompt cachetotalInputTokens- every prompt token consumed, counted once, whatever the provider
- Enclosing class:
AutonomousAgent
public static record AutonomousAgent.TokenUsage(int inputTokens, int outputTokens, int cacheReadInputTokens, int cacheWriteInputTokens, int totalInputTokens)
extends Record
Token usage statistics for an autonomous agent.
See Agent.TokenUsage for the meaning of each count. A
totalInputTokens of 0 is replaced by inputTokens.
-
Constructor Summary
ConstructorsConstructorDescriptionTokenUsage(int inputTokens, int outputTokens) A usage with no prompt cache activity.TokenUsage(int inputTokens, int outputTokens, int cacheReadInputTokens, int cacheWriteInputTokens, int totalInputTokens) Creates an instance of aTokenUsagerecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thecacheReadInputTokensrecord component.intReturns the value of thecacheWriteInputTokensrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of theinputTokensrecord component.intReturns the value of theoutputTokensrecord component.final StringtoString()Returns a string representation of this record class.intReturns the value of thetotalInputTokensrecord component.
-
Constructor Details
-
TokenUsage
public TokenUsage(int inputTokens, int outputTokens, int cacheReadInputTokens, int cacheWriteInputTokens, int totalInputTokens) Creates an instance of aTokenUsagerecord class.- Parameters:
inputTokens- the value for theinputTokensrecord componentoutputTokens- the value for theoutputTokensrecord componentcacheReadInputTokens- the value for thecacheReadInputTokensrecord componentcacheWriteInputTokens- the value for thecacheWriteInputTokensrecord componenttotalInputTokens- the value for thetotalInputTokensrecord component
-
TokenUsage
public TokenUsage(int inputTokens, int outputTokens) A usage with no prompt cache activity.
-
-
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 with '=='. -
inputTokens
public int inputTokens()Returns the value of theinputTokensrecord component.- Returns:
- the value of the
inputTokensrecord component
-
outputTokens
public int outputTokens()Returns the value of theoutputTokensrecord component.- Returns:
- the value of the
outputTokensrecord component
-
cacheReadInputTokens
public int cacheReadInputTokens()Returns the value of thecacheReadInputTokensrecord component.- Returns:
- the value of the
cacheReadInputTokensrecord component
-
cacheWriteInputTokens
public int cacheWriteInputTokens()Returns the value of thecacheWriteInputTokensrecord component.- Returns:
- the value of the
cacheWriteInputTokensrecord component
-
totalInputTokens
public int totalInputTokens()Returns the value of thetotalInputTokensrecord component.- Returns:
- the value of the
totalInputTokensrecord component
-