Class: Vellum::TestSuiteRunExecutionOutput
- Inherits:
-
Object
- Object
- Vellum::TestSuiteRunExecutionOutput
- Defined in:
- lib/vellum_ai/types/test_suite_run_execution_output.rb
Instance Attribute Summary collapse
-
#discriminant ⇒ Object
readonly
Returns the value of attribute discriminant.
-
#member ⇒ Object
readonly
Returns the value of attribute member.
Class Method Summary collapse
- .chat_history(member:) ⇒ TestSuiteRunExecutionOutput
- .error(member:) ⇒ TestSuiteRunExecutionOutput
-
.from_json(json_object:) ⇒ TestSuiteRunExecutionOutput
Deserialize a JSON object to an instance of TestSuiteRunExecutionOutput.
- .json(member:) ⇒ TestSuiteRunExecutionOutput
- .number(member:) ⇒ TestSuiteRunExecutionOutput
- .search_results(member:) ⇒ TestSuiteRunExecutionOutput
- .string(member:) ⇒ TestSuiteRunExecutionOutput
-
.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(member:, discriminant:) ⇒ TestSuiteRunExecutionOutput constructor
-
#is_a?(obj) ⇒ Boolean
For Union Types, is_a? functionality is delegated to the wrapped member.
- #kind_of? ⇒ Object
-
#to_json(*_args) ⇒ JSON
For Union Types, to_json functionality is delegated to the wrapped member.
Constructor Details
#initialize(member:, discriminant:) ⇒ TestSuiteRunExecutionOutput
20 21 22 23 24 25 |
# File 'lib/vellum_ai/types/test_suite_run_execution_output.rb', line 20 def initialize(member:, discriminant:) # @type [Object] @member = member # @type [String] @discriminant = discriminant end |
Instance Attribute Details
#discriminant ⇒ Object (readonly)
Returns the value of attribute discriminant.
13 14 15 |
# File 'lib/vellum_ai/types/test_suite_run_execution_output.rb', line 13 def discriminant @discriminant end |
#member ⇒ Object (readonly)
Returns the value of attribute member.
13 14 15 |
# File 'lib/vellum_ai/types/test_suite_run_execution_output.rb', line 13 def member @member end |
Class Method Details
.chat_history(member:) ⇒ TestSuiteRunExecutionOutput
126 127 128 |
# File 'lib/vellum_ai/types/test_suite_run_execution_output.rb', line 126 def self.chat_history(member:) new(member: member, discriminant: "CHAT_HISTORY") end |
.error(member:) ⇒ TestSuiteRunExecutionOutput
138 139 140 |
# File 'lib/vellum_ai/types/test_suite_run_execution_output.rb', line 138 def self.error(member:) new(member: member, discriminant: "ERROR") end |
.from_json(json_object:) ⇒ TestSuiteRunExecutionOutput
Deserialize a JSON object to an instance of TestSuiteRunExecutionOutput
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/vellum_ai/types/test_suite_run_execution_output.rb', line 31 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) member = case struct.type when "STRING" TestSuiteRunExecutionStringOutput.from_json(json_object: json_object) when "NUMBER" TestSuiteRunExecutionNumberOutput.from_json(json_object: json_object) when "JSON" TestSuiteRunExecutionJsonOutput.from_json(json_object: json_object) when "CHAT_HISTORY" TestSuiteRunExecutionChatHistoryOutput.from_json(json_object: json_object) when "SEARCH_RESULTS" TestSuiteRunExecutionSearchResultsOutput.from_json(json_object: json_object) when "ERROR" TestSuiteRunExecutionErrorOutput.from_json(json_object: json_object) else TestSuiteRunExecutionStringOutput.from_json(json_object: json_object) end new(member: member, discriminant: struct.type) end |
.json(member:) ⇒ TestSuiteRunExecutionOutput
120 121 122 |
# File 'lib/vellum_ai/types/test_suite_run_execution_output.rb', line 120 def self.json(member:) new(member: member, discriminant: "JSON") end |
.number(member:) ⇒ TestSuiteRunExecutionOutput
114 115 116 |
# File 'lib/vellum_ai/types/test_suite_run_execution_output.rb', line 114 def self.number(member:) new(member: member, discriminant: "NUMBER") end |
.search_results(member:) ⇒ TestSuiteRunExecutionOutput
132 133 134 |
# File 'lib/vellum_ai/types/test_suite_run_execution_output.rb', line 132 def self.search_results(member:) new(member: member, discriminant: "SEARCH_RESULTS") end |
.string(member:) ⇒ TestSuiteRunExecutionOutput
108 109 110 |
# File 'lib/vellum_ai/types/test_suite_run_execution_output.rb', line 108 def self.string(member:) new(member: member, discriminant: "STRING") 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.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/vellum_ai/types/test_suite_run_execution_output.rb', line 79 def self.validate_raw(obj:) case obj.type when "STRING" TestSuiteRunExecutionStringOutput.validate_raw(obj: obj) when "NUMBER" TestSuiteRunExecutionNumberOutput.validate_raw(obj: obj) when "JSON" TestSuiteRunExecutionJsonOutput.validate_raw(obj: obj) when "CHAT_HISTORY" TestSuiteRunExecutionChatHistoryOutput.validate_raw(obj: obj) when "SEARCH_RESULTS" TestSuiteRunExecutionSearchResultsOutput.validate_raw(obj: obj) when "ERROR" TestSuiteRunExecutionErrorOutput.validate_raw(obj: obj) else raise("Passed value matched no type within the union, validation failed.") end end |
Instance Method Details
#is_a?(obj) ⇒ Boolean
For Union Types, is_a? functionality is delegated to the wrapped member.
102 103 104 |
# File 'lib/vellum_ai/types/test_suite_run_execution_output.rb', line 102 def is_a?(obj) @member.is_a?(obj) end |
#kind_of? ⇒ Object
16 |
# File 'lib/vellum_ai/types/test_suite_run_execution_output.rb', line 16 alias kind_of? is_a? |
#to_json(*_args) ⇒ JSON
For Union Types, to_json functionality is delegated to the wrapped member.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/vellum_ai/types/test_suite_run_execution_output.rb', line 55 def to_json(*_args) case @discriminant when "STRING" { **@member.to_json, type: @discriminant }.to_json when "NUMBER" { **@member.to_json, type: @discriminant }.to_json when "JSON" { **@member.to_json, type: @discriminant }.to_json when "CHAT_HISTORY" { **@member.to_json, type: @discriminant }.to_json when "SEARCH_RESULTS" { **@member.to_json, type: @discriminant }.to_json when "ERROR" { **@member.to_json, type: @discriminant }.to_json else { "type": @discriminant, value: @member }.to_json end @member.to_json end |