Class: Vellum::StreamingWorkflowNodeResultEvent

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

Overview

An event that indicates that the node has execution is in progress.

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: OMIT, output_index: OMIT, additional_properties: nil) ⇒ Vellum::StreamingWorkflowNodeResultEvent

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 (Vellum::NodeOutputCompiledValue) (defaults to: OMIT)
  • output_index (Integer) (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/streaming_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: OMIT, output_index: 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 = output if output != OMIT
  @output_index = output_index if output_index != 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": output, "output_index": output_index }.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/streaming_workflow_node_result_event.rb', line 30

def additional_properties
  @additional_properties
end

#dataVellum::WorkflowNodeResultData (readonly)



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

def data
  @data
end

#idString (readonly)

Returns:

  • (String)


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

def id
  @id
end

#node_idString (readonly)

Returns:

  • (String)


14
15
16
# File 'lib/vellum_ai/types/streaming_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/streaming_workflow_node_result_event.rb', line 16

def node_result_id
  @node_result_id
end

#outputVellum::NodeOutputCompiledValue (readonly)



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

def output
  @output
end

#output_indexInteger (readonly)

Returns:

  • (Integer)


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

def output_index
  @output_index
end

#source_execution_idString (readonly)

Returns:

  • (String)


24
25
26
# File 'lib/vellum_ai/types/streaming_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/streaming_workflow_node_result_event.rb', line 18

def state
  @state
end

#tsDateTime (readonly)

Returns:

  • (DateTime)


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

def ts
  @ts
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::StreamingWorkflowNodeResultEvent

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
104
105
# File 'lib/vellum_ai/types/streaming_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"]
  unless parsed_json["output"].nil?
    output = parsed_json["output"].to_json
    output = Vellum::NodeOutputCompiledValue.from_json(json_object: output)
  else
    output = nil
  end
  output_index = parsed_json["output_index"]
  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: output,
    output_index: output_index,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


118
119
120
121
122
123
124
125
126
127
128
# File 'lib/vellum_ai/types/streaming_workflow_node_result_event.rb', line 118

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.nil? || Vellum::NodeOutputCompiledValue.validate_raw(obj: obj.output)
  obj.output_index&.is_a?(Integer) != false || raise("Passed value for field obj.output_index is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


109
110
111
# File 'lib/vellum_ai/types/streaming_workflow_node_result_event.rb', line 109

def to_json
  @_field_set&.to_json
end