Class: Anthropic::Models::CompletionCreateParams

Inherits:
Internal::Type::BaseModel show all
Extended by:
Internal::Type::RequestParameters::Converter
Includes:
Internal::Type::RequestParameters
Defined in:
lib/anthropic/models/completion_create_params.rb

Overview

Instance Attribute Summary collapse

Attributes included from Internal::Type::RequestParameters

#request_options

Instance Method Summary collapse

Methods included from Internal::Type::RequestParameters::Converter

dump_request

Methods included from Internal::Type::RequestParameters

included

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(max_tokens_to_sample: , model: , prompt: , metadata: nil, stop_sequences: nil, temperature: nil, top_k: nil, top_p: nil, betas: nil, request_options: {}) ⇒ void

Some parameter documentations has been truncated, see Anthropic::Models::CompletionCreateParams for more details.

Parameters:

  • max_tokens_to_sample (Integer) (defaults to: )

    The maximum number of tokens to generate before stopping.

  • model (Symbol, String, Anthropic::Models::Model) (defaults to: )

    The model that will complete your prompt.\n\nSee [models](https://docs.anthropic

  • prompt (String) (defaults to: )

    The prompt that you want Claude to complete.

  • metadata (Anthropic::Models::Metadata) (defaults to: nil)

    An object describing metadata about the request.

  • stop_sequences (Array<String>) (defaults to: nil)

    Sequences that will cause the model to stop generating.

  • temperature (Float) (defaults to: nil)

    Amount of randomness injected into the response.

  • top_k (Integer) (defaults to: nil)

    Only sample from the top K options for each subsequent token.

  • top_p (Float) (defaults to: nil)

    Use nucleus sampling.

  • betas (Array<String, Symbol, Anthropic::Models::AnthropicBeta>) (defaults to: nil)

    Optional header to specify the beta version(s) you want to use.

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}) (defaults to: {})


# File 'lib/anthropic/models/completion_create_params.rb', line 108

Instance Attribute Details

#betasArray<String, Symbol, Anthropic::Models::AnthropicBeta>?

Optional header to specify the beta version(s) you want to use.

Returns:



106
# File 'lib/anthropic/models/completion_create_params.rb', line 106

optional :betas, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::AnthropicBeta] }

#max_tokens_to_sampleInteger

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.

Returns:

  • (Integer)


19
# File 'lib/anthropic/models/completion_create_params.rb', line 19

required :max_tokens_to_sample, Integer

#metadataAnthropic::Models::Metadata?

An object describing metadata about the request.

Returns:



51
# File 'lib/anthropic/models/completion_create_params.rb', line 51

optional :metadata, -> { Anthropic::Metadata }

#modelSymbol, ...

The model that will complete your prompt.\n\nSee models for additional details and options.

Returns:



27
# File 'lib/anthropic/models/completion_create_params.rb', line 27

required :model, union: -> { Anthropic::Model }

#promptString

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.

Returns:

  • (String)


45
# File 'lib/anthropic/models/completion_create_params.rb', line 45

required :prompt, String

#stop_sequencesArray<String>?

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.

Returns:

  • (Array<String>, nil)


61
# File 'lib/anthropic/models/completion_create_params.rb', line 61

optional :stop_sequences, Anthropic::Internal::Type::ArrayOf[String]

#temperatureFloat?

Amount of randomness injected into the response.

Defaults to 1.0. Ranges from 0.0 to 1.0. Use temperature closer to 0.0 for analytical / multiple choice, and closer to 1.0 for creative and generative tasks.

Note that even with temperature of 0.0, the results will not be fully deterministic.

Returns:

  • (Float, nil)


74
# File 'lib/anthropic/models/completion_create_params.rb', line 74

optional :temperature, Float

#top_kInteger?

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.

Returns:

  • (Integer, nil)


86
# File 'lib/anthropic/models/completion_create_params.rb', line 86

optional :top_k, Integer

#top_pFloat?

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 alter temperature or top_p, but not both.

Recommended for advanced use cases only. You usually only need to use temperature.

Returns:

  • (Float, nil)


100
# File 'lib/anthropic/models/completion_create_params.rb', line 100

optional :top_p, Float