vellum_ai 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/requests.rb +2 -2
- data/lib/types_export.rb +20 -0
- data/lib/vellum_ai/types/audio_input_request.rb +75 -0
- data/lib/vellum_ai/types/delimiter_chunker_config.rb +63 -0
- data/lib/vellum_ai/types/delimiter_chunker_config_request.rb +63 -0
- data/lib/vellum_ai/types/delimiter_chunking.rb +69 -0
- data/lib/vellum_ai/types/delimiter_chunking_request.rb +69 -0
- data/lib/vellum_ai/types/document_index_chunking.rb +16 -0
- data/lib/vellum_ai/types/document_index_chunking_request.rb +16 -0
- data/lib/vellum_ai/types/document_input_request.rb +75 -0
- data/lib/vellum_ai/types/execution_audio_vellum_value.rb +84 -0
- data/lib/vellum_ai/types/execution_document_vellum_value.rb +84 -0
- data/lib/vellum_ai/types/execution_image_vellum_value.rb +84 -0
- data/lib/vellum_ai/types/execution_vellum_value.rb +64 -0
- data/lib/vellum_ai/types/execution_video_vellum_value.rb +84 -0
- data/lib/vellum_ai/types/image_input_request.rb +75 -0
- data/lib/vellum_ai/types/logical_operator.rb +2 -0
- data/lib/vellum_ai/types/node_input_compiled_audio_value.rb +83 -0
- data/lib/vellum_ai/types/node_input_compiled_document_value.rb +83 -0
- data/lib/vellum_ai/types/node_input_compiled_image_value.rb +83 -0
- data/lib/vellum_ai/types/node_input_compiled_video_value.rb +83 -0
- data/lib/vellum_ai/types/node_input_variable_compiled_value.rb +64 -0
- data/lib/vellum_ai/types/prompt_deployment_input_request.rb +64 -0
- data/lib/vellum_ai/types/prompt_request_audio_input.rb +74 -0
- data/lib/vellum_ai/types/prompt_request_document_input.rb +74 -0
- data/lib/vellum_ai/types/prompt_request_image_input.rb +74 -0
- data/lib/vellum_ai/types/prompt_request_input.rb +64 -0
- data/lib/vellum_ai/types/prompt_request_video_input.rb +74 -0
- data/lib/vellum_ai/types/video_input_request.rb +75 -0
- data/lib/vellum_ai/workflow_executions/client.rb +8 -8
- metadata +22 -2
@@ -0,0 +1,83 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative "vellum_image"
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class NodeInputCompiledImageValue
|
8
|
+
# @return [String]
|
9
|
+
attr_reader :node_input_id
|
10
|
+
# @return [String]
|
11
|
+
attr_reader :key
|
12
|
+
# @return [String]
|
13
|
+
attr_reader :type
|
14
|
+
# @return [Vellum::VellumImage]
|
15
|
+
attr_reader :value
|
16
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
17
|
+
attr_reader :additional_properties
|
18
|
+
# @return [Object]
|
19
|
+
attr_reader :_field_set
|
20
|
+
protected :_field_set
|
21
|
+
|
22
|
+
OMIT = Object.new
|
23
|
+
|
24
|
+
# @param node_input_id [String]
|
25
|
+
# @param key [String]
|
26
|
+
# @param type [String]
|
27
|
+
# @param value [Vellum::VellumImage]
|
28
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
29
|
+
# @return [Vellum::NodeInputCompiledImageValue]
|
30
|
+
def initialize(node_input_id:, key:, type:, value: OMIT, additional_properties: nil)
|
31
|
+
@node_input_id = node_input_id
|
32
|
+
@key = key
|
33
|
+
@type = type
|
34
|
+
@value = value if value != OMIT
|
35
|
+
@additional_properties = additional_properties
|
36
|
+
@_field_set = { "node_input_id": node_input_id, "key": key, "type": type, "value": value }.reject do | _k, v |
|
37
|
+
v == OMIT
|
38
|
+
end
|
39
|
+
end
|
40
|
+
# Deserialize a JSON object to an instance of NodeInputCompiledImageValue
|
41
|
+
#
|
42
|
+
# @param json_object [String]
|
43
|
+
# @return [Vellum::NodeInputCompiledImageValue]
|
44
|
+
def self.from_json(json_object:)
|
45
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
46
|
+
parsed_json = JSON.parse(json_object)
|
47
|
+
node_input_id = parsed_json["node_input_id"]
|
48
|
+
key = parsed_json["key"]
|
49
|
+
type = parsed_json["type"]
|
50
|
+
unless parsed_json["value"].nil?
|
51
|
+
value = parsed_json["value"].to_json
|
52
|
+
value = Vellum::VellumImage.from_json(json_object: value)
|
53
|
+
else
|
54
|
+
value = nil
|
55
|
+
end
|
56
|
+
new(
|
57
|
+
node_input_id: node_input_id,
|
58
|
+
key: key,
|
59
|
+
type: type,
|
60
|
+
value: value,
|
61
|
+
additional_properties: struct
|
62
|
+
)
|
63
|
+
end
|
64
|
+
# Serialize an instance of NodeInputCompiledImageValue to a JSON object
|
65
|
+
#
|
66
|
+
# @return [String]
|
67
|
+
def to_json
|
68
|
+
@_field_set&.to_json
|
69
|
+
end
|
70
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
71
|
+
# hash and check each fields type against the current object's property
|
72
|
+
# definitions.
|
73
|
+
#
|
74
|
+
# @param obj [Object]
|
75
|
+
# @return [Void]
|
76
|
+
def self.validate_raw(obj:)
|
77
|
+
obj.node_input_id.is_a?(String) != false || raise("Passed value for field obj.node_input_id is not the expected type, validation failed.")
|
78
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
79
|
+
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
80
|
+
obj.value.nil? || Vellum::VellumImage.validate_raw(obj: obj.value)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative "vellum_video"
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class NodeInputCompiledVideoValue
|
8
|
+
# @return [String]
|
9
|
+
attr_reader :node_input_id
|
10
|
+
# @return [String]
|
11
|
+
attr_reader :key
|
12
|
+
# @return [String]
|
13
|
+
attr_reader :type
|
14
|
+
# @return [Vellum::VellumVideo]
|
15
|
+
attr_reader :value
|
16
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
17
|
+
attr_reader :additional_properties
|
18
|
+
# @return [Object]
|
19
|
+
attr_reader :_field_set
|
20
|
+
protected :_field_set
|
21
|
+
|
22
|
+
OMIT = Object.new
|
23
|
+
|
24
|
+
# @param node_input_id [String]
|
25
|
+
# @param key [String]
|
26
|
+
# @param type [String]
|
27
|
+
# @param value [Vellum::VellumVideo]
|
28
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
29
|
+
# @return [Vellum::NodeInputCompiledVideoValue]
|
30
|
+
def initialize(node_input_id:, key:, type:, value: OMIT, additional_properties: nil)
|
31
|
+
@node_input_id = node_input_id
|
32
|
+
@key = key
|
33
|
+
@type = type
|
34
|
+
@value = value if value != OMIT
|
35
|
+
@additional_properties = additional_properties
|
36
|
+
@_field_set = { "node_input_id": node_input_id, "key": key, "type": type, "value": value }.reject do | _k, v |
|
37
|
+
v == OMIT
|
38
|
+
end
|
39
|
+
end
|
40
|
+
# Deserialize a JSON object to an instance of NodeInputCompiledVideoValue
|
41
|
+
#
|
42
|
+
# @param json_object [String]
|
43
|
+
# @return [Vellum::NodeInputCompiledVideoValue]
|
44
|
+
def self.from_json(json_object:)
|
45
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
46
|
+
parsed_json = JSON.parse(json_object)
|
47
|
+
node_input_id = parsed_json["node_input_id"]
|
48
|
+
key = parsed_json["key"]
|
49
|
+
type = parsed_json["type"]
|
50
|
+
unless parsed_json["value"].nil?
|
51
|
+
value = parsed_json["value"].to_json
|
52
|
+
value = Vellum::VellumVideo.from_json(json_object: value)
|
53
|
+
else
|
54
|
+
value = nil
|
55
|
+
end
|
56
|
+
new(
|
57
|
+
node_input_id: node_input_id,
|
58
|
+
key: key,
|
59
|
+
type: type,
|
60
|
+
value: value,
|
61
|
+
additional_properties: struct
|
62
|
+
)
|
63
|
+
end
|
64
|
+
# Serialize an instance of NodeInputCompiledVideoValue to a JSON object
|
65
|
+
#
|
66
|
+
# @return [String]
|
67
|
+
def to_json
|
68
|
+
@_field_set&.to_json
|
69
|
+
end
|
70
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
71
|
+
# hash and check each fields type against the current object's property
|
72
|
+
# definitions.
|
73
|
+
#
|
74
|
+
# @param obj [Object]
|
75
|
+
# @return [Void]
|
76
|
+
def self.validate_raw(obj:)
|
77
|
+
obj.node_input_id.is_a?(String) != false || raise("Passed value for field obj.node_input_id is not the expected type, validation failed.")
|
78
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
79
|
+
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
80
|
+
obj.value.nil? || Vellum::VellumVideo.validate_raw(obj: obj.value)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -9,6 +9,10 @@ require_relative "node_input_compiled_error_value"
|
|
9
9
|
require_relative "node_input_compiled_array_value"
|
10
10
|
require_relative "node_input_compiled_function_call_value"
|
11
11
|
require_relative "node_input_compiled_secret_value"
|
12
|
+
require_relative "node_input_compiled_audio_value"
|
13
|
+
require_relative "node_input_compiled_video_value"
|
14
|
+
require_relative "node_input_compiled_image_value"
|
15
|
+
require_relative "node_input_compiled_document_value"
|
12
16
|
|
13
17
|
module Vellum
|
14
18
|
class NodeInputVariableCompiledValue
|
@@ -106,6 +110,46 @@ end
|
|
106
110
|
return Vellum::NodeInputCompiledSecretValue.from_json(json_object: struct)
|
107
111
|
else
|
108
112
|
return nil
|
113
|
+
end
|
114
|
+
rescue StandardError
|
115
|
+
# noop
|
116
|
+
end
|
117
|
+
begin
|
118
|
+
Vellum::NodeInputCompiledAudioValue.validate_raw(obj: struct)
|
119
|
+
unless struct.nil?
|
120
|
+
return Vellum::NodeInputCompiledAudioValue.from_json(json_object: struct)
|
121
|
+
else
|
122
|
+
return nil
|
123
|
+
end
|
124
|
+
rescue StandardError
|
125
|
+
# noop
|
126
|
+
end
|
127
|
+
begin
|
128
|
+
Vellum::NodeInputCompiledVideoValue.validate_raw(obj: struct)
|
129
|
+
unless struct.nil?
|
130
|
+
return Vellum::NodeInputCompiledVideoValue.from_json(json_object: struct)
|
131
|
+
else
|
132
|
+
return nil
|
133
|
+
end
|
134
|
+
rescue StandardError
|
135
|
+
# noop
|
136
|
+
end
|
137
|
+
begin
|
138
|
+
Vellum::NodeInputCompiledImageValue.validate_raw(obj: struct)
|
139
|
+
unless struct.nil?
|
140
|
+
return Vellum::NodeInputCompiledImageValue.from_json(json_object: struct)
|
141
|
+
else
|
142
|
+
return nil
|
143
|
+
end
|
144
|
+
rescue StandardError
|
145
|
+
# noop
|
146
|
+
end
|
147
|
+
begin
|
148
|
+
Vellum::NodeInputCompiledDocumentValue.validate_raw(obj: struct)
|
149
|
+
unless struct.nil?
|
150
|
+
return Vellum::NodeInputCompiledDocumentValue.from_json(json_object: struct)
|
151
|
+
else
|
152
|
+
return nil
|
109
153
|
end
|
110
154
|
rescue StandardError
|
111
155
|
# noop
|
@@ -164,6 +208,26 @@ end
|
|
164
208
|
rescue StandardError
|
165
209
|
# noop
|
166
210
|
end
|
211
|
+
begin
|
212
|
+
return Vellum::NodeInputCompiledAudioValue.validate_raw(obj: obj)
|
213
|
+
rescue StandardError
|
214
|
+
# noop
|
215
|
+
end
|
216
|
+
begin
|
217
|
+
return Vellum::NodeInputCompiledVideoValue.validate_raw(obj: obj)
|
218
|
+
rescue StandardError
|
219
|
+
# noop
|
220
|
+
end
|
221
|
+
begin
|
222
|
+
return Vellum::NodeInputCompiledImageValue.validate_raw(obj: obj)
|
223
|
+
rescue StandardError
|
224
|
+
# noop
|
225
|
+
end
|
226
|
+
begin
|
227
|
+
return Vellum::NodeInputCompiledDocumentValue.validate_raw(obj: obj)
|
228
|
+
rescue StandardError
|
229
|
+
# noop
|
230
|
+
end
|
167
231
|
raise("Passed value matched no type within the union, validation failed.")
|
168
232
|
end
|
169
233
|
end
|
@@ -3,6 +3,10 @@ require "json"
|
|
3
3
|
require_relative "string_input_request"
|
4
4
|
require_relative "json_input_request"
|
5
5
|
require_relative "chat_history_input_request"
|
6
|
+
require_relative "audio_input_request"
|
7
|
+
require_relative "video_input_request"
|
8
|
+
require_relative "image_input_request"
|
9
|
+
require_relative "document_input_request"
|
6
10
|
|
7
11
|
module Vellum
|
8
12
|
class PromptDeploymentInputRequest
|
@@ -40,6 +44,46 @@ end
|
|
40
44
|
return Vellum::ChatHistoryInputRequest.from_json(json_object: struct)
|
41
45
|
else
|
42
46
|
return nil
|
47
|
+
end
|
48
|
+
rescue StandardError
|
49
|
+
# noop
|
50
|
+
end
|
51
|
+
begin
|
52
|
+
Vellum::AudioInputRequest.validate_raw(obj: struct)
|
53
|
+
unless struct.nil?
|
54
|
+
return Vellum::AudioInputRequest.from_json(json_object: struct)
|
55
|
+
else
|
56
|
+
return nil
|
57
|
+
end
|
58
|
+
rescue StandardError
|
59
|
+
# noop
|
60
|
+
end
|
61
|
+
begin
|
62
|
+
Vellum::VideoInputRequest.validate_raw(obj: struct)
|
63
|
+
unless struct.nil?
|
64
|
+
return Vellum::VideoInputRequest.from_json(json_object: struct)
|
65
|
+
else
|
66
|
+
return nil
|
67
|
+
end
|
68
|
+
rescue StandardError
|
69
|
+
# noop
|
70
|
+
end
|
71
|
+
begin
|
72
|
+
Vellum::ImageInputRequest.validate_raw(obj: struct)
|
73
|
+
unless struct.nil?
|
74
|
+
return Vellum::ImageInputRequest.from_json(json_object: struct)
|
75
|
+
else
|
76
|
+
return nil
|
77
|
+
end
|
78
|
+
rescue StandardError
|
79
|
+
# noop
|
80
|
+
end
|
81
|
+
begin
|
82
|
+
Vellum::DocumentInputRequest.validate_raw(obj: struct)
|
83
|
+
unless struct.nil?
|
84
|
+
return Vellum::DocumentInputRequest.from_json(json_object: struct)
|
85
|
+
else
|
86
|
+
return nil
|
43
87
|
end
|
44
88
|
rescue StandardError
|
45
89
|
# noop
|
@@ -68,6 +112,26 @@ end
|
|
68
112
|
rescue StandardError
|
69
113
|
# noop
|
70
114
|
end
|
115
|
+
begin
|
116
|
+
return Vellum::AudioInputRequest.validate_raw(obj: obj)
|
117
|
+
rescue StandardError
|
118
|
+
# noop
|
119
|
+
end
|
120
|
+
begin
|
121
|
+
return Vellum::VideoInputRequest.validate_raw(obj: obj)
|
122
|
+
rescue StandardError
|
123
|
+
# noop
|
124
|
+
end
|
125
|
+
begin
|
126
|
+
return Vellum::ImageInputRequest.validate_raw(obj: obj)
|
127
|
+
rescue StandardError
|
128
|
+
# noop
|
129
|
+
end
|
130
|
+
begin
|
131
|
+
return Vellum::DocumentInputRequest.validate_raw(obj: obj)
|
132
|
+
rescue StandardError
|
133
|
+
# noop
|
134
|
+
end
|
71
135
|
raise("Passed value matched no type within the union, validation failed.")
|
72
136
|
end
|
73
137
|
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative "vellum_audio"
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class PromptRequestAudioInput
|
8
|
+
# @return [String] The variable's name, as defined in the Prompt.
|
9
|
+
attr_reader :key
|
10
|
+
# @return [String]
|
11
|
+
attr_reader :type
|
12
|
+
# @return [Vellum::VellumAudio]
|
13
|
+
attr_reader :value
|
14
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
attr_reader :additional_properties
|
16
|
+
# @return [Object]
|
17
|
+
attr_reader :_field_set
|
18
|
+
protected :_field_set
|
19
|
+
|
20
|
+
OMIT = Object.new
|
21
|
+
|
22
|
+
# @param key [String] The variable's name, as defined in the Prompt.
|
23
|
+
# @param type [String]
|
24
|
+
# @param value [Vellum::VellumAudio]
|
25
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
26
|
+
# @return [Vellum::PromptRequestAudioInput]
|
27
|
+
def initialize(key:, type:, value:, additional_properties: nil)
|
28
|
+
@key = key
|
29
|
+
@type = type
|
30
|
+
@value = value
|
31
|
+
@additional_properties = additional_properties
|
32
|
+
@_field_set = { "key": key, "type": type, "value": value }
|
33
|
+
end
|
34
|
+
# Deserialize a JSON object to an instance of PromptRequestAudioInput
|
35
|
+
#
|
36
|
+
# @param json_object [String]
|
37
|
+
# @return [Vellum::PromptRequestAudioInput]
|
38
|
+
def self.from_json(json_object:)
|
39
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
40
|
+
parsed_json = JSON.parse(json_object)
|
41
|
+
key = parsed_json["key"]
|
42
|
+
type = parsed_json["type"]
|
43
|
+
unless parsed_json["value"].nil?
|
44
|
+
value = parsed_json["value"].to_json
|
45
|
+
value = Vellum::VellumAudio.from_json(json_object: value)
|
46
|
+
else
|
47
|
+
value = nil
|
48
|
+
end
|
49
|
+
new(
|
50
|
+
key: key,
|
51
|
+
type: type,
|
52
|
+
value: value,
|
53
|
+
additional_properties: struct
|
54
|
+
)
|
55
|
+
end
|
56
|
+
# Serialize an instance of PromptRequestAudioInput to a JSON object
|
57
|
+
#
|
58
|
+
# @return [String]
|
59
|
+
def to_json
|
60
|
+
@_field_set&.to_json
|
61
|
+
end
|
62
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
63
|
+
# hash and check each fields type against the current object's property
|
64
|
+
# definitions.
|
65
|
+
#
|
66
|
+
# @param obj [Object]
|
67
|
+
# @return [Void]
|
68
|
+
def self.validate_raw(obj:)
|
69
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
70
|
+
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
71
|
+
Vellum::VellumAudio.validate_raw(obj: obj.value)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative "vellum_document"
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class PromptRequestDocumentInput
|
8
|
+
# @return [String] The variable's name, as defined in the Prompt.
|
9
|
+
attr_reader :key
|
10
|
+
# @return [String]
|
11
|
+
attr_reader :type
|
12
|
+
# @return [Vellum::VellumDocument]
|
13
|
+
attr_reader :value
|
14
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
attr_reader :additional_properties
|
16
|
+
# @return [Object]
|
17
|
+
attr_reader :_field_set
|
18
|
+
protected :_field_set
|
19
|
+
|
20
|
+
OMIT = Object.new
|
21
|
+
|
22
|
+
# @param key [String] The variable's name, as defined in the Prompt.
|
23
|
+
# @param type [String]
|
24
|
+
# @param value [Vellum::VellumDocument]
|
25
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
26
|
+
# @return [Vellum::PromptRequestDocumentInput]
|
27
|
+
def initialize(key:, type:, value:, additional_properties: nil)
|
28
|
+
@key = key
|
29
|
+
@type = type
|
30
|
+
@value = value
|
31
|
+
@additional_properties = additional_properties
|
32
|
+
@_field_set = { "key": key, "type": type, "value": value }
|
33
|
+
end
|
34
|
+
# Deserialize a JSON object to an instance of PromptRequestDocumentInput
|
35
|
+
#
|
36
|
+
# @param json_object [String]
|
37
|
+
# @return [Vellum::PromptRequestDocumentInput]
|
38
|
+
def self.from_json(json_object:)
|
39
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
40
|
+
parsed_json = JSON.parse(json_object)
|
41
|
+
key = parsed_json["key"]
|
42
|
+
type = parsed_json["type"]
|
43
|
+
unless parsed_json["value"].nil?
|
44
|
+
value = parsed_json["value"].to_json
|
45
|
+
value = Vellum::VellumDocument.from_json(json_object: value)
|
46
|
+
else
|
47
|
+
value = nil
|
48
|
+
end
|
49
|
+
new(
|
50
|
+
key: key,
|
51
|
+
type: type,
|
52
|
+
value: value,
|
53
|
+
additional_properties: struct
|
54
|
+
)
|
55
|
+
end
|
56
|
+
# Serialize an instance of PromptRequestDocumentInput to a JSON object
|
57
|
+
#
|
58
|
+
# @return [String]
|
59
|
+
def to_json
|
60
|
+
@_field_set&.to_json
|
61
|
+
end
|
62
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
63
|
+
# hash and check each fields type against the current object's property
|
64
|
+
# definitions.
|
65
|
+
#
|
66
|
+
# @param obj [Object]
|
67
|
+
# @return [Void]
|
68
|
+
def self.validate_raw(obj:)
|
69
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
70
|
+
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
71
|
+
Vellum::VellumDocument.validate_raw(obj: obj.value)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative "vellum_image"
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class PromptRequestImageInput
|
8
|
+
# @return [String] The variable's name, as defined in the Prompt.
|
9
|
+
attr_reader :key
|
10
|
+
# @return [String]
|
11
|
+
attr_reader :type
|
12
|
+
# @return [Vellum::VellumImage]
|
13
|
+
attr_reader :value
|
14
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
attr_reader :additional_properties
|
16
|
+
# @return [Object]
|
17
|
+
attr_reader :_field_set
|
18
|
+
protected :_field_set
|
19
|
+
|
20
|
+
OMIT = Object.new
|
21
|
+
|
22
|
+
# @param key [String] The variable's name, as defined in the Prompt.
|
23
|
+
# @param type [String]
|
24
|
+
# @param value [Vellum::VellumImage]
|
25
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
26
|
+
# @return [Vellum::PromptRequestImageInput]
|
27
|
+
def initialize(key:, type:, value:, additional_properties: nil)
|
28
|
+
@key = key
|
29
|
+
@type = type
|
30
|
+
@value = value
|
31
|
+
@additional_properties = additional_properties
|
32
|
+
@_field_set = { "key": key, "type": type, "value": value }
|
33
|
+
end
|
34
|
+
# Deserialize a JSON object to an instance of PromptRequestImageInput
|
35
|
+
#
|
36
|
+
# @param json_object [String]
|
37
|
+
# @return [Vellum::PromptRequestImageInput]
|
38
|
+
def self.from_json(json_object:)
|
39
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
40
|
+
parsed_json = JSON.parse(json_object)
|
41
|
+
key = parsed_json["key"]
|
42
|
+
type = parsed_json["type"]
|
43
|
+
unless parsed_json["value"].nil?
|
44
|
+
value = parsed_json["value"].to_json
|
45
|
+
value = Vellum::VellumImage.from_json(json_object: value)
|
46
|
+
else
|
47
|
+
value = nil
|
48
|
+
end
|
49
|
+
new(
|
50
|
+
key: key,
|
51
|
+
type: type,
|
52
|
+
value: value,
|
53
|
+
additional_properties: struct
|
54
|
+
)
|
55
|
+
end
|
56
|
+
# Serialize an instance of PromptRequestImageInput to a JSON object
|
57
|
+
#
|
58
|
+
# @return [String]
|
59
|
+
def to_json
|
60
|
+
@_field_set&.to_json
|
61
|
+
end
|
62
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
63
|
+
# hash and check each fields type against the current object's property
|
64
|
+
# definitions.
|
65
|
+
#
|
66
|
+
# @param obj [Object]
|
67
|
+
# @return [Void]
|
68
|
+
def self.validate_raw(obj:)
|
69
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
70
|
+
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
71
|
+
Vellum::VellumImage.validate_raw(obj: obj.value)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -3,6 +3,10 @@ require "json"
|
|
3
3
|
require_relative "prompt_request_string_input"
|
4
4
|
require_relative "prompt_request_json_input"
|
5
5
|
require_relative "prompt_request_chat_history_input"
|
6
|
+
require_relative "prompt_request_audio_input"
|
7
|
+
require_relative "prompt_request_video_input"
|
8
|
+
require_relative "prompt_request_image_input"
|
9
|
+
require_relative "prompt_request_document_input"
|
6
10
|
|
7
11
|
module Vellum
|
8
12
|
class PromptRequestInput
|
@@ -40,6 +44,46 @@ end
|
|
40
44
|
return Vellum::PromptRequestChatHistoryInput.from_json(json_object: struct)
|
41
45
|
else
|
42
46
|
return nil
|
47
|
+
end
|
48
|
+
rescue StandardError
|
49
|
+
# noop
|
50
|
+
end
|
51
|
+
begin
|
52
|
+
Vellum::PromptRequestAudioInput.validate_raw(obj: struct)
|
53
|
+
unless struct.nil?
|
54
|
+
return Vellum::PromptRequestAudioInput.from_json(json_object: struct)
|
55
|
+
else
|
56
|
+
return nil
|
57
|
+
end
|
58
|
+
rescue StandardError
|
59
|
+
# noop
|
60
|
+
end
|
61
|
+
begin
|
62
|
+
Vellum::PromptRequestVideoInput.validate_raw(obj: struct)
|
63
|
+
unless struct.nil?
|
64
|
+
return Vellum::PromptRequestVideoInput.from_json(json_object: struct)
|
65
|
+
else
|
66
|
+
return nil
|
67
|
+
end
|
68
|
+
rescue StandardError
|
69
|
+
# noop
|
70
|
+
end
|
71
|
+
begin
|
72
|
+
Vellum::PromptRequestImageInput.validate_raw(obj: struct)
|
73
|
+
unless struct.nil?
|
74
|
+
return Vellum::PromptRequestImageInput.from_json(json_object: struct)
|
75
|
+
else
|
76
|
+
return nil
|
77
|
+
end
|
78
|
+
rescue StandardError
|
79
|
+
# noop
|
80
|
+
end
|
81
|
+
begin
|
82
|
+
Vellum::PromptRequestDocumentInput.validate_raw(obj: struct)
|
83
|
+
unless struct.nil?
|
84
|
+
return Vellum::PromptRequestDocumentInput.from_json(json_object: struct)
|
85
|
+
else
|
86
|
+
return nil
|
43
87
|
end
|
44
88
|
rescue StandardError
|
45
89
|
# noop
|
@@ -68,6 +112,26 @@ end
|
|
68
112
|
rescue StandardError
|
69
113
|
# noop
|
70
114
|
end
|
115
|
+
begin
|
116
|
+
return Vellum::PromptRequestAudioInput.validate_raw(obj: obj)
|
117
|
+
rescue StandardError
|
118
|
+
# noop
|
119
|
+
end
|
120
|
+
begin
|
121
|
+
return Vellum::PromptRequestVideoInput.validate_raw(obj: obj)
|
122
|
+
rescue StandardError
|
123
|
+
# noop
|
124
|
+
end
|
125
|
+
begin
|
126
|
+
return Vellum::PromptRequestImageInput.validate_raw(obj: obj)
|
127
|
+
rescue StandardError
|
128
|
+
# noop
|
129
|
+
end
|
130
|
+
begin
|
131
|
+
return Vellum::PromptRequestDocumentInput.validate_raw(obj: obj)
|
132
|
+
rescue StandardError
|
133
|
+
# noop
|
134
|
+
end
|
71
135
|
raise("Passed value matched no type within the union, validation failed.")
|
72
136
|
end
|
73
137
|
end
|