runapi-seedream 0.2.6 → 0.2.8

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: fd5375e0156b01735780ac14365797062e03a0e0659b2fa18077b8b00103d7a0
4
- data.tar.gz: 2a3501a778307978b225a90234903ae77ce518b3d6cb206604cb5efa72be4f03
3
+ metadata.gz: 4e82b3b45f3ff8bc900025adeb9a0390aa67962cc89b301f71fbddfd38c4fe09
4
+ data.tar.gz: 2092d13fd4d8d1cb37f27e78b6c8423fa7d58e75bcd0588ede104e5a8e8e2004
5
5
  SHA512:
6
- metadata.gz: 00a681e2011e9a77015c55036e537aaa40f0d451142f1b2cd0582e91dd500c24599f17be6b2f226a46f986c6ac2c406fd0241b2fc6a22e309c930185f49e874d
7
- data.tar.gz: e6e1ac147c0b246d308571e541e6aa5f5782e7c5fb2bff7bcd51385646af17893f8537a1999d237e0e0337700e814fd31e546506a37e97e2fca48ca26cc6f93e
6
+ metadata.gz: 775b36a48e102429084935f74046ee88703eaed8a1b69e86c1e100de6798166291857e211ba5f317e12a5db2a3aba89b1924c26b1d92508020110ae20583d36d
7
+ data.tar.gz: 315298e9ecd87fc3ac4209357364a3465944d8607d2cdddb5b03d1e76b46b551ed2fb00133f1a9e974f1e16b562c67e438c5ce16e16492611f60afa8948033d9
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # Seedream API Ruby SDK for RunAPI
1
+ # Seedream Ruby SDK for RunAPI
2
2
 
3
- The seedream api Ruby SDK is the language-specific package for Seedream on RunAPI. Use this seedream api package for text-to-image, image editing, and creative production flows when your application needs JSON request bodies, task status lookup, and consistent RunAPI errors in Ruby.
3
+ The Seedream Ruby SDK is the language-specific package for Seedream on RunAPI. Use this package for image generation, image editing, and creative production workflows when your application needs request bodies, task status lookup, and consistent RunAPI errors in Ruby.
4
4
 
5
- This seedream api README is the Ruby package guide inside the public `seedream-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/seedream; for API reference, use https://runapi.ai/docs#seedream; for SDK docs, use https://runapi.ai/docs#sdk-seedream.
5
+ This README is the Ruby package guide inside the public `seedream-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/seedream; for API reference, use https://runapi.ai/docs#seedream; for SDK docs, use https://runapi.ai/docs#sdk-seedream.
6
6
 
7
7
  ## Install
8
8
 
@@ -13,7 +13,7 @@ gem install runapi-seedream
13
13
  ## Quick start
14
14
 
