Class: Vellum::InitiatedWorkflowNodeResultEvent

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

Overview

An event that indicates that the node has initiated its execution.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, node_id:, node_result_id:, ts: nil, data: nil, source_execution_id: nil, input_values: nil, additional_properties: nil) ⇒ InitiatedWorkflowNodeResultEvent

Parameters:

  • id (String)
  • node_id (String)
  • node_result_id (String)
  • ts (DateTime) (defaults to: nil)
  • data (WorkflowNodeResultData) (defaults to: nil)
  • source_execution_id (String) (defaults to: nil)
  • input_values (Array<NodeInputVariableCompiledValue>) (defaults to: nil)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/vellum_ai/types/initiated_workflow_node_result_event.rb', line 22

def initialize(id:, node_id:, node_result_id:, ts: nil, data: nil, source_execution_id: nil, input_values: nil,
               additional_properties: nil)
  # @type [String]
  @id = id
  # @type [String]
  @node_id = node_id
  # @type [String]
  @node_result_id = node_result_id
  # @type [DateTime]
  @ts = ts
  # @type [WorkflowNodeResultData]
  @data = data
  # @type [String]
  @source_execution_id = source_execution_id
  # @type [Array<NodeInputVariableCompiledValue>]
  @input_values = input_values
  # @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.



11
12
13
# File 'lib/vellum_ai/types/initiated_workflow_node_result_event.rb', line 11

def additional_properties
  @additional_properties
end

#dataObject (readonly)

Returns the value of attribute data.



11
12
13
# File 'lib/vellum_ai/types/initiated_workflow_node_result_event.rb', line 11

def data
  @data
end

#idObject (readonly)

Returns the value of attribute id.



11
12
13
# File 'lib/vellum_ai/types/initiated_workflow_node_result_event.rb', line 11

def id
  @id
end

#input_valuesObject (readonly)

Returns the value of attribute input_values.



11
12
13
# File 'lib/vellum_ai/types/initiated_workflow_node_result_event.rb', line 11

def input_values
  @input_values
end

#node_idObject (readonly)

Returns the value of attribute node_id.



11
12
13
# File 'lib/vellum_ai/types/initiated_workflow_node_result_event.rb', line 11

def node_id
  @node_id
end

#node_result_idObject (readonly)

Returns the value of attribute node_result_id.



11
12
13
# File 'lib/vellum_ai/types/initiated_workflow_node_result_event.rb', line 11

def node_result_id
  @node_result_id
end

#source_execution_idObject (readonly)

Returns the value of attribute source_execution_id.



11
12
13
# File 'lib/vellum_ai/types/initiated_workflow_node_result_event.rb', line 11

def source_execution_id
  @source_execution_id
end

#tsObject (readonly)

Returns the value of attribute ts.



11
12
13
# File 'lib/vellum_ai/types/initiated_workflow_node_result_event.rb', line 11

def ts
  @ts
end

Class Method Details

.from_json(json_object:) ⇒ InitiatedWorkflowNodeResultEvent

Deserialize a JSON object to an instance of InitiatedWorkflowNodeResultEvent

Parameters:

  • json_object (JSON)

Returns:



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/vellum_ai/types/initiated_workflow_node_result_event.rb', line 46

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = struct.id
  node_id = struct.node_id
  node_result_id = struct.node_result_id
  ts = DateTime.parse(parsed_json["ts"])
  if parsed_json["data"].nil?
    data = nil
  else
    data = parsed_json["data"].to_json
    data = WorkflowNodeResultData.from_json(json_object: data)
  end
  source_execution_id = struct.source_execution_id
  input_values = parsed_json["input_values"].map do |v|
    v = v.to_json
    NodeInputVariableCompiledValue.from_json(json_object: v)
  end
  new(id: id, node_id: node_id, node_result_id: node_result_id, ts: ts, data: data,
      source_execution_id: source_execution_id, input_values: input_values, 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)


87
88
89
90
91
92
93
94
95
# File 'lib/vellum_ai/types/initiated_workflow_node_result_event.rb', line 87

def self.validate_raw(obj:)
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.node_id.is_a?(String) != false || raise("Passed value for field obj.node_id is not the expected type, validation failed.")
  obj.node_result_id.is_a?(String) != false || raise("Passed value for field obj.node_result_id is not the expected type, validation failed.")
  obj.ts&.is_a?(DateTime) != false || raise("Passed value for field obj.ts is not the expected type, validation failed.")
  obj.data.nil? || WorkflowNodeResultData.validate_raw(obj: obj.data)
  obj.source_execution_id&.is_a?(String) != false || raise("Passed value for field obj.source_execution_id is not the expected type, validation failed.")
  obj.input_values&.is_a?(Array) != false || raise("Passed value for field obj.input_values is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ JSON

Serialize an instance of InitiatedWorkflowNodeResultEvent to a JSON object

Returns:

  • (JSON)


71
72
73
74
75
76
77
78
79
80
81
# File 'lib/vellum_ai/types/initiated_workflow_node_result_event.rb', line 71

def to_json(*_args)
  {
    "id": @id,
    "node_id": @node_id,
    "node_result_id": @node_result_id,
    "ts": @ts,
    "data": @data,
    "source_execution_id": @source_execution_id,
    "input_values": @input_values
  }.to_json
end