Class ChatCompletionStreamOptions.Builder
-
- All Implemented Interfaces:
public final class ChatCompletionStreamOptions.Builder
A builder for ChatCompletionStreamOptions.
-
-
Method Summary
-
-
Method Detail
-
includeObfuscation
final ChatCompletionStreamOptions.Builder includeObfuscation(Boolean includeObfuscation)
When true, stream obfuscation will be enabled. Stream obfuscation adds random characters to an
obfuscation
field 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_obfuscation
to false to optimize for bandwidth if you trust the network links between your application and the OpenAI API.
-
includeObfuscation
final ChatCompletionStreamOptions.Builder includeObfuscation(JsonField<Boolean> includeObfuscation)
Sets Builder.includeObfuscation to an arbitrary JSON value.
You should usually call Builder.includeObfuscation with a well-typed Boolean value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
includeUsage
final ChatCompletionStreamOptions.Builder includeUsage(Boolean includeUsage)
If set, an additional chunk will be streamed before the
data: [DONE]
message. Theusage
field on this chunk shows the token usage statistics for the entire request, and thechoices
field will always be an empty array.All other chunks will also include a
usage
field, 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.
-
includeUsage
final ChatCompletionStreamOptions.Builder includeUsage(JsonField<Boolean> includeUsage)
Sets Builder.includeUsage to an arbitrary JSON value.
You should usually call Builder.includeUsage with a well-typed Boolean value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
additionalProperties
final ChatCompletionStreamOptions.Builder additionalProperties(Map<String, JsonValue> additionalProperties)
-
putAdditionalProperty
final ChatCompletionStreamOptions.Builder putAdditionalProperty(String key, JsonValue value)
-
putAllAdditionalProperties
final ChatCompletionStreamOptions.Builder putAllAdditionalProperties(Map<String, JsonValue> additionalProperties)
-
removeAdditionalProperty
final ChatCompletionStreamOptions.Builder removeAdditionalProperty(String key)
-
removeAllAdditionalProperties
final ChatCompletionStreamOptions.Builder removeAllAdditionalProperties(Set<String> keys)
-
build
final ChatCompletionStreamOptions build()
Returns an immutable instance of ChatCompletionStreamOptions.
Further updates to this Builder will not mutate the returned instance.
-
-
-
-