vellum_ai 0.3.7 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/requests.rb +2 -2
  3. data/lib/types_export.rb +16 -0
  4. data/lib/vellum_ai/deployments/client.rb +2 -2
  5. data/lib/vellum_ai/types/array_enum.rb +5 -0
  6. data/lib/vellum_ai/types/array_variable_value_item.rb +155 -0
  7. data/lib/vellum_ai/types/chat_history_variable_value.rb +49 -0
  8. data/lib/vellum_ai/types/code_execution_node_result_data.rb +9 -4
  9. data/lib/vellum_ai/types/node_input_compiled_array_value.rb +59 -0
  10. data/lib/vellum_ai/types/node_input_variable_compiled_value.rb +13 -0
  11. data/lib/vellum_ai/types/node_output_compiled_array_value.rb +54 -0
  12. data/lib/vellum_ai/types/node_output_compiled_function_value.rb +56 -0
  13. data/lib/vellum_ai/types/node_output_compiled_value.rb +26 -0
  14. data/lib/vellum_ai/types/number_variable_value.rb +45 -0
  15. data/lib/vellum_ai/types/prompt_node_result_data.rb +10 -4
  16. data/lib/vellum_ai/types/search_results_variable_value.rb +49 -0
  17. data/lib/vellum_ai/types/subworkflow_enum.rb +5 -0
  18. data/lib/vellum_ai/types/subworkflow_node_result.rb +40 -0
  19. data/lib/vellum_ai/types/terminal_node_array_result.rb +59 -0
  20. data/lib/vellum_ai/types/terminal_node_function_call_result.rb +61 -0
  21. data/lib/vellum_ai/types/terminal_node_result_output.rb +26 -0
  22. data/lib/vellum_ai/types/vellum_error_code_enum.rb +2 -1
  23. data/lib/vellum_ai/types/workflow_deployment_read.rb +118 -0
  24. data/lib/vellum_ai/types/workflow_execution_event_error_code.rb +2 -1
  25. data/lib/vellum_ai/types/workflow_node_result_data.rb +13 -0
  26. data/lib/vellum_ai/types/workflow_output.rb +13 -0
  27. data/lib/vellum_ai/types/workflow_output_array.rb +60 -0
  28. data/lib/vellum_ai/types/workflow_request_chat_history_input_request.rb +1 -0
  29. data/lib/vellum_ai/types/workflow_request_json_input_request.rb +1 -0
  30. data/lib/vellum_ai/types/workflow_request_number_input_request.rb +1 -0
  31. data/lib/vellum_ai/types/workflow_request_string_input_request.rb +1 -0
  32. data/lib/vellum_ai/types/workflow_result_event_output_data.rb +26 -0
  33. data/lib/vellum_ai/types/workflow_result_event_output_data_array.rb +83 -0
  34. data/lib/vellum_ai/types/workflow_result_event_output_data_function_call.rb +85 -0
  35. data/lib/vellum_ai/workflow_deployments/client.rb +35 -6
  36. data/lib/vellum_ai.rb +4 -4
  37. metadata +18 -2
@@ -7,6 +7,8 @@ require_relative "node_output_compiled_json_value"
7
7
  require_relative "node_output_compiled_chat_history_value"
8
8
  require_relative "node_output_compiled_search_results_value"
9
9
  require_relative "node_output_compiled_error_value"
10
+ require_relative "node_output_compiled_array_value"
11
+ require_relative "node_output_compiled_function_value"
10
12
 
11
13
  module Vellum
12
14
  class NodeOutputCompiledValue
@@ -43,6 +45,10 @@ module Vellum
43
45
  NodeOutputCompiledSearchResultsValue.from_json(json_object: json_object)
44
46
  when "ERROR"
45
47
  NodeOutputCompiledErrorValue.from_json(json_object: json_object)
