ChatChoice Class

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

Implements

public final class ChatChoice
implements JsonSerializable<ChatChoice>

The representation of a single prompt completion as part of an overall chat completions request. 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.

Method Summary

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

Reads an instance of ChatChoice from the JsonReader.

CompletionsFinishReason getFinishReason()

Get the finishReason property: The reason that this chat completions choice completed its generated.

int getIndex()

Get the index property: The ordered index associated with this chat completions choice.

ChatResponseMessage getMessage()

Get the message property: The chat message for a given chat completions prompt.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from java.lang.Object

Method Details

fromJson

public static ChatChoice fromJson(JsonReader jsonReader)

Reads an instance of ChatChoice from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of ChatChoice 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.

getFinishReason

public CompletionsFinishReason getFinishReason()

Get the finishReason property: The reason that this chat completions choice completed its generated.

Returns:

the finishReason value.

getIndex

public int getIndex()

Get the index property: The ordered index associated with this chat completions choice.

Returns:

the index value.

getMessage

public ChatResponseMessage getMessage()

Get the message property: The chat message for a given chat completions prompt.

Returns:

the message value.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to