Class: Vellum::PromptNodeResultData

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output_id:, array_output_id: nil, text: nil, delta: nil, additional_properties: nil) ⇒ PromptNodeResultData

Parameters:

  • output_id (String)
  • array_output_id (String) (defaults to: nil)
  • text (String) (defaults to: nil)
  • delta (String) (defaults to: nil)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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

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

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

Parameters:

  • json_object (JSON)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (JSON)


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