48
+ when "ARRAY"
49
+ NodeOutputCompiledArrayValue.from_json(json_object: json_object)
50
+ when "FUNCTION_CALL"
51
+ NodeOutputCompiledFunctionValue.from_json(json_object: json_object)
46
52
  else
47
53
  NodeOutputCompiledStringValue.from_json(json_object: json_object)
48
54
  end
@@ -66,6 +72,10 @@ module Vellum
66
72
  { **@member.to_json, type: @discriminant }.to_json
67
73
  when "ERROR"
68
74
  { **@member.to_json, type: @discriminant }.to_json
75
+ when "ARRAY"
76
+ { **@member.to_json, type: @discriminant }.to_json
77
+ when "FUNCTION_CALL"
78
+ { **@member.to_json, type: @discriminant }.to_json
69
79
  else
70
80
  { "type": @discriminant, value: @member }.to_json
71
81
  end
@@ -90,6 +100,10 @@ module Vellum
90
100
  NodeOutputCompiledSearchResultsValue.validate_raw(obj: obj)
91
101
  when "ERROR"
92
102
  NodeOutputCompiledErrorValue.validate_raw(obj: obj)
103
+ when "ARRAY"
104
+ NodeOutputCompiledArrayValue.validate_raw(obj: obj)
105
+ when "FUNCTION_CALL"
106
+ NodeOutputCompiledFunctionValue.validate_raw(obj: obj)
93
107
  else
94
108
  raise("Passed value matched no type within the union, validation failed.")
95
109
  end
@@ -138,5 +152,17 @@ module Vellum
138
152
  def self.error(member:)
139
153
  new(member: member, discriminant: "ERROR")
140
154
  end
155
+
156
+ # @param member [NodeOutputCompiledArrayValue]
157
+ # @return [NodeOutputCompiledValue]
158
+ def self.array(member:)
159
+ new(member: member, discriminant: "ARRAY")
160
+ end
161
+
162
+ # @param member [NodeOutputCompiledFunctionValue]
163
+ # @return [NodeOutputCompiledValue]
164
+ def self.function_call(member:)
165
+ new(member: member, discriminant: "FUNCTION_CALL")
166
+ end
141
167
  end
142
168
  end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+
5
+ module Vellum
6
+ class NumberVariableValue
7
+ attr_reader :value, :additional_properties
8
+
9
+ # @param value [Float]
10
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
11
+ # @return [NumberVariableValue]
12
+ def initialize(value: nil, additional_properties: nil)
13
+ # @type [Float]
14
+ @value = value
15
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
16
+ @additional_properties = additional_properties
17
+ end
18
+
19
+ # Deserialize a JSON object to an instance of NumberVariableValue
20
+ #
21
+ # @param json_object [JSON]
22
+ # @return [NumberVariableValue]
23
+ def self.from_json(json_object:)
24
+ struct = JSON.parse(json_object, object_class: OpenStruct)
25
+ JSON.parse(json_object)
26
+ value = struct.value
27
+ new(value: value, additional_properties: struct)
28
+ end
29
+
30
+ # Serialize an instance of NumberVariableValue to a JSON object
31
+ #
32
+ # @return [JSON]
33
+ def to_json(*_args)
34
+ { "value": @value }.to_json
35
+ end
36
+
37
+ # 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.
38
+ #
39
+ # @param obj [Object]
40
+ # @return [Void]
41
+ def self.validate_raw(obj:)
42
+ obj.value&.is_a?(Float) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
43
+ end
44
+ end
45
+ end
@@ -4,17 +4,20 @@ require "json"
4
4
 
5
5
  module Vellum
6
6
  class PromptNodeResultData
7
- attr_reader :output_id, :text, :delta, :additional_properties
7
+ attr_reader :output_id, :array_output_id, :text, :delta, :additional_properties
8
8
 
9
9
  # @param output_id [String]
10
+ # @param array_output_id [String]
10
11
  # @param text [String]
11
12
  # @param delta [String]
12
13
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
13
14
  # @return [PromptNodeResultData]
