ChatCompletions Class

  • java.lang.Object
    • com.azure.ai.inference.models.ChatCompletions

Implements

public final class ChatCompletions
implements JsonSerializable<ChatCompletions>

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.

Method Summary

Modifier and Type Method and Description
static ChatCompletions fromJson(JsonReader jsonReader)

Reads an instance of ChatCompletions from the JsonReader.

ChatChoice getChoice()

Get the choice property: The chat choice associated with this completion response.

List<ChatChoice> getChoices()

Get the choices property: The collection of completions choices associated with this completions response.

OffsetDateTime getCreated()

Get the created property: 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.

String getId()

Get the id property: A unique identifier associated with this chat completions response.

String getModel()

Get the model property: The model used for the chat completion.

CompletionsUsage getUsage()

Get the usage property: Usage information for tokens processed and generated as part of this completions operation.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from java.lang.Object

Method Details

fromJson

public static ChatCompletions fromJson(JsonReader jsonReader)

Reads an instance of ChatCompletions from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of ChatCompletions if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If the deserialized JSON object was missing any required properties.

getChoice

public ChatChoice getChoice()

Get the choice property: The chat choice associated with this completion response.

Returns:

the choice value.

getChoices

public List<ChatChoice> getChoices()

Get the choices property: 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.

Returns:

the choices value.

getCreated

public OffsetDateTime getCreated()

Get the created property: 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.

Returns:

the created value.

getId

public String getId()

Get the id property: A unique identifier associated with this chat completions response.

Returns:

the id value.

getModel

public String getModel()

Get the model property: The model used for the chat completion.

Returns:

the model value.

getUsage

public CompletionsUsage getUsage()

Get the usage property: Usage information for tokens processed and generated as part of this completions operation.

Returns:

the usage value.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to