class Anthropic::Resources::Completions
def create(params)
- See: Anthropic::Models::CompletionCreateParams -
Returns:
-
(Anthropic::Models::Completion)
-
Parameters:
-
request_options
(Anthropic::RequestOptions, Hash{Symbol=>Object}, nil
) -- -
betas
(Array
) -- Header param: Optional header to specify the beta version(s) you want to use. -
top_p
(Float
) -- Body param: Use nucleus sampling. -
top_k
(Integer
) -- Body param: Only sample from the top K options for each subsequent token. -
temperature
(Float
) -- Body param: Amount of randomness injected into the response. -
stop_sequences
(Array
) -- Body param: Sequences that will cause the model to stop generating. -
metadata
(Anthropic::Models::Metadata
) -- Body param: An object describing metadata about the request. -
prompt
(String
) -- Body param: The prompt that you want Claude to complete. -
model
(Symbol, String, Anthropic::Models::Model
) -- Body param: The model that will complete your prompt.\n\nSee [models](https://do -
max_tokens_to_sample
(Integer
) -- Body param: The maximum number of tokens to generate before stopping.
Overloads:
-
create(max_tokens_to_sample:, model:, prompt:, metadata: nil, stop_sequences: nil, temperature: nil, top_k: nil, top_p: nil, betas: nil, request_options: {})
def create(params) parsed, options = Anthropic::CompletionCreateParams.dump_request(params) if parsed[:stream] message = "Please use `#create_streaming` for the streaming use case." raise ArgumentError.new(message) end header_params = {betas: "anthropic-beta"} @client.request( method: :post, path: "v1/complete", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Anthropic::Completion, options: {timeout: 600, **options} ) end