venice_client 1.0.19 → 1.0.21

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 (189) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -1
  3. data/docs/AudioModelPricingInput.md +0 -2
  4. data/docs/CacheControl.md +20 -0
  5. data/docs/ChatApi.md +1 -1
  6. data/docs/ChatCompletionRequest.md +7 -1
  7. data/docs/ChatCompletionRequestReasoning.md +18 -0
  8. data/docs/ChatCompletionRequestVeniceParameters.md +3 -1
  9. data/docs/CompleteVideo200Response.md +18 -0
  10. data/docs/CompleteVideoRequest.md +20 -0
  11. data/docs/CreateChatCompletion200Response.md +1 -1
  12. data/docs/CreateChatCompletion200ResponseVeniceParameters.md +2 -0
  13. data/docs/GenerateImageRequest.md +9 -3
  14. data/docs/GetApiKeyRateLimitLogs200ResponseDataInner.md +1 -1
  15. data/docs/GetApiKeyRateLimits200Response.md +0 -2
  16. data/docs/GetApiKeyRateLimits200ResponseDataBalances.md +0 -2
  17. data/docs/GetApiKeyRateLimits200ResponseDataRateLimitsInner.md +1 -1
  18. data/docs/ImageApi.md +1 -1
  19. data/docs/ImageModelPricingGeneration.md +0 -2
  20. data/docs/ImageModelPricingUpscale2x.md +0 -2
  21. data/docs/ImageModelPricingUpscale4x.md +0 -2
  22. data/docs/ImageUrl.md +2 -0
  23. data/docs/LLMModelPricingInput.md +0 -2
  24. data/docs/LLMModelPricingOutput.md +0 -2
  25. data/docs/ModelResponseModelSpec.md +2 -0
  26. data/docs/ModelResponseModelSpecConstraints.md +13 -1
  27. data/docs/ModelsApi.md +2 -2
  28. data/docs/QueueVideo200Response.md +20 -0
  29. data/docs/QueueVideoRequest.md +32 -0
  30. data/docs/QuoteVideo200Response.md +18 -0
  31. data/docs/RetrieveVideo200Response.md +22 -0
  32. data/docs/RetrieveVideoRequest.md +22 -0
  33. data/docs/SimpleGenerateImageRequest.md +1 -1
  34. data/docs/Text.md +2 -0
  35. data/docs/VideoApi.md +295 -0
  36. data/docs/VideoModelConstraints.md +28 -0
  37. data/lib/venice_client/api/api_keys_api.rb +1 -1
  38. data/lib/venice_client/api/audio_api.rb +1 -1
  39. data/lib/venice_client/api/billing_api.rb +1 -1
  40. data/lib/venice_client/api/characters_api.rb +1 -1
  41. data/lib/venice_client/api/chat_api.rb +1 -1
  42. data/lib/venice_client/api/embeddings_api.rb +1 -1
  43. data/lib/venice_client/api/image_api.rb +1 -1
  44. data/lib/venice_client/api/models_api.rb +3 -3
  45. data/lib/venice_client/api/preview_api.rb +1 -1
  46. data/lib/venice_client/api/speech_api.rb +1 -1
  47. data/lib/venice_client/api/video_api.rb +278 -0
  48. data/lib/venice_client/api_client.rb +1 -1
  49. data/lib/venice_client/api_error.rb +1 -1
  50. data/lib/venice_client/configuration.rb +1 -1
  51. data/lib/venice_client/models/assistant_message.rb +8 -8
  52. data/lib/venice_client/models/assistant_message_content.rb +1 -1
  53. data/lib/venice_client/models/audio_model_pricing.rb +1 -1
  54. data/lib/venice_client/models/audio_model_pricing_input.rb +2 -29
  55. data/lib/venice_client/models/billing_usage_request.rb +1 -1
  56. data/lib/venice_client/models/billing_usage_response.rb +1 -1
  57. data/lib/venice_client/models/cache_control.rb +273 -0
  58. data/lib/venice_client/models/chat_completion_request.rb +65 -2
  59. data/lib/venice_client/models/chat_completion_request_messages_inner.rb +2 -2
  60. data/lib/venice_client/models/chat_completion_request_reasoning.rb +256 -0
  61. data/lib/venice_client/models/chat_completion_request_response_format.rb +1 -1
  62. data/lib/venice_client/models/chat_completion_request_stop.rb +1 -1
  63. data/lib/venice_client/models/chat_completion_request_stream_options.rb +1 -1
  64. data/lib/venice_client/models/chat_completion_request_tool_choice.rb +1 -1
  65. data/lib/venice_client/models/chat_completion_request_tool_choice_any_of.rb +1 -1
  66. data/lib/venice_client/models/chat_completion_request_tool_choice_any_of_function.rb +1 -1
  67. data/lib/venice_client/models/chat_completion_request_venice_parameters.rb +15 -3
  68. data/lib/venice_client/models/complete_video200_response.rb +238 -0
  69. data/lib/venice_client/models/complete_video_request.rb +265 -0
  70. data/lib/venice_client/models/create_api_key200_response.rb +1 -1
  71. data/lib/venice_client/models/create_api_key200_response_data.rb +1 -1
  72. data/lib/venice_client/models/create_api_key_request.rb +1 -1
  73. data/lib/venice_client/models/create_api_key_request_expires_at.rb +1 -1
  74. data/lib/venice_client/models/create_chat_completion200_response.rb +11 -19
  75. data/lib/venice_client/models/create_chat_completion200_response_choices_inner.rb +7 -7
  76. data/lib/venice_client/models/create_chat_completion200_response_choices_inner_logprobs.rb +1 -1
  77. data/lib/venice_client/models/create_chat_completion200_response_choices_inner_logprobs_top_logprobs_inner.rb +1 -1
  78. data/lib/venice_client/models/create_chat_completion200_response_choices_inner_message.rb +2 -2
  79. data/lib/venice_client/models/create_chat_completion200_response_usage.rb +1 -1
  80. data/lib/venice_client/models/create_chat_completion200_response_venice_parameters.rb +29 -2
  81. data/lib/venice_client/models/create_chat_completion200_response_venice_parameters_web_search_citations_inner.rb +1 -1
  82. data/lib/venice_client/models/create_embedding200_response.rb +1 -1
  83. data/lib/venice_client/models/create_embedding200_response_data_inner.rb +1 -1
  84. data/lib/venice_client/models/create_embedding200_response_usage.rb +1 -1
  85. data/lib/venice_client/models/create_embedding_request_schema.rb +1 -1
  86. data/lib/venice_client/models/create_embedding_request_schema_input.rb +1 -1
  87. data/lib/venice_client/models/create_embedding_request_schema_model.rb +1 -1
  88. data/lib/venice_client/models/create_speech_request_schema.rb +1 -1
  89. data/lib/venice_client/models/delete_api_key200_response.rb +1 -1
  90. data/lib/venice_client/models/detailed_error.rb +1 -1
  91. data/lib/venice_client/models/edit_image_request.rb +1 -1
  92. data/lib/venice_client/models/edit_image_request_image.rb +1 -1
  93. data/lib/venice_client/models/generate_image200_response.rb +1 -1
  94. data/lib/venice_client/models/generate_image200_response_timing.rb +1 -1
  95. data/lib/venice_client/models/generate_image_request.rb +44 -42
  96. data/lib/venice_client/models/get_api_key_by_id200_response.rb +1 -1
  97. data/lib/venice_client/models/get_api_key_by_id200_response_data.rb +1 -1
  98. data/lib/venice_client/models/get_api_key_generate_web3_key200_response.rb +1 -1
  99. data/lib/venice_client/models/get_api_key_generate_web3_key200_response_data.rb +1 -1
  100. data/lib/venice_client/models/get_api_key_rate_limit_logs200_response.rb +1 -1
  101. data/lib/venice_client/models/get_api_key_rate_limit_logs200_response_data_inner.rb +2 -2
  102. data/lib/venice_client/models/get_api_key_rate_limits200_response.rb +2 -12
  103. data/lib/venice_client/models/get_api_key_rate_limits200_response_data.rb +1 -1
  104. data/lib/venice_client/models/get_api_key_rate_limits200_response_data_api_tier.rb +1 -1
  105. data/lib/venice_client/models/get_api_key_rate_limits200_response_data_balances.rb +2 -12
  106. data/lib/venice_client/models/get_api_key_rate_limits200_response_data_rate_limits_inner.rb +1 -1
  107. data/lib/venice_client/models/get_api_key_rate_limits200_response_data_rate_limits_inner_rate_limits_inner.rb +1 -1
  108. data/lib/venice_client/models/get_api_keys200_response.rb +1 -1
  109. data/lib/venice_client/models/get_api_keys200_response_data_inner.rb +1 -1
  110. data/lib/venice_client/models/get_api_keys200_response_data_inner_consumption_limits.rb +1 -1
  111. data/lib/venice_client/models/get_api_keys200_response_data_inner_usage.rb +1 -1
  112. data/lib/venice_client/models/get_api_keys200_response_data_inner_usage_trailing_seven_days.rb +1 -1
  113. data/lib/venice_client/models/get_billing_usage200_response.rb +1 -1
  114. data/lib/venice_client/models/get_billing_usage200_response_data_inner.rb +1 -1
  115. data/lib/venice_client/models/get_billing_usage200_response_data_inner_inference_details.rb +1 -1
  116. data/lib/venice_client/models/get_billing_usage200_response_pagination.rb +1 -1
  117. data/lib/venice_client/models/get_character_by_slug200_response.rb +1 -1
  118. data/lib/venice_client/models/image_model_constraints.rb +1 -1
  119. data/lib/venice_client/models/image_model_constraints_steps.rb +1 -1
  120. data/lib/venice_client/models/image_model_pricing.rb +1 -1
  121. data/lib/venice_client/models/image_model_pricing_generation.rb +2 -29
  122. data/lib/venice_client/models/image_model_pricing_upscale.rb +1 -1
  123. data/lib/venice_client/models/image_model_pricing_upscale2x.rb +2 -29
  124. data/lib/venice_client/models/image_model_pricing_upscale4x.rb +2 -29
  125. data/lib/venice_client/models/image_styles_get200_response.rb +1 -1
  126. data/lib/venice_client/models/image_url.rb +12 -3
  127. data/lib/venice_client/models/image_url_object.rb +1 -1
  128. data/lib/venice_client/models/json_object.rb +1 -1
  129. data/lib/venice_client/models/json_schema.rb +1 -1
  130. data/lib/venice_client/models/list_characters200_response.rb +1 -1
  131. data/lib/venice_client/models/list_characters200_response_data_inner.rb +1 -1
  132. data/lib/venice_client/models/list_characters200_response_data_inner_stats.rb +1 -1
  133. data/lib/venice_client/models/list_model_compatibility_mapping200_response.rb +1 -1
  134. data/lib/venice_client/models/list_model_traits200_response.rb +1 -1
  135. data/lib/venice_client/models/list_models200_response.rb +1 -1
  136. data/lib/venice_client/models/list_models200_response_type.rb +1 -1
  137. data/lib/venice_client/models/list_models_type_parameter.rb +1 -1
  138. data/lib/venice_client/models/llm_model_pricing.rb +1 -1
  139. data/lib/venice_client/models/llm_model_pricing_input.rb +2 -29
  140. data/lib/venice_client/models/llm_model_pricing_output.rb +2 -29
  141. data/lib/venice_client/models/model_response.rb +3 -3
  142. data/lib/venice_client/models/model_response_model_spec.rb +46 -2
  143. data/lib/venice_client/models/model_response_model_spec_capabilities.rb +3 -3
  144. data/lib/venice_client/models/model_response_model_spec_constraints.rb +3 -2
  145. data/lib/venice_client/models/model_response_model_spec_pricing.rb +1 -1
  146. data/lib/venice_client/models/objects_inner.rb +1 -1
  147. data/lib/venice_client/models/post_api_key_generate_web3_key_request.rb +1 -1
  148. data/lib/venice_client/models/queue_video200_response.rb +265 -0
  149. data/lib/venice_client/models/queue_video_request.rb +438 -0
  150. data/lib/venice_client/models/quote_video200_response.rb +237 -0
  151. data/lib/venice_client/models/retrieve_video200_response.rb +316 -0
  152. data/lib/venice_client/models/retrieve_video_request.rb +277 -0
  153. data/lib/venice_client/models/simple_generate_image200_response.rb +1 -1
  154. data/lib/venice_client/models/simple_generate_image200_response_data_inner.rb +1 -1
  155. data/lib/venice_client/models/simple_generate_image200_response_data_inner_any_of.rb +1 -1
  156. data/lib/venice_client/models/simple_generate_image200_response_data_inner_any_of1.rb +1 -1
  157. data/lib/venice_client/models/simple_generate_image_request.rb +1 -1
  158. data/lib/venice_client/models/standard_error.rb +1 -1
  159. data/lib/venice_client/models/system_message.rb +8 -8
  160. data/lib/venice_client/models/system_message_content.rb +1 -1
  161. data/lib/venice_client/models/text.rb +12 -3
  162. data/lib/venice_client/models/text_model_constraints.rb +1 -1
  163. data/lib/venice_client/models/text_model_constraints_temperature.rb +1 -1
  164. data/lib/venice_client/models/text_model_constraints_top_p.rb +1 -1
  165. data/lib/venice_client/models/tool_call.rb +1 -1
  166. data/lib/venice_client/models/tool_call_function.rb +1 -1
  167. data/lib/venice_client/models/tool_message.rb +8 -8
  168. data/lib/venice_client/models/upscale_image_request.rb +1 -1
  169. data/lib/venice_client/models/upscale_image_request_enhance.rb +1 -1
  170. data/lib/venice_client/models/user_message.rb +8 -8
  171. data/lib/venice_client/models/user_message_content.rb +1 -1
  172. data/lib/venice_client/models/video_model_constraints.rb +404 -0
  173. data/lib/venice_client/version.rb +2 -2
  174. data/lib/venice_client.rb +12 -1
  175. data/spec/api/video_api_spec.rb +83 -0
  176. data/spec/models/cache_control_spec.rb +46 -0
  177. data/spec/models/chat_completion_request_reasoning_spec.rb +40 -0
  178. data/spec/models/complete_video200_response_spec.rb +36 -0
  179. data/spec/models/complete_video_request_spec.rb +42 -0
  180. data/spec/models/queue_video200_response_spec.rb +42 -0
  181. data/spec/models/queue_video_request_spec.rb +86 -0
  182. data/spec/models/quote_video200_response_spec.rb +36 -0
  183. data/spec/models/retrieve_video200_response_spec.rb +52 -0
  184. data/spec/models/retrieve_video_request_spec.rb +48 -0
  185. data/spec/models/video_model_constraints_spec.rb +70 -0
  186. data/spec/spec_helper.rb +1 -1
  187. data/swagger.yaml +587 -76
  188. data/venice_client.gemspec +1 -1
  189. metadata +46 -2
