runapi-wan 0.3.0 → 0.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ff9e49c2be2096d808b536f970a9831c23e7ad6ccd8e48e6110e8111ba1883a
4
- data.tar.gz: 5fc2b96d0bbe28bddd388711e3894f44c0fee6056fe13ee547ebf4dea87b7436
3
+ metadata.gz: e8eaed6c91d79172fc345efc68ed0cb4abe8b0883a8d5c71de4eba5879091a9b
4
+ data.tar.gz: 9b6615610ac41cfc453c7ce97b963449b5187c38e04444fba029bb91946dbb61
5
5
  SHA512:
6
- metadata.gz: 882f970def74e970888f733a18fd779e6d868e161b946135dd54d3866ee217d20091b7f38221d558e72177af25dd3add44b2704d5ef0d68f201c14091ec33012
7
- data.tar.gz: 34171809be101f2104046bc785e3ec33f9d2fdd69a3c3c8a9c4aa07bab5abb8c1d590770d2b044a4c69b09d0a0651d4e1597de32af25b6a654ecab4fcf927df9
6
+ metadata.gz: 0a0dd9f32929329e8efa8b6fc4644901ca0b19a0cc9a29fd86403ef3c16d76ba971cc8c4776fadf88425e8581a6d592534ebd61bc4d0df197a4c52d0995fde78
7
+ data.tar.gz: 4aeae30b9fadf26407e9560f8740d7104da235b8b0c48989dec83b9306140ade548c6b6a956accbd075659294d5fbba537d7ded3a99accc255b6f5399a703f25
@@ -32,7 +32,6 @@ module RunApi
32
32
  # @return [RunApi::Wan::Types::VideoTaskResponse] task creation result with id
33
33
  def create(options: nil, **params)
34
34
  params = compact_params(params)
35
- validate_params!(params)
36
35
  request(:post, ENDPOINT, body: params, options: options)
37
36
  end
38
37
 
@@ -43,12 +42,6 @@ module RunApi
43
42
  def get(id, options: nil)
44
43
  request(:get, "#{ENDPOINT}/#{id}", options: options)
45
44
  end
46
-
47
- private
48
-
49
- def validate_params!(params)
50
- validate_contract!(CONTRACT["animate"], params)
51
- end
52
45
  end
53
46
  end
54
47
  end
@@ -34,7 +34,6 @@ module RunApi
34
34
  # @return [RunApi::Wan::Types::VideoTaskResponse] task creation result with id
35
35
  def create(options: nil, **params)
36
36
  params = compact_params(params)
37
- validate_params!(params)
38
37
  request(:post, ENDPOINT, body: params, options: options)
39
38
  end
40
39
 
@@ -45,12 +44,6 @@ module RunApi
45
44
  def get(id, options: nil)
46
45
  request(:get, "#{ENDPOINT}/#{id}", options: options)
47
46
  end
48
-
49
- private
50
-
51
- def validate_params!(params)
52
- validate_contract!(CONTRACT["edit-video"], params)
53
- end
54
47
  end
55
48
  end
56
49
  end
@@ -33,7 +33,6 @@ module RunApi
33
33
  # @return [RunApi::Wan::Types::VideoTaskResponse] task creation result with id
34
34
  def create(options: nil, **params)
35
35
  params = compact_params(params)
36
- validate_params!(params)
37
36
  request(:post, ENDPOINT, body: params, options: options)
38
37
  end
39
38
 
@@ -44,12 +43,6 @@ module RunApi
44
43
  def get(id, options: nil)
45
44
  request(:get, "#{ENDPOINT}/#{id}", options: options)
46
45
  end
47
-
48
- private
49
-
50
- def validate_params!(params)
51
- validate_contract!(CONTRACT["image-to-video"], params)
52
- end
53
46
  end
54
47
  end
55
48
  end
@@ -31,7 +31,6 @@ module RunApi
31
31
  # @return [RunApi::Wan::Types::VideoTaskResponse] task creation result with id
32
32
  def create(options: nil, **params)
33
33
  params = compact_params(params)
34
- validate_params!(params)
35
34
  request(:post, ENDPOINT, body: params, options: options)
36
35
  end
37
36
 
@@ -42,12 +41,6 @@ module RunApi
42
41
  def get(id, options: nil)
43
42
  request(:get, "#{ENDPOINT}/#{id}", options: options)
44
43
  end
45
-
46
- private
47
-
48
- def validate_params!(params)
49
- validate_contract!(CONTRACT["speech-to-video"], params)
50
- end
51
44
  end
