Class ChatCompletionChunk.Builder
-
- All Implemented Interfaces:
public final class ChatCompletionChunk.Builder
A builder for ChatCompletionChunk.
-
-
Method Summary
-
-
Method Detail
-
id
final ChatCompletionChunk.Builder id(String id)
A unique identifier for the chat completion. Each chunk has the same ID.
-
id
final ChatCompletionChunk.Builder id(JsonField<String> id)
Sets Builder.id to an arbitrary JSON value.
You should usually call Builder.id with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
choices
final ChatCompletionChunk.Builder choices(List<ChatCompletionChunk.Choice> choices)
A list of chat completion choices. Can contain more than one elements if
n
is greater than 1. Can also be empty for the last chunk if you setstream_options: {"include_usage": true}
.
-
choices
final ChatCompletionChunk.Builder choices(JsonField<List<ChatCompletionChunk.Choice>> choices)
Sets Builder.choices to an arbitrary JSON value.
You should usually call Builder.choices with a well-typed
List<Choice>
value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
addChoice
final ChatCompletionChunk.Builder addChoice(ChatCompletionChunk.Choice choice)
-
created
final ChatCompletionChunk.Builder created(Long created)
The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp.
-
created
final ChatCompletionChunk.Builder created(JsonField<Long> created)
Sets Builder.created to an arbitrary JSON value.
You should usually call Builder.created with a well-typed Long value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
model
final ChatCompletionChunk.Builder model(String model)
The model to generate the completion.
-
model
final ChatCompletionChunk.Builder model(JsonField<String> model)
Sets Builder.model to an arbitrary JSON value.
You should usually call Builder.model with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
object_
final ChatCompletionChunk.Builder object_(JsonValue object_)
Sets the field to an arbitrary JSON value.
It is usually unnecessary to call this method because the field defaults to the following:
JsonValue.from("chat.completion.chunk")
This method is primarily for setting the field to an undocumented or not yet supported value.
-
serviceTier
final ChatCompletionChunk.Builder serviceTier(ChatCompletionChunk.ServiceTier serviceTier)
Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service:
If set to 'auto', and the Project is Scale tier enabled, the system will utilize scale tier credits until they are exhausted.
If set to 'auto', and the Project is not Scale tier enabled, the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee.
If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee.
If set to 'flex', the request will be processed with the Flex Processing service tier. Learn more.
When not set, the default behavior is 'auto'.
When this parameter is set, the response body will include the
service_tier
utilized.
-
serviceTier
final ChatCompletionChunk.Builder serviceTier(Optional<ChatCompletionChunk.ServiceTier> serviceTier)
Alias for calling Builder.serviceTier with
serviceTier.orElse(null)
.
-
serviceTier
final ChatCompletionChunk.Builder serviceTier(JsonField<ChatCompletionChunk.ServiceTier> serviceTier)
Sets Builder.serviceTier to an arbitrary JSON value.
You should usually call Builder.serviceTier with a well-typed ServiceTier value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
systemFingerprint
final ChatCompletionChunk.Builder systemFingerprint(String systemFingerprint)
This fingerprint represents the backend configuration that the model runs with. Can be used in conjunction with the
seed
request parameter to understand when backend changes have been made that might impact determinism.
-
systemFingerprint
final ChatCompletionChunk.Builder systemFingerprint(JsonField<String> systemFingerprint)
Sets Builder.systemFingerprint to an arbitrary JSON value.
You should usually call Builder.systemFingerprint with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
usage
final ChatCompletionChunk.Builder usage(CompletionUsage usage)
An optional field that will only be present when you set
stream_options: {"include_usage": true}
in your request. When present, it contains a null value except for the last chunk which contains the token usage statistics for the entire request.NOTE: If the stream is interrupted or cancelled, you may not receive the final usage chunk which contains the total token usage for the request.
-
usage
final ChatCompletionChunk.Builder usage(Optional<CompletionUsage> usage)
Alias for calling Builder.usage with
usage.orElse(null)
.
-
usage
final ChatCompletionChunk.Builder usage(JsonField<CompletionUsage> usage)
Sets Builder.usage to an arbitrary JSON value.
You should usually call Builder.usage with a well-typed CompletionUsage value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
additionalProperties
final ChatCompletionChunk.Builder additionalProperties(Map<String, JsonValue> additionalProperties)
-
putAdditionalProperty
final ChatCompletionChunk.Builder putAdditionalProperty(String key, JsonValue value)
-
putAllAdditionalProperties
final ChatCompletionChunk.Builder putAllAdditionalProperties(Map<String, JsonValue> additionalProperties)
-
removeAdditionalProperty
final ChatCompletionChunk.Builder removeAdditionalProperty(String key)
-
removeAllAdditionalProperties
final ChatCompletionChunk.Builder removeAllAdditionalProperties(Set<String> keys)
-
build
final ChatCompletionChunk build()
Returns an immutable instance of ChatCompletionChunk.
Further updates to this Builder will not mutate the returned instance.
The following fields are required:
.id() .choices() .created() .model()
-
-
-
-