Class: Vellum::SearchNodeResultData

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(results_output_id:, results:, text_output_id:, text: OMIT, additional_properties: nil) ⇒ Vellum::SearchNodeResultData

Parameters:

  • text_output_id (String)
  • text (String) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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

#resultsObject (readonly)

search query.



12
13
14
# File 'lib/vellum_ai/types/search_node_result_data.rb', line 12

def results
  @results
end

#results_output_idString (readonly)

Returns:

  • (String)


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

def results_output_id
  @results_output_id
end

#textString (readonly)

Returns:

  • (String)


16
17
18
# File 'lib/vellum_ai/types/search_node_result_data.rb', line 16

def text
  @text
end

#text_output_idString (readonly)

Returns:

  • (String)


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

Parameters:

  • json_object (String)

Returns:



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

Parameters:

  • obj (Object)

Returns:

  • (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_jsonString

Returns:

  • (String)


67
68
69
# File 'lib/vellum_ai/types/search_node_result_data.rb', line 67

def to_json
  @_field_set&.to_json
end