Class: OpenAI::Models::Decision

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/decision.rb,
sig/openai/models/decision.rbs

Overview

See Also:

  • OpenAI::Resources::Decisions#create

Defined Under Namespace

Modules: Answer Classes: Usage

Instance Attribute Summary collapse

Attributes inherited from Internal::Type::BaseModel

#last_response

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], #_request_id, #_set_last_response, coerce, #deconstruct_keys, #deep_to_h, dump, #encode_with, 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, coerce_cached, coerce_with_error, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, resolve_type, 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(name:, type: :refusal) ⇒ Decision

Returns a new instance of Decision.

Parameters:

  • answers —

    Answers in question order. Any question can return a refusal instead of an answer; other questions can still receive answers. A refusal has type: "refusal" and the question's name, or null if it was unnamed.

  • model —

    The model used.

  • usage —

    Token usage for the request.

  • answers: (::Array[OpenAI::Models::Decision::answer])
  • model: (String)
  • usage: (OpenAI::Decision::Usage)


# File 'lib/openai/models/decision.rb', line 27

Instance Attribute Details

#answers ⇒ ::Array[OpenAI::Models::Decision::answer]

Answers in question order. Any question can return a refusal instead of an answer; other questions can still receive answers. A refusal has type: "refusal" and the question's name, or null if it was unnamed.

Returns:

  • (::Array[OpenAI::Models::Decision::answer])


13
# File 'lib/openai/models/decision.rb', line 13

required :answers, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Decision::Answer] }

#model ⇒ String

The model used.

Returns:

  • (String)


19
# File 'lib/openai/models/decision.rb', line 19

required :model, String

#usage ⇒ OpenAI::Decision::Usage

Token usage for the request.

Returns:

  • (OpenAI::Decision::Usage)


25
# File 'lib/openai/models/decision.rb', line 25

required :usage, -> { OpenAI::Decision::Usage }

Class Method Details

.variants ⇒ Array(OpenAI::Models::Decision::Answer::Predicate, OpenAI::Models::Decision::Answer::Choice, OpenAI::Models::Decision::Answer::Score, OpenAI::Models::Decision::Answer::Refusal)



# File 'lib/openai/models/decision.rb', line 258

Instance Method Details

#to_hash ⇒ { answers: ::Array[OpenAI::Models::Decision::answer], model: String, usage: OpenAI::Decision::Usage }

Returns:

  • ({ answers: ::Array[OpenAI::Models::Decision::answer], model: String, usage: OpenAI::Decision::Usage })


36
37
38
39
40
# File 'sig/openai/models/decision.rbs', line 36

def to_hash: -> {
  answers: ::Array[OpenAI::Models::Decision::answer],
  model: String,
  usage: OpenAI::Decision::Usage
}