Class: Vellum::TestSuiteRunExecution

Inherits:
Object
  • Object
show all
Defined in:
lib/vellum_ai/types/test_suite_run_execution.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, test_case_id:, outputs:, metric_results:, additional_properties: nil) ⇒ TestSuiteRunExecution

Parameters:



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/vellum_ai/types/test_suite_run_execution.rb', line 17

def initialize(id:, test_case_id:, outputs:, metric_results:, additional_properties: nil)
  # @type [String]
  @id = id
  # @type [String]
  @test_case_id = test_case_id
  # @type [Array<TestSuiteRunExecutionOutput>]
  @outputs = outputs
  # @type [Array<TestSuiteRunExecutionMetricResult>]
  @metric_results = metric_results
  # @type [OpenStruct] Additional properties unmapped to the current class definition
  @additional_properties = additional_properties
end

Instance Attribute Details

#additional_propertiesObject (readonly)

Returns the value of attribute additional_properties.



9
10
11
# File 'lib/vellum_ai/types/test_suite_run_execution.rb', line 9

def additional_properties
  @additional_properties
end

#idObject (readonly)

Returns the value of attribute id.



9
10
11
# File 'lib/vellum_ai/types/test_suite_run_execution.rb', line 9

def id
  @id
end

#metric_resultsObject (readonly)

Returns the value of attribute metric_results.



9
10
11
# File 'lib/vellum_ai/types/test_suite_run_execution.rb', line 9

def metric_results
  @metric_results
end

#outputsObject (readonly)

Returns the value of attribute outputs.



9
10
11
# File 'lib/vellum_ai/types/test_suite_run_execution.rb', line 9

def outputs
  @outputs
end

#test_case_idObject (readonly)

Returns the value of attribute test_case_id.



9
10
11
# File 'lib/vellum_ai/types/test_suite_run_execution.rb', line 9

def test_case_id
  @test_case_id
end

Class Method Details

.from_json(json_object:) ⇒ TestSuiteRunExecution

Deserialize a JSON object to an instance of TestSuiteRunExecution

Parameters:

  • json_object (JSON)

Returns:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/vellum_ai/types/test_suite_run_execution.rb', line 34

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = struct.id
  test_case_id = struct.test_case_id
  outputs = parsed_json["outputs"].map do |v|
    v = v.to_json
    TestSuiteRunExecutionOutput.from_json(json_object: v)
  end
  metric_results = parsed_json["metric_results"].map do |v|
    v = v.to_json
    TestSuiteRunExecutionMetricResult.from_json(json_object: v)
  end
  new(id: id, test_case_id: test_case_id, outputs: outputs, metric_results: metric_results,
      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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


62
63
64
65
66
67
# File 'lib/vellum_ai/types/test_suite_run_execution.rb', line 62

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.test_case_id.is_a?(String) != false || raise("Passed value for field obj.test_case_id is not the expected type, validation failed.")
  obj.outputs.is_a?(Array) != false || raise("Passed value for field obj.outputs is not the expected type, validation failed.")
  obj.metric_results.is_a?(Array) != false || raise("Passed value for field obj.metric_results is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ JSON

Serialize an instance of TestSuiteRunExecution to a JSON object

Returns:

  • (JSON)


54
55
56
# File 'lib/vellum_ai/types/test_suite_run_execution.rb', line 54

def to_json(*_args)
  { "id": @id, "test_case_id": @test_case_id, "outputs": @outputs, "metric_results": @metric_results }.to_json
end