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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/lib/requests.rb +2 -2
  3. data/lib/types_export.rb +20 -0
  4. data/lib/vellum_ai/types/audio_input_request.rb +75 -0
  5. data/lib/vellum_ai/types/delimiter_chunker_config.rb +63 -0
  6. data/lib/vellum_ai/types/delimiter_chunker_config_request.rb +63 -0
  7. data/lib/vellum_ai/types/delimiter_chunking.rb +69 -0
  8. data/lib/vellum_ai/types/delimiter_chunking_request.rb +69 -0
  9. data/lib/vellum_ai/types/document_index_chunking.rb +16 -0
  10. data/lib/vellum_ai/types/document_index_chunking_request.rb +16 -0
  11. data/lib/vellum_ai/types/document_input_request.rb +75 -0
  12. data/lib/vellum_ai/types/execution_audio_vellum_value.rb +84 -0
  13. data/lib/vellum_ai/types/execution_document_vellum_value.rb +84 -0
  14. data/lib/vellum_ai/types/execution_image_vellum_value.rb +84 -0
  15. data/lib/vellum_ai/types/execution_vellum_value.rb +64 -0
  16. data/lib/vellum_ai/types/execution_video_vellum_value.rb +84 -0
  17. data/lib/vellum_ai/types/image_input_request.rb +75 -0
  18. data/lib/vellum_ai/types/logical_operator.rb +2 -0
  19. data/lib/vellum_ai/types/node_input_compiled_audio_value.rb +83 -0
  20. data/lib/vellum_ai/types/node_input_compiled_document_value.rb +83 -0
  21. data/lib/vellum_ai/types/node_input_compiled_image_value.rb +83 -0
  22. data/lib/vellum_ai/types/node_input_compiled_video_value.rb +83 -0
  23. data/lib/vellum_ai/types/node_input_variable_compiled_value.rb +64 -0
  24. data/lib/vellum_ai/types/prompt_deployment_input_request.rb +64 -0
  25. data/lib/vellum_ai/types/prompt_request_audio_input.rb +74 -0
  26. data/lib/vellum_ai/types/prompt_request_document_input.rb +74 -0
  27. data/lib/vellum_ai/types/prompt_request_image_input.rb +74 -0
  28. data/lib/vellum_ai/types/prompt_request_input.rb +64 -0
  29. data/lib/vellum_ai/types/prompt_request_video_input.rb +74 -0
  30. data/lib/vellum_ai/types/video_input_request.rb +75 -0
  31. data/lib/vellum_ai/workflow_executions/client.rb +8 -8
  32. metadata +22 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49922c85b2678eeee8ed04b415fa796c301cd96a11e78d8f4890ed8e7366a459
4
- data.tar.gz: '072484516d78fe38adeed059f64ef96bf92c94148b051628d4d07270401a0fd7'
3
+ metadata.gz: ed4f8e7fd2abb3d4c54b1c11b689abce99a44a6c092bb823ac50d6f62f23a327
4
+ data.tar.gz: d972f95e51865b2e6698310c4a493242e034d25ff4447d4e4261a0115e29f827
5
5
  SHA512:
6
- metadata.gz: aea9e6058fd8ef33388020c05ff5f6588f92581c8994f000670efb9088aa82aaefad0859088edc0334077234534f4389aa96619885317247dd2367aed8f46fb2
7
- data.tar.gz: 77a6972f1f26bfae51bd9184a546cd58ddb1450c006b0682a32edac9a9eb5303ef28eaea245985138338219926b28448e31c17584251d2be5120b850b4ffd15c
6
+ metadata.gz: 5c736995f0f01ded6e0722a580bb41372f1ef09a8c5bf50400694a273b1e40158ed897995f0ea620cd89f38bf50f617463a50d4fd3b31caf41b4ccd9023addce
7
+ data.tar.gz: 758912161efe589f4457de44b75f8fd254e460ed88ce14011366f1318327ccc5558a5e77d1a49a5d33c44a29bba5ee1dcc766625e074ad279b34f0549259db7a
data/lib/requests.rb CHANGED
@@ -56,7 +56,7 @@ end
56
56
  end
57
57
  # @return [Hash{String => String}]
58
58
  def get_headers
