vellum_ai 0.3.8 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: adb4760882a30ad83ab4941e55cb8a40ae87e258c1bf3e20e3ac448b2813e7f1
4
- data.tar.gz: 8c59f859ad9128cb569fa0c4b1139097e46e7d6ad62c060aa87137d85275e001
3
+ metadata.gz: 72a042dfa14e5c853594fed021ab79235d7493790da8e34280f66c6f448fb1db
4
+ data.tar.gz: 25ddfca2df59cc444d7e4c63cf221f8bb3274a660253183a165c5741ed4de8b4
5
5
  SHA512:
6
- metadata.gz: 5174ac6dcb5de429f610cf186a21badc4210d412c3a9286cde43e6c71687a604a3ea907e7a842a8be93e3cef159963c71e150455e7ab74122ced178e9fca03f7
7
- data.tar.gz: 2bcf48bbf3e24cc50d1c3f06554cce5fff4381d9005bf4e965bb2df29e25a4ad2483f187f4ace29919c989d17c19923e888338f368812e54479ccd6523f1d68f
6
+ metadata.gz: b0de23219672cbb8def515bc8fa00b31e0209b3914ca4284f103fbb21a9022d51830ff802d1b924599bbd8443ff40b7de721d9e265d1792acb8d736c58c5150e
7
+ data.tar.gz: a7cd6b831b2937bd112d934bb6d9a1d57a20594cc567296568bd3271632b29ab082c25d2b11e2fe872579f26b26e2a1c0067ae6d6f5a754f089ba0a15b0b5593
data/lib/requests.rb CHANGED
@@ -20,7 +20,7 @@ module Vellum
20
20
  @headers = {
21
21
  "X-Fern-Language": "Ruby",
22
22
  "X-Fern-SDK-Name": "Vellum",
23
- "X-Fern-SDK-Version": "0.3.8",
23
+ "X-Fern-SDK-Version": "0.3.9",
24
24
  "X_API_KEY": api_key.to_s
25
25
  }
26
26
  @conn = Faraday.new(headers: @headers) do |faraday|
@@ -46,7 +46,7 @@ module Vellum
46
46
  @headers = {
47
47
  "X-Fern-Language": "Ruby",
48
48
  "X-Fern-SDK-Name": "Vellum",
49
- "X-Fern-SDK-Version": "0.3.8",
49
+ "X-Fern-SDK-Version": "0.3.9",
50
50
  "X_API_KEY": api_key.to_s
51
51
  }
52
52
  @conn = Faraday.new(headers: @headers) do |faraday|
data/lib/types_export.rb CHANGED
@@ -192,6 +192,8 @@ require_relative "vellum_ai/types/string_variable_value"
192
192
  require_relative "vellum_ai/types/submit_completion_actual_request"
193
193
  require_relative "vellum_ai/types/submit_completion_actuals_error_response"
194
194
  require_relative "vellum_ai/types/submit_workflow_execution_actual_request"
195
+ require_relative "vellum_ai/types/subworkflow_enum"
196
+ require_relative "vellum_ai/types/subworkflow_node_result"
195
197
  require_relative "vellum_ai/types/templating_node_chat_history_result"
196
198
  require_relative "vellum_ai/types/templating_node_error_result"
197
199
  require_relative "vellum_ai/types/templating_node_json_result"
@@ -201,8 +203,10 @@ require_relative "vellum_ai/types/templating_node_result_data"
201
203
  require_relative "vellum_ai/types/templating_node_result_output"
202
204
  require_relative "vellum_ai/types/templating_node_search_results_result"
203
205
  require_relative "vellum_ai/types/templating_node_string_result"
206
+ require_relative "vellum_ai/types/terminal_node_array_result"
204
207
  require_relative "vellum_ai/types/terminal_node_chat_history_result"
205
208
  require_relative "vellum_ai/types/terminal_node_error_result"
209
+ require_relative "vellum_ai/types/terminal_node_function_call_result"
206
210
  require_relative "vellum_ai/types/terminal_node_json_result"
207
211
  require_relative "vellum_ai/types/terminal_node_number_result"
