类 ChatUsage

java.lang.Object
io.agentscope.core.model.ChatUsage

public class ChatUsage extends Object
Represents token usage information for chat completion responses.

This immutable data class tracks the number of tokens used during a chat completion, including input tokens (prompt), output tokens (generated response), and execution time.

  • 构造器详细资料

    • ChatUsage

      public ChatUsage(int inputTokens, int outputTokens, double time)
      Creates a new ChatUsage instance.
      参数:
      inputTokens - the number of tokens used for the input/prompt
      outputTokens - the number of tokens used for the output/generated response
      time - the execution time in seconds
  • 方法详细资料

    • getInputTokens

      public int getInputTokens()
      Gets the number of input tokens used.
      返回:
      the number of tokens used for the input/prompt
    • getOutputTokens

      public int getOutputTokens()
      Gets the number of output tokens used.
      返回:
      the number of tokens used for the output/generated response
    • getTotalTokens

      public int getTotalTokens()
      Gets the total number of tokens used.
      返回:
      the sum of input and output tokens
    • getTime

      public double getTime()
      Gets the execution time.
      返回:
      the execution time in seconds
    • builder

      public static ChatUsage.Builder builder()
      Creates a new builder for ChatUsage.
      返回:
      a new Builder instance