Class: Vellum::FulfilledExecuteWorkflowWorkflowResultEvent

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

Overview

The successful response from the Workflow execution containing the produced outputs.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, ts:, outputs:, additional_properties: nil) ⇒ FulfilledExecuteWorkflowWorkflowResultEvent

Parameters:

  • id (String)
  • ts (DateTime)
  • outputs (Array<WorkflowOutput>)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



17
18
19
20
21
22
23
24
25
26
# File 'lib/vellum_ai/types/fulfilled_execute_workflow_workflow_result_event.rb', line 17

def initialize(id:, ts:, outputs:, additional_properties: nil)
  # @type [String]
  @id = id
  # @type [DateTime]
  @ts = ts
  # @type [Array<WorkflowOutput>]
  @outputs = outputs
  # @type [OpenStruct] Additional properties unmapped to the current class definition
  @additional_properties = additional_properties
end

Instance Attribute Details

#additional_propertiesObject (readonly)

Returns the value of attribute additional_properties.



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

def additional_properties
  @additional_properties
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#outputsObject (readonly)

Returns the value of attribute outputs.



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

def outputs
  @outputs
end

#tsObject (readonly)

Returns the value of attribute ts.



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

def ts
  @ts
end

Class Method Details

.from_json(json_object:) ⇒ FulfilledExecuteWorkflowWorkflowResultEvent

Deserialize a JSON object to an instance of FulfilledExecuteWorkflowWorkflowResultEvent

Parameters:

  • json_object (JSON)

Returns:



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/vellum_ai/types/fulfilled_execute_workflow_workflow_result_event.rb', line 32

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = struct.id
  ts = DateTime.parse(parsed_json["ts"])
  outputs = parsed_json["outputs"].map do |v|
    v = v.to_json
    WorkflowOutput.from_json(json_object: v)
  end
  new(id: id, ts: ts, outputs: outputs, additional_properties: struct)
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


55
56
57
58
59
# File 'lib/vellum_ai/types/fulfilled_execute_workflow_workflow_result_event.rb', line 55

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.ts.is_a?(DateTime) != false || raise("Passed value for field obj.ts 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.")
end

Instance Method Details

#to_json(*_args) ⇒ JSON

Serialize an instance of FulfilledExecuteWorkflowWorkflowResultEvent to a JSON object

Returns:

  • (JSON)


47
48
49
# File 'lib/vellum_ai/types/fulfilled_execute_workflow_workflow_result_event.rb', line 47

def to_json(*_args)
  { "id": @id, "ts": @ts, "outputs": @outputs }.to_json
end