Record Class ProviderUsage
java.lang.Object
java.lang.Record
ai.doctruth.ProviderUsage
- Record Components:
inputTokens- prompt tokens billed by the provider.outputTokens- completion tokens billed by the provider.modelVersion- provider-reported model version (e.g. a date stamp or build id).
Token-usage and model-version data returned by an LLM provider on every successful call.
Carried into
Provenance so audit logs can reconstruct cost and reproducibility.
Invariants (compact constructor):
inputTokens >= 0,outputTokens >= 0.modelVersionnon-null and non-blank.
- Since:
- 0.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionProviderUsage(int inputTokens, int outputTokens, String modelVersion) Creates an instance of aProviderUsagerecord 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.intReturns the value of theinputTokensrecord component.Returns the value of themodelVersionrecord component.intReturns the value of theoutputTokensrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ProviderUsage
Creates an instance of aProviderUsagerecord class.- Parameters:
inputTokens- the value for theinputTokensrecord componentoutputTokens- the value for theoutputTokensrecord componentmodelVersion- the value for themodelVersionrecord component
-
-
Method Details
-
toString
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
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
-
modelVersion
Returns the value of themodelVersionrecord component.- Returns:
- the value of the
modelVersionrecord component
-