vellum_ai 0.3.8 → 0.3.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/requests.rb +2 -2
- data/lib/types_export.rb +9 -0
- data/lib/vellum_ai/document_indexes/client.rb +58 -0
- data/lib/vellum_ai/document_indexes/types/document_indexes_list_request_status.rb +8 -0
- data/lib/vellum_ai/types/code_execution_node_result_data.rb +9 -4
- data/lib/vellum_ai/types/node_input_compiled_array_value.rb +2 -2
- data/lib/vellum_ai/types/node_output_compiled_array_value.rb +2 -2
- data/lib/vellum_ai/types/paginated_document_index_read_list.rb +64 -0
- data/lib/vellum_ai/types/subworkflow_enum.rb +5 -0
- data/lib/vellum_ai/types/subworkflow_node_result.rb +40 -0
- data/lib/vellum_ai/types/terminal_node_array_result.rb +59 -0
- data/lib/vellum_ai/types/terminal_node_function_call_result.rb +61 -0
- data/lib/vellum_ai/types/terminal_node_result_output.rb +26 -0
- data/lib/vellum_ai/types/vellum_error_code_enum.rb +2 -1
- data/lib/vellum_ai/types/workflow_execution_event_error_code.rb +2 -1
- data/lib/vellum_ai/types/workflow_node_result_data.rb +13 -0
- data/lib/vellum_ai/types/workflow_output.rb +13 -0
- data/lib/vellum_ai/types/workflow_output_array.rb +60 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data.rb +26 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data_array.rb +83 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data_function_call.rb +85 -0
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ee15857c4f6d078afa21d87b58baf72fa919289417db31edd4d749d76616dac
|
4
|
+
data.tar.gz: 2b3ef152052326857531cfcea45ee4baa5ec17285aeceab9f1e1fb42719e08f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46b1deb69aee31554a0fef8440a43de43027687f2be4d39c39491a3b0221852961a00759ad42837ce6d2ad16a0aea89ecd2a7671e387e70fa3ac91c1093c7879
|
7
|
+
data.tar.gz: d9325756359ce00b83ba6fa59f6ae988e801c04e420645ae653e43f592a5ae702caac0ccc00c58e026c2ce4f92bd0490c99a6cf25c1865e689e3295d47a5440e
|
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.
|
23
|
+
"X-Fern-SDK-Version": "0.3.10",
|
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.
|
49
|
+
"X-Fern-SDK-Version": "0.3.10",
|
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
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "vellum_ai/deployments/types/deployments_list_request_status"
|
4
|
+
require_relative "vellum_ai/document_indexes/types/document_indexes_list_request_status"
|
4
5
|
require_relative "vellum_ai/workflow_deployments/types/workflow_deployments_list_request_status"
|
5
6
|
require_relative "vellum_ai/types/api_node_result"
|
6
7
|
require_relative "vellum_ai/types/api_node_result_data"
|
@@ -123,6 +124,7 @@ require_relative "vellum_ai/types/normalized_log_probs"
|
|
123
124
|
require_relative "vellum_ai/types/normalized_token_log_probs"
|
124
125
|
require_relative "vellum_ai/types/number_enum"
|
125
126
|
require_relative "vellum_ai/types/number_variable_value"
|
127
|
+
require_relative "vellum_ai/types/paginated_document_index_read_list"
|
126
128
|
require_relative "vellum_ai/types/paginated_slim_deployment_read_list"
|
127
129
|
require_relative "vellum_ai/types/paginated_slim_document_list"
|
128
130
|
require_relative "vellum_ai/types/paginated_slim_workflow_deployment_list"
|
@@ -192,6 +194,8 @@ require_relative "vellum_ai/types/string_variable_value"
|
|
192
194
|
require_relative "vellum_ai/types/submit_completion_actual_request"
|
193
195
|
require_relative "vellum_ai/types/submit_completion_actuals_error_response"
|
194
196
|
require_relative "vellum_ai/types/submit_workflow_execution_actual_request"
|
197
|
+
require_relative "vellum_ai/types/subworkflow_enum"
|
198
|
+
require_relative "vellum_ai/types/subworkflow_node_result"
|
195
199
|
require_relative "vellum_ai/types/templating_node_chat_history_result"
|
196
200
|
require_relative "vellum_ai/types/templating_node_error_result"
|
197
201
|
require_relative "vellum_ai/types/templating_node_json_result"
|
@@ -201,8 +205,10 @@ require_relative "vellum_ai/types/templating_node_result_data"
|
|
201
205
|
require_relative "vellum_ai/types/templating_node_result_output"
|
202
206
|
require_relative "vellum_ai/types/templating_node_search_results_result"
|
203
207
|
require_relative "vellum_ai/types/templating_node_string_result"
|
208
|
+
require_relative "vellum_ai/types/terminal_node_array_result"
|
204
209
|
require_relative "vellum_ai/types/terminal_node_chat_history_result"
|
205
210
|
require_relative "vellum_ai/types/terminal_node_error_result"
|
211
|
+
require_relative "vellum_ai/types/terminal_node_function_call_result"
|
206
212
|
require_relative "vellum_ai/types/terminal_node_json_result"
|
207
213
|
require_relative "vellum_ai/types/terminal_node_number_result"
|
208
214
|
require_relative "vellum_ai/types/terminal_node_result"
|
@@ -240,6 +246,7 @@ require_relative "vellum_ai/types/workflow_node_result_data"
|
|
240
246
|
require_relative "vellum_ai/types/workflow_node_result_event"
|
241
247
|
require_relative "vellum_ai/types/workflow_node_result_event_state"
|
242
248
|
require_relative "vellum_ai/types/workflow_output"
|
249
|
+
require_relative "vellum_ai/types/workflow_output_array"
|
243
250
|
require_relative "vellum_ai/types/workflow_output_chat_history"
|
244
251
|
require_relative "vellum_ai/types/workflow_output_error"
|
245
252
|
require_relative "vellum_ai/types/workflow_output_function_call"
|
@@ -255,8 +262,10 @@ require_relative "vellum_ai/types/workflow_request_number_input_request"
|
|
255
262
|
require_relative "vellum_ai/types/workflow_request_string_input_request"
|
256
263
|
require_relative "vellum_ai/types/workflow_result_event"
|
257
264
|
require_relative "vellum_ai/types/workflow_result_event_output_data"
|
265
|
+
require_relative "vellum_ai/types/workflow_result_event_output_data_array"
|
258
266
|
require_relative "vellum_ai/types/workflow_result_event_output_data_chat_history"
|
259
267
|
require_relative "vellum_ai/types/workflow_result_event_output_data_error"
|
268
|
+
require_relative "vellum_ai/types/workflow_result_event_output_data_function_call"
|
260
269
|
require_relative "vellum_ai/types/workflow_result_event_output_data_json"
|
261
270
|
require_relative "vellum_ai/types/workflow_result_event_output_data_number"
|
262
271
|
require_relative "vellum_ai/types/workflow_result_event_output_data_search_results"
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "../../requests"
|
4
|
+
require_relative "types/document_indexes_list_request_status"
|
5
|
+
require_relative "../types/paginated_document_index_read_list"
|
4
6
|
require_relative "../types/entity_status"
|
5
7
|
require_relative "../types/environment_enum"
|
6
8
|
require_relative "../types/document_index_read"
|
@@ -17,6 +19,33 @@ module Vellum
|
|
17
19
|
@request_client = request_client
|
18
20
|
end
|
19
21
|
|
22
|
+
# Used to retrieve a list of Document Indexes.
|
23
|
+
#
|
24
|
+
# @param limit [Integer] Number of results to return per page.
|
25
|
+
# @param offset [Integer] The initial index from which to return the results.
|
26
|
+
# @param ordering [String] Which field to use when ordering the results.
|
27
|
+
# @param status [DOCUMENT_INDEXES_LIST_REQUEST_STATUS] The current status of the document index
|
28
|
+
# - `ACTIVE` - Active
|
29
|
+
# - `ARCHIVED` - Archived
|
30
|
+
# @param request_options [RequestOptions]
|
31
|
+
# @return [PaginatedDocumentIndexReadList]
|
32
|
+
def list(limit: nil, offset: nil, ordering: nil, status: nil, request_options: nil)
|
33
|
+
response = @request_client.conn.get do |req|
|
34
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
35
|
+
req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
36
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
37
|
+
req.params = {
|
38
|
+
**(request_options&.additional_query_parameters || {}),
|
39
|
+
"limit": limit,
|
40
|
+
"offset": offset,
|
41
|
+
"ordering": ordering,
|
42
|
+
"status": status
|
43
|
+
}.compact
|
44
|
+
req.url "#{@request_client.default_environment[:Default]}/v1/document-indexes"
|
45
|
+
end
|
46
|
+
PaginatedDocumentIndexReadList.from_json(json_object: response.body)
|
47
|
+
end
|
48
|
+
|
20
49
|
# Creates a new document index.
|
21
50
|
#
|
22
51
|
# @param label [String] A human-readable label for the document index
|
@@ -78,6 +107,35 @@ module Vellum
|
|
78
107
|
@request_client = request_client
|
79
108
|
end
|
80
109
|
|
110
|
+
# Used to retrieve a list of Document Indexes.
|
111
|
+
#
|
112
|
+
# @param limit [Integer] Number of results to return per page.
|
113
|
+
# @param offset [Integer] The initial index from which to return the results.
|
114
|
+
# @param ordering [String] Which field to use when ordering the results.
|
115
|
+
# @param status [DOCUMENT_INDEXES_LIST_REQUEST_STATUS] The current status of the document index
|
116
|
+
# - `ACTIVE` - Active
|
117
|
+
# - `ARCHIVED` - Archived
|
118
|
+
# @param request_options [RequestOptions]
|
119
|
+
# @return [PaginatedDocumentIndexReadList]
|
120
|
+
def list(limit: nil, offset: nil, ordering: nil, status: nil, request_options: nil)
|
121
|
+
Async do
|
122
|
+
response = @request_client.conn.get do |req|
|
123
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
124
|
+
req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
125
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
126
|
+
req.params = {
|
127
|
+
**(request_options&.additional_query_parameters || {}),
|
128
|
+
"limit": limit,
|
129
|
+
"offset": offset,
|
130
|
+
"ordering": ordering,
|
131
|
+
"status": status
|
132
|
+
}.compact
|
133
|
+
req.url "#{@request_client.default_environment[:Default]}/v1/document-indexes"
|
134
|
+
end
|
135
|
+
PaginatedDocumentIndexReadList.from_json(json_object: response.body)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
81
139
|
# Creates a new document index.
|
82
140
|
#
|
83
141
|
# @param label [String] A human-readable label for the document index
|
@@ -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
|
-
|
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
|
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
|
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
|
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
|
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,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "document_index_read"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class PaginatedDocumentIndexReadList
|
8
|
+
attr_reader :count, :next_, :previous, :results, :additional_properties
|
9
|
+
|
10
|
+
# @param count [Integer]
|
11
|
+
# @param next_ [String]
|
12
|
+
# @param previous [String]
|
13
|
+
# @param results [Array<DocumentIndexRead>]
|
14
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
# @return [PaginatedDocumentIndexReadList]
|
16
|
+
def initialize(count: nil, next_: nil, previous: nil, results: nil, additional_properties: nil)
|
17
|
+
# @type [Integer]
|
18
|
+
@count = count
|
19
|
+
# @type [String]
|
20
|
+
@next_ = next_
|
21
|
+
# @type [String]
|
22
|
+
@previous = previous
|
23
|
+
# @type [Array<DocumentIndexRead>]
|
24
|
+
@results = results
|
25
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
26
|
+
@additional_properties = additional_properties
|
27
|
+
end
|
28
|
+
|
29
|
+
# Deserialize a JSON object to an instance of PaginatedDocumentIndexReadList
|
30
|
+
#
|
31
|
+
# @param json_object [JSON]
|
32
|
+
# @return [PaginatedDocumentIndexReadList]
|
33
|
+
def self.from_json(json_object:)
|
34
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
35
|
+
parsed_json = JSON.parse(json_object)
|
36
|
+
count = struct.count
|
37
|
+
next_ = struct.next
|
38
|
+
previous = struct.previous
|
39
|
+
results = parsed_json["results"].map do |v|
|
40
|
+
v = v.to_json
|
41
|
+
DocumentIndexRead.from_json(json_object: v)
|
42
|
+
end
|
43
|
+
new(count: count, next_: next_, previous: previous, results: results, additional_properties: struct)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Serialize an instance of PaginatedDocumentIndexReadList to a JSON object
|
47
|
+
#
|
48
|
+
# @return [JSON]
|
49
|
+
def to_json(*_args)
|
50
|
+
{ "count": @count, "next": @next_, "previous": @previous, "results": @results }.to_json
|
51
|
+
end
|
52
|
+
|
53
|
+
# 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.
|
54
|
+
#
|
55
|
+
# @param obj [Object]
|
56
|
+
# @return [Void]
|
57
|
+
def self.validate_raw(obj:)
|
58
|
+
obj.count&.is_a?(Integer) != false || raise("Passed value for field obj.count is not the expected type, validation failed.")
|
59
|
+
obj.next_&.is_a?(String) != false || raise("Passed value for field obj.next_ is not the expected type, validation failed.")
|
60
|
+
obj.previous&.is_a?(String) != false || raise("Passed value for field obj.previous is not the expected type, validation failed.")
|
61
|
+
obj.results&.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
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.
|
4
|
+
version: 0.3.10
|
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-
|
11
|
+
date: 2024-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-http-faraday
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- lib/vellum_ai/deployments/client.rb
|
96
96
|
- lib/vellum_ai/deployments/types/deployments_list_request_status.rb
|
97
97
|
- lib/vellum_ai/document_indexes/client.rb
|
98
|
+
- lib/vellum_ai/document_indexes/types/document_indexes_list_request_status.rb
|
98
99
|
- lib/vellum_ai/documents/client.rb
|
99
100
|
- lib/vellum_ai/folder_entities/client.rb
|
100
101
|
- lib/vellum_ai/model_versions/client.rb
|
@@ -222,6 +223,7 @@ files:
|
|
222
223
|
- lib/vellum_ai/types/normalized_token_log_probs.rb
|
223
224
|
- lib/vellum_ai/types/number_enum.rb
|
224
225
|
- lib/vellum_ai/types/number_variable_value.rb
|
226
|
+
- lib/vellum_ai/types/paginated_document_index_read_list.rb
|
225
227
|
- lib/vellum_ai/types/paginated_slim_deployment_read_list.rb
|
226
228
|
- lib/vellum_ai/types/paginated_slim_document_list.rb
|
227
229
|
- lib/vellum_ai/types/paginated_slim_workflow_deployment_list.rb
|
@@ -291,6 +293,8 @@ files:
|
|
291
293
|
- lib/vellum_ai/types/submit_completion_actual_request.rb
|
292
294
|
- lib/vellum_ai/types/submit_completion_actuals_error_response.rb
|
293
295
|
- lib/vellum_ai/types/submit_workflow_execution_actual_request.rb
|
296
|
+
- lib/vellum_ai/types/subworkflow_enum.rb
|
297
|
+
- lib/vellum_ai/types/subworkflow_node_result.rb
|
294
298
|
- lib/vellum_ai/types/templating_node_chat_history_result.rb
|
295
299
|
- lib/vellum_ai/types/templating_node_error_result.rb
|
296
300
|
- lib/vellum_ai/types/templating_node_json_result.rb
|
@@ -300,8 +304,10 @@ files:
|
|
300
304
|
- lib/vellum_ai/types/templating_node_result_output.rb
|
301
305
|
- lib/vellum_ai/types/templating_node_search_results_result.rb
|
302
306
|
- lib/vellum_ai/types/templating_node_string_result.rb
|
307
|
+
- lib/vellum_ai/types/terminal_node_array_result.rb
|
303
308
|
- lib/vellum_ai/types/terminal_node_chat_history_result.rb
|
304
309
|
- lib/vellum_ai/types/terminal_node_error_result.rb
|
310
|
+
- lib/vellum_ai/types/terminal_node_function_call_result.rb
|
305
311
|
- lib/vellum_ai/types/terminal_node_json_result.rb
|
306
312
|
- lib/vellum_ai/types/terminal_node_number_result.rb
|
307
313
|
- lib/vellum_ai/types/terminal_node_result.rb
|
@@ -339,6 +345,7 @@ files:
|
|
339
345
|
- lib/vellum_ai/types/workflow_node_result_event.rb
|
340
346
|
- lib/vellum_ai/types/workflow_node_result_event_state.rb
|
341
347
|
- lib/vellum_ai/types/workflow_output.rb
|
348
|
+
- lib/vellum_ai/types/workflow_output_array.rb
|
342
349
|
- lib/vellum_ai/types/workflow_output_chat_history.rb
|
343
350
|
- lib/vellum_ai/types/workflow_output_error.rb
|
344
351
|
- lib/vellum_ai/types/workflow_output_function_call.rb
|
@@ -354,8 +361,10 @@ files:
|
|
354
361
|
- lib/vellum_ai/types/workflow_request_string_input_request.rb
|
355
362
|
- lib/vellum_ai/types/workflow_result_event.rb
|
356
363
|
- lib/vellum_ai/types/workflow_result_event_output_data.rb
|
364
|
+
- lib/vellum_ai/types/workflow_result_event_output_data_array.rb
|
357
365
|
- lib/vellum_ai/types/workflow_result_event_output_data_chat_history.rb
|
358
366
|
- lib/vellum_ai/types/workflow_result_event_output_data_error.rb
|
367
|
+
- lib/vellum_ai/types/workflow_result_event_output_data_function_call.rb
|
359
368
|
- lib/vellum_ai/types/workflow_result_event_output_data_json.rb
|
360
369
|
- lib/vellum_ai/types/workflow_result_event_output_data_number.rb
|
361
370
|
- lib/vellum_ai/types/workflow_result_event_output_data_search_results.rb
|