Class: Anthropic::Models::Completion

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/anthropic/models/completion.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

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(id: , completion: , model: , stop_reason: , type: :completion) ⇒ void

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

Parameters:

  • id (String) (defaults to: )

    Unique object identifier.

  • completion (String) (defaults to: )

    The resulting completion up to and excluding the stop sequences.

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

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

  • stop_reason (String, nil) (defaults to: )

    The reason that we stopped.

  • type (Symbol, :completion) (defaults to: :completion)

    Object type.



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

Instance Attribute Details

#completionString

The resulting completion up to and excluding the stop sequences.

Returns:

  • (String)


21
# File 'lib/anthropic/models/completion.rb', line 21

required :completion, String

#idString

Unique object identifier.

The format and length of IDs may change over time.

Returns:

  • (String)


15
# File 'lib/anthropic/models/completion.rb', line 15

required :id, String

#modelSymbol, ...

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

Returns:



29
# File 'lib/anthropic/models/completion.rb', line 29

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

#stop_reasonString?

The reason that we stopped.

This may be one the following values:

  • "stop_sequence": we reached a stop sequence — either provided by you via the stop_sequences parameter, or a stop sequence built into the model
  • "max_tokens": we exceeded max_tokens_to_sample or the model's maximum

Returns:

  • (String, nil)


41
# File 'lib/anthropic/models/completion.rb', line 41

required :stop_reason, String, nil?: true

#typeSymbol, :completion

Object type.

For Text Completions, this is always "completion".

Returns:

  • (Symbol, :completion)


49
# File 'lib/anthropic/models/completion.rb', line 49

required :type, const: :completion