AS AgentScopeAPI 手册 / API Reference
类class agentscope.model

ChatUsage

@dataclass
class ChatUsage(DictMixin)
源码Source agentscope/model/_model_usage.py:10–32

聊天用量,与模型服务通信并返回生成或向量化结果。位于 agentscope.model 包,继承自 DictMixin。

The usage of a chat model API invocation. Declared in agentscope.model. Extends DictMixin.

属性摘要Attribute Summary

属性Attribute类型Type说明Description值Value
input_tokensint
输入令牌数字段。
—
output_tokensint
输出令牌数字段。
—
timefloat
时间字段。
—
cache_creation_input_tokensint
`cache_creation_input_tokens` 字段。
field(default_factory=lambda: 0)
cache_input_tokensint
缓存输入令牌数字段。
field(default_factory=lambda: 0)
typeLiteral['chat']
类型字段。
field(default_factory=lambda: 'chat')
metadatadict[str, Any] | None
元数据字段。
field(default_factory=lambda: None)

属性详情Attribute Detail

input_tokens

int

输入令牌数字段。声明为 int。

The input tokens field.

源码Source agentscope/model/_model_usage.py:13

output_tokens

int

输出令牌数字段。声明为 int。

The output tokens field.

源码Source agentscope/model/_model_usage.py:16

time

float

时间字段。声明为 float。

The time field.

源码Source agentscope/model/_model_usage.py:19

cache_creation_input_tokens

int = field(default_factory=lambda: 0)

cache_creation_input_tokens 字段。声明为 int。

The cache creation input tokens field.

源码Source agentscope/model/_model_usage.py:22

cache_input_tokens

int = field(default_factory=lambda: 0)

缓存输入令牌数字段。声明为 int。

The cache input tokens field.

源码Source agentscope/model/_model_usage.py:25

type

Literal['chat'] = field(default_factory=lambda: 'chat')

类型字段。声明为 Literal['chat']。

The type field.

源码Source agentscope/model/_model_usage.py:28

metadata

dict[str, Any] | None = field(default_factory=lambda: None)

元数据字段。声明为 dict[str, Any] | None。

The metadata field.

源码Source agentscope/model/_model_usage.py:31
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.