类 ChatUsage
java.lang.Object
io.agentscope.core.model.ChatUsage
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.
-
嵌套类概要
嵌套类 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static ChatUsage.Builderbuilder()Creates a new builder for ChatUsage.intGets the number of input tokens used.intGets the number of output tokens used.doublegetTime()Gets the execution time.intGets the total number of tokens used.
-
构造器详细资料
-
ChatUsage
public ChatUsage(int inputTokens, int outputTokens, double time) Creates a new ChatUsage instance.- 参数:
inputTokens- the number of tokens used for the input/promptoutputTokens- the number of tokens used for the output/generated responsetime- 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
Creates a new builder for ChatUsage.- 返回:
- a new Builder instance
-