59
- headers = { "X-Fern-Language": 'Ruby', "X-Fern-SDK-Name": 'vellum_ai', "X-Fern-SDK-Version": '1.2.2' }
59
+ headers = { "X-Fern-Language": 'Ruby', "X-Fern-SDK-Name": 'vellum_ai', "X-Fern-SDK-Version": '1.2.3' }
60
60
  headers["X-API-KEY"] = ((@api_key.is_a? Method) ? @api_key.call : @api_key) unless @api_key.nil?
61
61
  headers
62
62
  end
@@ -107,7 +107,7 @@ end
107
107
  end
108
108
  # @return [Hash{String => String}]
109
109
  def get_headers
110
- headers = { "X-Fern-Language": 'Ruby', "X-Fern-SDK-Name": 'vellum_ai', "X-Fern-SDK-Version": '1.2.2' }
110
+ headers = { "X-Fern-Language": 'Ruby', "X-Fern-SDK-Name": 'vellum_ai', "X-Fern-SDK-Version": '1.2.3' }
111
111
  headers["X-API-KEY"] = ((@api_key.is_a? Method) ? @api_key.call : @api_key) unless @api_key.nil?
112
112
  headers
113
113
  end
data/lib/types_export.rb CHANGED
@@ -43,6 +43,7 @@ require_relative "vellum_ai/types/array_chat_message_content_request"
43
43
  require_relative "vellum_ai/types/array_input"
44
44
  require_relative "vellum_ai/types/array_vellum_value"
45
45
  require_relative "vellum_ai/types/array_vellum_value_request"
46
+ require_relative "vellum_ai/types/audio_input_request"
46
47
  require_relative "vellum_ai/types/audio_prompt_block"
47
48
  require_relative "vellum_ai/types/audio_vellum_value"
48
49
  require_relative "vellum_ai/types/audio_vellum_value_request"
@@ -96,6 +97,10 @@ require_relative "vellum_ai/types/container_image_build_config"
96
97
  require_relative "vellum_ai/types/container_image_container_image_tag"
97
98
  require_relative "vellum_ai/types/container_image_read"
98
99
  require_relative "vellum_ai/types/create_test_suite_test_case_request"
100
+ require_relative "vellum_ai/types/delimiter_chunker_config"
101
+ require_relative "vellum_ai/types/delimiter_chunker_config_request"
102
+ require_relative "vellum_ai/types/delimiter_chunking"
103
+ require_relative "vellum_ai/types/delimiter_chunking_request"
99
104
  require_relative "vellum_ai/types/deployment_history_item"
100
105
  require_relative "vellum_ai/types/deployment_provider_payload_response_payload"
101
106
  require_relative "vellum_ai/types/deployment_provider_payload_response"
@@ -115,6 +120,7 @@ require_relative "vellum_ai/types/document_index_chunking_request"
115
120
  require_relative "vellum_ai/types/document_index_indexing_config"
116
121
  require_relative "vellum_ai/types/document_index_indexing_config_request"
117
122
  require_relative "vellum_ai/types/document_index_read"
123
+ require_relative "vellum_ai/types/document_input_request"
118
124
  require_relative "vellum_ai/types/document_processing_state"
119
125
  require_relative "vellum_ai/types/document_prompt_block"
120
126
  require_relative "vellum_ai/types/document_read"
@@ -146,14 +152,18 @@ require_relative "vellum_ai/types/fulfilled_execute_workflow_workflow_result_eve
146
152
  require_relative "vellum_ai/types/rejected_execute_workflow_workflow_result_event"
147
153
  require_relative "vellum_ai/types/execute_workflow_workflow_result_event"
148
154
  require_relative "vellum_ai/types/execution_array_vellum_value"
155
+ require_relative "vellum_ai/types/execution_audio_vellum_value"
149
156
  require_relative "vellum_ai/types/execution_chat_history_vellum_value"
157
+ require_relative "vellum_ai/types/execution_document_vellum_value"
150
158
  require_relative "vellum_ai/types/execution_error_vellum_value"
151
159
  require_relative "vellum_ai/types/execution_function_call_vellum_value"
160
+ require_relative "vellum_ai/types/execution_image_vellum_value"
152
161
  require_relative "vellum_ai/types/execution_json_vellum_value"
153
162
  require_relative "vellum_ai/types/execution_number_vellum_value"
154
163
  require_relative "vellum_ai/types/execution_search_results_vellum_value"
155
164
  require_relative "vellum_ai/types/execution_string_vellum_value"
156
165
  require_relative "vellum_ai/types/execution_thinking_vellum_value"
