Package com.tnsai.llm.cost
Record Class CostTracker.CostStatistics
java.lang.Object
java.lang.Record
com.tnsai.llm.cost.CostTracker.CostStatistics
- Enclosing interface:
CostTracker
public static record CostTracker.CostStatistics(int recordCount, long totalInputTokens, long totalOutputTokens, long totalCachedTokens, BigDecimal totalInputCost, BigDecimal totalOutputCost, BigDecimal totalCost, BigDecimal averageCostPerRequest, long averageLatencyMs, Optional<UsageRecord> mostExpensiveRequest, Map<String,BigDecimal> costByModel, Map<String,BigDecimal> costByProvider, Duration timeSpan)
extends Record
Aggregated cost statistics.
-
Constructor Summary
ConstructorsConstructorDescriptionCostStatistics(int recordCount, long totalInputTokens, long totalOutputTokens, long totalCachedTokens, BigDecimal totalInputCost, BigDecimal totalOutputCost, BigDecimal totalCost, BigDecimal averageCostPerRequest, long averageLatencyMs, Optional<UsageRecord> mostExpensiveRequest, Map<String, BigDecimal> costByModel, Map<String, BigDecimal> costByProvider, Duration timeSpan) Creates an instance of aCostStatisticsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theaverageCostPerRequestrecord component.longReturns the value of theaverageLatencyMsrecord component.Returns the value of thecostByModelrecord component.Returns the value of thecostByProviderrecord component.static CostTracker.CostStatisticsempty()final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of themostExpensiveRequestrecord component.intReturns the value of therecordCountrecord component.timeSpan()Returns the value of thetimeSpanrecord component.final StringtoString()Returns a string representation of this record class.longReturns the value of thetotalCachedTokensrecord component.Returns the value of thetotalCostrecord component.Returns the value of thetotalInputCostrecord component.longReturns the value of thetotalInputTokensrecord component.Returns the value of thetotalOutputCostrecord component.longReturns the value of thetotalOutputTokensrecord component.
-
Constructor Details
-
CostStatistics
public CostStatistics(int recordCount, long totalInputTokens, long totalOutputTokens, long totalCachedTokens, BigDecimal totalInputCost, BigDecimal totalOutputCost, BigDecimal totalCost, BigDecimal averageCostPerRequest, long averageLatencyMs, Optional<UsageRecord> mostExpensiveRequest, Map<String, BigDecimal> costByModel, Map<String, BigDecimal> costByProvider, Duration timeSpan) Creates an instance of aCostStatisticsrecord class.- Parameters:
recordCount- the value for therecordCountrecord componenttotalInputTokens- the value for thetotalInputTokensrecord componenttotalOutputTokens- the value for thetotalOutputTokensrecord componenttotalCachedTokens- the value for thetotalCachedTokensrecord componenttotalInputCost- the value for thetotalInputCostrecord componenttotalOutputCost- the value for thetotalOutputCostrecord componenttotalCost- the value for thetotalCostrecord componentaverageCostPerRequest- the value for theaverageCostPerRequestrecord componentaverageLatencyMs- the value for theaverageLatencyMsrecord componentmostExpensiveRequest- the value for themostExpensiveRequestrecord componentcostByModel- the value for thecostByModelrecord componentcostByProvider- the value for thecostByProviderrecord componenttimeSpan- the value for thetimeSpanrecord component
-
-
Method Details
-
empty
-
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 '=='. -
recordCount
public int recordCount()Returns the value of therecordCountrecord component.- Returns:
- the value of the
recordCountrecord component
-
totalInputTokens
public long totalInputTokens()Returns the value of thetotalInputTokensrecord component.- Returns:
- the value of the
totalInputTokensrecord component
-
totalOutputTokens
public long totalOutputTokens()Returns the value of thetotalOutputTokensrecord component.- Returns:
- the value of the
totalOutputTokensrecord component
-
totalCachedTokens
public long totalCachedTokens()Returns the value of thetotalCachedTokensrecord component.- Returns:
- the value of the
totalCachedTokensrecord component
-
totalInputCost
Returns the value of thetotalInputCostrecord component.- Returns:
- the value of the
totalInputCostrecord component
-
totalOutputCost
Returns the value of thetotalOutputCostrecord component.- Returns:
- the value of the
totalOutputCostrecord component
-
totalCost
Returns the value of thetotalCostrecord component.- Returns:
- the value of the
totalCostrecord component
-
averageCostPerRequest
Returns the value of theaverageCostPerRequestrecord component.- Returns:
- the value of the
averageCostPerRequestrecord component
-
averageLatencyMs
public long averageLatencyMs()Returns the value of theaverageLatencyMsrecord component.- Returns:
- the value of the
averageLatencyMsrecord component
-
mostExpensiveRequest
Returns the value of themostExpensiveRequestrecord component.- Returns:
- the value of the
mostExpensiveRequestrecord component
-
costByModel
Returns the value of thecostByModelrecord component.- Returns:
- the value of the
costByModelrecord component
-
costByProvider
Returns the value of thecostByProviderrecord component.- Returns:
- the value of the
costByProviderrecord component
-
timeSpan
Returns the value of thetimeSpanrecord component.- Returns:
- the value of the
timeSpanrecord component
-