Package com.azure.ai.openai.models
Class ChatChoice
java.lang.Object
com.azure.ai.openai.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 ChatChoicefromJson(com.azure.json.JsonReader jsonReader) Reads an instance of ChatChoice from the JsonReader.Get the contentFilterResults property: Information about the content filtering category (hate, sexual, violence, self_harm), if it has been detected, as well as the severity level (very_low, low, medium, high-scale that determines the intensity and risk level of harmful content) and if it has been filtered or not.getDelta()Get the delta property: The delta message content for a streaming response.Get the enhancements property: Represents the output results of Azure OpenAI enhancements to chat completions, as configured via the matching input provided in the request.Get the finishDetails property: The reason the model stopped generating tokens, together with any applicable details.Get the finishReason property: The reason that this chat completions choice completed its generated.intgetIndex()Get the index property: The ordered index associated with this chat completions choice.Get the logprobs property: The log probability information for this choice, as enabled via the 'logprobs' request option.Get the message property: The chat message for a given chat completions prompt.com.azure.json.JsonWritertoJson(com.azure.json.JsonWriter jsonWriter)
-
Method Details
-
getMessage
Get the message property: The chat message for a given chat completions prompt.- Returns:
- the message value.
-
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.
-
getDelta
Get the delta property: The delta message content for a streaming response.- Returns:
- the delta value.
-
getContentFilterResults
Get the contentFilterResults property: Information about the content filtering category (hate, sexual, violence, self_harm), if it has been detected, as well as the severity level (very_low, low, medium, high-scale that determines the intensity and risk level of harmful content) and if it has been filtered or not.- Returns:
- the contentFilterResults value.
-
getFinishDetails
Get the finishDetails property: The reason the model stopped generating tokens, together with any applicable details. This structured representation replaces 'finish_reason' for some models.- Returns:
- the finishDetails value.
-
getEnhancements
Get the enhancements property: Represents the output results of Azure OpenAI enhancements to chat completions, as configured via the matching input provided in the request. This supplementary information is only available when using Azure OpenAI and only when the request is configured to use enhancements.- Returns:
- the enhancements value.
-
getLogprobs
Get the logprobs property: The log probability information for this choice, as enabled via the 'logprobs' request option.- Returns:
- the logprobs value.
-
toJson
- Specified by:
toJsonin 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.
-