Class: Vellum::WorkflowResolvedState

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

Overview

The latest execution state of a given Workflow Execution

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(trace_id:, timestamp:, span_id:, state:, previous_span_id: OMIT, previous_trace_id: OMIT, root_span_id: OMIT, root_trace_id: OMIT, additional_properties: nil) ⇒ Vellum::WorkflowResolvedState

Parameters:

  • trace_id (String)
  • timestamp (DateTime)
  • span_id (String)
  • state (Hash{String => Object})
  • previous_span_id (String) (defaults to: OMIT)
  • previous_trace_id (String) (defaults to: OMIT)
  • root_span_id (String) (defaults to: OMIT)
  • root_trace_id (String) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/vellum_ai/types/workflow_resolved_state.rb', line 43

def initialize(trace_id:, timestamp:, span_id:, state:, previous_span_id: OMIT, previous_trace_id: OMIT, root_span_id: OMIT, root_trace_id: OMIT, additional_properties: nil)
  @trace_id = trace_id
  @timestamp = timestamp
  @span_id = span_id
  @state = state
  @previous_span_id = previous_span_id if previous_span_id != OMIT
  @previous_trace_id = previous_trace_id if previous_trace_id != OMIT
  @root_span_id = root_span_id if root_span_id != OMIT
  @root_trace_id = root_trace_id if root_trace_id != OMIT
  @additional_properties = additional_properties
  @_field_set = { "trace_id": trace_id, "timestamp": timestamp, "span_id": span_id, "state": state, "previous_span_id": previous_span_id, "previous_trace_id": previous_trace_id, "root_span_id": root_span_id, "root_trace_id": root_trace_id }.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



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

def additional_properties
  @additional_properties
end

#previous_span_idString (readonly)

Returns:

  • (String)


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

def previous_span_id
  @previous_span_id
end

#previous_trace_idString (readonly)

Returns:

  • (String)


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

def previous_trace_id
  @previous_trace_id
end

#root_span_idString (readonly)

Returns:

  • (String)


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

def root_span_id
  @root_span_id
end

#root_trace_idString (readonly)

Returns:

  • (String)


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

def root_trace_id
  @root_trace_id
end

#span_idString (readonly)

Returns:

  • (String)


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

def span_id
  @span_id
end

#stateHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


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

def state
  @state
end

#timestampDateTime (readonly)

Returns:

  • (DateTime)


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

def timestamp
  @timestamp
end

#trace_idString (readonly)

Returns:

  • (String)


10
11
12
# File 'lib/vellum_ai/types/workflow_resolved_state.rb', line 10

def trace_id
  @trace_id
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::WorkflowResolvedState

Parameters:

  • json_object (String)

Returns:



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
# File 'lib/vellum_ai/types/workflow_resolved_state.rb', line 61

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  trace_id = parsed_json["trace_id"]
  timestamp = unless parsed_json["timestamp"].nil?
  DateTime.parse(parsed_json["timestamp"])
else
  nil
end
  span_id = parsed_json["span_id"]
  state = parsed_json["state"]
  previous_span_id = parsed_json["previous_span_id"]
  previous_trace_id = parsed_json["previous_trace_id"]
  root_span_id = parsed_json["root_span_id"]
  root_trace_id = parsed_json["root_trace_id"]
  new(
    trace_id: trace_id,
    timestamp: timestamp,
    span_id: span_id,
    state: state,
    previous_span_id: previous_span_id,
    previous_trace_id: previous_trace_id,
    root_span_id: root_span_id,
    root_trace_id: root_trace_id,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


100
101
102
103
104
105
106
107
108
109
# File 'lib/vellum_ai/types/workflow_resolved_state.rb', line 100

def self.validate_raw(obj:)
  obj.trace_id.is_a?(String) != false || raise("Passed value for field obj.trace_id is not the expected type, validation failed.")
  obj.timestamp.is_a?(DateTime) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.")
  obj.span_id.is_a?(String) != false || raise("Passed value for field obj.span_id 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.")
  obj.previous_span_id&.is_a?(String) != false || raise("Passed value for field obj.previous_span_id is not the expected type, validation failed.")
  obj.previous_trace_id&.is_a?(String) != false || raise("Passed value for field obj.previous_trace_id is not the expected type, validation failed.")
  obj.root_span_id&.is_a?(String) != false || raise("Passed value for field obj.root_span_id is not the expected type, validation failed.")
  obj.root_trace_id&.is_a?(String) != false || raise("Passed value for field obj.root_trace_id is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


91
92
93
# File 'lib/vellum_ai/types/workflow_resolved_state.rb', line 91

def to_json
  @_field_set&.to_json
end