52
45
  end
53
46
  end
@@ -32,7 +32,6 @@ module RunApi
32
32
  # @return [RunApi::Wan::Types::ImageTaskResponse] task creation result with id
33
33
  def create(options: nil, **params)
34
34
  params = compact_params(params)
35
- validate_params!(params)
36
35
  request(:post, ENDPOINT, body: params, options: options)
37
36
  end
38
37
 
@@ -43,13 +42,6 @@ module RunApi
43
42
  def get(id, options: nil)
44
43
  request(:get, "#{ENDPOINT}/#{id}", options: options)
45
44
  end
46
-
47
- private
48
-
49
- def validate_params!(params)
50
- validate_contract!(CONTRACT["text-to-image"], params)
51
- raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
52
- end
53
45
  end
54
46
  end
55
47
  end
@@ -34,7 +34,6 @@ module RunApi
34
34
  # @return [RunApi::Wan::Types::VideoTaskResponse] task creation result with id
35
35
  def create(options: nil, **params)
36
36
  params = compact_params(params)
37
- validate_params!(params)
38
37
  request(:post, ENDPOINT, body: params, options: options)
39
38
  end
40
39
 
@@ -45,13 +44,6 @@ module RunApi
45
44
  def get(id, options: nil)
46
45
  request(:get, "#{ENDPOINT}/#{id}", options: options)
47
46
  end
48
-
49
- private
50
-
51
- def validate_params!(params)
52
- validate_contract!(CONTRACT["text-to-video"], params)
53
- raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
54
- end
55
47
  end
56
48
  end
57
49
  end
data/lib/runapi/wan.rb CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  require "runapi/core"
4
4
  require_relative "wan/types"
5
- require_relative "wan/contract_gen"
6
5
  require_relative "wan/resources/text_to_video"
7
6
  require_relative "wan/resources/image_to_video"
8
7
  require_relative "wan/resources/speech_to_video"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runapi-wan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - RunAPI
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 0.5.2
18
+ version: 0.6.0
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: 0.5.2
25
+ version: 0.6.0
26
26
  description: The Wan Ruby SDK is the language-specific package for Wan on RunAPI.
27
27
  Use this package for video generation, animation, and video editing workflows when
28
28
  your application needs request bodies, task status lookup, and consistent RunAPI
@@ -38,7 +38,6 @@ files:
38
38
  - README.md
39
39
  - lib/runapi/wan.rb
40
40
  - lib/runapi/wan/client.rb
41
- - lib/runapi/wan/contract_gen.rb
42
41
  - lib/runapi/wan/resources/animate.rb
43
42
  - lib/runapi/wan/resources/edit_video.rb
44
43
  - lib/runapi/wan/resources/image_to_video.rb