14
- def initialize(output_id:, text: nil, delta: nil, additional_properties: nil)
15
+ def initialize(output_id:, array_output_id: nil, text: nil, delta: nil, additional_properties: nil)
15
16
  # @type [String]
16
17
  @output_id = output_id
17
18
  # @type [String]
19
+ @array_output_id = array_output_id
20
+ # @type [String]
18
21
  @text = text
19
22
  # @type [String]
20
23
  @delta = delta
@@ -30,16 +33,18 @@ module Vellum
30
33
  struct = JSON.parse(json_object, object_class: OpenStruct)
31
34
  JSON.parse(json_object)
32
35
  output_id = struct.output_id
36
+ array_output_id = struct.array_output_id
33
37
  text = struct.text
34
38
  delta = struct.delta
35
- new(output_id: output_id, text: text, delta: delta, additional_properties: struct)
39
+ new(output_id: output_id, array_output_id: array_output_id, text: text, delta: delta,
40
+ additional_properties: struct)
36
41
  end
37
42
 
38
43
  # Serialize an instance of PromptNodeResultData to a JSON object
39
44
  #
40
45
  # @return [JSON]
41
46
  def to_json(*_args)
42
- { "output_id": @output_id, "text": @text, "delta": @delta }.to_json
47
+ { "output_id": @output_id, "array_output_id": @array_output_id, "text": @text, "delta": @delta }.to_json
43
48
  end
44
49
 
45
50
  # 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.
@@ -48,6 +53,7 @@ module Vellum
48
53
  # @return [Void]
49
54
  def self.validate_raw(obj:)
50
55
  obj.output_id.is_a?(String) != false || raise("Passed value for field obj.output_id is not the expected type, validation failed.")
56
+ obj.array_output_id&.is_a?(String) != false || raise("Passed value for field obj.array_output_id is not the expected type, validation failed.")
51
57
  obj.text&.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
52
58
  obj.delta&.is_a?(String) != false || raise("Passed value for field obj.delta is not the expected type, validation failed.")
53
59
  end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "search_result"