166
+ require_relative "vellum_ai/types/execution_video_vellum_value"
157
167
  require_relative "vellum_ai/types/execution_vellum_value"
158
168
  require_relative "vellum_ai/types/external_input_descriptor"
159
169
  require_relative "vellum_ai/types/external_parent_context"
@@ -204,6 +214,7 @@ require_relative "vellum_ai/types/google_vertex_ai_vectorizer_text_multilingual_
204
214
  require_relative "vellum_ai/types/google_vertex_ai_vectorizer_text_multilingual_embedding_002_request"
205
215
  require_relative "vellum_ai/types/hkunlp_instructor_xl_vectorizer"
206
216
  require_relative "vellum_ai/types/hkunlp_instructor_xl_vectorizer_request"
217
+ require_relative "vellum_ai/types/image_input_request"
207
218
  require_relative "vellum_ai/types/image_prompt_block"
208
219
  require_relative "vellum_ai/types/image_vellum_value"
209
220
  require_relative "vellum_ai/types/image_vellum_value_request"
@@ -285,14 +296,18 @@ require_relative "vellum_ai/types/node_execution_span_attributes"
285
296
  require_relative "vellum_ai/types/node_execution_streaming_body"
286
297
  require_relative "vellum_ai/types/node_execution_streaming_event"
287
298
  require_relative "vellum_ai/types/node_input_compiled_array_value"
299
+ require_relative "vellum_ai/types/node_input_compiled_audio_value"
288
300
  require_relative "vellum_ai/types/node_input_compiled_chat_history_value"
301
+ require_relative "vellum_ai/types/node_input_compiled_document_value"
289
302
  require_relative "vellum_ai/types/node_input_compiled_error_value"
290
303
  require_relative "vellum_ai/types/node_input_compiled_function_call_value"
304
+ require_relative "vellum_ai/types/node_input_compiled_image_value"
291
305
  require_relative "vellum_ai/types/node_input_compiled_json_value"
292
306
  require_relative "vellum_ai/types/node_input_compiled_number_value"
293
307
  require_relative "vellum_ai/types/node_input_compiled_search_results_value"
294
308
  require_relative "vellum_ai/types/node_input_compiled_secret_value"
295
309
  require_relative "vellum_ai/types/node_input_compiled_string_value"
310
+ require_relative "vellum_ai/types/node_input_compiled_video_value"
296
311
  require_relative "vellum_ai/types/node_input_variable_compiled_value"
297
312
  require_relative "vellum_ai/types/node_output_compiled_array_value"
298
313
  require_relative "vellum_ai/types/node_output_compiled_chat_history_value"
@@ -340,6 +355,7 @@ require_relative "vellum_ai/types/prompt_block"
340
355
  require_relative "vellum_ai/types/prompt_block_state"
341
356
  require_relative "vellum_ai/types/prompt_deployment_expand_meta_request"
342
357
  require_relative "vellum_ai/types/string_input_request"
358
+ require_relative "vellum_ai/types/video_input_request"
343
359
  require_relative "vellum_ai/types/prompt_deployment_input_request"
344
360
  require_relative "vellum_ai/types/prompt_deployment_release"
345
361
  require_relative "vellum_ai/types/prompt_deployment_release_prompt_deployment"
@@ -354,9 +370,13 @@ require_relative "vellum_ai/types/thinking_vellum_value"
354
370
  require_relative "vellum_ai/types/prompt_output"
355
371
  require_relative "vellum_ai/types/prompt_parameters"
356
372
  require_relative "vellum_ai/types/prompt_push_response"
373
+ require_relative "vellum_ai/types/prompt_request_audio_input"
357
374
  require_relative "vellum_ai/types/prompt_request_chat_history_input"
375
+ require_relative "vellum_ai/types/prompt_request_document_input"
376
+ require_relative "vellum_ai/types/prompt_request_image_input"
358
377
  require_relative "vellum_ai/types/prompt_request_string_input"
359
378
  require_relative "vellum_ai/types/prompt_request_json_input"
379
+ require_relative "vellum_ai/types/prompt_request_video_input"
360
380
  require_relative "vellum_ai/types/prompt_request_input"
361
381
  require_relative "vellum_ai/types/prompt_settings"
