Interface Usage

All Known Implementing Classes:
AnthropicUsage, AzureOpenAiEmbeddingUsage, AzureOpenAiUsage, BedrockUsage, BedrockUsage, DefaultUsage, EmptyUsage, MessageAggregator.DefaultUsage, MiniMaxUsage, MistralAiUsage, MoonshotUsage, OllamaChatUsage, OllamaEmbeddingUsage, OpenAiUsage, QianFanUsage, VertexAiEmbeddingUsage, VertexAiUsage, ZhiPuAiUsage

public interface Usage
Abstract Data Type (ADT) encapsulating metadata on the usage of an AI provider's API per AI request.
Since:
0.7.0
Author:
John Blum
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the number of tokens returned in the generation (aka completion) of the AI's response.
    Returns the number of tokens used in the prompt of the AI request.
    default Long
    Return the total number of tokens from both the prompt of an AI request and generation of the AI's response.
  • Method Details

    • getPromptTokens

      Long getPromptTokens()
      Returns the number of tokens used in the prompt of the AI request.
      Returns:
      an Long with the number of tokens used in the prompt of the AI request.
      See Also:
    • getGenerationTokens

      Long getGenerationTokens()
      Returns the number of tokens returned in the generation (aka completion) of the AI's response.
      Returns:
      an Long with the number of tokens returned in the generation (aka completion) of the AI's response.
      See Also:
    • getTotalTokens

      default Long getTotalTokens()
      Return the total number of tokens from both the prompt of an AI request and generation of the AI's response.
      Returns:
      the total number of tokens from both the prompt of an AI request and generation of the AI's response.
      See Also: