Class: Vellum::FulfilledWorkflowNodeResultEvent

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

Overview

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, node_id:, node_result_id:, state:, ts: OMIT, data: OMIT, source_execution_id: OMIT, output_values:, mocked: OMIT, additional_properties: nil) ⇒ Vellum::FulfilledWorkflowNodeResultEvent

Parameters:

  • id (String)
  • node_id (String)
  • node_result_id (String)
  • state (String)
  • ts (DateTime) (defaults to: OMIT)
  • data (Vellum::WorkflowNodeResultData) (defaults to: OMIT)
  • source_execution_id (String) (defaults to: OMIT)
  • output_values (Array<Vellum::NodeOutputCompiledValue>)
  • mocked (Boolean) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/vellum_ai/types/fulfilled_workflow_node_result_event.rb', line 48

def initialize(id:, node_id:, node_result_id:, state:, ts: OMIT, data: OMIT, source_execution_id: OMIT, output_values:, mocked: OMIT, additional_properties: nil)
  @id = id
  @node_id = node_id
  @node_result_id = node_result_id
  @state = state
  @ts = ts if ts != OMIT
  @data = data if data != OMIT
  @source_execution_id = source_execution_id if source_execution_id != OMIT
  @output_values = output_values
  @mocked = mocked if mocked != OMIT
  @additional_properties = additional_properties
  @_field_set = { "id": id, "node_id": node_id, "node_result_id": node_result_id, "state": state, "ts": ts, "data": data, "source_execution_id": source_execution_id, "output_values": output_values, "mocked": mocked }.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



30
31
32
# File 'lib/vellum_ai/types/fulfilled_workflow_node_result_event.rb', line 30

def additional_properties
  @additional_properties
end

#dataVellum::WorkflowNodeResultData (readonly)



22
23
24
# File 'lib/vellum_ai/types/fulfilled_workflow_node_result_event.rb', line 22

def data
  @data
end

#idString (readonly)

Returns:

  • (String)


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

def id
  @id
end

#mockedBoolean (readonly)

Returns:

  • (Boolean)


28
29
30
# File 'lib/vellum_ai/types/fulfilled_workflow_node_result_event.rb', line 28

def mocked
  @mocked
end

#node_idString (readonly)

Returns:

  • (String)


14
15
16
# File 'lib/vellum_ai/types/fulfilled_workflow_node_result_event.rb', line 14

def node_id
  @node_id
end

#node_result_idString (readonly)

Returns:

  • (String)


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

def node_result_id
  @node_result_id
end

#output_valuesArray<Vellum::NodeOutputCompiledValue> (readonly)



26
27
28
# File 'lib/vellum_ai/types/fulfilled_workflow_node_result_event.rb', line 26

def output_values
  @output_values
end

#source_execution_idString (readonly)

Returns:

  • (String)


24
25
26
# File 'lib/vellum_ai/types/fulfilled_workflow_node_result_event.rb', line 24

def source_execution_id
  @source_execution_id
end

#stateString (readonly)

Returns:

  • (String)


18
19
20
# File 'lib/vellum_ai/types/fulfilled_workflow_node_result_event.rb', line 18

def state
  @state
end

#tsDateTime (readonly)

Returns:

  • (DateTime)


20
21
22
# File 'lib/vellum_ai/types/fulfilled_workflow_node_result_event.rb', line 20

def ts
  @ts
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::FulfilledWorkflowNodeResultEvent

Parameters:

  • json_object (String)

Returns:



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/vellum_ai/types/fulfilled_workflow_node_result_event.rb', line 67

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  node_id = parsed_json["node_id"]
  node_result_id = parsed_json["node_result_id"]
  state = parsed_json["state"]
  ts = unless parsed_json["ts"].nil?
  DateTime.parse(parsed_json["ts"])
else
  nil
end
  unless parsed_json["data"].nil?
    data = parsed_json["data"].to_json
    data = Vellum::WorkflowNodeResultData.from_json(json_object: data)
  else
    data = nil
  end
  source_execution_id = parsed_json["source_execution_id"]
  output_values = parsed_json["output_values"]&.map do | item |
  item = item.to_json
  Vellum::NodeOutputCompiledValue.from_json(json_object: item)
end
  mocked = parsed_json["mocked"]
  new(
    id: id,
    node_id: node_id,
    node_result_id: node_result_id,
    state: state,
    ts: ts,
    data: data,
    source_execution_id: source_execution_id,
    output_values: output_values,
    mocked: mocked,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


116
117
118
119
120
121
122
123
124
125
126
# File 'lib/vellum_ai/types/fulfilled_workflow_node_result_event.rb', line 116

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.state.is_a?(String) != false || raise("Passed value for field obj.state 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? || Vellum::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.output_values.is_a?(Array) != false || raise("Passed value for field obj.output_values is not the expected type, validation failed.")
  obj.mocked&.is_a?(Boolean) != false || raise("Passed value for field obj.mocked is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


107
108
109
# File 'lib/vellum_ai/types/fulfilled_workflow_node_result_event.rb', line 107

def to_json
  @_field_set&.to_json
end