4
+ require "json"
5
+
6
+ module Vellum
7
+ class SearchResultsVariableValue
8
+ attr_reader :value, :additional_properties
9
+
10
+ # @param value [Array<SearchResult>]
11
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
12
+ # @return [SearchResultsVariableValue]
13
+ def initialize(value: nil, additional_properties: nil)
14
+ # @type [Array<SearchResult>]
15
+ @value = value
16
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
17
+ @additional_properties = additional_properties
18
+ end
19
+
20
+ # Deserialize a JSON object to an instance of SearchResultsVariableValue
21
+ #
22
+ # @param json_object [JSON]
23
+ # @return [SearchResultsVariableValue]
24
+ def self.from_json(json_object:)
25
+ struct = JSON.parse(json_object, object_class: OpenStruct)
26
+ parsed_json = JSON.parse(json_object)
27
+ value = parsed_json["value"].map do |v|
28
+ v = v.to_json
29
+ SearchResult.from_json(json_object: v)
30
+ end
31
+ new(value: value, additional_properties: struct)
32
+ end
33
+
34
+ # Serialize an instance of SearchResultsVariableValue to a JSON object
35
+ #
36
+ # @return [JSON]
37
+ def to_json(*_args)
38
+ { "value": @value }.to_json
39
+ end
40
+
41
+ # 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.
42
+ #
43
+ # @param obj [Object]
44
+ # @return [Void]
45
+ def self.validate_raw(obj:)
46
+ obj.value&.is_a?(Array) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Vellum
4
+ SUBWORKFLOW_ENUM = String
5
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+
5
+ module Vellum
6
+ # A Node Result Event emitted from a Subworkflow Node.
7
+ class SubworkflowNodeResult
8
+ attr_reader :additional_properties
9
+
10
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
11
+ # @return [SubworkflowNodeResult]
12
+ def initialize(additional_properties: nil)
13
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
14
+ @additional_properties = additional_properties
15
+ end
16
+
17
+ # Deserialize a JSON object to an instance of SubworkflowNodeResult
18
+ #
19
+ # @param json_object [JSON]
20
+ # @return [SubworkflowNodeResult]
21
+ def self.from_json(json_object:)
22
+ struct = JSON.parse(json_object, object_class: OpenStruct)
23
+ JSON.parse(json_object)
24
+ new(additional_properties: struct)
25
+ end
26
+
27
+ # Serialize an instance of SubworkflowNodeResult to a JSON object
28
+ #
29
+ # @return [JSON]
30
+ def to_json(*_args)
31
+ {}.to_json
32
+ end
33
+
34
+ # 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.
35
+ #
36
+ # @param obj [Object]
37
+ # @return [Void]
38
+ def self.validate_raw(obj:); end
39
+ end
40
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "array_variable_value_item"
4
+ require "json"
5
+
6
+ module Vellum
7
+ class TerminalNodeArrayResult
8
+ attr_reader :id, :name, :value, :additional_properties
9
+
10
+ # @param id [String]
11
+ # @param name [String] The unique name given to the terminal node that produced this output.
12
+ # @param value [Array<ArrayVariableValueItem>]
13
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
14
+ # @return [TerminalNodeArrayResult]
15
+ def initialize(name:, id: nil, value: nil, additional_properties: nil)
16
+ # @type [String]
17
+ @id = id
18
+ # @type [String] The unique name given to the terminal node that produced this output.
19
+ @name = name
20
+ # @type [Array<ArrayVariableValueItem>]
21
+ @value = value
22
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
23
+ @additional_properties = additional_properties
24
+ end
25
+
26
+ # Deserialize a JSON object to an instance of TerminalNodeArrayResult
27
+ #
28
+ # @param json_object [JSON]
29
+ # @return [TerminalNodeArrayResult]
30
+ def self.from_json(json_object:)
31
+ struct = JSON.parse(json_object, object_class: OpenStruct)
32
+ parsed_json = JSON.parse(json_object)
33
+ id = struct.id
34
+ name = struct.name
35
+ value = parsed_json["value"].map do |v|
36
+ v = v.to_json
37
+ ArrayVariableValueItem.from_json(json_object: v)
38
+ end
39
+ new(id: id, name: name, value: value, additional_properties: struct)
40
+ end
41
+
42
+ # Serialize an instance of TerminalNodeArrayResult to a JSON object
43
+ #
44
+ # @return [JSON]
45
+ def to_json(*_args)
46
+ { "id": @id, "name": @name, "value": @value }.to_json
47
+ end
48
+
49
+ # 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.
50
+ #
51
+ # @param obj [Object]
52
+ # @return [Void]
53
+ def self.validate_raw(obj:)
54
+ obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
55
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
56
+ obj.value&.is_a?(Array) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "function_call"
4
+ require "json"
5
+
6
+ module Vellum
7
+ class TerminalNodeFunctionCallResult
8
+ attr_reader :id, :name, :value, :additional_properties
9
+
10
+ # @param id [String]
11
+ # @param name [String] The unique name given to the terminal node that produced this output.
12
+ # @param value [FunctionCall]
13
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
14
+ # @return [TerminalNodeFunctionCallResult]
15
+ def initialize(name:, id: nil, value: nil, additional_properties: nil)
16
+ # @type [String]
17
+ @id = id
18
+ # @type [String] The unique name given to the terminal node that produced this output.
19
+ @name = name
20
+ # @type [FunctionCall]
21
+ @value = value
22
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
23
+ @additional_properties = additional_properties
24
+ end
25
+
26
+ # Deserialize a JSON object to an instance of TerminalNodeFunctionCallResult
27
+ #
28
+ # @param json_object [JSON]
29
+ # @return [TerminalNodeFunctionCallResult]
30
+ def self.from_json(json_object:)
31
+ struct = JSON.parse(json_object, object_class: OpenStruct)
32
+ parsed_json = JSON.parse(json_object)
33
+ id = struct.id
34
+ name = struct.name
35
+ if parsed_json["value"].nil?
36
+ value = nil
37
+ else
38
+ value = parsed_json["value"].to_json
39
+ value = FunctionCall.from_json(json_object: value)
40
+ end
41
+ new(id: id, name: name, value: value, additional_properties: struct)
42
+ end
43
+
44
+ # Serialize an instance of TerminalNodeFunctionCallResult to a JSON object
45
+ #
46
+ # @return [JSON]
47
+ def to_json(*_args)
48
+ { "id": @id, "name": @name, "value": @value }.to_json
49
+ end
50
+
51
+ # 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.
52
+ #
53
+ # @param obj [Object]
54
+ # @return [Void]
55
+ def self.validate_raw(obj:)
56
+ obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
57
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
58
+ obj.value.nil? || FunctionCall.validate_raw(obj: obj.value)
59
+ end
60
+ end
61
+ end
@@ -6,6 +6,8 @@ require_relative "terminal_node_number_result"
6
6
  require_relative "terminal_node_json_result"