208
212
  require_relative "vellum_ai/types/terminal_node_result"
@@ -240,6 +244,7 @@ require_relative "vellum_ai/types/workflow_node_result_data"
240
244
  require_relative "vellum_ai/types/workflow_node_result_event"
241
245
  require_relative "vellum_ai/types/workflow_node_result_event_state"
242
246
  require_relative "vellum_ai/types/workflow_output"
247
+ require_relative "vellum_ai/types/workflow_output_array"
243
248
  require_relative "vellum_ai/types/workflow_output_chat_history"
244
249
  require_relative "vellum_ai/types/workflow_output_error"
245
250
  require_relative "vellum_ai/types/workflow_output_function_call"
@@ -255,8 +260,10 @@ require_relative "vellum_ai/types/workflow_request_number_input_request"
255
260
  require_relative "vellum_ai/types/workflow_request_string_input_request"
256
261
  require_relative "vellum_ai/types/workflow_result_event"
257
262
  require_relative "vellum_ai/types/workflow_result_event_output_data"
263
+ require_relative "vellum_ai/types/workflow_result_event_output_data_array"
258
264
  require_relative "vellum_ai/types/workflow_result_event_output_data_chat_history"
259
265
  require_relative "vellum_ai/types/workflow_result_event_output_data_error"
266
+ require_relative "vellum_ai/types/workflow_result_event_output_data_function_call"
260
267
  require_relative "vellum_ai/types/workflow_result_event_output_data_json"
261
268
  require_relative "vellum_ai/types/workflow_result_event_output_data_number"
262
269
  require_relative "vellum_ai/types/workflow_result_event_output_data_search_results"
@@ -5,14 +5,17 @@ require "json"
5
5
 
6
6
  module Vellum
7
7
  class CodeExecutionNodeResultData
8
- attr_reader :output, :additional_properties
8
+ attr_reader :output, :log_output_id, :additional_properties
9
9
 
10
10
  # @param output [CodeExecutionNodeResultOutput]
11
+ # @param log_output_id [String]
11
12
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
12
13
  # @return [CodeExecutionNodeResultData]
13
- def initialize(output:, additional_properties: nil)
14
+ def initialize(output:, log_output_id: nil, additional_properties: nil)
14
15
  # @type [CodeExecutionNodeResultOutput]
15
16
  @output = output
17
+ # @type [String]
18
+ @log_output_id = log_output_id
16
19
  # @type [OpenStruct] Additional properties unmapped to the current class definition
17
20
  @additional_properties = additional_properties
18
21
  end
@@ -30,14 +33,15 @@ module Vellum
30
33
  output = parsed_json["output"].to_json
31
34
  output = CodeExecutionNodeResultOutput.from_json(json_object: output)
32
35
  end
33
- new(output: output, additional_properties: struct)
36
+ log_output_id = struct.log_output_id
37
+ new(output: output, log_output_id: log_output_id, additional_properties: struct)
34
38
  end
35
39
 
36
40
  # Serialize an instance of CodeExecutionNodeResultData to a JSON object
37
41
  #
38
42
  # @return [JSON]
39
43
  def to_json(*_args)
40
- { "output": @output }.to_json
44
+ { "output": @output, "log_output_id": @log_output_id }.to_json
41
45
  end
42
46
 
43
47
  # 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.
@@ -46,6 +50,7 @@ module Vellum
46
50
  # @return [Void]
47
51
  def self.validate_raw(obj:)
48
52
  CodeExecutionNodeResultOutput.validate_raw(obj: obj.output)
53
+ obj.log_output_id&.is_a?(String) != false || raise("Passed value for field obj.log_output_id is not the expected type, validation failed.")
49
54
  end
50
55
  end
51
56
  end
@@ -12,7 +12,7 @@ module Vellum
12
12
  # @param value [Array<ArrayVariableValueItem>]
13
13
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
14
14
  # @return [NodeInputCompiledArrayValue]
15
- def initialize(node_input_id:, key:, value:, additional_properties: nil)
15
+ def initialize(node_input_id:, key:, value: nil, additional_properties: nil)
16
16
  # @type [String]