362
382
  require_relative "vellum_ai/types/prompt_version_build_config_sandbox"
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+ require_relative "vellum_audio_request"
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Vellum
7
+ # A user input representing a Vellum Audio value
8
+ class AudioInputRequest
9
+ # @return [String] The variable's name
10
+ attr_reader :name
11
+ # @return [String]
12
+ attr_reader :type
13
+ # @return [Vellum::VellumAudioRequest]
14
+ attr_reader :value
15
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
16
+ attr_reader :additional_properties
17
+ # @return [Object]
18
+ attr_reader :_field_set
19
+ protected :_field_set
20
+
21
+ OMIT = Object.new
22
+
23
+ # @param name [String] The variable's name
24
+ # @param type [String]
25
+ # @param value [Vellum::VellumAudioRequest]
26
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
27
+ # @return [Vellum::AudioInputRequest]
28
+ def initialize(name:, type:, value:, additional_properties: nil)
29
+ @name = name
30
+ @type = type
31
+ @value = value
32
+ @additional_properties = additional_properties
33
+ @_field_set = { "name": name, "type": type, "value": value }
34
+ end
35
+ # Deserialize a JSON object to an instance of AudioInputRequest
36
+ #
37
+ # @param json_object [String]
38
+ # @return [Vellum::AudioInputRequest]
39
+ def self.from_json(json_object:)
40
+ struct = JSON.parse(json_object, object_class: OpenStruct)
41
+ parsed_json = JSON.parse(json_object)
42
+ name = parsed_json["name"]
43
+ type = parsed_json["type"]
44
+ unless parsed_json["value"].nil?
45
+ value = parsed_json["value"].to_json
46
+ value = Vellum::VellumAudioRequest.from_json(json_object: value)
47
+ else
48
+ value = nil
49
+ end
50
+ new(
51
+ name: name,
52
+ type: type,
53
+ value: value,
54
+ additional_properties: struct
55
+ )
56
+ end
57
+ # Serialize an instance of AudioInputRequest to a JSON object
58
+ #
59
+ # @return [String]
60
+ def to_json
61
+ @_field_set&.to_json
62
+ end
63
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
64
+ # hash and check each fields type against the current object's property
65
+ # definitions.
66
+ #
67
+ # @param obj [Object]
68
+ # @return [Void]
69
+ def self.validate_raw(obj:)
70
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
71
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
72
+ Vellum::VellumAudioRequest.validate_raw(obj: obj.value)
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+ require "ostruct"
3
+ require "json"
4
+
5
+ module Vellum
6
+ class DelimiterChunkerConfig
7
+ # @return [String]
8
+ attr_reader :delimiter
9
+ # @return [Boolean]
10
+ attr_reader :is_regex
11
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
12
+ attr_reader :additional_properties
13
+ # @return [Object]
14
+ attr_reader :_field_set
15
+ protected :_field_set
16
+
17
+ OMIT = Object.new
18
+
19
+ # @param delimiter [String]
20
+ # @param is_regex [Boolean]
21
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
22
+ # @return [Vellum::DelimiterChunkerConfig]
23
+ def initialize(delimiter: OMIT, is_regex: OMIT, additional_properties: nil)
24
+ @delimiter = delimiter if delimiter != OMIT
25
+ @is_regex = is_regex if is_regex != OMIT
26
+ @additional_properties = additional_properties
27
+ @_field_set = { "delimiter": delimiter, "is_regex": is_regex }.reject do | _k, v |
28
+ v == OMIT
29
+ end
30
+ end
31
+ # Deserialize a JSON object to an instance of DelimiterChunkerConfig
32
+ #
33
+ # @param json_object [String]
34
+ # @return [Vellum::DelimiterChunkerConfig]
35
+ def self.from_json(json_object:)
36
+ struct = JSON.parse(json_object, object_class: OpenStruct)
37
+ parsed_json = JSON.parse(json_object)
38
+ delimiter = parsed_json["delimiter"]
39
+ is_regex = parsed_json["is_regex"]
40
+ new(
41
+ delimiter: delimiter,
42
+ is_regex: is_regex,
43
+ additional_properties: struct
44
+ )
45
+ end
46
+ # Serialize an instance of DelimiterChunkerConfig to a JSON object
47
+ #
48
+ # @return [String]
49
+ def to_json
50
+ @_field_set&.to_json
51
+ end
52
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
53
+ # hash and check each fields type against the current object's property
54
+ # definitions.
55
+ #
56
+ # @param obj [Object]
57
+ # @return [Void]
58
+ def self.validate_raw(obj:)
59
+ obj.delimiter&.is_a?(String) != false || raise("Passed value for field obj.delimiter is not the expected type, validation failed.")
60
+ obj.is_regex&.is_a?(Boolean) != false || raise("Passed value for field obj.is_regex is not the expected type, validation failed.")
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+ require "ostruct"
3
+ require "json"
4
+
5
+ module Vellum
6
+ class DelimiterChunkerConfigRequest
7
+ # @return [String]
8
+ attr_reader :delimiter
9
+ # @return [Boolean]
10
+ attr_reader :is_regex
11
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
12
+ attr_reader :additional_properties
13
+ # @return [Object]
14
+ attr_reader :_field_set
15
+ protected :_field_set
16
+
17
+ OMIT = Object.new
18
+
19
+ # @param delimiter [String]
20
+ # @param is_regex [Boolean]
21
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
22
+ # @return [Vellum::DelimiterChunkerConfigRequest]
23
+ def initialize(delimiter: OMIT, is_regex: OMIT, additional_properties: nil)
24
+ @delimiter = delimiter if delimiter != OMIT
25
+ @is_regex = is_regex if is_regex != OMIT
26
+ @additional_properties = additional_properties
27
+ @_field_set = { "delimiter": delimiter, "is_regex": is_regex }.reject do | _k, v |
28
+ v == OMIT
29
+ end
30
+ end
31
+ # Deserialize a JSON object to an instance of DelimiterChunkerConfigRequest
32
+ #
33
+ # @param json_object [String]
34
+ # @return [Vellum::DelimiterChunkerConfigRequest]
35
+ def self.from_json(json_object:)
36
+ struct = JSON.parse(json_object, object_class: OpenStruct)
37
+ parsed_json = JSON.parse(json_object)
38
+ delimiter = parsed_json["delimiter"]
39
+ is_regex = parsed_json["is_regex"]
40
+ new(
41
+ delimiter: delimiter,
42
+ is_regex: is_regex,
43
+ additional_properties: struct
44
+ )
45
+ end
46
+ # Serialize an instance of DelimiterChunkerConfigRequest to a JSON object
47
+ #
48
+ # @return [String]
49
+ def to_json
50
+ @_field_set&.to_json
51
+ end
52
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
53
+ # hash and check each fields type against the current object's property
54
+ # definitions.
55
+ #
56
+ # @param obj [Object]
57
+ # @return [Void]
58
+ def self.validate_raw(obj:)
59
+ obj.delimiter&.is_a?(String) != false || raise("Passed value for field obj.delimiter is not the expected type, validation failed.")
60
+ obj.is_regex&.is_a?(Boolean) != false || raise("Passed value for field obj.is_regex is not the expected type, validation failed.")
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+ require_relative "delimiter_chunker_config"
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Vellum
7
+ class DelimiterChunking
8
+ # @return [String]
9
+ attr_reader :chunker_name
10
+ # @return [Vellum::DelimiterChunkerConfig]
11
+ attr_reader :chunker_config
12
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
13
+ attr_reader :additional_properties
14
+ # @return [Object]
15
+ attr_reader :_field_set
16
+ protected :_field_set
17
+
18
+ OMIT = Object.new
19
+
20
+ # @param chunker_name [String]
21
+ # @param chunker_config [Vellum::DelimiterChunkerConfig]
22
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
23
+ # @return [Vellum::DelimiterChunking]
24
+ def initialize(chunker_name:, chunker_config: OMIT, additional_properties: nil)
25
+ @chunker_name = chunker_name
26
+ @chunker_config = chunker_config if chunker_config != OMIT
27
+ @additional_properties = additional_properties
28
+ @_field_set = { "chunker_name": chunker_name, "chunker_config": chunker_config }.reject do | _k, v |
29
+ v == OMIT
30
+ end
31
+ end
32
+ # Deserialize a JSON object to an instance of DelimiterChunking
33
+ #
34
+ # @param json_object [String]
35
+ # @return [Vellum::DelimiterChunking]
36
+ def self.from_json(json_object:)
37
+ struct = JSON.parse(json_object, object_class: OpenStruct)
38
+ parsed_json = JSON.parse(json_object)
39
+ chunker_name = parsed_json["chunker_name"]
40
+ unless parsed_json["chunker_config"].nil?
41
+ chunker_config = parsed_json["chunker_config"].to_json
42
+ chunker_config = Vellum::DelimiterChunkerConfig.from_json(json_object: chunker_config)
43
+ else
44
+ chunker_config = nil
45
+ end
46
+ new(
47
+ chunker_name: chunker_name,
48
+ chunker_config: chunker_config,
49
+ additional_properties: struct
50
+ )
51
+ end
52
+ # Serialize an instance of DelimiterChunking to a JSON object
53
+ #
54
+ # @return [String]
55
+ def to_json
56
+ @_field_set&.to_json
57
+ end
58
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
59
+ # hash and check each fields type against the current object's property
60
+ # definitions.
61
+ #
62
+ # @param obj [Object]
63
+ # @return [Void]
64
+ def self.validate_raw(obj:)
65
+ obj.chunker_name.is_a?(String) != false || raise("Passed value for field obj.chunker_name is not the expected type, validation failed.")
66
+ obj.chunker_config.nil? || Vellum::DelimiterChunkerConfig.validate_raw(obj: obj.chunker_config)
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+ require_relative "delimiter_chunker_config_request"
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Vellum
7
+ class DelimiterChunkingRequest
8
+ # @return [String]
9
+ attr_reader :chunker_name
10
+ # @return [Vellum::DelimiterChunkerConfigRequest]
11
+ attr_reader :chunker_config
12
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
13
+ attr_reader :additional_properties
14
+ # @return [Object]
15
+ attr_reader :_field_set
16
+ protected :_field_set
17
+
18
+ OMIT = Object.new
19
+
20
+ # @param chunker_name [String]
21
+ # @param chunker_config [Vellum::DelimiterChunkerConfigRequest]
22
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
23
+ # @return [Vellum::DelimiterChunkingRequest]
24
+ def initialize(chunker_name:, chunker_config: OMIT, additional_properties: nil)
25
+ @chunker_name = chunker_name
26
+ @chunker_config = chunker_config if chunker_config != OMIT
27
+ @additional_properties = additional_properties
28
+ @_field_set = { "chunker_name": chunker_name, "chunker_config": chunker_config }.reject do | _k, v |
29
+ v == OMIT
30
+ end
31
+ end
32
+ # Deserialize a JSON object to an instance of DelimiterChunkingRequest
33
+ #
34
+ # @param json_object [String]
35
+ # @return [Vellum::DelimiterChunkingRequest]
36
+ def self.from_json(json_object:)
37
+ struct = JSON.parse(json_object, object_class: OpenStruct)
38
+ parsed_json = JSON.parse(json_object)
39
+ chunker_name = parsed_json["chunker_name"]
40
+ unless parsed_json["chunker_config"].nil?
41
+ chunker_config = parsed_json["chunker_config"].to_json
42
+ chunker_config = Vellum::DelimiterChunkerConfigRequest.from_json(json_object: chunker_config)
43
+ else
44
+ chunker_config = nil
45
+ end
46
+ new(
47
+ chunker_name: chunker_name,
48
+ chunker_config: chunker_config,
49
+ additional_properties: struct
50
+ )
51
+ end
52
+ # Serialize an instance of DelimiterChunkingRequest to a JSON object
53
+ #
54
+ # @return [String]
55
+ def to_json
56
+ @_field_set&.to_json
57
+ end
58
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
59
+ # hash and check each fields type against the current object's property
60
+ # definitions.
61
+ #
62
+ # @param obj [Object]
63
+ # @return [Void]
64
+ def self.validate_raw(obj:)
65
+ obj.chunker_name.is_a?(String) != false || raise("Passed value for field obj.chunker_name is not the expected type, validation failed.")
66
+ obj.chunker_config.nil? || Vellum::DelimiterChunkerConfigRequest.validate_raw(obj: obj.chunker_config)
67
+ end
68
+ end
69
+ end
@@ -3,6 +3,7 @@ require "json"
3
3
  require_relative "reducto_chunking"