7
7
  require_relative "terminal_node_chat_history_result"
8
8
  require_relative "terminal_node_search_results_result"
9
+ require_relative "terminal_node_array_result"
10
+ require_relative "terminal_node_function_call_result"
9
11
  require_relative "terminal_node_error_result"
10
12
 
11
13
  module Vellum
@@ -41,6 +43,10 @@ module Vellum
41
43
  TerminalNodeChatHistoryResult.from_json(json_object: json_object)
42
44
  when "SEARCH_RESULTS"
43
45
  TerminalNodeSearchResultsResult.from_json(json_object: json_object)
46
+ when "ARRAY"
47
+ TerminalNodeArrayResult.from_json(json_object: json_object)
48
+ when "FUNCTION_CALL"
49
+ TerminalNodeFunctionCallResult.from_json(json_object: json_object)
44
50
  when "ERROR"
45
51
  TerminalNodeErrorResult.from_json(json_object: json_object)
46
52
  else
@@ -64,6 +70,10 @@ module Vellum
64
70
  { **@member.to_json, type: @discriminant }.to_json
65
71
  when "SEARCH_RESULTS"
66
72
  { **@member.to_json, type: @discriminant }.to_json
73
+ when "ARRAY"
74
+ { **@member.to_json, type: @discriminant }.to_json
75
+ when "FUNCTION_CALL"
76
+ { **@member.to_json, type: @discriminant }.to_json
67
77
  when "ERROR"
68
78
  { **@member.to_json, type: @discriminant }.to_json
69
79
  else
@@ -88,6 +98,10 @@ module Vellum
88
98
  TerminalNodeChatHistoryResult.validate_raw(obj: obj)
89
99
  when "SEARCH_RESULTS"
90
100
  TerminalNodeSearchResultsResult.validate_raw(obj: obj)
101
+ when "ARRAY"
102
+ TerminalNodeArrayResult.validate_raw(obj: obj)
103
+ when "FUNCTION_CALL"
104
+ TerminalNodeFunctionCallResult.validate_raw(obj: obj)
91
105
  when "ERROR"
92
106
  TerminalNodeErrorResult.validate_raw(obj: obj)
93
107
  else
@@ -133,6 +147,18 @@ module Vellum
133
147
  new(member: member, discriminant: "SEARCH_RESULTS")
134
148
  end
135
149
 
150
+ # @param member [TerminalNodeArrayResult]
151
+ # @return [TerminalNodeResultOutput]
152
+ def self.array(member:)
153
+ new(member: member, discriminant: "ARRAY")
154
+ end
155
+
156
+ # @param member [TerminalNodeFunctionCallResult]
157
+ # @return [TerminalNodeResultOutput]
158
+ def self.function_call(member:)
159
+ new(member: member, discriminant: "FUNCTION_CALL")
160
+ end
161
+
136
162
  # @param member [TerminalNodeErrorResult]
