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 Details

    • ChatCompletionStreamOptions

      public ChatCompletionStreamOptions()
      Creates an instance of ChatCompletionStreamOptions class.
  • Method Details

    • isIncludeUsage

      public Boolean 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

      public ChatCompletionStreamOptions setIncludeUsage(Boolean includeUsage)
      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

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Specified by:
      toJson in interface com.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.