Class CompletionCreateParams.Body
-
- All Implemented Interfaces:
public final class CompletionCreateParams.Body
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classCompletionCreateParams.Body.BuilderA builder for Body.
-
Method Summary
Modifier and Type Method Description final LongmaxTokensToSample()The maximum number of tokens to generate before stopping. final Modelmodel()The model that will complete your prompt. final Stringprompt()The prompt that you want Claude to complete. final Optional<Metadata>metadata()An object describing metadata about the request. final Optional<List<String>>stopSequences()Sequences that will cause the model to stop generating. final Optional<Double>temperature()Amount of randomness injected into the response. final Optional<Long>topK()Only sample from the top K options for each subsequent token. final Optional<Double>topP()Use nucleus sampling. final JsonField<Long>_maxTokensToSample()Returns the raw JSON value of maxTokensToSample. final JsonField<Model>_model()Returns the raw JSON value of model. final JsonField<String>_prompt()Returns the raw JSON value of prompt. final JsonField<Metadata>_metadata()Returns the raw JSON value of metadata. final JsonField<List<String>>_stopSequences()Returns the raw JSON value of stopSequences. final JsonField<Double>_temperature()Returns the raw JSON value of temperature. final JsonField<Long>_topK()Returns the raw JSON value of topK. final JsonField<Double>_topP()Returns the raw JSON value of topP. final Map<String, JsonValue>_additionalProperties()final CompletionCreateParams.Body.BuildertoBuilder()final CompletionCreateParams.Bodyvalidate()final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static CompletionCreateParams.Body.Builderbuilder()Returns a mutable builder for constructing an instance of Body. -
-
Method Detail
-
maxTokensToSample
final 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.
-
model
final Model model()
The model that will complete your prompt.\n\nSee models for additional details and options.
-
prompt
final 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.
-
stopSequences
final Optional<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.
-
temperature
final Optional<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.
-
topK
final Optional<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.
-
topP
final Optional<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.
-
_maxTokensToSample
final JsonField<Long> _maxTokensToSample()
Returns the raw JSON value of maxTokensToSample.
Unlike maxTokensToSample, this method doesn't throw if the JSON field has an unexpected type.
-
_model
final JsonField<Model> _model()
Returns the raw JSON value of model.
Unlike model, this method doesn't throw if the JSON field has an unexpected type.
-
_prompt
final JsonField<String> _prompt()
Returns the raw JSON value of prompt.
Unlike prompt, this method doesn't throw if the JSON field has an unexpected type.
-
_metadata
final JsonField<Metadata> _metadata()
Returns the raw JSON value of metadata.
Unlike metadata, this method doesn't throw if the JSON field has an unexpected type.
-
_stopSequences
final JsonField<List<String>> _stopSequences()
Returns the raw JSON value of stopSequences.
Unlike stopSequences, this method doesn't throw if the JSON field has an unexpected type.
-
_temperature
final JsonField<Double> _temperature()
Returns the raw JSON value of temperature.
Unlike temperature, this method doesn't throw if the JSON field has an unexpected type.
-
_topK
final JsonField<Long> _topK()
Returns the raw JSON value of topK.
Unlike topK, this method doesn't throw if the JSON field has an unexpected type.
-
_topP
final JsonField<Double> _topP()
Returns the raw JSON value of topP.
Unlike topP, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
toBuilder
final CompletionCreateParams.Body.Builder toBuilder()
-
validate
final CompletionCreateParams.Body validate()
-
builder
final static CompletionCreateParams.Body.Builder builder()
Returns a mutable builder for constructing an instance of Body.
The following fields are required:
.maxTokensToSample() .model() .prompt()
-
-
-
-