137
163
  # @return [TerminalNodeResultOutput]
138
164
  def self.error(member:)
@@ -5,6 +5,7 @@ module Vellum
5
5
  VELLUM_ERROR_CODE_ENUM = {
6
6
  invalid_request: "INVALID_REQUEST",
7
7
  provider_error: "PROVIDER_ERROR",
8
- internal_server_error: "INTERNAL_SERVER_ERROR"
8
+ internal_server_error: "INTERNAL_SERVER_ERROR",
9
+ user_defined_error: "USER_DEFINED_ERROR"
9
10
  }.freeze
10
11
  end
@@ -0,0 +1,118 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "entity_status"
4
+ require_relative "environment_enum"
5
+ require "date"
6
+ require_relative "vellum_variable"
7
+ require "json"
8
+
9
+ module Vellum
10
+ class WorkflowDeploymentRead
11
+ attr_reader :id, :name, :label, :status, :environment, :created, :last_deployed_on, :input_variables,
12
+ :output_variables, :additional_properties
13
+
14
+ # @param id [String]
15
+ # @param name [String] A name that uniquely identifies this workflow deployment within its workspace
16
+ # @param label [String] A human-readable label for the workflow deployment
17
+ # @param status [ENTITY_STATUS] The current status of the workflow deployment
18
+ # - `ACTIVE` - Active
19
+ # - `ARCHIVED` - Archived
20
+ # @param environment [ENVIRONMENT_ENUM] The environment this workflow deployment is used in
21
+ # - `DEVELOPMENT` - Development
22
+ # - `STAGING` - Staging
23
+ # - `PRODUCTION` - Production
24
+ # @param created [DateTime]
25
+ # @param last_deployed_on [DateTime]
26
+ # @param input_variables [Array<VellumVariable>] The input variables this Workflow Deployment expects to receive values for when it is executed.
27
+ # @param output_variables [Array<VellumVariable>] The output variables this Workflow Deployment produces values for when it's executed.
28
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
29
+ # @return [WorkflowDeploymentRead]
30
+ def initialize(id:, name:, label:, created:, last_deployed_on:, input_variables:, output_variables:, status: nil,
31
+ environment: nil, additional_properties: nil)
32
+ # @type [String]
33
+ @id = id
34
+ # @type [String] A name that uniquely identifies this workflow deployment within its workspace
35
+ @name = name
36
+ # @type [String] A human-readable label for the workflow deployment
37
+ @label = label
38
+ # @type [ENTITY_STATUS] The current status of the workflow deployment
39
+ # - `ACTIVE` - Active
40
+ # - `ARCHIVED` - Archived
41
+ @status = status
42
+ # @type [ENVIRONMENT_ENUM] The environment this workflow deployment is used in
43
+ # - `DEVELOPMENT` - Development
44
+ # - `STAGING` - Staging
45
+ # - `PRODUCTION` - Production
46
+ @environment = environment
47
+ # @type [DateTime]
48
+ @created = created
49
+ # @type [DateTime]
50
+ @last_deployed_on = last_deployed_on
51
+ # @type [Array<VellumVariable>] The input variables this Workflow Deployment expects to receive values for when it is executed.
52
+ @input_variables = input_variables
53
+ # @type [Array<VellumVariable>] The output variables this Workflow Deployment produces values for when it's executed.
54
+ @output_variables = output_variables
55
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
56
+ @additional_properties = additional_properties
57
+ end
58
+
59
+ # Deserialize a JSON object to an instance of WorkflowDeploymentRead
60
+ #
61
+ # @param json_object [JSON]
62
+ # @return [WorkflowDeploymentRead]
63
+ def self.from_json(json_object:)
64
+ struct = JSON.parse(json_object, object_class: OpenStruct)
65
+ parsed_json = JSON.parse(json_object)
66
+ id = struct.id
67
+ name = struct.name
68
+ label = struct.label
69
+ status = ENTITY_STATUS.key(parsed_json["status"]) || parsed_json["status"]
70
+ environment = ENVIRONMENT_ENUM.key(parsed_json["environment"]) || parsed_json["environment"]
71
+ created = DateTime.parse(parsed_json["created"])
72
+ last_deployed_on = DateTime.parse(parsed_json["last_deployed_on"])
73
+ input_variables = parsed_json["input_variables"].map do |v|
74
+ v = v.to_json
75
+ VellumVariable.from_json(json_object: v)
76
+ end
77
+ output_variables = parsed_json["output_variables"].map do |v|
78
+ v = v.to_json
79
+ VellumVariable.from_json(json_object: v)
80
+ end
81
+ new(id: id, name: name, label: label, status: status, environment: environment, created: created,
82
+ last_deployed_on: last_deployed_on, input_variables: input_variables, output_variables: output_variables, additional_properties: struct)
83
+ end
84
+
85
+ # Serialize an instance of WorkflowDeploymentRead to a JSON object
86
+ #
87
+ # @return [JSON]
88
+ def to_json(*_args)
89
+ {
90
+ "id": @id,
91
+ "name": @name,
92
+ "label": @label,
93
+ "status": ENTITY_STATUS[@status] || @status,
94
+ "environment": ENVIRONMENT_ENUM[@environment] || @environment,
95
+ "created": @created,
96
+ "last_deployed_on": @last_deployed_on,
97
+ "input_variables": @input_variables,
98
+ "output_variables": @output_variables
99
+ }.to_json
100
+ end
101
+
102
+ # 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.
103
+ #
104
+ # @param obj [Object]
105
+ # @return [Void]
106
+ def self.validate_raw(obj:)
107
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
108
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
109
+ obj.label.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.")
110
+ obj.status&.is_a?(ENTITY_STATUS) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
111
+ obj.environment&.is_a?(ENVIRONMENT_ENUM) != false || raise("Passed value for field obj.environment is not the expected type, validation failed.")
112
+ obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
113
+ obj.last_deployed_on.is_a?(DateTime) != false || raise("Passed value for field obj.last_deployed_on is not the expected type, validation failed.")
114
+ obj.input_variables.is_a?(Array) != false || raise("Passed value for field obj.input_variables is not the expected type, validation failed.")
115
+ obj.output_variables.is_a?(Array) != false || raise("Passed value for field obj.output_variables is not the expected type, validation failed.")
116
+ end
117
+ end
118
+ end
@@ -8,6 +8,7 @@ module Vellum
8
8
  internal_server_error: "INTERNAL_SERVER_ERROR",
