Class: Vellum::WorkflowExecutionDetail
- Inherits:
-
Object
- Object
- Vellum::WorkflowExecutionDetail
- Defined in:
- lib/vellum_ai/types/workflow_execution_detail.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #end_ ⇒ DateTime readonly
- #error ⇒ Vellum::WorkflowError readonly
- #inputs ⇒ Array<Vellum::ExecutionVellumValue> readonly
- #outputs ⇒ Array<Vellum::ExecutionVellumValue> readonly
- #parent_context ⇒ Vellum::ParentContext readonly
- #span_id ⇒ String readonly
- #spans ⇒ Array<Vellum::VellumSpan> readonly
- #start ⇒ DateTime readonly
- #state ⇒ Hash{String => Object} readonly
- #usage_results ⇒ Array<Vellum::WorkflowExecutionUsageResult> readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(span_id:, parent_context: OMIT, start:, end_: OMIT, inputs:, outputs:, error: OMIT, usage_results: OMIT, spans:, state: OMIT, additional_properties: nil) ⇒ Vellum::WorkflowExecutionDetail constructor
- #to_json ⇒ String
Constructor Details
#initialize(span_id:, parent_context: OMIT, start:, end_: OMIT, inputs:, outputs:, error: OMIT, usage_results: OMIT, spans:, state: OMIT, additional_properties: nil) ⇒ Vellum::WorkflowExecutionDetail
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/vellum_ai/types/workflow_execution_detail.rb', line 54 def initialize(span_id:, parent_context: OMIT, start:, end_: OMIT, inputs:, outputs:, error: OMIT, usage_results: OMIT, spans:, state: OMIT, additional_properties: nil) @span_id = span_id @parent_context = parent_context if parent_context != OMIT @start = start @end_ = end_ if end_ != OMIT @inputs = inputs @outputs = outputs @error = error if error != OMIT @usage_results = usage_results if usage_results != OMIT @spans = spans @state = state if state != OMIT @additional_properties = additional_properties @_field_set = { "span_id": span_id, "parent_context": parent_context, "start": start, "end": end_, "inputs": inputs, "outputs": outputs, "error": error, "usage_results": usage_results, "spans": spans, "state": state }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
35 36 37 |
# File 'lib/vellum_ai/types/workflow_execution_detail.rb', line 35 def additional_properties @additional_properties end |
#end_ ⇒ DateTime (readonly)
21 22 23 |
# File 'lib/vellum_ai/types/workflow_execution_detail.rb', line 21 def end_ @end_ end |
#error ⇒ Vellum::WorkflowError (readonly)
27 28 29 |
# File 'lib/vellum_ai/types/workflow_execution_detail.rb', line 27 def error @error end |
#inputs ⇒ Array<Vellum::ExecutionVellumValue> (readonly)
23 24 25 |
# File 'lib/vellum_ai/types/workflow_execution_detail.rb', line 23 def inputs @inputs end |
#outputs ⇒ Array<Vellum::ExecutionVellumValue> (readonly)
25 26 27 |
# File 'lib/vellum_ai/types/workflow_execution_detail.rb', line 25 def outputs @outputs end |
#parent_context ⇒ Vellum::ParentContext (readonly)
17 18 19 |
# File 'lib/vellum_ai/types/workflow_execution_detail.rb', line 17 def parent_context @parent_context end |
#span_id ⇒ String (readonly)
15 16 17 |
# File 'lib/vellum_ai/types/workflow_execution_detail.rb', line 15 def span_id @span_id end |
#spans ⇒ Array<Vellum::VellumSpan> (readonly)
31 32 33 |
# File 'lib/vellum_ai/types/workflow_execution_detail.rb', line 31 def spans @spans end |
#start ⇒ DateTime (readonly)
19 20 21 |
# File 'lib/vellum_ai/types/workflow_execution_detail.rb', line 19 def start @start end |
#state ⇒ Hash{String => Object} (readonly)
33 34 35 |
# File 'lib/vellum_ai/types/workflow_execution_detail.rb', line 33 def state @state end |
#usage_results ⇒ Array<Vellum::WorkflowExecutionUsageResult> (readonly)
29 30 31 |
# File 'lib/vellum_ai/types/workflow_execution_detail.rb', line 29 def usage_results @usage_results end |
Class Method Details
.from_json(json_object:) ⇒ Vellum::WorkflowExecutionDetail
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 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/vellum_ai/types/workflow_execution_detail.rb', line 74 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) span_id = parsed_json["span_id"] unless parsed_json["parent_context"].nil? parent_context = parsed_json["parent_context"].to_json parent_context = Vellum::ParentContext.from_json(json_object: parent_context) else parent_context = nil end start = unless parsed_json["start"].nil? DateTime.parse(parsed_json["start"]) else nil end end_ = unless parsed_json["end"].nil? DateTime.parse(parsed_json["end"]) else nil end inputs = parsed_json["inputs"]&.map do | item | item = item.to_json Vellum::ExecutionVellumValue.from_json(json_object: item) end outputs = parsed_json["outputs"]&.map do | item | item = item.to_json Vellum::ExecutionVellumValue.from_json(json_object: item) end unless parsed_json["error"].nil? error = parsed_json["error"].to_json error = Vellum::WorkflowError.from_json(json_object: error) else error = nil end usage_results = parsed_json["usage_results"]&.map do | item | item = item.to_json Vellum::WorkflowExecutionUsageResult.from_json(json_object: item) end spans = parsed_json["spans"]&.map do | item | item = item.to_json Vellum::VellumSpan.from_json(json_object: item) end state = parsed_json["state"] new( span_id: span_id, parent_context: parent_context, start: start, end_: end_, inputs: inputs, outputs: outputs, error: error, usage_results: usage_results, spans: spans, state: state, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/vellum_ai/types/workflow_execution_detail.rb', line 143 def self.validate_raw(obj:) obj.span_id.is_a?(String) != false || raise("Passed value for field obj.span_id is not the expected type, validation failed.") obj.parent_context.nil? || Vellum::ParentContext.validate_raw(obj: obj.parent_context) obj.start.is_a?(DateTime) != false || raise("Passed value for field obj.start is not the expected type, validation failed.") obj.end_&.is_a?(DateTime) != false || raise("Passed value for field obj.end_ 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.") obj.outputs.is_a?(Array) != false || raise("Passed value for field obj.outputs is not the expected type, validation failed.") obj.error.nil? || Vellum::WorkflowError.validate_raw(obj: obj.error) obj.usage_results&.is_a?(Array) != false || raise("Passed value for field obj.usage_results is not the expected type, validation failed.") obj.spans.is_a?(Array) != false || raise("Passed value for field obj.spans is not the expected type, validation failed.") obj.state&.is_a?(Hash) != false || raise("Passed value for field obj.state is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
134 135 136 |
# File 'lib/vellum_ai/types/workflow_execution_detail.rb', line 134 def to_json @_field_set&.to_json end |