15
15
  ```ruby
16
- require "runapi-seedream"
16
+ require "runapi/seedream"
17
17
 
18
18
  client = RunApi::Seedream::Client.new
19
19
  task = client.text_to_image.create(
@@ -28,6 +28,12 @@ status = client.text_to_image.get(task.id)
28
28
 
29
29
  Use `create` when you want to submit a task and return quickly, `get` when you need the latest task state, and `run` when a script should create and poll until completion. In web request handlers, prefer `create` plus webhook or later `get` polling so a worker is not held open.
30
30
 
31
+ RunAPI-generated file URLs are temporary. Download and store generated images, videos, audio, or other files in your own durable storage within 7 days; do not treat returned URLs as long-term assets.
32
+
33
+ ## Seedream 5 Pro
34
+
35
+ Use `seedream-5-pro-text-to-image` for generation and `seedream-5-pro-edit` for image editing. Both accept `output_quality`, optional `output_format`, and optional content safety checking; editing accepts up to 10 source image URLs.
36
+
31
37
  ## Language notes
32
38
 
33
39
  Use Ruby keyword arguments and the `RunApi::Seedream` error classes when building image jobs, Rails workers, or scripts. The package exposes `text_to_image` for text models and `edit_image` for editing models. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
@@ -2,14 +2,36 @@
2
2
 
3
3
  module RunApi
4
4
  module Seedream
5
- class Client
6
- attr_reader :text_to_image, :edit_image
5
+ # Seedream image generation and editing API client.
6
+ #
7
+ # Three model families with different field requirements:
8
+ # - 4.5: requires aspect_ratio and output_quality
9
+ # - 5-lite: same required fields as 4.5, faster generation
10
+ # - V4: uses output_resolution instead; supports seed and batch output_count
11
+ #
12
+ # @example
13
+ # client = RunApi::Seedream::Client.new(api_key: "your-api-key")
14
+ #
15
+ # # Seedream 4.5
16
+ # result = client.text_to_image.run(
17
+ # model: "seedream-4.5-text-to-image",
18
+ # prompt: "A beautiful product render",
19
+ # aspect_ratio: "16:9", output_quality: "high"
20
+ # )
21
+ #
22
+ # # Seedream V4 with batch output
23
+ # batch = client.text_to_image.run(
24
+ # model: "seedream-v4-text-to-image",
25
+ # prompt: "Minimalist logo design", output_count: 4
26
+ # )
27
+ class Client < RunApi::Core::Client
28
+ # @return [Resources::TextToImage] Text-to-image generation across model versions.
29
+ attr_reader :text_to_image
30
+ # @return [Resources::EditImage] Edit source images with a text prompt.
31
+ attr_reader :edit_image
7
32
 
8
33
  def initialize(api_key: nil, **options)
9
- @api_key = Core::Auth.resolve_api_key(api_key)
10
-
11
- client_options = Core::ClientOptions.new(api_key: @api_key, **options)
12
- http = client_options.http_client || Core::HttpClient.new(client_options)
34
+ super
13
35
  @text_to_image = Resources::TextToImage.new(http)
14
36
  @edit_image = Resources::EditImage.new(http)
15
37
  end
@@ -0,0 +1,200 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RunApi
4
+ module Seedream
5
+ CONTRACT = {
6
+ "edit-image" => {
7
+ "models" => ["seedream-4.5-edit", "seedream-5-lite-edit", "seedream-5-pro-edit", "seedream-v4-edit"],
8
+ "fields_by_model" => {
9
+ "seedream-4.5-edit" => {
10
+ "aspect_ratio" => {
11
+ "enum" => ["1:1", "4:3", "3:4", "16:9", "9:16", "2:3", "3:2", "21:9"],
12
+ "required" => true
13
+ },
14
+ "output_count" => {
15
+ "type" => "integer"
16
+ },
17
+ "output_quality" => {
18
+ "enum" => ["basic", "high"],
19
+ "required" => true
20
+ },
21
+ "seed" => {
22
+ "type" => "integer"
23
+ },
24
+ "source_image_urls" => {
25
+ "required" => true
26
+ }
27
+ },
28
+ "seedream-5-lite-edit" => {
29
+ "aspect_ratio" => {
30
+ "enum" => ["1:1", "4:3", "3:4", "16:9", "9:16", "2:3", "3:2", "21:9"],
31
+ "required" => true
32
+ },
33
+ "output_count" => {
34
+ "type" => "integer"
35
+ },
36
+ "output_format" => {
37
+ "enum" => ["png", "jpeg"]
38
+ },
39
+ "output_quality" => {
40
+ "enum" => ["basic", "high"],
41
+ "required" => true
42
+ },
43
+ "seed" => {
44
+ "type" => "integer"
45
+ },
46
+ "source_image_urls" => {
47
+ "required" => true
48
+ }
49
+ },
50
+ "seedream-5-pro-edit" => {
51
+ "aspect_ratio" => {
52
+ "enum" => ["1:1", "4:3", "3:4", "16:9", "9:16", "2:3", "3:2", "21:9"],
53
+ "required" => true
54
+ },
55
+ "output_format" => {
56
+ "enum" => ["png", "jpeg"]
57
+ },
58
+ "output_quality" => {
59
+ "enum" => ["basic", "high"],
60
+ "required" => true
61
+ },
62
+ "prompt" => {
63
+ "required" => true,
64
+ "min" => 3,
65
+ "max" => 5000,
66
+ "length" => true
67
+ },
68
+ "source_image_urls" => {
69
+ "required" => true
70
+ }
71
+ },
72
+ "seedream-v4-edit" => {
73
+ "aspect_ratio" => {
74
+ "enum" => ["1:1", "4:3", "3:4", "3:2", "2:3", "16:9", "9:16", "21:9"]
75
+ },
76
+ "output_count" => {
77
+ "enum" => [1, 2, 3, 4, 5, 6],
78
+ "type" => "integer"
79
+ },
80
+ "output_resolution" => {
81
+ "enum" => ["1k", "2k", "4k"]
82
+ },
83
+ "seed" => {
84
+ "type" => "integer"
85
+ },
86
+ "source_image_urls" => {
87
+ "required" => true
88
+ }
89
+ }
90
+ },
91
+ "rules" => [{
92
+ "when" => {
93
+ "model" => "seedream-4.5-edit"
94
+ },
95
+ "forbidden" => ["output_format"]
96
+ }, {
97
+ "when" => {
98
+ "model" => "seedream-5-pro-edit"
99
+ },
100
+ "forbidden" => ["output_resolution", "output_count", "seed"]
101
+ }, {
102
+ "when" => {
103
+ "model" => "seedream-v4-edit"
104
+ },
105
+ "forbidden" => ["output_format"]
106
+ }]
107
+ },
108
+ "text-to-image" => {
109
+ "models" => ["seedream-4.5-text-to-image", "seedream-5-lite-text-to-image", "seedream-5-pro-text-to-image", "seedream-v4-text-to-image"],
110
+ "fields_by_model" => {
111
+ "seedream-4.5-text-to-image" => {
112
+ "aspect_ratio" => {
113
+ "enum" => ["1:1", "4:3", "3:4", "16:9", "9:16", "2:3", "3:2", "21:9"],
114
+ "required" => true
115
+ },
116
+ "output_count" => {
117
+ "type" => "integer"
118
+ },
119
+ "output_quality" => {
120
+ "enum" => ["basic", "high"],
121
+ "required" => true
122
+ },
123
+ "seed" => {
124
+ "type" => "integer"
125
+ }
126
+ },
127
+ "seedream-5-lite-text-to-image" => {
128
+ "aspect_ratio" => {
129
+ "enum" => ["1:1", "4:3", "3:4", "16:9", "9:16", "2:3", "3:2", "21:9"],
130
+ "required" => true
131
+ },
132
+ "output_count" => {
133
+ "type" => "integer"
134
+ },
135
+ "output_format" => {
136
+ "enum" => ["png", "jpeg"]
137
+ },
138
+ "output_quality" => {
139
+ "enum" => ["basic", "high"],
140
+ "required" => true
141
+ },
142
+ "seed" => {
143
+ "type" => "integer"
144
+ }
145
+ },
146
+ "seedream-5-pro-text-to-image" => {
147
+ "aspect_ratio" => {
148
+ "enum" => ["1:1", "4:3", "3:4", "16:9", "9:16", "2:3", "3:2", "21:9"],
149
+ "required" => true
150
+ },
151
+ "output_format" => {
152
+ "enum" => ["png", "jpeg"]
153
+ },
154
+ "output_quality" => {
155
+ "enum" => ["basic", "high"],
156
+ "required" => true
157
+ },
158
+ "prompt" => {
159
+ "required" => true,
160
+ "min" => 3,
161
+ "max" => 5000,
162
+ "length" => true
163
+ }
164
+ },
165
+ "seedream-v4-text-to-image" => {
166
+ "aspect_ratio" => {
167
+ "enum" => ["1:1", "4:3", "3:4", "3:2", "2:3", "16:9", "9:16", "21:9"]
168
+ },
169
+ "output_count" => {
170
+ "enum" => [1, 2, 3, 4, 5, 6],
171
+ "type" => "integer"
172
+ },
173
+ "output_resolution" => {
174
+ "enum" => ["1k", "2k", "4k"]
175
+ },
176
+ "seed" => {
177
+ "type" => "integer"
178
+ }
179
+ }
180
+ },
181
+ "rules" => [{
182
+ "when" => {
183
+ "model" => "seedream-4.5-text-to-image"
184
+ },
185
+ "forbidden" => ["output_format"]
186
+ }, {
187
+ "when" => {
188
+ "model" => "seedream-5-pro-text-to-image"
189
+ },
190
+ "forbidden" => ["output_resolution", "output_count", "seed"]
191
+ }, {
192
+ "when" => {
193
+ "model" => "seedream-v4-text-to-image"
194
+ },
195
+ "forbidden" => ["output_format"]
196
+ }]
197
+ }
198
+ }.freeze
199
+ end
200
+ end
@@ -3,6 +3,9 @@
3
3
  module RunApi
4
4
  module Seedream
5
5
  module Resources
6
+ # Seedream image editing resource.
7
+ # Modifies source images according to a text prompt.
8
+ # 5 Pro and V4 accept up to 10 source images; 4.5 and 5-Lite accept up to 14.
6
9
  class EditImage
7
10
  include RunApi::Core::ResourceHelpers
8
11
 
@@ -12,70 +15,48 @@ module RunApi
12
15
  PROMPT_MAX_LENGTH = 3000
13
16
  V4_PROMPT_MAX_LENGTH = 5000
14
17
  PROMPT_MIN_LENGTH_LITE = 3
15
- V4_OUTPUT_COUNT_RANGE = (1..6)
16
18
 
17
19
  def initialize(http)
18
20
  @http = http
19
21
  end
20
22
 
21
- def run(**params)
22
- task = create(**params)
23
- poll_until_complete { get(task.id) }
23
+ def run(options: nil, **params)
24
+ task = create(options: options, **params)
25
+ poll_until_complete { get(task.id, options: options) }
24
26
  end
25
27
 
26
- def create(**params)
28
+ def create(options: nil, **params)
27
29
  params = compact_params(params)
28
30
  validate_params!(params)
29
- request(:post, ENDPOINT, body: params)
31
+ request(:post, ENDPOINT, body: params, options: options)
30
32
  end
31
33
 
32
- def get(id)
33
- request(:get, "#{ENDPOINT}/#{id}")
34
+ def get(id, options: nil)
35
+ request(:get, "#{ENDPOINT}/#{id}", options: options)
34
36
  end
35
37
 
36
38
  private
37
39
 
38
40
  def validate_params!(params)
41
+ validate_contract!(CONTRACT["edit-image"], params)
42
+
39
43
  model = param(params, :model)
40
- raise Core::ValidationError, "model is required" unless model
41
- unless Types::EDIT_MODELS.include?(model)
42
- raise Core::ValidationError, "Invalid model: #{model}. Must be one of: #{Types::EDIT_MODELS.join(", ")}"
43
- end
44
44
 
45
45
  prompt = param(params, :prompt)
46
46
  raise Core::ValidationError, "prompt is required" unless prompt.is_a?(String) && !prompt.empty?
47
- max_length = Types::V4_MODELS.include?(model) ? V4_PROMPT_MAX_LENGTH : PROMPT_MAX_LENGTH
47
+ max_length = Types::LONG_PROMPT_MODELS.include?(model) ? V4_PROMPT_MAX_LENGTH : PROMPT_MAX_LENGTH
48
48
  raise Core::ValidationError, "prompt must be at most #{max_length} characters" if prompt.length > max_length
49
- if Types::LITE_MODELS.include?(model) && prompt.length < PROMPT_MIN_LENGTH_LITE
50
- raise Core::ValidationError, "prompt must be between #{PROMPT_MIN_LENGTH_LITE} and #{PROMPT_MAX_LENGTH} characters"
49
+ if Types::MINIMUM_THREE_PROMPT_MODELS.include?(model) && prompt.length < PROMPT_MIN_LENGTH_LITE
50
+ raise Core::ValidationError, "prompt must be between #{PROMPT_MIN_LENGTH_LITE} and #{max_length} characters"
51
51
  end
52
52
 
53
- raise Core::ValidationError, "source_image_urls is required" unless field_present?(params, :source_image_urls)
54
-
55
- if Types::V4_MODELS.include?(model)
56
- validate_optional!(params, :aspect_ratio, Types::ASPECT_RATIOS)
57
- validate_optional!(params, :output_resolution, Types::V4_OUTPUT_RESOLUTIONS)
58
- validate_integer_range!(params, :output_count, V4_OUTPUT_COUNT_RANGE)
59
- validate_integer!(params, :seed)
60
- else
61
- validate_required!(params, :aspect_ratio)
62
- validate_required!(params, :output_quality)
63
- validate_optional!(params, :aspect_ratio, Types::ASPECT_RATIOS)
64
- validate_optional!(params, :output_quality, Types::OUTPUT_QUALITIES)
53
+ source_image_urls = param(params, :source_image_urls)
54
+ source_image_max = Types::TEN_SOURCE_IMAGE_MODELS.include?(model) ? 10 : 14
55
+ if source_image_urls.is_a?(Array) && source_image_urls.length > source_image_max
56
+ raise Core::ValidationError, "source_image_urls accepts at most #{source_image_max} images"
65
57
  end
66
- end
67
-
68
- def validate_required!(params, key)
69
- raise Core::ValidationError, "#{key} is required" unless field_present?(params, key)
70
- end
71
-
72
- def field_present?(params, key)
73
- value = param(params, key)
74
- return false if value.nil?
75
- return value.any? if value.is_a?(Array)
76
- return !value.empty? if value.respond_to?(:empty?)
77
58
 
78
- true
59
+ validate_integer!(params, :seed) if Types::V4_MODELS.include?(model)
79
60
  end
80
61
 
81
62
  def validate_integer!(params, key)
@@ -85,15 +66,6 @@ module RunApi
85
66
 
86
67
  raise Core::ValidationError, "#{key} must be an integer"
87
68
  end
88
-
89
- def validate_integer_range!(params, key, range)
90
- value = param(params, key)
91
- return if value.nil?
92
-
93
- return if value.is_a?(Integer) && range.cover?(value)
94
-
95
- raise Core::ValidationError, "#{key} must be between #{range.first} and #{range.last}"
96
- end
97
69
  end
98
70
  end
99
71
  end
@@ -3,6 +3,9 @@
3
3
  module RunApi
4
4
  module Seedream
5
5
  module Resources
6
+ # Seedream text-to-image generation resource.
7
+ # Field requirements vary by model: 4.5/5-Lite/5 Pro require aspect_ratio
8
+ # and output_quality; V4 uses output_resolution and supports seed/output_count.
6
9
  class TextToImage
7
10
  include RunApi::Core::ResourceHelpers
8
11
 
@@ -12,74 +15,48 @@ module RunApi
12
15
  PROMPT_MAX_LENGTH = 3000
13
16
  V4_PROMPT_MAX_LENGTH = 5000
14
17
  PROMPT_MIN_LENGTH_LITE = 3
15
- V4_OUTPUT_COUNT_RANGE = (1..6)
16
18
 
17
19
  def initialize(http)
18
20
  @http = http
19
21
  end
20
22
 
21
- def run(**params)
22
- task = create(**params)
23
- poll_until_complete { get(task.id) }
23
+ def run(options: nil, **params)
24
+ task = create(options: options, **params)
25
+ poll_until_complete { get(task.id, options: options) }
24
26
  end
25
27
 
26
- def create(**params)
28
+ def create(options: nil, **params)
27
29
  params = compact_params(params)
28
30
  validate_params!(params)
29
- request(:post, ENDPOINT, body: params)
31
+ request(:post, ENDPOINT, body: params, options: options)
30
32
  end
31
33
 
32
- def get(id)
33
- request(:get, "#{ENDPOINT}/#{id}")
34
+ def get(id, options: nil)
35
+ request(:get, "#{ENDPOINT}/#{id}", options: options)
34
36
  end
35
37
 
36
38
  private
37
39
 
38
40
  def validate_params!(params)
41
+ validate_contract!(CONTRACT["text-to-image"], params)
42
+
39
43
  model = param(params, :model)
40
- raise Core::ValidationError, "model is required" unless model
41
- unless Types::TEXT_TO_IMAGE_MODELS.include?(model)
42
- raise Core::ValidationError, "Invalid model: #{model}. Must be one of: #{Types::TEXT_TO_IMAGE_MODELS.join(", ")}"
43
- end
44
44
 
45
45
  prompt = param(params, :prompt)
46
46
  raise Core::ValidationError, "prompt is required" unless prompt.is_a?(String) && !prompt.empty?
47
- max_length = Types::V4_MODELS.include?(model) ? V4_PROMPT_MAX_LENGTH : PROMPT_MAX_LENGTH
47
+ max_length = Types::LONG_PROMPT_MODELS.include?(model) ? V4_PROMPT_MAX_LENGTH : PROMPT_MAX_LENGTH
48
48
  raise Core::ValidationError, "prompt must be at most #{max_length} characters" if prompt.length > max_length
49
- if Types::LITE_MODELS.include?(model) && prompt.length < PROMPT_MIN_LENGTH_LITE
50
- raise Core::ValidationError, "prompt must be between #{PROMPT_MIN_LENGTH_LITE} and #{PROMPT_MAX_LENGTH} characters"
49
+ if Types::MINIMUM_THREE_PROMPT_MODELS.include?(model) && prompt.length < PROMPT_MIN_LENGTH_LITE
50
+ raise Core::ValidationError, "prompt must be between #{PROMPT_MIN_LENGTH_LITE} and #{max_length} characters"
51
51
  end
52
52
 
53
- if Types::V4_MODELS.include?(model)
54
- validate_optional!(params, :aspect_ratio, Types::ASPECT_RATIOS)
55
- validate_optional!(params, :output_resolution, Types::V4_OUTPUT_RESOLUTIONS)
56
- validate_integer_range!(params, :output_count, V4_OUTPUT_COUNT_RANGE)
57
- validate_integer!(params, :seed)
58
- else
59
- validate_required!(params, :aspect_ratio)
60
- validate_required!(params, :output_quality)
61
- validate_optional!(params, :aspect_ratio, Types::ASPECT_RATIOS)
62
- validate_optional!(params, :output_quality, Types::OUTPUT_QUALITIES)
63
- end
53
+ validate_integer!(params, :seed) if Types::V4_MODELS.include?(model)
64
54
 
65
55
  if field_present?(params, :source_image_urls)
66
56
  raise Core::ValidationError, "source_image_urls is not supported for #{model}"
67
57
  end
68
58
  end
69
59
 
70
- def validate_required!(params, key)
71
- raise Core::ValidationError, "#{key} is required" unless field_present?(params, key)
72
- end
73
-
74
- def field_present?(params, key)
75
- value = param(params, key)
76
- return false if value.nil?
77
- return value.any? if value.is_a?(Array)
78
- return !value.empty? if value.respond_to?(:empty?)
79
-
80
- true
81
- end
82
-
83
60
  def validate_integer!(params, key)
84
61
  value = param(params, key)
85
62
  return if value.nil?
@@ -87,15 +64,6 @@ module RunApi
87
64
 
88
65
  raise Core::ValidationError, "#{key} must be an integer"
89
66
  end
90
-
91
- def validate_integer_range!(params, key, range)
92
- value = param(params, key)
93
- return if value.nil?
94
-
95
- return if value.is_a?(Integer) && range.cover?(value)
96
-
97
- raise Core::ValidationError, "#{key} must be between #{range.first} and #{range.last}"
98
- end
99
67
  end
100
68
  end
101
69
  end
@@ -2,22 +2,20 @@
2
2
 
3
3
  module RunApi
4
4
  module Seedream
5
+ # Seedream type constants and response models.
6
+ # Model families differ in supported params: 4.5/5-Lite/5 Pro require
7
+ # aspect_ratio and output_quality; 5-Lite/5 Pro also support output_format; V4 uses
8
+ # output_resolution and supports seed/output_count.
5
9
  module Types
6
- MODELS = %w[
7
- seedream-4.5-text-to-image
8
- seedream-4.5-edit
9
- seedream-5-lite-text-to-image
10
- seedream-5-lite-edit
11
- seedream-v4-text-to-image
12
- seedream-v4-edit
13
- ].freeze
14
- TEXT_TO_IMAGE_MODELS = %w[seedream-4.5-text-to-image seedream-5-lite-text-to-image seedream-v4-text-to-image].freeze
15
- EDIT_MODELS = %w[seedream-4.5-edit seedream-5-lite-edit seedream-v4-edit].freeze
10
+ # Model groupings used by bespoke prompt-length selection (a per-model rule
11
+ # the contract cannot express). Model membership and field enums are
12
+ # validated by the generated CONTRACT.
16
13
  LITE_MODELS = %w[seedream-5-lite-text-to-image seedream-5-lite-edit].freeze
14
+ PRO_MODELS = %w[seedream-5-pro-text-to-image seedream-5-pro-edit].freeze
17
15
  V4_MODELS = %w[seedream-v4-text-to-image seedream-v4-edit].freeze
18
- ASPECT_RATIOS = %w[1:1 4:3 3:4 16:9 9:16 2:3 3:2 21:9].freeze
19
- OUTPUT_QUALITIES = %w[basic high].freeze
20
- V4_OUTPUT_RESOLUTIONS = %w[1k 2k 4k].freeze
16
+ LONG_PROMPT_MODELS = (PRO_MODELS + V4_MODELS).freeze
17
+ MINIMUM_THREE_PROMPT_MODELS = (LITE_MODELS + PRO_MODELS).freeze
18
+ TEN_SOURCE_IMAGE_MODELS = %w[seedream-5-pro-edit seedream-v4-edit].freeze
21
19
 
22
20
  class Image < RunApi::Core::BaseModel
23
21
  optional :url, String
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "runapi/core"
4
4
  require_relative "seedream/types"
5
+ require_relative "seedream/contract_gen"
5
6
  require_relative "seedream/resources/text_to_image"
6
7
  require_relative "seedream/resources/edit_image"
7
8
  require_relative "seedream/client"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runapi-seedream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - RunAPI
@@ -15,18 +15,18 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 0.2.5
18
+ version: 0.2.13
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.2.5
26
- description: The seedream api Ruby SDK is the language-specific package for Seedream
27
- on RunAPI. Use this seedream api package for text-to-image, image editing, and creative
28
- production flows when your application needs JSON request bodies, task status lookup,
29
- and consistent RunAPI errors in Ruby.
25
+ version: 0.2.13
26
+ description: The Seedream Ruby SDK is the language-specific package for Seedream on
27
+ RunAPI. Use this package for image generation, image editing, and creative production
28
+ workflows when your application needs request bodies, task status lookup, and consistent
29
+ RunAPI errors in Ruby.
30
30
  email:
31
31
  - contact@runapi.ai
32
32
  executables: []
@@ -39,6 +39,7 @@ files:
39
39
  - lib/runapi-seedream.rb
40
40
  - lib/runapi/seedream.rb
41
41
  - lib/runapi/seedream/client.rb
42
+ - lib/runapi/seedream/contract_gen.rb
42
43
  - lib/runapi/seedream/resources/edit_image.rb
43
44
  - lib/runapi/seedream/resources/text_to_image.rb
44
45
  - lib/runapi/seedream/types.rb
@@ -46,9 +47,11 @@ homepage: https://runapi.ai/models/seedream
46
47
  licenses:
47
48
  - Apache-2.0
48
49
  metadata:
50
+ runapi_slug: seedream
49
51
  homepage_uri: https://runapi.ai/models/seedream
50
52
  documentation_uri: https://github.com/runapi-ai/seedream-sdk/blob/main/ruby/README.md
51
53
  source_code_uri: https://github.com/runapi-ai/seedream-sdk
54
+ bug_tracker_uri: https://github.com/runapi-ai/seedream-sdk/issues
52
55
  changelog_uri: https://github.com/runapi-ai/seedream-sdk/blob/main/CHANGELOG.md
53
56
  rdoc_options: []
54
57
  require_paths:
@@ -66,5 +69,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
69
  requirements: []
67
70
  rubygems_version: 4.0.10
68
71
  specification_version: 4
69
- summary: Seedream API Ruby SDK for RunAPI
72
+ summary: Seedream Ruby SDK for RunAPI
70
73
  test_files: []