9
9
  node_execution: "NODE_EXECUTION",
10
10
  llm_provider: "LLM_PROVIDER",
11
- invalid_template: "INVALID_TEMPLATE"
11
+ invalid_template: "INVALID_TEMPLATE",
12
+ user_defined_error: "USER_DEFINED_ERROR"
12
13
  }.freeze
13
14
  end
@@ -8,6 +8,7 @@ require_relative "code_execution_node_result"
8
8
  require_relative "conditional_node_result"
9
9
  require_relative "api_node_result"
10
10
  require_relative "terminal_node_result"
11
+ require_relative "subworkflow_node_result"
11
12
 
12
13
  module Vellum
13
14
  class WorkflowNodeResultData
@@ -46,6 +47,8 @@ module Vellum
46
47
  ApiNodeResult.from_json(json_object: json_object)
47
48
  when "TERMINAL"
48
49
  TerminalNodeResult.from_json(json_object: json_object)
50
+ when "SUBWORKFLOW"
51
+ SubworkflowNodeResult.from_json(json_object: json_object)
49
52
  else
50
53
  PromptNodeResult.from_json(json_object: json_object)
51
54
  end
@@ -71,6 +74,8 @@ module Vellum
71
74
  { **@member.to_json, type: @discriminant }.to_json
72
75
  when "TERMINAL"