4
4
  require_relative "sentence_chunking"
5
5
  require_relative "token_overlapping_window_chunking"
6
+ require_relative "delimiter_chunking"
6
7
 
7
8
  module Vellum
8
9
  class DocumentIndexChunking
@@ -40,6 +41,16 @@ end
40
41
  return Vellum::TokenOverlappingWindowChunking.from_json(json_object: struct)
41
42
  else
42
43
  return nil
44
+ end
45
+ rescue StandardError
46
+ # noop
47
+ end
48
+ begin
49
+ Vellum::DelimiterChunking.validate_raw(obj: struct)
50
+ unless struct.nil?
51
+ return Vellum::DelimiterChunking.from_json(json_object: struct)
52
+ else
53
+ return nil
43
54
  end
44
55
  rescue StandardError
45
56
  # noop
@@ -68,6 +79,11 @@ end
68
79
  rescue StandardError
69
80
  # noop
70
81
  end
82
+ begin
83
+ return Vellum::DelimiterChunking.validate_raw(obj: obj)
84
+ rescue StandardError
85
+ # noop
86
+ end
71
87
  raise("Passed value matched no type within the union, validation failed.")
72
88
  end
73
89
  end
@@ -3,6 +3,7 @@ require "json"
3
3
  require_relative "reducto_chunking_request"