17
17
  @node_input_id = node_input_id
18
18
  # @type [String]
@@ -53,7 +53,7 @@ module Vellum
53
53
  def self.validate_raw(obj:)
54
54
  obj.node_input_id.is_a?(String) != false || raise("Passed value for field obj.node_input_id is not the expected type, validation failed.")
55
55
  obj.key.is_a?(String) != false || raise("Passed value for field obj.key 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.")
56
+ obj.value&.is_a?(Array) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
57
57
  end
58
58
  end
59
59
  end
@@ -11,7 +11,7 @@ module Vellum
11
11
  # @param value [Array<ArrayVariableValueItem>]
12
12
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
13
13
  # @return [NodeOutputCompiledArrayValue]
14
- def initialize(node_output_id:, value:, additional_properties: nil)
14
+ def initialize(node_output_id:, value: nil, additional_properties: nil)
15
15
  # @type [String]
16
16
  @node_output_id = node_output_id
17
17
  # @type [Array<ArrayVariableValueItem>]
@@ -48,7 +48,7 @@ module Vellum
48
48
  # @return [Void]
49
49
  def self.validate_raw(obj:)
50
50
  obj.node_output_id.is_a?(String) != false || raise("Passed value for field obj.node_output_id is not the expected type, validation failed.")
51
- obj.value.is_a?(Array) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
51
+ obj.value&.is_a?(Array) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
52
52
  end
53
53
  end
54
54
  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
@@ -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:)
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "array_variable_value_item"
4
+ require "json"
5
+
6
+ module Vellum
7
+ # An array output from a Workflow execution.
8
+ class WorkflowOutputArray
9
+ attr_reader :id, :name, :value, :additional_properties
10
+
11
+ # @param id [String]
12
+ # @param name [String] The output's name, as defined in the workflow
13
+ # @param value [Array<ArrayVariableValueItem>]
14
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
15
+ # @return [WorkflowOutputArray]
16
+ def initialize(id:, name:, value:, additional_properties: nil)
17
+ # @type [String]
18
+ @id = id
19
+ # @type [String] The output's name, as defined in the workflow
20
+ @name = name
21
+ # @type [Array<ArrayVariableValueItem>]
22
+ @value = value
23
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
24
+ @additional_properties = additional_properties
25
+ end
26
+
27
+ # Deserialize a JSON object to an instance of WorkflowOutputArray
28
+ #
29
+ # @param json_object [JSON]
30
+ # @return [WorkflowOutputArray]
31
+ def self.from_json(json_object:)
32
+ struct = JSON.parse(json_object, object_class: OpenStruct)
33
+ parsed_json = JSON.parse(json_object)
34
+ id = struct.id
35
+ name = struct.name
36
+ value = parsed_json["value"].map do |v|
37
+ v = v.to_json
38
+ ArrayVariableValueItem.from_json(json_object: v)
39
+ end
40
+ new(id: id, name: name, value: value, additional_properties: struct)
41
+ end
42
+
43
+ # Serialize an instance of WorkflowOutputArray to a JSON object
44
+ #
45
+ # @return [JSON]
46
+ def to_json(*_args)
47
+ { "id": @id, "name": @name, "value": @value }.to_json
48
+ end
49
+
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.
51
+ #
52
+ # @param obj [Object]
53
+ # @return [Void]
54
+ def self.validate_raw(obj:)
55
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
56
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
57
+ obj.value.is_a?(Array) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
58
+ end
59
+ end
60
+ end
@@ -6,6 +6,8 @@ require_relative "workflow_result_event_output_data_number"
6
6
  require_relative "workflow_result_event_output_data_json"
7
7
  require_relative "workflow_result_event_output_data_chat_history"
8
8
  require_relative "workflow_result_event_output_data_search_results"
9
+ require_relative "workflow_result_event_output_data_array"
10
+ require_relative "workflow_result_event_output_data_function_call"
9
11
  require_relative "workflow_result_event_output_data_error"
10
12
 
11
13
  module Vellum