73
76
  { **@member.to_json, type: @discriminant }.to_json
77
+ when "SUBWORKFLOW"
78
+ { **@member.to_json, type: @discriminant }.to_json
74
79
  else
75
80
  { "type": @discriminant, value: @member }.to_json
76
81
  end
@@ -97,6 +102,8 @@ module Vellum
97
102
  ApiNodeResult.validate_raw(obj: obj)
98
103
  when "TERMINAL"
99
104
  TerminalNodeResult.validate_raw(obj: obj)
105
+ when "SUBWORKFLOW"
106
+ SubworkflowNodeResult.validate_raw(obj: obj)
100
107
  else
101
108
  raise("Passed value matched no type within the union, validation failed.")
102
109
  end
@@ -151,5 +158,11 @@ module Vellum
151
158
  def self.terminal(member:)
152
159
  new(member: member, discriminant: "TERMINAL")
153
160
  end
161
+
162
+ # @param member [SubworkflowNodeResult]
163
+ # @return [WorkflowNodeResultData]
164
+ def self.subworkflow(member:)
165
+ new(member: member, discriminant: "SUBWORKFLOW")
166
+ end
154
167
  end
155
168
  end
@@ -6,6 +6,7 @@ require_relative "workflow_output_number"
6
6
  require_relative "workflow_output_json"
7
7
  require_relative "workflow_output_chat_history"
8
8
  require_relative "workflow_output_search_results"
9
+ require_relative "workflow_output_array"
9
10
  require_relative "workflow_output_error"
10
11
  require_relative "workflow_output_function_call"
11
12
  require_relative "workflow_output_image"
@@ -43,6 +44,8 @@ module Vellum
43
44
  WorkflowOutputChatHistory.from_json(json_object: json_object)
44
45
  when "SEARCH_RESULTS"
45
46
  WorkflowOutputSearchResults.from_json(json_object: json_object)
47
+ when "ARRAY"
48
+ WorkflowOutputArray.from_json(json_object: json_object)
46
49
  when "ERROR"
47
50
  WorkflowOutputError.from_json(json_object: json_object)
48
51
  when "FUNCTION_CALL"
@@ -70,6 +73,8 @@ module Vellum
70
73
  { **@member.to_json, type: @discriminant }.to_json
71
74
  when "SEARCH_RESULTS"
72
75
  { **@member.to_json, type: @discriminant }.to_json
76
+ when "ARRAY"
77
+ { **@member.to_json, type: @discriminant }.to_json
73
78
  when "ERROR"
74
79
  { **@member.to_json, type: @discriminant }.to_json
75
80
  when "FUNCTION_CALL"
@@ -98,6 +103,8 @@ module Vellum
98
103
  WorkflowOutputChatHistory.validate_raw(obj: obj)
99
104
  when "SEARCH_RESULTS"
100
105
  WorkflowOutputSearchResults.validate_raw(obj: obj)
106
+ when "ARRAY"
107
+ WorkflowOutputArray.validate_raw(obj: obj)
101
108
  when "ERROR"
102
109
  WorkflowOutputError.validate_raw(obj: obj)
103
110
  when "FUNCTION_CALL"
@@ -147,6 +154,12 @@ module Vellum
147
154
  new(member: member, discriminant: "SEARCH_RESULTS")
148
155
  end
149
156
 
157
+ # @param member [WorkflowOutputArray]
158
+ # @return [WorkflowOutput]
159
+ def self.array(member:)
160
+ new(member: member, discriminant: "ARRAY")
161
+ end
162
+
150
163
  # @param member [WorkflowOutputError]
151
164
  # @return [WorkflowOutput]
152
165
  def self.error(member:)