Class EmptyUsage

java.lang.Object
org.springframework.ai.chat.metadata.EmptyUsage
All Implemented Interfaces:
Usage

public class EmptyUsage extends Object implements Usage
A EmptyUsage implementation that returns zero for all property getters. All instances of this class are equal to each other.
Since:
0.7.0
Author:
John Blum, Ilayaperumal Gopinathan, Christian Tzolov
  • Constructor Details

    • EmptyUsage

      public EmptyUsage()
  • Method Details

    • getPromptTokens

      public Integer getPromptTokens()
      Description copied from interface: Usage
      Returns the number of tokens used in the prompt of the AI request.
      Specified by:
      getPromptTokens in interface Usage
      Returns:
      an Integer with the number of tokens used in the prompt of the AI request.
      See Also:
    • getCompletionTokens

      public Integer getCompletionTokens()
      Description copied from interface: Usage
      Returns the number of tokens returned in the generation (aka completion) of the AI's response.
      Specified by:
      getCompletionTokens in interface Usage
      Returns:
      an Integer with the number of tokens returned in the generation (aka completion) of the AI's response.
      See Also:
    • getNativeUsage

      public Object getNativeUsage()
      Description copied from interface: Usage
      Return the usage data from the underlying model API response.
      Specified by:
      getNativeUsage in interface Usage
      Returns:
      the object of type inferred by the API response.
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object