Package dev.langchain4j.model.anthropic
Class AnthropicTokenUsage
java.lang.Object
dev.langchain4j.model.output.TokenUsage
dev.langchain4j.model.anthropic.AnthropicTokenUsage
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionAnthropicTokenUsage
(Integer inputTokenCount, Integer outputTokenCount, Integer cacheCreationInputTokens, Integer cacheReadInputTokens) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionadd
(TokenUsage that) Adds the token usage of two responses together.static AnthropicTokenUsage.Builder
builder()
Returns The total cached token created count, or null if unknown.Returns The total cached token read count, or null if unknown.toString()
Methods inherited from class dev.langchain4j.model.output.TokenUsage
equals, hashCode, inputTokenCount, outputTokenCount, sum, sum, totalTokenCount
-
Constructor Details
-
AnthropicTokenUsage
-
AnthropicTokenUsage
@Deprecated(forRemoval=true, since="1.0.0-beta4") public AnthropicTokenUsage(Integer inputTokenCount, Integer outputTokenCount, Integer cacheCreationInputTokens, Integer cacheReadInputTokens) Deprecated, for removal: This API element is subject to removal in a future version.please usebuilder()
insteadCreates a newAnthropicTokenUsage
instance with the given input, output token counts and cache creation/read input tokens.- Parameters:
inputTokenCount
- The input token count, or null if unknown.outputTokenCount
- The output token count, or null if unknown.cacheCreationInputTokens
- The total cached token created count, or null if unknown.cacheReadInputTokens
- The total cached token read count, or null if unknown.
-
-
Method Details
-
cacheCreationInputTokens
Returns The total cached token created count, or null if unknown.- Returns:
- The total cached token created count, or null if unknown.
-
cacheReadInputTokens
Returns The total cached token read count, or null if unknown.- Returns:
- The total cached token read count, or null if unknown.
-
add
Description copied from class:TokenUsage
Adds the token usage of two responses together.Fields which are null in both responses will be null in the result.
- Overrides:
add
in classTokenUsage
- Parameters:
that
- The token usage to add to this one.- Returns:
- a new
TokenUsage
instance with the token usage of both responses added together.
-
toString
- Overrides:
toString
in classTokenUsage
-
builder
-
builder()
instead