Class: Vellum::TestSuiteTestCase
- Inherits:
-
Object
- Object
- Vellum::TestSuiteTestCase
- Defined in:
- lib/vellum_ai/types/test_suite_test_case.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#evaluation_values ⇒ Object
readonly
Returns the value of attribute evaluation_values.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#input_values ⇒ Object
readonly
Returns the value of attribute input_values.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ TestSuiteTestCase
Deserialize a JSON object to an instance of TestSuiteTestCase.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(input_values:, evaluation_values:, id: nil, label: nil, additional_properties: nil) ⇒ TestSuiteTestCase constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of TestSuiteTestCase to a JSON object.
Constructor Details
#initialize(input_values:, evaluation_values:, id: nil, label: nil, additional_properties: nil) ⇒ TestSuiteTestCase
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/vellum_ai/types/test_suite_test_case.rb', line 16 def initialize(input_values:, evaluation_values:, id: nil, label: nil, additional_properties: nil) # @type [String] @id = id # @type [String] @label = label # @type [Array<TestCaseVariableValue>] @input_values = input_values # @type [Array<TestCaseVariableValue>] @evaluation_values = evaluation_values # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end |
Instance Attribute Details
#additional_properties ⇒ Object (readonly)
Returns the value of attribute additional_properties.
8 9 10 |
# File 'lib/vellum_ai/types/test_suite_test_case.rb', line 8 def additional_properties @additional_properties end |
#evaluation_values ⇒ Object (readonly)
Returns the value of attribute evaluation_values.
8 9 10 |
# File 'lib/vellum_ai/types/test_suite_test_case.rb', line 8 def evaluation_values @evaluation_values end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/vellum_ai/types/test_suite_test_case.rb', line 8 def id @id end |
#input_values ⇒ Object (readonly)
Returns the value of attribute input_values.
8 9 10 |
# File 'lib/vellum_ai/types/test_suite_test_case.rb', line 8 def input_values @input_values end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
8 9 10 |
# File 'lib/vellum_ai/types/test_suite_test_case.rb', line 8 def label @label end |
Class Method Details
.from_json(json_object:) ⇒ TestSuiteTestCase
Deserialize a JSON object to an instance of TestSuiteTestCase
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/vellum_ai/types/test_suite_test_case.rb', line 33 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = struct.id label = struct.label input_values = parsed_json["input_values"].map do |v| v = v.to_json TestCaseVariableValue.from_json(json_object: v) end evaluation_values = parsed_json["evaluation_values"].map do |v| v = v.to_json TestCaseVariableValue.from_json(json_object: v) end new(id: id, label: label, input_values: input_values, evaluation_values: evaluation_values, additional_properties: struct) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
61 62 63 64 65 66 |
# File 'lib/vellum_ai/types/test_suite_test_case.rb', line 61 def self.validate_raw(obj:) obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.label&.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.") obj.input_values.is_a?(Array) != false || raise("Passed value for field obj.input_values is not the expected type, validation failed.") obj.evaluation_values.is_a?(Array) != false || raise("Passed value for field obj.evaluation_values is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of TestSuiteTestCase to a JSON object
53 54 55 |
# File 'lib/vellum_ai/types/test_suite_test_case.rb', line 53 def to_json(*_args) { "id": @id, "label": @label, "input_values": @input_values, "evaluation_values": @evaluation_values }.to_json end |