Class: Vellum::PromptNodeResultData
- Inherits:
-
Object
- Object
- Vellum::PromptNodeResultData
- Defined in:
- lib/vellum_ai/types/prompt_node_result_data.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#array_output_id ⇒ Object
readonly
Returns the value of attribute array_output_id.
-
#delta ⇒ Object
readonly
Returns the value of attribute delta.
-
#output_id ⇒ Object
readonly
Returns the value of attribute output_id.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ PromptNodeResultData
Deserialize a JSON object to an instance of PromptNodeResultData.
-
.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(output_id:, array_output_id: nil, text: nil, delta: nil, additional_properties: nil) ⇒ PromptNodeResultData constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of PromptNodeResultData to a JSON object.
Constructor Details
#initialize(output_id:, array_output_id: nil, text: nil, delta: nil, additional_properties: nil) ⇒ PromptNodeResultData
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/vellum_ai/types/prompt_node_result_data.rb', line 15 def initialize(output_id:, array_output_id: nil, text: nil, delta: nil, additional_properties: nil) # @type [String] @output_id = output_id # @type [String] @array_output_id = array_output_id # @type [String] @text = text # @type [String] @delta = delta # @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/prompt_node_result_data.rb', line 7 def additional_properties @additional_properties end |
#array_output_id ⇒ Object (readonly)
Returns the value of attribute array_output_id.
7 8 9 |
# File 'lib/vellum_ai/types/prompt_node_result_data.rb', line 7 def array_output_id @array_output_id end |
#delta ⇒ Object (readonly)
Returns the value of attribute delta.
7 8 9 |
# File 'lib/vellum_ai/types/prompt_node_result_data.rb', line 7 def delta @delta end |
#output_id ⇒ Object (readonly)
Returns the value of attribute output_id.
7 8 9 |
# File 'lib/vellum_ai/types/prompt_node_result_data.rb', line 7 def output_id @output_id end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
7 8 9 |
# File 'lib/vellum_ai/types/prompt_node_result_data.rb', line 7 def text @text end |
Class Method Details
.from_json(json_object:) ⇒ PromptNodeResultData
Deserialize a JSON object to an instance of PromptNodeResultData
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/vellum_ai/types/prompt_node_result_data.rb', line 32 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) JSON.parse(json_object) output_id = struct.output_id array_output_id = struct.array_output_id text = struct.text delta = struct.delta new(output_id: output_id, array_output_id: array_output_id, text: text, delta: delta, 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.
54 55 56 57 58 59 |
# File 'lib/vellum_ai/types/prompt_node_result_data.rb', line 54 def self.validate_raw(obj:) obj.output_id.is_a?(String) != false || raise("Passed value for field obj.output_id is not the expected type, validation failed.") obj.array_output_id&.is_a?(String) != false || raise("Passed value for field obj.array_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.delta&.is_a?(String) != false || raise("Passed value for field obj.delta is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of PromptNodeResultData to a JSON object
46 47 48 |
# File 'lib/vellum_ai/types/prompt_node_result_data.rb', line 46 def to_json(*_args) { "output_id": @output_id, "array_output_id": @array_output_id, "text": @text, "delta": @delta }.to_json end |