Spaces:
Paused
Paused
Download src/agentscope/model/_model_usage.py from Akshay66777/agentscope-chat: direct link, hf CLI and curl.
- Browser
- Download file 967 Bytes
-
https://huggingface.co/spaces/Akshay66777/agentscope-chat/resolve/main/src/agentscope/model/_model_usage.py
- Command line
-
hf download hf://spaces/Akshay66777/agentscope-chat/src/agentscope/model/_model_usage.py
-
curl -L -o _model_usage.py https://huggingface.co/spaces/Akshay66777/agentscope-chat/resolve/main/src/agentscope/model/_model_usage.py
967 Bytes
| # -*- coding: utf-8 -*- | |
| """The model usage class in agentscope.""" | |
| from dataclasses import dataclass, field | |
| from typing import Any, Literal | |
| from .._utils._mixin import DictMixin | |
| class ChatUsage(DictMixin): | |
| """The usage of a chat model API invocation.""" | |
| input_tokens: int | |
| """The number of input tokens.""" | |
| output_tokens: int | |
| """The number of output tokens.""" | |
| time: float | |
| """The time used in seconds.""" | |
| cache_creation_input_tokens: int = field(default_factory=lambda: 0) | |
| """The number of input tokens used to create the prompt cache.""" | |
| cache_input_tokens: int = field(default_factory=lambda: 0) | |
| """The number of input tokens read from the prompt cache.""" | |
| type: Literal["chat"] = field(default_factory=lambda: "chat") | |
| """The type of the usage, must be `chat`.""" | |
| metadata: dict[str, Any] | None = field(default_factory=lambda: None) | |
| """Optional metadata associated with the usage.""" | |