@@ -41,6 +43,10 @@ module Vellum
41
43
  WorkflowResultEventOutputDataChatHistory.from_json(json_object: json_object)
42
44
  when "SEARCH_RESULTS"
43
45
  WorkflowResultEventOutputDataSearchResults.from_json(json_object: json_object)
46
+ when "ARRAY"
47
+ WorkflowResultEventOutputDataArray.from_json(json_object: json_object)
48
+ when "FUNCTION_CALL"
49
+ WorkflowResultEventOutputDataFunctionCall.from_json(json_object: json_object)
44
50
  when "ERROR"
45
51
  WorkflowResultEventOutputDataError.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
  WorkflowResultEventOutputDataChatHistory.validate_raw(obj: obj)
89
99
  when "SEARCH_RESULTS"
90
100
  WorkflowResultEventOutputDataSearchResults.validate_raw(obj: obj)
101
+ when "ARRAY"
102
+ WorkflowResultEventOutputDataArray.validate_raw(obj: obj)
103
+ when "FUNCTION_CALL"
104
+ WorkflowResultEventOutputDataFunctionCall.validate_raw(obj: obj)
91
105
  when "ERROR"
92
106
  WorkflowResultEventOutputDataError.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 [WorkflowResultEventOutputDataArray]
151
+ # @return [WorkflowResultEventOutputData]
152
+ def self.array(member:)
153
+ new(member: member, discriminant: "ARRAY")
154
+ end
155
+
156
+ # @param member [WorkflowResultEventOutputDataFunctionCall]
157
+ # @return [WorkflowResultEventOutputData]
158
+ def self.function_call(member:)
159
+ new(member: member, discriminant: "FUNCTION_CALL")
160
+ end
161
+
136
162
  # @param member [WorkflowResultEventOutputDataError]
137
163
  # @return [WorkflowResultEventOutputData]
