Package com.azure.ai.inference.models
Class ChatChoice
java.lang.Object
com.azure.ai.inference.models.ChatChoice
- All Implemented Interfaces:
com.azure.json.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 TypeMethodDescriptionstatic ChatChoice
fromJson
(com.azure.json.JsonReader jsonReader) Reads an instance of ChatChoice from the JsonReader.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.Get the message property: The chat message for a given chat completions prompt.com.azure.json.JsonWriter
toJson
(com.azure.json.JsonWriter jsonWriter) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.azure.json.JsonSerializable
toJson, toJson, toJsonBytes, toJsonString
-
Method Details
-
getIndex
public int getIndex()Get the index property: The ordered index associated with this chat completions choice.- Returns:
- the index value.
-
getFinishReason
Get the finishReason property: The reason that this chat completions choice completed its generated.- Returns:
- the finishReason value.
-
getMessage
Get the message property: The chat message for a given chat completions prompt.- Returns:
- the message value.
-
toJson
- Specified by:
toJson
in interfacecom.azure.json.JsonSerializable<ChatChoice>
- Throws:
IOException
-
fromJson
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:
IllegalStateException
- If the deserialized JSON object was missing any required properties.IOException
- If an error occurs while reading the ChatChoice.
-