Class: Vellum::WorkflowExecutionNodeResultEvent

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

Overview

A NODE-level event emitted from the workflow’s execution.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(execution_id:, data:, run_id: nil, external_id: nil, additional_properties: nil) ⇒ WorkflowExecutionNodeResultEvent

Parameters:

  • execution_id (String)
  • run_id (String) (defaults to: nil)
  • external_id (String) (defaults to: nil)
  • data (WorkflowNodeResultEvent)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/vellum_ai/types/workflow_execution_node_result_event.rb', line 17

def initialize(execution_id:, data:, run_id: nil, external_id: nil, additional_properties: nil)
  # @type [String]
  @execution_id = execution_id
  # @type [String]
  @run_id = run_id
  # @type [String]
  @external_id = external_id
  # @type [WorkflowNodeResultEvent]
  @data = data
  # @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.



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

def additional_properties
  @additional_properties
end

#dataObject (readonly)

Returns the value of attribute data.



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

def data
  @data
end

#execution_idObject (readonly)

Returns the value of attribute execution_id.



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

def execution_id
  @execution_id
end

#external_idObject (readonly)

Returns the value of attribute external_id.



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

def external_id
  @external_id
end

#run_idObject (readonly)

Returns the value of attribute run_id.



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

def run_id
  @run_id
end

Class Method Details

.from_json(json_object:) ⇒ WorkflowExecutionNodeResultEvent

Deserialize a JSON object to an instance of WorkflowExecutionNodeResultEvent

Parameters:

  • json_object (JSON)

Returns:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/vellum_ai/types/workflow_execution_node_result_event.rb', line 34

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  execution_id = struct.execution_id
  run_id = struct.run_id
  external_id = struct.external_id
  if parsed_json["data"].nil?
    data = nil
  else
    data = parsed_json["data"].to_json
    data = WorkflowNodeResultEvent.from_json(json_object: data)
  end
  new(execution_id: execution_id, run_id: run_id, external_id: external_id, data: data,
      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)


61
62
63
64
65
66
# File 'lib/vellum_ai/types/workflow_execution_node_result_event.rb', line 61

def self.validate_raw(obj:)
  obj.execution_id.is_a?(String) != false || raise("Passed value for field obj.execution_id is not the expected type, validation failed.")
  obj.run_id&.is_a?(String) != false || raise("Passed value for field obj.run_id is not the expected type, validation failed.")
  obj.external_id&.is_a?(String) != false || raise("Passed value for field obj.external_id is not the expected type, validation failed.")
  WorkflowNodeResultEvent.validate_raw(obj: obj.data)
end

Instance Method Details

#to_json(*_args) ⇒ JSON

Serialize an instance of WorkflowExecutionNodeResultEvent to a JSON object

Returns:

  • (JSON)


53
54
55
# File 'lib/vellum_ai/types/workflow_execution_node_result_event.rb', line 53

def to_json(*_args)
  { "execution_id": @execution_id, "run_id": @run_id, "external_id": @external_id, "data": @data }.to_json
end