ChatCompletions Class

Representation of the response data from a chat completions request. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.

Inheritance
azure.ai.inference.models._models.ChatCompletions
ChatCompletions

Constructor

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

Variables

Name Description
id
str

A unique identifier associated with this chat completions response. Required.

created

The first timestamp associated with generation activity for this completions response, represented as seconds since the beginning of the Unix epoch of 00:00 on 1 Jan 1970. Required.

model
str

The model used for the chat completion. Required.

usage

Usage information for tokens processed and generated as part of this completions operation. Required.

choices

The collection of completions choices associated with this completions response. Generally, n choices are generated per provided prompt with a default value of 1. Token limits and other settings may limit the number of choices generated. 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

choices

The collection of completions choices associated with this completions response. Generally, n choices are generated per provided prompt with a default value of 1. Token limits and other settings may limit the number of choices generated. Required.

choices: List['_models.ChatChoice']

created

The first timestamp associated with generation activity for this completions response, represented as seconds since the beginning of the Unix epoch of 00:00 on 1 Jan 1970. Required.

created: datetime.datetime

id

A unique identifier associated with this chat completions response. Required.

id: str

model

The model used for the chat completion. Required.

model: str

usage

Usage information for tokens processed and generated as part of this completions operation. Required.

usage: _models.CompletionsUsage