Class CompletionCreateParams.Builder
-
- All Implemented Interfaces:
public final class CompletionCreateParams.BuilderA builder for CompletionCreateParams.
-
-
Method Summary
-
-
Method Detail
-
betas
final CompletionCreateParams.Builder betas(List<AnthropicBeta> betas)
Optional header to specify the beta version(s) you want to use.
-
betas
final CompletionCreateParams.Builder betas(Optional<List<AnthropicBeta>> betas)
Alias for calling Builder.betas with
betas.orElse(null).
-
addBeta
final CompletionCreateParams.Builder addBeta(AnthropicBeta beta)
Adds a single AnthropicBeta to betas.
-
addBeta
final CompletionCreateParams.Builder addBeta(String value)
Sets addBeta to an arbitrary String.
You should usually call addBeta with a well-typed AnthropicBeta constant instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
body
final CompletionCreateParams.Builder body(CompletionCreateParams.Body body)
Sets the entire request body.
This is generally only useful if you are already constructing the body separately. Otherwise, it's more convenient to use the top-level setters instead:
-
maxTokensToSample
final CompletionCreateParams.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.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.Builder model(Model model)
The model that will complete your prompt.\n\nSee models for additional details and options.
-
model
final CompletionCreateParams.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.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.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.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.Builder metadata(Metadata metadata)
An object describing metadata about the request.
-
metadata
final CompletionCreateParams.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.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.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.Builder addStopSequence(String stopSequence)
Adds a single String to stopSequences.
-
temperature
final CompletionCreateParams.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.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.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.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.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.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.
-
additionalBodyProperties
final CompletionCreateParams.Builder additionalBodyProperties(Map<String, JsonValue> additionalBodyProperties)
-
putAdditionalBodyProperty
final CompletionCreateParams.Builder putAdditionalBodyProperty(String key, JsonValue value)
-
putAllAdditionalBodyProperties
final CompletionCreateParams.Builder putAllAdditionalBodyProperties(Map<String, JsonValue> additionalBodyProperties)
-
removeAdditionalBodyProperty
final CompletionCreateParams.Builder removeAdditionalBodyProperty(String key)
-
removeAllAdditionalBodyProperties
final CompletionCreateParams.Builder removeAllAdditionalBodyProperties(Set<String> keys)
-
additionalHeaders
final CompletionCreateParams.Builder additionalHeaders(Headers additionalHeaders)
-
additionalHeaders
final CompletionCreateParams.Builder additionalHeaders(Map<String, Iterable<String>> additionalHeaders)
-
putAdditionalHeader
final CompletionCreateParams.Builder putAdditionalHeader(String name, String value)
-
putAdditionalHeaders
final CompletionCreateParams.Builder putAdditionalHeaders(String name, Iterable<String> values)
-
putAllAdditionalHeaders
final CompletionCreateParams.Builder putAllAdditionalHeaders(Headers additionalHeaders)
-
putAllAdditionalHeaders
final CompletionCreateParams.Builder putAllAdditionalHeaders(Map<String, Iterable<String>> additionalHeaders)
-
replaceAdditionalHeaders
final CompletionCreateParams.Builder replaceAdditionalHeaders(String name, String value)
-
replaceAdditionalHeaders
final CompletionCreateParams.Builder replaceAdditionalHeaders(String name, Iterable<String> values)
-
replaceAllAdditionalHeaders
final CompletionCreateParams.Builder replaceAllAdditionalHeaders(Headers additionalHeaders)
-
replaceAllAdditionalHeaders
final CompletionCreateParams.Builder replaceAllAdditionalHeaders(Map<String, Iterable<String>> additionalHeaders)
-
removeAdditionalHeaders
final CompletionCreateParams.Builder removeAdditionalHeaders(String name)
-
removeAllAdditionalHeaders
final CompletionCreateParams.Builder removeAllAdditionalHeaders(Set<String> names)
-
additionalQueryParams
final CompletionCreateParams.Builder additionalQueryParams(QueryParams additionalQueryParams)
-
additionalQueryParams
final CompletionCreateParams.Builder additionalQueryParams(Map<String, Iterable<String>> additionalQueryParams)
-
putAdditionalQueryParam
final CompletionCreateParams.Builder putAdditionalQueryParam(String key, String value)
-
putAdditionalQueryParams
final CompletionCreateParams.Builder putAdditionalQueryParams(String key, Iterable<String> values)
-
putAllAdditionalQueryParams
final CompletionCreateParams.Builder putAllAdditionalQueryParams(QueryParams additionalQueryParams)
-
putAllAdditionalQueryParams
final CompletionCreateParams.Builder putAllAdditionalQueryParams(Map<String, Iterable<String>> additionalQueryParams)
-
replaceAdditionalQueryParams
final CompletionCreateParams.Builder replaceAdditionalQueryParams(String key, String value)
-
replaceAdditionalQueryParams
final CompletionCreateParams.Builder replaceAdditionalQueryParams(String key, Iterable<String> values)
-
replaceAllAdditionalQueryParams
final CompletionCreateParams.Builder replaceAllAdditionalQueryParams(QueryParams additionalQueryParams)
-
replaceAllAdditionalQueryParams
final CompletionCreateParams.Builder replaceAllAdditionalQueryParams(Map<String, Iterable<String>> additionalQueryParams)
-
removeAdditionalQueryParams
final CompletionCreateParams.Builder removeAdditionalQueryParams(String key)
-
removeAllAdditionalQueryParams
final CompletionCreateParams.Builder removeAllAdditionalQueryParams(Set<String> keys)
-
build
final CompletionCreateParams build()
Returns an immutable instance of CompletionCreateParams.
Further updates to this Builder will not mutate the returned instance.
The following fields are required:
.maxTokensToSample() .model() .prompt()
-
-
-
-