Class: Vellum::ApiNodeResultData

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text_output_id:, json_output_id:, status_code_output_id:, status_code:, text: nil, json: nil, additional_properties: nil) ⇒ ApiNodeResultData

Parameters:

  • text_output_id (String)
  • text (String) (defaults to: nil)
  • json_output_id (String)
  • json (Hash{String => String}) (defaults to: nil)
  • status_code_output_id (String)
  • status_code (Integer)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesObject (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

#jsonObject (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_idObject (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_codeObject (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_idObject (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

#textObject (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_idObject (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

Parameters:

  • json_object (JSON)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (JSON)


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