Class: Vellum::WorkflowEventExecutionRead

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(span_id:, parent_context: OMIT, start:, end_: OMIT, inputs:, outputs:, error: OMIT, latest_actual: OMIT, metric_results:, usage_results: OMIT, spans:, state: OMIT, additional_properties: nil) ⇒ Vellum::WorkflowEventExecutionRead

Parameters:



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/vellum_ai/types/workflow_event_execution_read.rb', line 62

def initialize(span_id:, parent_context: OMIT, start:, end_: OMIT, inputs:, outputs:, error: OMIT, latest_actual: OMIT, metric_results:, 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
  @latest_actual = latest_actual if latest_actual != OMIT
  @metric_results = metric_results
  @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, "latest_actual": latest_actual, "metric_results": metric_results, "usage_results": usage_results, "spans": spans, "state": state }.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



41
42
43
# File 'lib/vellum_ai/types/workflow_event_execution_read.rb', line 41

def additional_properties
  @additional_properties
end

#end_DateTime (readonly)

Returns:

  • (DateTime)


23
24
25
# File 'lib/vellum_ai/types/workflow_event_execution_read.rb', line 23

def end_
  @end_
end

#errorVellum::WorkflowError (readonly)



29
30
31
# File 'lib/vellum_ai/types/workflow_event_execution_read.rb', line 29

def error
  @error
end

#inputsArray<Vellum::ExecutionVellumValue> (readonly)

Returns:



25
26
27
# File 'lib/vellum_ai/types/workflow_event_execution_read.rb', line 25

def inputs
  @inputs
end

#latest_actualVellum::WorkflowExecutionActual (readonly)



31
32
33
# File 'lib/vellum_ai/types/workflow_event_execution_read.rb', line 31

def latest_actual
  @latest_actual
end

#metric_resultsArray<Vellum::WorkflowExecutionViewOnlineEvalMetricResult> (readonly)



33
34
35
# File 'lib/vellum_ai/types/workflow_event_execution_read.rb', line 33

def metric_results
  @metric_results
end

#outputsArray<Vellum::ExecutionVellumValue> (readonly)

Returns:



27
28
29
# File 'lib/vellum_ai/types/workflow_event_execution_read.rb', line 27

def outputs
  @outputs
end

#parent_contextVellum::WorkflowDeploymentParentContext (readonly)



19
20
21
# File 'lib/vellum_ai/types/workflow_event_execution_read.rb', line 19

def parent_context
  @parent_context
end

#span_idString (readonly)

Returns:

  • (String)


17
18
19
# File 'lib/vellum_ai/types/workflow_event_execution_read.rb', line 17

def span_id
  @span_id
end

#spansArray<Vellum::VellumSpan> (readonly)

Returns:



37
38
39
# File 'lib/vellum_ai/types/workflow_event_execution_read.rb', line 37

def spans
  @spans
end

#startDateTime (readonly)

Returns:

  • (DateTime)


21
22
23
# File 'lib/vellum_ai/types/workflow_event_execution_read.rb', line 21

def start
  @start
end

#stateHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


39
40
41
# File 'lib/vellum_ai/types/workflow_event_execution_read.rb', line 39

def state
  @state
end

#usage_resultsArray<Vellum::WorkflowExecutionUsageResult> (readonly)



35
36
37
# File 'lib/vellum_ai/types/workflow_event_execution_read.rb', line 35

def usage_results
  @usage_results
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::WorkflowEventExecutionRead

Parameters:

  • json_object (String)

Returns:



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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/vellum_ai/types/workflow_event_execution_read.rb', line 84

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::WorkflowDeploymentParentContext.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
  unless parsed_json["latest_actual"].nil?
    latest_actual = parsed_json["latest_actual"].to_json
    latest_actual = Vellum::WorkflowExecutionActual.from_json(json_object: latest_actual)
  else
    latest_actual = nil
  end
  metric_results = parsed_json["metric_results"]&.map do | item |
  item = item.to_json
  Vellum::WorkflowExecutionViewOnlineEvalMetricResult.from_json(json_object: item)
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,
    latest_actual: latest_actual,
    metric_results: metric_results,
    usage_results: usage_results,
    spans: spans,
    state: state,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/vellum_ai/types/workflow_event_execution_read.rb', line 165

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::WorkflowDeploymentParentContext.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.latest_actual.nil? || Vellum::WorkflowExecutionActual.validate_raw(obj: obj.latest_actual)
  obj.metric_results.is_a?(Array) != false || raise("Passed value for field obj.metric_results is not the expected type, validation failed.")
  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_jsonString

Returns:

  • (String)


156
157
158
# File 'lib/vellum_ai/types/workflow_event_execution_read.rb', line 156

def to_json
  @_field_set&.to_json
end