CompletionsUsage Class

Representation of the token counts processed for a completions request. Counts consider all tokens across prompts, choices, choice alternates, best_of generations, and other consumers.

Inheritance
azure.ai.inference._model_base.Model
CompletionsUsage

Constructor

CompletionsUsage(*args: Any, **kwargs: Any)

Variables

Name Description
completion_tokens
int

The number of tokens generated across all completions emissions. Required.

prompt_tokens
int

The number of tokens in the provided prompts for the completions request. Required.

total_tokens
int

The total number of tokens processed for the completions request and response. Required.

Methods

as_dict

Return a dict that can be turned into json using json.dump.

clear
copy
get
items
keys
pop
popitem
setdefault
update
values

as_dict

Return a dict that can be turned into json using json.dump.

as_dict(*, exclude_readonly: bool = False) -> Dict[str, Any]

Keyword-Only Parameters

Name Description
exclude_readonly

Whether to remove the readonly properties.

Returns

Type Description

A dict JSON compatible object

clear

clear() -> None

copy

copy() -> Model

get

get(key: str, default: Any = None) -> Any

Parameters

Name Description
key
Required
default
Required
Default value: None

items

items() -> ItemsView[str, Any]

keys

keys() -> KeysView[str]

pop

pop(key: str, default: ~typing.Any = <object object>) -> Any

Parameters

Name Description
key
Required
default
Required

popitem

popitem() -> Tuple[str, Any]

setdefault

setdefault(key: str, default: ~typing.Any = <object object>) -> Any

Parameters

Name Description
key
Required
default
Required

update

update(*args: Any, **kwargs: Any) -> None

values

values() -> ValuesView[Any]

Attributes

completion_tokens

The number of tokens generated across all completions emissions. Required.

completion_tokens: int

prompt_tokens

The number of tokens in the provided prompts for the completions request. Required.

prompt_tokens: int

total_tokens

The total number of tokens processed for the completions request and response. Required.

total_tokens: int