138
164
  def self.error(member:)
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "workflow_node_result_event_state"
4
+ require_relative "array_variable_value_item"
5
+ require "json"
6
+
7
+ module Vellum
8
+ # An Array output returned from a Workflow execution.
9
+ class WorkflowResultEventOutputDataArray
10
+ attr_reader :id, :name, :state, :node_id, :delta, :value, :additional_properties
11
+
12
+ # @param id [String]
13
+ # @param name [String]
14
+ # @param state [WORKFLOW_NODE_RESULT_EVENT_STATE]
15
+ # @param node_id [String]
16
+ # @param delta [String] The newly output string value. Only relevant for string outputs with a state of STREAMING.
17
+ # @param value [Array<ArrayVariableValueItem>]
18
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
19
+ # @return [WorkflowResultEventOutputDataArray]
20
+ def initialize(name:, state:, node_id:, id: nil, delta: nil, value: nil, additional_properties: nil)
21
+ # @type [String]
22
+ @id = id
23
+ # @type [String]
24
+ @name = name
25
+ # @type [WORKFLOW_NODE_RESULT_EVENT_STATE]
26
+ @state = state
27
+ # @type [String]
28
+ @node_id = node_id
29
+ # @type [String] The newly output string value. Only relevant for string outputs with a state of STREAMING.
30
+ @delta = delta
31
+ # @type [Array<ArrayVariableValueItem>]
32
+ @value = value
33
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
34
+ @additional_properties = additional_properties
35
+ end
36
+
37
+ # Deserialize a JSON object to an instance of WorkflowResultEventOutputDataArray
38
+ #
39
+ # @param json_object [JSON]
40
+ # @return [WorkflowResultEventOutputDataArray]
41
+ def self.from_json(json_object:)
42
+ struct = JSON.parse(json_object, object_class: OpenStruct)
43
+ parsed_json = JSON.parse(json_object)
44
+ id = struct.id
45
+ name = struct.name
46
+ state = WORKFLOW_NODE_RESULT_EVENT_STATE.key(parsed_json["state"]) || parsed_json["state"]
47
+ node_id = struct.node_id
48
+ delta = struct.delta
49
+ value = parsed_json["value"].map do |v|
50
+ v = v.to_json
51
+ ArrayVariableValueItem.from_json(json_object: v)
52
+ end
53
+ new(id: id, name: name, state: state, node_id: node_id, delta: delta, value: value, additional_properties: struct)
54
+ end
55
+
56
+ # Serialize an instance of WorkflowResultEventOutputDataArray to a JSON object
57
+ #
58
+ # @return [JSON]
59
+ def to_json(*_args)
60
+ {
61
+ "id": @id,
62
+ "name": @name,
63
+ "state": WORKFLOW_NODE_RESULT_EVENT_STATE[@state] || @state,
64
+ "node_id": @node_id,
65
+ "delta": @delta,
66
+ "value": @value
67
+ }.to_json
68
+ end
69
+
70
+ # 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.
71
+ #
72
+ # @param obj [Object]
73
+ # @return [Void]
74
+ def self.validate_raw(obj:)
75
+ obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
76
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
77
+ obj.state.is_a?(WORKFLOW_NODE_RESULT_EVENT_STATE) != false || raise("Passed value for field obj.state is not the expected type, validation failed.")
78
+ obj.node_id.is_a?(String) != false || raise("Passed value for field obj.node_id is not the expected type, validation failed.")
79
+ obj.delta&.is_a?(String) != false || raise("Passed value for field obj.delta is not the expected type, validation failed.")
80
+ obj.value&.is_a?(Array) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "workflow_node_result_event_state"
4
+ require_relative "function_call"
5
+ require "json"
6
+
7
+ module Vellum
8
+ # A Function Call output returned from a Workflow execution.
9
+ class WorkflowResultEventOutputDataFunctionCall
10
+ attr_reader :id, :name, :state, :node_id, :delta, :value, :additional_properties
11
+
12
+ # @param id [String]
13
+ # @param name [String]
14
+ # @param state [WORKFLOW_NODE_RESULT_EVENT_STATE]
15
+ # @param node_id [String]
16
+ # @param delta [String] The newly output string value. Only relevant for string outputs with a state of STREAMING.
17
+ # @param value [FunctionCall]
18
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
19
+ # @return [WorkflowResultEventOutputDataFunctionCall]
20
+ def initialize(name:, state:, node_id:, id: nil, delta: nil, value: nil, additional_properties: nil)
21
+ # @type [String]
22
+ @id = id
23
+ # @type [String]
24
+ @name = name
25
+ # @type [WORKFLOW_NODE_RESULT_EVENT_STATE]
26
+ @state = state
27
+ # @type [String]
28
+ @node_id = node_id
29
+ # @type [String] The newly output string value. Only relevant for string outputs with a state of STREAMING.
30
+ @delta = delta
31
+ # @type [FunctionCall]
32
+ @value = value
33
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
34
+ @additional_properties = additional_properties
35
+ end
36
+
37
+ # Deserialize a JSON object to an instance of WorkflowResultEventOutputDataFunctionCall
38
+ #
39
+ # @param json_object [JSON]
40
+ # @return [WorkflowResultEventOutputDataFunctionCall]
41
+ def self.from_json(json_object:)
42
+ struct = JSON.parse(json_object, object_class: OpenStruct)
43
+ parsed_json = JSON.parse(json_object)
44
+ id = struct.id
45
+ name = struct.name
46
+ state = WORKFLOW_NODE_RESULT_EVENT_STATE.key(parsed_json["state"]) || parsed_json["state"]
47
+ node_id = struct.node_id
48
+ delta = struct.delta
49
+ if parsed_json["value"].nil?
50
+ value = nil
51
+ else
52
+ value = parsed_json["value"].to_json
53
+ value = FunctionCall.from_json(json_object: value)
54
+ end
55
+ new(id: id, name: name, state: state, node_id: node_id, delta: delta, value: value, additional_properties: struct)
56
+ end
57
+
58
+ # Serialize an instance of WorkflowResultEventOutputDataFunctionCall to a JSON object
59
+ #
60
+ # @return [JSON]
61
+ def to_json(*_args)
62
+ {
63
+ "id": @id,
64
+ "name": @name,
65
+ "state": WORKFLOW_NODE_RESULT_EVENT_STATE[@state] || @state,
66
+ "node_id": @node_id,
67
+ "delta": @delta,
68
+ "value": @value
69
+ }.to_json
70
+ end
71
+
72
+ # 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.
73
+ #
74
+ # @param obj [Object]
75
+ # @return [Void]
76
+ def self.validate_raw(obj:)
77
+ obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
78
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
79
+ obj.state.is_a?(WORKFLOW_NODE_RESULT_EVENT_STATE) != false || raise("Passed value for field obj.state is not the expected type, validation failed.")
80
+ obj.node_id.is_a?(String) != false || raise("Passed value for field obj.node_id is not the expected type, validation failed.")
81
+ obj.delta&.is_a?(String) != false || raise("Passed value for field obj.delta is not the expected type, validation failed.")
82
+ obj.value.nil? || FunctionCall.validate_raw(obj: obj.value)
83
+ end
84
+ end
85
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vellum_ai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vellum
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-01 00:00:00.000000000 Z
11
+ date: 2024-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-http-faraday
@@ -291,6 +291,8 @@ files:
291
291
  - lib/vellum_ai/types/submit_completion_actual_request.rb
