Class: Vellum::WorkflowResultEvent
- Inherits:
-
Object
- Object
- Vellum::WorkflowResultEvent
- Defined in:
- lib/vellum_ai/types/workflow_result_event.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #error ⇒ Vellum::WorkflowEventError readonly
- #id ⇒ String readonly
- #inputs ⇒ Array<Vellum::ExecutionVellumValue> readonly
- #output ⇒ Vellum::WorkflowResultEventOutputData readonly
- #outputs ⇒ Array<Vellum::WorkflowOutput> readonly
- #state ⇒ Vellum::WorkflowNodeResultEventState readonly
- #ts ⇒ DateTime readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(id:, state:, ts:, output: OMIT, error: OMIT, outputs: OMIT, inputs: OMIT, additional_properties: nil) ⇒ Vellum::WorkflowResultEvent constructor
- #to_json ⇒ String
Constructor Details
#initialize(id:, state:, ts:, output: OMIT, error: OMIT, outputs: OMIT, inputs: OMIT, additional_properties: nil) ⇒ Vellum::WorkflowResultEvent
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/vellum_ai/types/workflow_result_event.rb', line 44 def initialize(id:, state:, ts:, output: OMIT, error: OMIT, outputs: OMIT, inputs: OMIT, additional_properties: nil) @id = id @state = state @ts = ts @output = output if output != OMIT @error = error if error != OMIT @outputs = outputs if outputs != OMIT @inputs = inputs if inputs != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "state": state, "ts": ts, "output": output, "error": error, "outputs": outputs, "inputs": inputs }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
28 29 30 |
# File 'lib/vellum_ai/types/workflow_result_event.rb', line 28 def additional_properties @additional_properties end |
#error ⇒ Vellum::WorkflowEventError (readonly)
22 23 24 |
# File 'lib/vellum_ai/types/workflow_result_event.rb', line 22 def error @error end |
#id ⇒ String (readonly)
14 15 16 |
# File 'lib/vellum_ai/types/workflow_result_event.rb', line 14 def id @id end |
#inputs ⇒ Array<Vellum::ExecutionVellumValue> (readonly)
26 27 28 |
# File 'lib/vellum_ai/types/workflow_result_event.rb', line 26 def inputs @inputs end |
#output ⇒ Vellum::WorkflowResultEventOutputData (readonly)
20 21 22 |
# File 'lib/vellum_ai/types/workflow_result_event.rb', line 20 def output @output end |
#outputs ⇒ Array<Vellum::WorkflowOutput> (readonly)
24 25 26 |
# File 'lib/vellum_ai/types/workflow_result_event.rb', line 24 def outputs @outputs end |
#state ⇒ Vellum::WorkflowNodeResultEventState (readonly)
16 17 18 |
# File 'lib/vellum_ai/types/workflow_result_event.rb', line 16 def state @state end |
#ts ⇒ DateTime (readonly)
18 19 20 |
# File 'lib/vellum_ai/types/workflow_result_event.rb', line 18 def ts @ts end |
Class Method Details
.from_json(json_object:) ⇒ Vellum::WorkflowResultEvent
61 62 63 64 65 66 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 |
# File 'lib/vellum_ai/types/workflow_result_event.rb', line 61 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] state = parsed_json["state"] ts = unless parsed_json["ts"].nil? DateTime.parse(parsed_json["ts"]) else nil end unless parsed_json["output"].nil? output = parsed_json["output"].to_json output = Vellum::WorkflowResultEventOutputData.from_json(json_object: output) else output = nil end unless parsed_json["error"].nil? error = parsed_json["error"].to_json error = Vellum::WorkflowEventError.from_json(json_object: error) else error = nil end outputs = parsed_json["outputs"]&.map do | item | item = item.to_json Vellum::WorkflowOutput.from_json(json_object: item) end inputs = parsed_json["inputs"]&.map do | item | item = item.to_json Vellum::ExecutionVellumValue.from_json(json_object: item) end new( id: id, state: state, ts: ts, output: output, error: error, outputs: outputs, inputs: inputs, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
114 115 116 117 118 119 120 121 122 |
# File 'lib/vellum_ai/types/workflow_result_event.rb', line 114 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.state.is_a?(Vellum::WorkflowNodeResultEventState) != 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.output.nil? || Vellum::WorkflowResultEventOutputData.validate_raw(obj: obj.output) obj.error.nil? || Vellum::WorkflowEventError.validate_raw(obj: obj.error) obj.outputs&.is_a?(Array) != false || raise("Passed value for field obj.outputs is not the expected type, validation failed.") obj.inputs&.is_a?(Array) != false || raise("Passed value for field obj.inputs is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
105 106 107 |
# File 'lib/vellum_ai/types/workflow_result_event.rb', line 105 def to_json @_field_set&.to_json end |