@@ -0,0 +1,265 @@
1
+ =begin
2
+ #Venice.ai API
3
+
4
+ #The Venice.ai API.
5
+
6
+ The version of the OpenAPI document: 20251209.153516
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module VeniceClient
17
+ class QueueVideo200Response
18
+ # The ID of the model used for video generation.
19
+ attr_accessor :model
20
+
21
+ # The ID of the video generation request.
22
+ attr_accessor :queue_id
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'model' => :'model',
28
+ :'queue_id' => :'queue_id'
29
+ }
30
+ end
31
+
32
+ # Returns attribute mapping this model knows about
33
+ def self.acceptable_attribute_map
34
+ attribute_map
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ acceptable_attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'model' => :'String',
46
+ :'queue_id' => :'String'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `VeniceClient::QueueVideo200Response` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ acceptable_attribute_map = self.class.acceptable_attribute_map
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!acceptable_attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `VeniceClient::QueueVideo200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'model')
73
+ self.model = attributes[:'model']
74
+ else
75
+ self.model = nil
76
+ end
77
+
78
+ if attributes.key?(:'queue_id')
79
+ self.queue_id = attributes[:'queue_id']
80
+ else
81
+ self.queue_id = nil
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
89
+ invalid_properties = Array.new
90
+ if @model.nil?
91
+ invalid_properties.push('invalid value for "model", model cannot be nil.')
92
+ end
93
+
94
+ if @queue_id.nil?
95
+ invalid_properties.push('invalid value for "queue_id", queue_id cannot be nil.')
96
+ end
97
+
98
+ invalid_properties
99
+ end
100
+
101
+ # Check to see if the all the properties in the model are valid
102
+ # @return true if the model is valid
103
+ def valid?
104
+ warn '[DEPRECATED] the `valid?` method is obsolete'
105
+ return false if @model.nil?
106
+ return false if @queue_id.nil?
107
+ true
108
+ end
109
+
110
+ # Custom attribute writer method with validation
111
+ # @param [Object] model Value to be assigned
112
+ def model=(model)
113
+ if model.nil?
114
+ fail ArgumentError, 'model cannot be nil'
115
+ end
116
+
117
+ @model = model
118
+ end
119
+
120
+ # Custom attribute writer method with validation
121
+ # @param [Object] queue_id Value to be assigned
122
+ def queue_id=(queue_id)
123
+ if queue_id.nil?
124
+ fail ArgumentError, 'queue_id cannot be nil'
125
+ end
126
+
127
+ @queue_id = queue_id
128
+ end
129
+
130
+ # Checks equality by comparing each attribute.
131
+ # @param [Object] Object to be compared
132
+ def ==(o)
133
+ return true if self.equal?(o)
134
+ self.class == o.class &&
135
+ model == o.model &&
136
+ queue_id == o.queue_id
137
+ end
138
+
139
+ # @see the `==` method
140
+ # @param [Object] Object to be compared
141
+ def eql?(o)
142
+ self == o
143
+ end
144
+
145
+ # Calculates hash code according to all attributes.
146
+ # @return [Integer] Hash code
147
+ def hash
148
+ [model, queue_id].hash
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def self.build_from_hash(attributes)
155
+ return nil unless attributes.is_a?(Hash)
156
+ attributes = attributes.transform_keys(&:to_sym)
157
+ transformed_hash = {}
158
+ openapi_types.each_pair do |key, type|
159
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
160
+ transformed_hash["#{key}"] = nil
161
+ elsif type =~ /\AArray<(.*)>/i
162
+ # check to ensure the input is an array given that the attribute
163
+ # is documented as an array but the input is not
164
+ if attributes[attribute_map[key]].is_a?(Array)
165
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
166
+ end
167
+ elsif !attributes[attribute_map[key]].nil?
168
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
169
+ end
170
+ end
171
+ new(transformed_hash)
172
+ end
173
+
174
+ # Deserializes the data based on type
175
+ # @param string type Data type
176
+ # @param string value Value to be deserialized
177
+ # @return [Object] Deserialized data
178
+ def self._deserialize(type, value)
179
+ case type.to_sym
180
+ when :Time
181
+ Time.parse(value)
182
+ when :Date
183
+ Date.parse(value)
184
+ when :String
185
+ value.to_s
186
+ when :Integer
187
+ value.to_i
188
+ when :Float
189
+ value.to_f
190
+ when :Boolean
191
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
192
+ true
193
+ else
194
+ false
195
+ end
196
+ when :Object
197
+ # generic object (usually a Hash), return directly
198
+ value
199
+ when /\AArray<(?<inner_type>.+)>\z/
200
+ inner_type = Regexp.last_match[:inner_type]
201
+ value.map { |v| _deserialize(inner_type, v) }
202
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
203
+ k_type = Regexp.last_match[:k_type]
204
+ v_type = Regexp.last_match[:v_type]
205
+ {}.tap do |hash|
206
+ value.each do |k, v|
207
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
208
+ end
209
+ end
210
+ else # model
211
+ # models (e.g. Pet) or oneOf
212
+ klass = VeniceClient.const_get(type)
213
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
214
+ end
215
+ end
216
+
217
+ # Returns the string representation of the object
218
+ # @return [String] String presentation of the object
219
+ def to_s
220
+ to_hash.to_s
221
+ end
222
+
223
+ # to_body is an alias to to_hash (backward compatibility)
224
+ # @return [Hash] Returns the object in the form of hash
225
+ def to_body
226
+ to_hash
227
+ end
228
+
229
+ # Returns the object in the form of hash
230
+ # @return [Hash] Returns the object in the form of hash
231
+ def to_hash
232
+ hash = {}
233
+ self.class.attribute_map.each_pair do |attr, param|
234
+ value = self.send(attr)
235
+ if value.nil?
236
+ is_nullable = self.class.openapi_nullable.include?(attr)
237
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
238
+ end
239
+
240
+ hash[param] = _to_hash(value)
241
+ end
242
+ hash
243
+ end
244
+
245
+ # Outputs non-array value in the form of hash
246
+ # For object, use to_hash. Otherwise, just return the value
247
+ # @param [Object] value Any valid value
248
+ # @return [Hash] Returns the value in the form of hash
249
+ def _to_hash(value)
250
+ if value.is_a?(Array)
251
+ value.compact.map { |v| _to_hash(v) }
252
+ elsif value.is_a?(Hash)
253
+ {}.tap do |hash|
254
+ value.each { |k, v| hash[k] = _to_hash(v) }
255
+ end
256
+ elsif value.respond_to? :to_hash
257
+ value.to_hash
258
+ else
259
+ value
260
+ end
261
+ end
262
+
263
+ end
264
+
265
+ end
@@ -0,0 +1,438 @@
1
+ =begin
2
+ #Venice.ai API
3
+
4
+ #The Venice.ai API.
5
+
6
+ The version of the OpenAPI document: 20251209.153516
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module VeniceClient
17
+ class QueueVideoRequest
18
+ # The model to use for image generation.
19
+ attr_accessor :model
20
+
21
+ # The prompt to use for video generation. The maximum length is 2500 characters.
22
+ attr_accessor :prompt
23
+
24
+ # The negative prompt to use for video generation. The maximum length is 2500 characters.
25
+ attr_accessor :negative_prompt
26
+
27
+ # The duration of the video to generate.
28
+ attr_accessor :duration
29
+
30
+ # The aspect ratio of the video to generate.
31
+ attr_accessor :aspect_ratio
32
+
33
+ # The resolution of the video to generate.
34
+ attr_accessor :resolution
35
+
36
+ # For models which support audio generation and configuration, indicates if audio should be generated. Defaults to true.
37
+ attr_accessor :audio
38
+
39
+ # For image to video models, the reference image to use for video generation. Must be either a URL (starting with \"http://\" or \"https://\") or a data URL (starting with \"data:\").
40
+ attr_accessor :image_url
41
+
42
+ class EnumAttributeValidator
43
+ attr_reader :datatype
44
+ attr_reader :allowable_values
45
+
46
+ def initialize(datatype, allowable_values)
47
+ @allowable_values = allowable_values.map do |value|
48
+ case datatype.to_s
49
+ when /Integer/i
50
+ value.to_i
51
+ when /Float/i
52
+ value.to_f
53
+ else
54
+ value
55
+ end
56
+ end
57
+ end
58
+
59
+ def valid?(value)
60
+ !value || allowable_values.include?(value)
61
+ end
62
+ end
63
+
64
+ # Attribute mapping from ruby-style variable name to JSON key.
65
+ def self.attribute_map
66
+ {
67
+ :'model' => :'model',
68
+ :'prompt' => :'prompt',
69
+ :'negative_prompt' => :'negative_prompt',
70
+ :'duration' => :'duration',
71
+ :'aspect_ratio' => :'aspect_ratio',
72
+ :'resolution' => :'resolution',
73
+ :'audio' => :'audio',
74
+ :'image_url' => :'image_url'
75
+ }
76
+ end
77
+
78
+ # Returns attribute mapping this model knows about
79
+ def self.acceptable_attribute_map
80
+ attribute_map
81
+ end
82
+
83
+ # Returns all the JSON keys this model knows about
84
+ def self.acceptable_attributes
85
+ acceptable_attribute_map.values
86
+ end
87
+
88
+ # Attribute type mapping.
89
+ def self.openapi_types
90
+ {
91
+ :'model' => :'String',
92
+ :'prompt' => :'String',
93
+ :'negative_prompt' => :'String',
94
+ :'duration' => :'String',
95
+ :'aspect_ratio' => :'Object',
96
+ :'resolution' => :'String',
97
+ :'audio' => :'Object',
98
+ :'image_url' => :'String'
99
+ }
100
+ end
101
+
102
+ # List of attributes with nullable: true
103
+ def self.openapi_nullable
104
+ Set.new([
105
+ :'aspect_ratio',
106
+ :'audio',
107
+ ])
108
+ end
109
+
110
+ # Initializes the object
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ def initialize(attributes = {})
113
+ if (!attributes.is_a?(Hash))
114
+ fail ArgumentError, "The input argument (attributes) must be a hash in `VeniceClient::QueueVideoRequest` initialize method"
115
+ end
116
+
117
+ # check to see if the attribute exists and convert string to symbol for hash key
118
+ acceptable_attribute_map = self.class.acceptable_attribute_map
119
+ attributes = attributes.each_with_object({}) { |(k, v), h|
120
+ if (!acceptable_attribute_map.key?(k.to_sym))
121
+ fail ArgumentError, "`#{k}` is not a valid attribute in `VeniceClient::QueueVideoRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
122
+ end
123
+ h[k.to_sym] = v
124
+ }
125
+
126
+ if attributes.key?(:'model')
127
+ self.model = attributes[:'model']
128
+ else
129
+ self.model = nil
130
+ end
131
+
132
+ if attributes.key?(:'prompt')
133
+ self.prompt = attributes[:'prompt']
134
+ else
135
+ self.prompt = nil
136
+ end
137
+
138
+ if attributes.key?(:'negative_prompt')
139
+ self.negative_prompt = attributes[:'negative_prompt']
140
+ else
141
+ self.negative_prompt = 'low resolution, error, worst quality, low quality, defects'
142
+ end
143
+
144
+ if attributes.key?(:'duration')
145
+ self.duration = attributes[:'duration']
146
+ else
147
+ self.duration = nil
148
+ end
149
+
150
+ if attributes.key?(:'aspect_ratio')
151
+ self.aspect_ratio = attributes[:'aspect_ratio']
152
+ end
153
+
154
+ if attributes.key?(:'resolution')
155
+ self.resolution = attributes[:'resolution']
156
+ else
157
+ self.resolution = '720p'
158
+ end
159
+
160
+ if attributes.key?(:'audio')
161
+ self.audio = attributes[:'audio']
162
+ end
163
+
164
+ if attributes.key?(:'image_url')
165
+ self.image_url = attributes[:'image_url']
166
+ else
167
+ self.image_url = nil
168
+ end
169
+ end
170
+
171
+ # Show invalid properties with the reasons. Usually used together with valid?
172
+ # @return Array for valid properties with the reasons
173
+ def list_invalid_properties
174
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
175
+ invalid_properties = Array.new
176
+ if @model.nil?
177
+ invalid_properties.push('invalid value for "model", model cannot be nil.')
178
+ end
179
+
180
+ if @prompt.nil?
181
+ invalid_properties.push('invalid value for "prompt", prompt cannot be nil.')
182
+ end
183
+
184
+ if @prompt.to_s.length > 2500
185
+ invalid_properties.push('invalid value for "prompt", the character length must be smaller than or equal to 2500.')
186
+ end
187
+
188
+ if @prompt.to_s.length < 1
189
+ invalid_properties.push('invalid value for "prompt", the character length must be greater than or equal to 1.')
190
+ end
191
+
192
+ if !@negative_prompt.nil? && @negative_prompt.to_s.length > 2500
193
+ invalid_properties.push('invalid value for "negative_prompt", the character length must be smaller than or equal to 2500.')
194
+ end
195
+
196
+ if @duration.nil?
197
+ invalid_properties.push('invalid value for "duration", duration cannot be nil.')
198
+ end
199
+
200
+ if @image_url.nil?
201
+ invalid_properties.push('invalid value for "image_url", image_url cannot be nil.')
202
+ end
203
+
204
+ invalid_properties
205
+ end
206
+
207
+ # Check to see if the all the properties in the model are valid
208
+ # @return true if the model is valid
209
+ def valid?
210
+ warn '[DEPRECATED] the `valid?` method is obsolete'
211
+ return false if @model.nil?
212
+ return false if @prompt.nil?
213
+ return false if @prompt.to_s.length > 2500
214
+ return false if @prompt.to_s.length < 1
215
+ return false if !@negative_prompt.nil? && @negative_prompt.to_s.length > 2500
216
+ return false if @duration.nil?
217
+ duration_validator = EnumAttributeValidator.new('String', ["5s", "10s"])
218
+ return false unless duration_validator.valid?(@duration)
219
+ resolution_validator = EnumAttributeValidator.new('String', ["1080p", "720p", "480p"])
220
+ return false unless resolution_validator.valid?(@resolution)
221
+ return false if @image_url.nil?
222
+ true
223
+ end
224
+
225
+ # Custom attribute writer method with validation
226
+ # @param [Object] model Value to be assigned
227
+ def model=(model)
228
+ if model.nil?
229
+ fail ArgumentError, 'model cannot be nil'
230
+ end
231
+
232
+ @model = model
233
+ end
234
+
235
+ # Custom attribute writer method with validation
236
+ # @param [Object] prompt Value to be assigned
237
+ def prompt=(prompt)
238
+ if prompt.nil?
239
+ fail ArgumentError, 'prompt cannot be nil'
240
+ end
241
+
242
+ if prompt.to_s.length > 2500
243
+ fail ArgumentError, 'invalid value for "prompt", the character length must be smaller than or equal to 2500.'
244
+ end
245
+
246
+ if prompt.to_s.length < 1
247
+ fail ArgumentError, 'invalid value for "prompt", the character length must be greater than or equal to 1.'
248
+ end
249
+
250
+ @prompt = prompt
251
+ end
252
+
253
+ # Custom attribute writer method with validation
254
+ # @param [Object] negative_prompt Value to be assigned
255
+ def negative_prompt=(negative_prompt)
256
+ if negative_prompt.nil?
257
+ fail ArgumentError, 'negative_prompt cannot be nil'
258
+ end
259
+
260
+ if negative_prompt.to_s.length > 2500
261
+ fail ArgumentError, 'invalid value for "negative_prompt", the character length must be smaller than or equal to 2500.'
262
+ end
263
+
264
+ @negative_prompt = negative_prompt
265
+ end
266
+
267
+ # Custom attribute writer method checking allowed values (enum).
268
+ # @param [Object] duration Object to be assigned
269
+ def duration=(duration)
270
+ validator = EnumAttributeValidator.new('String', ["5s", "10s"])
271
+ unless validator.valid?(duration)
272
+ fail ArgumentError, "invalid value for \"duration\", must be one of #{validator.allowable_values}."
273
+ end
274
+ @duration = duration
275
+ end
276
+
277
+ # Custom attribute writer method checking allowed values (enum).
278
+ # @param [Object] resolution Object to be assigned
279
+ def resolution=(resolution)
280
+ validator = EnumAttributeValidator.new('String', ["1080p", "720p", "480p"])
281
+ unless validator.valid?(resolution)
282
+ fail ArgumentError, "invalid value for \"resolution\", must be one of #{validator.allowable_values}."
283
+ end
284
+ @resolution = resolution
285
+ end
286
+
287
+ # Custom attribute writer method with validation
288
+ # @param [Object] image_url Value to be assigned
289
+ def image_url=(image_url)
290
+ if image_url.nil?
291
+ fail ArgumentError, 'image_url cannot be nil'
292
+ end
293
+
294
+ @image_url = image_url
295
+ end
296
+
297
+ # Checks equality by comparing each attribute.
298
+ # @param [Object] Object to be compared
299
+ def ==(o)
300
+ return true if self.equal?(o)
301
+ self.class == o.class &&
302
+ model == o.model &&
303
+ prompt == o.prompt &&
304
+ negative_prompt == o.negative_prompt &&
305
+ duration == o.duration &&
306
+ aspect_ratio == o.aspect_ratio &&
307
+ resolution == o.resolution &&
308
+ audio == o.audio &&
309
+ image_url == o.image_url
310
+ end
311
+
312
+ # @see the `==` method
313
+ # @param [Object] Object to be compared
314
+ def eql?(o)
315
+ self == o
316
+ end
317
+
318
+ # Calculates hash code according to all attributes.
319
+ # @return [Integer] Hash code
320
+ def hash
321
+ [model, prompt, negative_prompt, duration, aspect_ratio, resolution, audio, image_url].hash
322
+ end
323
+
324
+ # Builds the object from hash
325
+ # @param [Hash] attributes Model attributes in the form of hash
326
+ # @return [Object] Returns the model itself
327
+ def self.build_from_hash(attributes)
328
+ return nil unless attributes.is_a?(Hash)
329
+ attributes = attributes.transform_keys(&:to_sym)
330
+ transformed_hash = {}
331
+ openapi_types.each_pair do |key, type|
332
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
333
+ transformed_hash["#{key}"] = nil
334
+ elsif type =~ /\AArray<(.*)>/i
335
+ # check to ensure the input is an array given that the attribute
336
+ # is documented as an array but the input is not
337
+ if attributes[attribute_map[key]].is_a?(Array)
338
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
339
+ end
340
+ elsif !attributes[attribute_map[key]].nil?
341
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
342
+ end
343
+ end
344
+ new(transformed_hash)
345
+ end
346
+
347
+ # Deserializes the data based on type
348
+ # @param string type Data type
349
+ # @param string value Value to be deserialized
350
+ # @return [Object] Deserialized data
351
+ def self._deserialize(type, value)
352
+ case type.to_sym
353
+ when :Time
354
+ Time.parse(value)
355
+ when :Date
356
+ Date.parse(value)
357
+ when :String
358
+ value.to_s
359
+ when :Integer
360
+ value.to_i
361
+ when :Float
362
+ value.to_f
363
+ when :Boolean
364
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
365
+ true
366
+ else
367
+ false
368
+ end
369
+ when :Object
370
+ # generic object (usually a Hash), return directly
371
+ value
372
+ when /\AArray<(?<inner_type>.+)>\z/
373
+ inner_type = Regexp.last_match[:inner_type]
374
+ value.map { |v| _deserialize(inner_type, v) }
375
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
376
+ k_type = Regexp.last_match[:k_type]
377
+ v_type = Regexp.last_match[:v_type]
378
+ {}.tap do |hash|
379
+ value.each do |k, v|
380
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
381
+ end
382
+ end
383
+ else # model
384
+ # models (e.g. Pet) or oneOf
385
+ klass = VeniceClient.const_get(type)
386
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
387
+ end
388
+ end
389
+
390
+ # Returns the string representation of the object
391
+ # @return [String] String presentation of the object
392
+ def to_s
393
+ to_hash.to_s
394
+ end
395
+
396
+ # to_body is an alias to to_hash (backward compatibility)
397
+ # @return [Hash] Returns the object in the form of hash
398
+ def to_body
399
+ to_hash
400
+ end
401
+
402
+ # Returns the object in the form of hash
403
+ # @return [Hash] Returns the object in the form of hash
404
+ def to_hash
405
+ hash = {}
406
+ self.class.attribute_map.each_pair do |attr, param|
407
+ value = self.send(attr)
408
+ if value.nil?
409
+ is_nullable = self.class.openapi_nullable.include?(attr)
410
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
411
+ end
412
+
413
+ hash[param] = _to_hash(value)
414
+ end
415
+ hash
416
+ end
417
+
418
+ # Outputs non-array value in the form of hash
419
+ # For object, use to_hash. Otherwise, just return the value
420
+ # @param [Object] value Any valid value
421
+ # @return [Hash] Returns the value in the form of hash
422
+ def _to_hash(value)
423
+ if value.is_a?(Array)
424
+ value.compact.map { |v| _to_hash(v) }
425
+ elsif value.is_a?(Hash)
426
+ {}.tap do |hash|
427
+ value.each { |k, v| hash[k] = _to_hash(v) }
428
+ end
429
+ elsif value.respond_to? :to_hash
430
+ value.to_hash
431
+ else
432
+ value
433
+ end
434
+ end
435
+
436
+ end
437
+
438
+ end