Class: Vellum::ApiNodeResultData
- Inherits:
-
Object
- Object
- Vellum::ApiNodeResultData
- Defined in:
- lib/vellum_ai/types/api_node_result_data.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#json ⇒ Object
readonly
Returns the value of attribute json.
-
#json_output_id ⇒ Object
readonly
Returns the value of attribute json_output_id.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
-
#status_code_output_id ⇒ Object
readonly
Returns the value of attribute status_code_output_id.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#text_output_id ⇒ Object
readonly
Returns the value of attribute text_output_id.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ ApiNodeResultData
Deserialize a JSON object to an instance of ApiNodeResultData.
-
.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(text_output_id:, json_output_id:, status_code_output_id:, status_code:, text: nil, json: nil, additional_properties: nil) ⇒ ApiNodeResultData constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of ApiNodeResultData to a JSON object.
Constructor Details
#initialize(text_output_id:, json_output_id:, status_code_output_id:, status_code:, text: nil, json: nil, additional_properties: nil) ⇒ ApiNodeResultData
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/vellum_ai/types/api_node_result_data.rb', line 18 def initialize(text_output_id:, json_output_id:, status_code_output_id:, status_code:, text: nil, json: nil, additional_properties: nil) # @type [String] @text_output_id = text_output_id # @type [String] @text = text # @type [String] @json_output_id = json_output_id # @type [Hash{String => String}] @json = json # @type [String] @status_code_output_id = status_code_output_id # @type [Integer] @status_code = status_code # @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.
7 8 9 |
# File 'lib/vellum_ai/types/api_node_result_data.rb', line 7 def additional_properties @additional_properties end |
#json ⇒ Object (readonly)
Returns the value of attribute json.
7 8 9 |
# File 'lib/vellum_ai/types/api_node_result_data.rb', line 7 def json @json end |
#json_output_id ⇒ Object (readonly)
Returns the value of attribute json_output_id.
7 8 9 |
# File 'lib/vellum_ai/types/api_node_result_data.rb', line 7 def json_output_id @json_output_id end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
7 8 9 |
# File 'lib/vellum_ai/types/api_node_result_data.rb', line 7 def status_code @status_code end |
#status_code_output_id ⇒ Object (readonly)
Returns the value of attribute status_code_output_id.
7 8 9 |
# File 'lib/vellum_ai/types/api_node_result_data.rb', line 7 def status_code_output_id @status_code_output_id end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
7 8 9 |
# File 'lib/vellum_ai/types/api_node_result_data.rb', line 7 def text @text end |
#text_output_id ⇒ Object (readonly)
Returns the value of attribute text_output_id.
7 8 9 |
# File 'lib/vellum_ai/types/api_node_result_data.rb', line 7 def text_output_id @text_output_id end |
Class Method Details
.from_json(json_object:) ⇒ ApiNodeResultData
Deserialize a JSON object to an instance of ApiNodeResultData
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/vellum_ai/types/api_node_result_data.rb', line 40 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) JSON.parse(json_object) text_output_id = struct.text_output_id text = struct.text json_output_id = struct.json_output_id json = struct.json status_code_output_id = struct.status_code_output_id status_code = struct.status_code new(text_output_id: text_output_id, text: text, json_output_id: json_output_id, json: json, status_code_output_id: status_code_output_id, status_code: status_code, 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.
71 72 73 74 75 76 77 78 |
# File 'lib/vellum_ai/types/api_node_result_data.rb', line 71 def self.validate_raw(obj:) obj.text_output_id.is_a?(String) != false || raise("Passed value for field obj.text_output_id is not the expected type, validation failed.") obj.text&.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.") obj.json_output_id.is_a?(String) != false || raise("Passed value for field obj.json_output_id is not the expected type, validation failed.") obj.json&.is_a?(Hash) != false || raise("Passed value for field obj.json is not the expected type, validation failed.") obj.status_code_output_id.is_a?(String) != false || raise("Passed value for field obj.status_code_output_id is not the expected type, validation failed.") obj.status_code.is_a?(Integer) != false || raise("Passed value for field obj.status_code is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of ApiNodeResultData to a JSON object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/vellum_ai/types/api_node_result_data.rb', line 56 def to_json(*_args) { "text_output_id": @text_output_id, "text": @text, "json_output_id": @json_output_id, "json": @json, "status_code_output_id": @status_code_output_id, "status_code": @status_code }.to_json end |