Class CompletionCreateParams.Body.Builder
-
- All Implemented Interfaces:
public final class CompletionCreateParams.Body.BuilderA builder for Body.
-
-
Method Summary
-
-
Method Detail
-
maxTokensToSample
final CompletionCreateParams.Body.Builder maxTokensToSample(Long maxTokensToSample)
The maximum number of tokens to generate before stopping.
Note that our models may stop before reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
-
maxTokensToSample
final CompletionCreateParams.Body.Builder maxTokensToSample(JsonField<Long> maxTokensToSample)
Sets Builder.maxTokensToSample to an arbitrary JSON value.
You should usually call Builder.maxTokensToSample 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 CompletionCreateParams.Body.Builder model(Model model)
The model that will complete your prompt.\n\nSee models for additional details and options.
-
model
final CompletionCreateParams.Body.Builder model(JsonField<Model> model)
Sets Builder.model to an arbitrary JSON value.
You should usually call Builder.model with a well-typed Model value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
model
final CompletionCreateParams.Body.Builder model(String value)
Sets model to an arbitrary String.
You should usually call model with a well-typed Model constant instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
prompt
final CompletionCreateParams.Body.Builder prompt(String prompt)
The prompt that you want Claude to complete.
For proper response generation you will need to format your prompt using alternating
\n\nHuman:and\n\nAssistant:conversational turns. For example:"\n\nHuman: {userQuestion}\n\nAssistant:"See prompt validation and our guide to prompt design for more details.
-
prompt
final CompletionCreateParams.Body.Builder prompt(JsonField<String> prompt)
Sets Builder.prompt to an arbitrary JSON value.
You should usually call Builder.prompt with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
metadata
final CompletionCreateParams.Body.Builder metadata(Metadata metadata)
An object describing metadata about the request.
-
metadata
final CompletionCreateParams.Body.Builder metadata(JsonField<Metadata> metadata)
Sets Builder.metadata to an arbitrary JSON value.
You should usually call Builder.metadata with a well-typed Metadata value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
stopSequences
final CompletionCreateParams.Body.Builder stopSequences(List<String> stopSequences)
Sequences that will cause the model to stop generating.
Our models stop on
"\n\nHuman:", and may include additional built-in stop sequences in the future. By providing the stop_sequences parameter, you may include additional strings that will cause the model to stop generating.
-
stopSequences
final CompletionCreateParams.Body.Builder stopSequences(JsonField<List<String>> stopSequences)
Sets Builder.stopSequences to an arbitrary JSON value.
You should usually call Builder.stopSequences with a well-typed
List<String>value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
addStopSequence
final CompletionCreateParams.Body.Builder addStopSequence(String stopSequence)
Adds a single String to stopSequences.
-
temperature
final CompletionCreateParams.Body.Builder temperature(Double temperature)
Amount of randomness injected into the response.
Defaults to
1.0. Ranges from0.0to1.0. Usetemperaturecloser to0.0for analytical / multiple choice, and closer to1.0for creative and generative tasks.Note that even with
temperatureof0.0, the results will not be fully deterministic.
-
temperature
final CompletionCreateParams.Body.Builder temperature(JsonField<Double> temperature)
Sets Builder.temperature to an arbitrary JSON value.
You should usually call Builder.temperature with a well-typed Double value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
topK
final CompletionCreateParams.Body.Builder topK(Long topK)
Only sample from the top K options for each subsequent token.
Used to remove "long tail" low probability responses. Learn more technical details here.
Recommended for advanced use cases only. You usually only need to use
temperature.
-
topK
final CompletionCreateParams.Body.Builder topK(JsonField<Long> topK)
Sets Builder.topK to an arbitrary JSON value.
You should usually call Builder.topK with a well-typed Long value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
topP
final CompletionCreateParams.Body.Builder topP(Double topP)
Use nucleus sampling.
In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by
top_p. You should either altertemperatureortop_p, but not both.Recommended for advanced use cases only. You usually only need to use
temperature.
-
topP
final CompletionCreateParams.Body.Builder topP(JsonField<Double> topP)
Sets Builder.topP to an arbitrary JSON value.
You should usually call Builder.topP with a well-typed Double value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
additionalProperties
final CompletionCreateParams.Body.Builder additionalProperties(Map<String, JsonValue> additionalProperties)
-
putAdditionalProperty
final CompletionCreateParams.Body.Builder putAdditionalProperty(String key, JsonValue value)
-
putAllAdditionalProperties
final CompletionCreateParams.Body.Builder putAllAdditionalProperties(Map<String, JsonValue> additionalProperties)
-
removeAdditionalProperty
final CompletionCreateParams.Body.Builder removeAdditionalProperty(String key)
-
removeAllAdditionalProperties
final CompletionCreateParams.Body.Builder removeAllAdditionalProperties(Set<String> keys)
-
build
final CompletionCreateParams.Body build()
Returns an immutable instance of Body.
Further updates to this Builder will not mutate the returned instance.
The following fields are required:
.maxTokensToSample() .model() .prompt()
-
-
-
-