4
4
  require_relative "sentence_chunking_request"
5
5
  require_relative "token_overlapping_window_chunking_request"
6
+ require_relative "delimiter_chunking_request"
6
7
 
7
8
  module Vellum
8
9
  class DocumentIndexChunkingRequest
@@ -40,6 +41,16 @@ end
40
41
  return Vellum::TokenOverlappingWindowChunkingRequest.from_json(json_object: struct)
41
42
  else
42
43
  return nil
44
+ end
45
+ rescue StandardError
46
+ # noop
47
+ end
48
+ begin
49
+ Vellum::DelimiterChunkingRequest.validate_raw(obj: struct)
50
+ unless struct.nil?
51
+ return Vellum::DelimiterChunkingRequest.from_json(json_object: struct)
52
+ else
53
+ return nil
43
54
  end
44
55
  rescue StandardError
45
56
  # noop
@@ -68,6 +79,11 @@ end
68
79
  rescue StandardError
69
80
  # noop
70
81
  end
82
+ begin
83
+ return Vellum::DelimiterChunkingRequest.validate_raw(obj: obj)
84
+ rescue StandardError
85
+ # noop
86
+ end
71
87
  raise("Passed value matched no type within the union, validation failed.")
72
88
  end
73
89
  end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+ require_relative "vellum_document_request"
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Vellum
7
+ # A user input representing a Vellum Document value
8
+ class DocumentInputRequest
9
+ # @return [String] The variable's name
10
+ attr_reader :name
11
+ # @return [String]
12
+ attr_reader :type
13
+ # @return [Vellum::VellumDocumentRequest]
14
+ attr_reader :value
15
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
16
+ attr_reader :additional_properties
17
+ # @return [Object]
18
+ attr_reader :_field_set
19
+ protected :_field_set
20
+
21
+ OMIT = Object.new
22
+
23
+ # @param name [String] The variable's name
24
+ # @param type [String]
25
+ # @param value [Vellum::VellumDocumentRequest]
26
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
27
+ # @return [Vellum::DocumentInputRequest]
28
+ def initialize(name:, type:, value:, additional_properties: nil)
29
+ @name = name
30
+ @type = type
31
+ @value = value
32
+ @additional_properties = additional_properties
33
+ @_field_set = { "name": name, "type": type, "value": value }
34
+ end
35
+ # Deserialize a JSON object to an instance of DocumentInputRequest
36
+ #
37
+ # @param json_object [String]
38
+ # @return [Vellum::DocumentInputRequest]
39
+ def self.from_json(json_object:)
40
+ struct = JSON.parse(json_object, object_class: OpenStruct)
41
+ parsed_json = JSON.parse(json_object)
42
+ name = parsed_json["name"]
43
+ type = parsed_json["type"]
44
+ unless parsed_json["value"].nil?
45
+ value = parsed_json["value"].to_json
46
+ value = Vellum::VellumDocumentRequest.from_json(json_object: value)
47
+ else
48
+ value = nil
49
+ end
50
+ new(
51
+ name: name,
52
+ type: type,
53
+ value: value,
54
+ additional_properties: struct
55
+ )
56
+ end
57
+ # Serialize an instance of DocumentInputRequest to a JSON object
58
+ #
59
+ # @return [String]
60
+ def to_json
61
+ @_field_set&.to_json
62
+ end
63
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
64
+ # hash and check each fields type against the current object's property
65
+ # definitions.
66
+ #
67
+ # @param obj [Object]
68
+ # @return [Void]
69
+ def self.validate_raw(obj:)
70
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
71
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
72
+ Vellum::VellumDocumentRequest.validate_raw(obj: obj.value)
73
+ end
74
+ end
75
+ end