Class: Vellum::ExecuteWorkflowResponse

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(execution_id:, data:, run_id: nil, external_id: nil, additional_properties: nil) ⇒ ExecuteWorkflowResponse

Parameters:

  • execution_id (String)
  • run_id (String) (defaults to: nil)
  • external_id (String) (defaults to: nil)
  • data (ExecuteWorkflowWorkflowResultEvent)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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

def initialize(execution_id:, data:, run_id: nil, external_id: nil, additional_properties: nil)
  # @type [String]
  @execution_id = execution_id
  # @type [String]
  @run_id = run_id
  # @type [String]
  @external_id = external_id
  # @type [ExecuteWorkflowWorkflowResultEvent]
  @data = data
  # @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.



8
9
10
# File 'lib/vellum_ai/types/execute_workflow_response.rb', line 8

def additional_properties
  @additional_properties
end

#dataObject (readonly)

Returns the value of attribute data.



8
9
10
# File 'lib/vellum_ai/types/execute_workflow_response.rb', line 8

def data
  @data
end

#execution_idObject (readonly)

Returns the value of attribute execution_id.



8
9
10
# File 'lib/vellum_ai/types/execute_workflow_response.rb', line 8

def execution_id
  @execution_id
end

#external_idObject (readonly)

Returns the value of attribute external_id.



8
9
10
# File 'lib/vellum_ai/types/execute_workflow_response.rb', line 8

def external_id
  @external_id
end

#run_idObject (readonly)

Returns the value of attribute run_id.



8
9
10
# File 'lib/vellum_ai/types/execute_workflow_response.rb', line 8

def run_id
  @run_id
end

Class Method Details

.from_json(json_object:) ⇒ ExecuteWorkflowResponse

Deserialize a JSON object to an instance of ExecuteWorkflowResponse

Parameters:

  • json_object (JSON)

Returns:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/vellum_ai/types/execute_workflow_response.rb', line 33

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  execution_id = struct.execution_id
  run_id = struct.run_id
  external_id = struct.external_id
  if parsed_json["data"].nil?
    data = nil
  else
    data = parsed_json["data"].to_json
    data = ExecuteWorkflowWorkflowResultEvent.from_json(json_object: data)
  end
  new(execution_id: execution_id, run_id: run_id, external_id: external_id, data: data,
      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)


60
61
62
63
64
65
# File 'lib/vellum_ai/types/execute_workflow_response.rb', line 60

def self.validate_raw(obj:)
  obj.execution_id.is_a?(String) != false || raise("Passed value for field obj.execution_id is not the expected type, validation failed.")
  obj.run_id&.is_a?(String) != false || raise("Passed value for field obj.run_id is not the expected type, validation failed.")
  obj.external_id&.is_a?(String) != false || raise("Passed value for field obj.external_id is not the expected type, validation failed.")
  ExecuteWorkflowWorkflowResultEvent.validate_raw(obj: obj.data)
end

Instance Method Details

#to_json(*_args) ⇒ JSON

Serialize an instance of ExecuteWorkflowResponse to a JSON object

Returns:

  • (JSON)


52
53
54
# File 'lib/vellum_ai/types/execute_workflow_response.rb', line 52

def to_json(*_args)
  { "execution_id": @execution_id, "run_id": @run_id, "external_id": @external_id, "data": @data }.to_json
end