@@ -1,359 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RunApi
4
- module Wan
5
- CONTRACT = {
6
- "animate" => {
7
- "models" => ["wan-2.2-animate-move", "wan-2.2-animate-replace"],
8
- "fields_by_model" => {
9
- "wan-2.2-animate-move" => {
10
- "output_resolution" => {
11
- "enum" => ["480p", "580p", "720p"]
12
- },
13
- "reference_video_url" => {
14
- "required" => true
15
- },
16
- "source_image_url" => {
17
- "required" => true
18
- }
19
- },
20
- "wan-2.2-animate-replace" => {
21
- "output_resolution" => {
22
- "enum" => ["480p", "580p", "720p"]
23
- },
24
- "reference_video_url" => {
25
- "required" => true
26
- },
27
- "source_image_url" => {
28
- "required" => true
29
- }
30
- }
31
- }
32
- },
33
- "edit-video" => {
34
- "models" => ["wan-2.6-edit-video", "wan-2.6-flash-edit-video", "wan-2.7-edit-video"],
35
- "fields_by_model" => {
36
- "wan-2.6-edit-video" => {
37
- "duration_seconds" => {
38
- "type" => "integer"
39
- },
40
- "output_resolution" => {
41
- "enum" => ["720p", "1080p"]
42
- },
43
- "prompt" => {
44
- "required" => true
45
- },
46
- "seed" => {
47
- "type" => "integer"
48
- },
49
- "source_video_urls" => {
50
- "required" => true
51
- }
52
- },
53
- "wan-2.6-flash-edit-video" => {
54
- "audio" => {
55
- "required" => true
56
- },
57
- "duration_seconds" => {
58
- "type" => "integer"
59
- },
60
- "prompt" => {
61
- "required" => true
62
- },
63
- "seed" => {
64
- "type" => "integer"
65
- },
66
- "source_video_urls" => {
67
- "required" => true
68
- }
69
- },
70
- "wan-2.7-edit-video" => {
71
- "aspect_ratio" => {
72
- "enum" => ["16:9", "9:16", "1:1", "4:3", "3:4"]
73
- },
74
- "duration_seconds" => {
75
- "type" => "integer"
76
- },
77
- "output_resolution" => {
78
- "enum" => ["720p", "1080p"]
79
- },
80
- "seed" => {
81
- "type" => "integer"
82
- },
83
- "source_video_url" => {
84
- "required" => true
85
- }
86
- }
87
- },
88
- "rules" => [{
89
- "when" => {
90
- "model" => "wan-2.7-edit-video"
91
- },
92
- "forbidden" => ["multi_shots"]
93
- }]
94
- },
95
- "image-to-video" => {
96
- "models" => ["wan-2.2-a14b-image-to-video-turbo", "wan-2.5-image-to-video", "wan-2.6-flash-image-to-video", "wan-2.6-image-to-video", "wan-2.7-image-to-video"],
97
- "fields_by_model" => {
98
- "wan-2.2-a14b-image-to-video-turbo" => {
99
- "duration_seconds" => {
100
- "type" => "integer"
101
- },
102
- "first_frame_image_url" => {
103
- "required" => true
104
- },
105
- "output_resolution" => {
106
- "enum" => ["480p", "720p"]
107
- },
108
- "seed" => {
109
- "type" => "integer"
110
- }
111
- },
112
- "wan-2.5-image-to-video" => {
113
- "duration_seconds" => {
114
- "enum" => [5, 10],
115
- "required" => true,
116
- "type" => "integer"
117
- },
118
- "first_frame_image_url" => {
119
- "required" => true
120
- },
121
- "output_resolution" => {
122
- "enum" => ["720p", "1080p"],
123
- "required" => true
124
- },
125
- "seed" => {
126
- "type" => "integer"
127
- }
128
- },
129
- "wan-2.6-flash-image-to-video" => {
130
- "audio" => {
131
- "required" => true
132
- },
133
- "duration_seconds" => {
134
- "enum" => [5, 10, 15],
135
- "type" => "integer"
136
- },
137
- "first_frame_image_url" => {
138
- "required" => true
139
- },
140
- "output_resolution" => {
141
- "enum" => ["720p", "1080p"]
142
- },
143
- "prompt" => {
144
- "required" => true
145
- }
146
- },
147
- "wan-2.6-image-to-video" => {
148
- "duration_seconds" => {
149
- "type" => "integer"
150
- },
151
- "first_frame_image_url" => {
152
- "required" => true
153
- },
154
- "output_resolution" => {
155
- "enum" => ["720p", "1080p"]
156
- },
157
- "prompt" => {
158
- "required" => true
159
- }
160
- },
161
- "wan-2.7-image-to-video" => {
162
- "duration_seconds" => {
163
- "type" => "integer"
164
- },
165
- "output_resolution" => {
166
- "enum" => ["720p", "1080p"]
167
- },
168
- "prompt" => {
169
- "required" => true
170
- },
171
- "seed" => {
172
- "type" => "integer"
173
- }
174
- }
175
- },
176
- "rules" => [{
177
- "when" => {
178
- "model" => "wan-2.2-a14b-image-to-video-turbo"
179
- },
180
- "forbidden" => ["multi_shots"]
181
- }, {
182
- "when" => {
183
- "model" => "wan-2.5-image-to-video"
184
- },
185
- "forbidden" => ["multi_shots"]
186
- }, {
187
- "when" => {
188
- "model" => "wan-2.6-flash-image-to-video"
189
- },
190
- "forbidden" => ["seed"]
191
- }, {
192
- "when" => {
193
- "model" => "wan-2.6-image-to-video"
194
- },
195
- "forbidden" => ["seed"]
196
- }, {
197
- "when" => {
198
- "model" => "wan-2.7-image-to-video"
199
- },
200
- "forbidden" => ["multi_shots"]
201
- }]
202
- },
203
- "speech-to-video" => {
204
- "models" => ["wan-2.2-a14b-speech-to-video-turbo"],
205
- "fields_by_model" => {
206
- "wan-2.2-a14b-speech-to-video-turbo" => {
207
- "frames_per_second" => {
208
- "type" => "integer"
209
- },
210
- "num_frames" => {
211
- "type" => "integer"
212
- },
213
- "num_inference_steps" => {
214
- "type" => "integer"
215
- },
216
- "output_resolution" => {
217
- "enum" => ["480p", "580p", "720p"]
218
- },
219
- "prompt" => {
220
- "required" => true
221
- },
222
- "seed" => {
223
- "type" => "integer"
224
- },
225
- "source_audio_url" => {
226
- "required" => true
227
- },
228
- "source_image_url" => {
229
- "required" => true
230
- }
231
- }
232
- }
233
- },
234
- "text-to-image" => {
235
- "models" => ["wan-2.7-image", "wan-2.7-image-pro"],
236
- "fields_by_model" => {
237
- "wan-2.7-image" => {
238
- "aspect_ratio" => {
239
- "enum" => ["1:1", "16:9", "4:3", "21:9", "3:4", "9:16", "8:1", "1:8"]
240
- },
241
- "output_count" => {
242
- "type" => "integer"
243
- },
244
- "output_resolution" => {
245
- "enum" => ["1k", "2k", "4k"]
246
- },
247
- "seed" => {
248
- "type" => "integer"
249
- }
250
- },
251
- "wan-2.7-image-pro" => {
252
- "aspect_ratio" => {
253
- "enum" => ["1:1", "16:9", "4:3", "21:9", "3:4", "9:16", "8:1", "1:8"]
254
- },
255
- "output_count" => {
256
- "type" => "integer"
257
- },
258
- "output_resolution" => {
259
- "enum" => ["1k", "2k", "4k"]
260
- },
261
- "seed" => {
262
- "type" => "integer"
263
- }
264
- }
265
- }
266
- },
267
- "text-to-video" => {
268
- "models" => ["wan-2.2-a14b-text-to-video-turbo", "wan-2.5-text-to-video", "wan-2.6-text-to-video", "wan-2.7-r2v", "wan-2.7-text-to-video"],
269
- "fields_by_model" => {
270
- "wan-2.2-a14b-text-to-video-turbo" => {
271
- "duration_seconds" => {
272
- "type" => "integer"
273
- },
274
- "output_resolution" => {
275
- "enum" => ["480p", "580p", "720p"]
276
- },
277
- "seed" => {
278
- "type" => "integer"
279
- }
280
- },
281
- "wan-2.5-text-to-video" => {
282
- "duration_seconds" => {
283
- "enum" => [5, 10],
284
- "type" => "integer"
285
- },
286
- "output_resolution" => {
287
- "enum" => ["720p", "1080p"],
288
- "required" => true
289
- },
290
- "seed" => {
291
- "type" => "integer"
292
- }
293
- },
294
- "wan-2.6-text-to-video" => {
295
- "duration_seconds" => {
296
- "type" => "integer"
297
- },
298
- "output_resolution" => {
299
- "enum" => ["720p", "1080p"]
300
- }
301
- },
302
- "wan-2.7-r2v" => {
303
- "aspect_ratio" => {
304
- "enum" => ["16:9", "9:16", "1:1", "4:3", "3:4"]
305
- },
306
- "duration_seconds" => {
307
- "min" => 2,
308
- "max" => 10,
309
- "type" => "integer"
310
- },
311
- "output_resolution" => {
312
- "enum" => ["720p", "1080p"]
313
- },
314
- "seed" => {
315
- "type" => "integer"
316
- }
317
- },
318
- "wan-2.7-text-to-video" => {
319
- "duration_seconds" => {
320
- "type" => "integer"
321
- },
322
- "output_resolution" => {
323
- "enum" => ["720p", "1080p"]
324
- },
325
- "seed" => {
326
- "type" => "integer"
327
- }
328
- }
329
- },
330
- "rules" => [{
331
- "when" => {
332
- "model" => "wan-2.2-a14b-text-to-video-turbo"
333
- },
334
- "forbidden" => ["multi_shots"]
335
- }, {
336
- "when" => {
337
- "model" => "wan-2.5-text-to-video"
338
- },
339
- "forbidden" => ["multi_shots"]
340
- }, {
341
- "when" => {
342
- "model" => "wan-2.6-text-to-video"
343
- },
344
- "forbidden" => ["seed"]
345
- }, {
346
- "when" => {
347
- "model" => "wan-2.7-r2v"
348
- },
349
- "forbidden" => ["multi_shots"]
350
- }, {
351
- "when" => {
352
- "model" => "wan-2.7-text-to-video"
353
- },
354
- "forbidden" => ["multi_shots"]
355
- }]
356
- }
357
- }.freeze
358
- end
359
- end