Class: Vellum::SearchNodeResultData
- Inherits:
-
Object
- Object
- Vellum::SearchNodeResultData
- Defined in:
- lib/vellum_ai/types/search_node_result_data.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#results ⇒ Object
readonly
search query.
- #results_output_id ⇒ String readonly
- #text ⇒ String readonly
- #text_output_id ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(results_output_id:, results:, text_output_id:, text: OMIT, additional_properties: nil) ⇒ Vellum::SearchNodeResultData constructor
- #to_json ⇒ String
Constructor Details
#initialize(results_output_id:, results:, text_output_id:, text: OMIT, additional_properties: nil) ⇒ Vellum::SearchNodeResultData
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/vellum_ai/types/search_node_result_data.rb', line 32 def initialize(results_output_id:, results:, text_output_id:, text: OMIT, additional_properties: nil) @results_output_id = results_output_id @results = results @text_output_id = text_output_id @text = text if text != OMIT @additional_properties = additional_properties @_field_set = { "results_output_id": results_output_id, "results": results, "text_output_id": text_output_id, "text": text }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
18 19 20 |
# File 'lib/vellum_ai/types/search_node_result_data.rb', line 18 def additional_properties @additional_properties end |
#results ⇒ Object (readonly)
search query.
12 13 14 |
# File 'lib/vellum_ai/types/search_node_result_data.rb', line 12 def results @results end |
#results_output_id ⇒ String (readonly)
9 10 11 |
# File 'lib/vellum_ai/types/search_node_result_data.rb', line 9 def results_output_id @results_output_id end |
#text ⇒ String (readonly)
16 17 18 |
# File 'lib/vellum_ai/types/search_node_result_data.rb', line 16 def text @text end |
#text_output_id ⇒ String (readonly)
14 15 16 |
# File 'lib/vellum_ai/types/search_node_result_data.rb', line 14 def text_output_id @text_output_id end |
Class Method Details
.from_json(json_object:) ⇒ Vellum::SearchNodeResultData
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/vellum_ai/types/search_node_result_data.rb', line 46 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) results_output_id = parsed_json["results_output_id"] results = parsed_json["results"]&.map do | item | item = item.to_json Vellum::SearchResult.from_json(json_object: item) end text_output_id = parsed_json["text_output_id"] text = parsed_json["text"] new( results_output_id: results_output_id, results: results, text_output_id: text_output_id, text: text, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
76 77 78 79 80 81 |
# File 'lib/vellum_ai/types/search_node_result_data.rb', line 76 def self.validate_raw(obj:) obj.results_output_id.is_a?(String) != false || raise("Passed value for field obj.results_output_id is not the expected type, validation failed.") obj.results.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.") 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.") end |
Instance Method Details
#to_json ⇒ String
67 68 69 |
# File 'lib/vellum_ai/types/search_node_result_data.rb', line 67 def to_json @_field_set&.to_json end |