Class: Vellum::WorkflowResultEventOutputDataNumber

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

Overview

A number output streamed from a Workflow execution.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: OMIT, name:, state:, node_id:, delta: OMIT, type:, value: OMIT, additional_properties: nil) ⇒ Vellum::WorkflowResultEventOutputDataNumber

Parameters:

  • type (String)
  • value (Float) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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

def initialize(id: OMIT, name:, state:, node_id:, delta: OMIT, type:, value: OMIT, additional_properties: nil)
  @id = id if id != OMIT
  @name = name
  @state = state
  @node_id = node_id
  @delta = delta if delta != OMIT
  @type = type
  @value = value if value != OMIT
  @additional_properties = additional_properties
  @_field_set = { "id": id, "name": name, "state": state, "node_id": node_id, "delta": delta, "type": type, "value": value }.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



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

def additional_properties
  @additional_properties
end

#deltaObject (readonly)

STREAMING.



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

def delta
  @delta
end

#idString (readonly)

Returns:

  • (String)


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

def id
  @id
end

#nameString (readonly)

Returns:

  • (String)


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

def name
  @name
end

#node_idString (readonly)

Returns:

  • (String)


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

def node_id
  @node_id
end

#stateVellum::WorkflowNodeResultEventState (readonly)



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

def state
  @state
end

#typeString (readonly)

Returns:

  • (String)


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

def type
  @type
end

#valueFloat (readonly)

Returns:

  • (Float)


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

def value
  @value
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::WorkflowResultEventOutputDataNumber

Parameters:

  • json_object (String)

Returns:



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

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  name = parsed_json["name"]
  state = parsed_json["state"]
  node_id = parsed_json["node_id"]
  delta = parsed_json["delta"]
  type = parsed_json["type"]
  value = parsed_json["value"]
  new(
    id: id,
    name: name,
    state: state,
    node_id: node_id,
    delta: delta,
    type: type,
    value: value,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


92
93
94
95
96
97
98
99
100
# File 'lib/vellum_ai/types/workflow_result_event_output_data_number.rb', line 92

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.name.is_a?(String) != false || raise("Passed value for field obj.name 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.node_id.is_a?(String) != false || raise("Passed value for field obj.node_id is not the expected type, validation failed.")
  obj.delta&.is_a?(String) != false || raise("Passed value for field obj.delta is not the expected type, validation failed.")
  obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
  obj.value&.is_a?(Float) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


83
84
85
# File 'lib/vellum_ai/types/workflow_result_event_output_data_number.rb', line 83

def to_json
  @_field_set&.to_json
end