Package com.azure.ai.openai.models
Class ChatCompletionStreamOptions
java.lang.Object
com.azure.ai.openai.models.ChatCompletionStreamOptions
- All Implemented Interfaces:
com.azure.json.JsonSerializable<ChatCompletionStreamOptions>
public final class ChatCompletionStreamOptions
extends Object
implements com.azure.json.JsonSerializable<ChatCompletionStreamOptions>
Options for streaming response. Only set this when you set `stream: true`.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance of ChatCompletionStreamOptions class. -
Method Summary
Modifier and TypeMethodDescriptionstatic ChatCompletionStreamOptionsfromJson(com.azure.json.JsonReader jsonReader) Reads an instance of ChatCompletionStreamOptions from the JsonReader.Get the includeUsage property: If set, an additional chunk will be streamed before the `data: [DONE]` message.setIncludeUsage(Boolean includeUsage) Set the includeUsage property: If set, an additional chunk will be streamed before the `data: [DONE]` message.com.azure.json.JsonWritertoJson(com.azure.json.JsonWriter jsonWriter) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.azure.json.JsonSerializable
toJson, toJson, toJsonBytes, toJsonString
-
Constructor Details
-
ChatCompletionStreamOptions
public ChatCompletionStreamOptions()Creates an instance of ChatCompletionStreamOptions class.
-
-
Method Details
-
isIncludeUsage
Get the includeUsage property: If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value.- Returns:
- the includeUsage value.
-
setIncludeUsage
Set the includeUsage property: If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value.- Parameters:
includeUsage- the includeUsage value to set.- Returns:
- the ChatCompletionStreamOptions object itself.
-
toJson
- Specified by:
toJsonin interfacecom.azure.json.JsonSerializable<ChatCompletionStreamOptions>- Throws:
IOException
-
fromJson
public static ChatCompletionStreamOptions fromJson(com.azure.json.JsonReader jsonReader) throws IOException Reads an instance of ChatCompletionStreamOptions from the JsonReader.- Parameters:
jsonReader- The JsonReader being read.- Returns:
- An instance of ChatCompletionStreamOptions if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.
- Throws:
IOException- If an error occurs while reading the ChatCompletionStreamOptions.
-