Class: Vellum::SandboxScenario
- Inherits:
-
Object
- Object
- Vellum::SandboxScenario
- Defined in:
- lib/vellum_ai/types/sandbox_scenario.rb
Overview
Sandbox Scenario
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#id ⇒ String
readonly
The id of the scenario.
-
#inputs ⇒ Array<Vellum::ScenarioInput>
readonly
The inputs for the scenario.
- #label ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(label: OMIT, inputs:, id:, additional_properties: nil) ⇒ Vellum::SandboxScenario constructor
- #to_json ⇒ String
Constructor Details
#initialize(label: OMIT, inputs:, id:, additional_properties: nil) ⇒ Vellum::SandboxScenario
28 29 30 31 32 33 34 35 36 |
# File 'lib/vellum_ai/types/sandbox_scenario.rb', line 28 def initialize(label: OMIT, inputs:, id:, additional_properties: nil) @label = label if label != OMIT @inputs = inputs @id = id @additional_properties = additional_properties @_field_set = { "label": label, "inputs": inputs, "id": id }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
16 17 18 |
# File 'lib/vellum_ai/types/sandbox_scenario.rb', line 16 def additional_properties @additional_properties end |
#id ⇒ String (readonly)
Returns The id of the scenario.
14 15 16 |
# File 'lib/vellum_ai/types/sandbox_scenario.rb', line 14 def id @id end |
#inputs ⇒ Array<Vellum::ScenarioInput> (readonly)
Returns The inputs for the scenario.
12 13 14 |
# File 'lib/vellum_ai/types/sandbox_scenario.rb', line 12 def inputs @inputs end |
#label ⇒ String (readonly)
10 11 12 |
# File 'lib/vellum_ai/types/sandbox_scenario.rb', line 10 def label @label end |
Class Method Details
.from_json(json_object:) ⇒ Vellum::SandboxScenario
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/vellum_ai/types/sandbox_scenario.rb', line 41 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) label = parsed_json["label"] inputs = parsed_json["inputs"]&.map do | item | item = item.to_json Vellum::ScenarioInput.from_json(json_object: item) end id = parsed_json["id"] new( label: label, inputs: inputs, id: id, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
69 70 71 72 73 |
# File 'lib/vellum_ai/types/sandbox_scenario.rb', line 69 def self.validate_raw(obj:) obj.label&.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.") obj.inputs.is_a?(Array) != false || raise("Passed value for field obj.inputs is not the expected type, validation failed.") obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
60 61 62 |
# File 'lib/vellum_ai/types/sandbox_scenario.rb', line 60 def to_json @_field_set&.to_json end |