Class ChatCompletionStreamOptions
-
- All Implemented Interfaces:
public final class ChatCompletionStreamOptionsOptions for streaming response. Only set this when you set
stream: true.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classChatCompletionStreamOptions.BuilderA builder for ChatCompletionStreamOptions.
-
Method Summary
Modifier and Type Method Description final Optional<Boolean>includeObfuscation()When true, stream obfuscation will be enabled. final Optional<Boolean>includeUsage()If set, an additional chunk will be streamed before the data: [DONE]message.final JsonField<Boolean>_includeObfuscation()Returns the raw JSON value of includeObfuscation. final JsonField<Boolean>_includeUsage()Returns the raw JSON value of includeUsage. final Map<String, JsonValue>_additionalProperties()final ChatCompletionStreamOptions.BuildertoBuilder()final ChatCompletionStreamOptionsvalidate()final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static ChatCompletionStreamOptions.Builderbuilder()Returns a mutable builder for constructing an instance of ChatCompletionStreamOptions. -
-
Method Detail
-
includeObfuscation
final Optional<Boolean> includeObfuscation()
When true, stream obfuscation will be enabled. Stream obfuscation adds random characters to an
obfuscationfield on streaming delta events to normalize payload sizes as a mitigation to certain side-channel attacks. These obfuscation fields are included by default, but add a small amount of overhead to the data stream. You can setinclude_obfuscationto false to optimize for bandwidth if you trust the network links between your application and the OpenAI API.
-
includeUsage
final Optional<Boolean> includeUsage()
If set, an additional chunk will be streamed before the
data: [DONE]message. Theusagefield on this chunk shows the token usage statistics for the entire request, and thechoicesfield will always be an empty array.All other chunks will also include a
usagefield, but with a null value. NOTE: If the stream is interrupted, you may not receive the final usage chunk which contains the total token usage for the request.
-
_includeObfuscation
final JsonField<Boolean> _includeObfuscation()
Returns the raw JSON value of includeObfuscation.
Unlike includeObfuscation, this method doesn't throw if the JSON field has an unexpected type.
-
_includeUsage
final JsonField<Boolean> _includeUsage()
Returns the raw JSON value of includeUsage.
Unlike includeUsage, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
toBuilder
final ChatCompletionStreamOptions.Builder toBuilder()
-
validate
final ChatCompletionStreamOptions validate()
-
builder
final static ChatCompletionStreamOptions.Builder builder()
Returns a mutable builder for constructing an instance of ChatCompletionStreamOptions.
-
-
-
-