292
292
  - lib/vellum_ai/types/submit_completion_actuals_error_response.rb
293
293
  - lib/vellum_ai/types/submit_workflow_execution_actual_request.rb
294
+ - lib/vellum_ai/types/subworkflow_enum.rb
295
+ - lib/vellum_ai/types/subworkflow_node_result.rb
294
296
  - lib/vellum_ai/types/templating_node_chat_history_result.rb
295
297
  - lib/vellum_ai/types/templating_node_error_result.rb
296
298
  - lib/vellum_ai/types/templating_node_json_result.rb
@@ -300,8 +302,10 @@ files:
300
302
  - lib/vellum_ai/types/templating_node_result_output.rb
301
303
  - lib/vellum_ai/types/templating_node_search_results_result.rb
302
304
  - lib/vellum_ai/types/templating_node_string_result.rb
305
+ - lib/vellum_ai/types/terminal_node_array_result.rb
303
306
  - lib/vellum_ai/types/terminal_node_chat_history_result.rb
304
307
  - lib/vellum_ai/types/terminal_node_error_result.rb
308
+ - lib/vellum_ai/types/terminal_node_function_call_result.rb
305
309
  - lib/vellum_ai/types/terminal_node_json_result.rb
306
310
  - lib/vellum_ai/types/terminal_node_number_result.rb
307
311
  - lib/vellum_ai/types/terminal_node_result.rb
@@ -339,6 +343,7 @@ files:
339
343
  - lib/vellum_ai/types/workflow_node_result_event.rb
340
344
  - lib/vellum_ai/types/workflow_node_result_event_state.rb
341
345
  - lib/vellum_ai/types/workflow_output.rb
346
+ - lib/vellum_ai/types/workflow_output_array.rb
342
347
  - lib/vellum_ai/types/workflow_output_chat_history.rb
343
348
  - lib/vellum_ai/types/workflow_output_error.rb
344
349
  - lib/vellum_ai/types/workflow_output_function_call.rb
@@ -354,8 +359,10 @@ files:
354
359
  - lib/vellum_ai/types/workflow_request_string_input_request.rb
355
360
  - lib/vellum_ai/types/workflow_result_event.rb
356
361
  - lib/vellum_ai/types/workflow_result_event_output_data.rb
362
+ - lib/vellum_ai/types/workflow_result_event_output_data_array.rb
357
363
  - lib/vellum_ai/types/workflow_result_event_output_data_chat_history.rb
358
364
  - lib/vellum_ai/types/workflow_result_event_output_data_error.rb
365
+ - lib/vellum_ai/types/workflow_result_event_output_data_function_call.rb
359
366
  - lib/vellum_ai/types/workflow_result_event_output_data_json.rb
360
367
  - lib/vellum_ai/types/workflow_result_event_output_data_number.rb
361
368
  - lib/vellum_ai/types/workflow_result_event_output_data_search_results.rb