runapi-seedream 0.2.10 → 0.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/lib/runapi/seedream/client.rb +3 -0
- data/lib/runapi/seedream/contract_gen.rb +22 -2
- data/lib/runapi/seedream/resources/decompose_layers.rb +35 -0
- data/lib/runapi/seedream/types.rb +13 -0
- data/lib/runapi/seedream.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2656a2d0439dd8f5ccb5282b66fc1d43b18e0fc32495a41871c6033a9c56e3ea
|
|
4
|
+
data.tar.gz: 7a478828b7c2de132e32a280f6e1c8b4056eadb34c52f4092e712179bfa86a0c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 33b11a3cb4c6fd20c07eb89f7e059ae64d72d355879d1a9197cc57cabadb3acad71878e1dcf71c1b4caf3e8b1ce580bb5c23a4c7eda81fbcc6619d467a67382f
|
|
7
|
+
data.tar.gz: fd41da8643a0c7d487e829210972f2773fb5b804ae807596cb16e5807c628a9e7bddbf2c33e41850d04d621433558de3fae205ad24495e57428c46b12163b827
|
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
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 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
|
|
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/api/seedream/text-to-image; for SDK docs, use https://runapi.ai/docs/resources/sdks.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -32,17 +32,17 @@ RunAPI-generated file URLs are temporary. Download and store generated images, v
|
|
|
32
32
|
|
|
33
33
|
## Seedream 5 Pro
|
|
34
34
|
|
|
35
|
-
Use `seedream-5-pro-text-to-image` for generation
|
|
35
|
+
Use `seedream-5-pro-text-to-image` for generation, `seedream-5-pro-edit` for image editing, and `seedream-5-pro-layer-decomposition` to separate one image into a base image and ordered transparent layers.
|
|
36
36
|
|
|
37
37
|
## Language notes
|
|
38
38
|
|
|
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`
|
|
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`, `edit_image`, and `decompose_layers`. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
|
|
40
40
|
|
|
41
41
|
## Links
|
|
42
42
|
|
|
43
43
|
- Model page: https://runapi.ai/models/seedream
|
|
44
|
-
- SDK docs: https://runapi.ai/docs
|
|
45
|
-
- Product docs: https://runapi.ai/docs
|
|
44
|
+
- SDK docs: https://runapi.ai/docs/resources/sdks
|
|
45
|
+
- Product docs: https://runapi.ai/docs/api/seedream/text-to-image
|
|
46
46
|
- Pricing and rate limits: https://runapi.ai/models/seedream/v4-text-to-image
|
|
47
47
|
- Full catalog: https://runapi.ai/models
|
|
48
48
|
- Repository: https://github.com/runapi-ai/seedream-sdk
|
|
@@ -29,11 +29,14 @@ module RunApi
|
|
|
29
29
|
attr_reader :text_to_image
|
|
30
30
|
# @return [Resources::EditImage] Edit source images with a text prompt.
|
|
31
31
|
attr_reader :edit_image
|
|
32
|
+
# @return [Resources::DecomposeLayers] Separate an image into editable layers.
|
|
33
|
+
attr_reader :decompose_layers
|
|
32
34
|
|
|
33
35
|
def initialize(api_key: nil, **options)
|
|
34
36
|
super
|
|
35
37
|
@text_to_image = Resources::TextToImage.new(http)
|
|
36
38
|
@edit_image = Resources::EditImage.new(http)
|
|
39
|
+
@decompose_layers = Resources::DecomposeLayers.new(http)
|
|
37
40
|
end
|
|
38
41
|
end
|
|
39
42
|
end
|
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
module RunApi
|
|
4
4
|
module Seedream
|
|
5
5
|
CONTRACT = {
|
|
6
|
+
"decompose-layers" => {
|
|
7
|
+
"models" => ["seedream-5-pro-layer-decomposition"],
|
|
8
|
+
"fields_by_model" => {
|
|
9
|
+
"seedream-5-pro-layer-decomposition" => {
|
|
10
|
+
"image_url" => {
|
|
11
|
+
"required" => true
|
|
12
|
+
},
|
|
13
|
+
"output_format" => {
|
|
14
|
+
"enum" => ["png", "jpeg"]
|
|
15
|
+
},
|
|
16
|
+
"prompt" => {
|
|
17
|
+
"max" => 5000,
|
|
18
|
+
"length" => true
|
|
19
|
+
},
|
|
20
|
+
"size" => {
|
|
21
|
+
"enum" => ["auto", "1K", "1.5K", "2K"]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
6
26
|
"edit-image" => {
|
|
7
27
|
"models" => ["seedream-4.5-edit", "seedream-5-lite-edit", "seedream-5-pro-edit", "seedream-v4-edit"],
|
|
8
28
|
"fields_by_model" => {
|
|
@@ -39,7 +59,7 @@ module RunApi
|
|
|
39
59
|
"enum" => ["png", "jpeg"]
|
|
40
60
|
},
|
|
41
61
|
"output_quality" => {
|
|
42
|
-
"enum" => ["basic", "high"],
|
|
62
|
+
"enum" => ["basic", "high", "ultra"],
|
|
43
63
|
"required" => true
|
|
44
64
|
},
|
|
45
65
|
"seed" => {
|
|
@@ -144,7 +164,7 @@ module RunApi
|
|
|
144
164
|
"enum" => ["png", "jpeg"]
|
|
145
165
|
},
|
|
146
166
|
"output_quality" => {
|
|
147
|
-
"enum" => ["basic", "high"],
|
|
167
|
+
"enum" => ["basic", "high", "ultra"],
|
|
148
168
|
"required" => true
|
|
149
169
|
},
|
|
150
170
|
"seed" => {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RunApi
|
|
4
|
+
module Seedream
|
|
5
|
+
module Resources
|
|
6
|
+
# Separates one image into a base image and independent layers.
|
|
7
|
+
class DecomposeLayers
|
|
8
|
+
include RunApi::Core::ResourceHelpers
|
|
9
|
+
|
|
10
|
+
ENDPOINT = "/api/v1/seedream/decompose_layers"
|
|
11
|
+
RESPONSE_CLASS = Types::DecomposeLayersResponse
|
|
12
|
+
COMPLETED_RESPONSE_CLASS = Types::CompletedDecomposeLayersResponse
|
|
13
|
+
|
|
14
|
+
def initialize(http)
|
|
15
|
+
@http = http
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def run(options: nil, **params)
|
|
19
|
+
task = create(options: options, **params)
|
|
20
|
+
poll_until_complete { get(task.id, options: options) }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def create(options: nil, **params)
|
|
24
|
+
params = compact_params(params)
|
|
25
|
+
validate_contract!(CONTRACT["decompose-layers"], params)
|
|
26
|
+
request(:post, ENDPOINT, body: params, options: options)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def get(id, options: nil)
|
|
30
|
+
request(:get, "#{ENDPOINT}/#{id}", options: options)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -37,6 +37,19 @@ module RunApi
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
CompletedEditImageResponse = CompletedTextToImageResponse
|
|
40
|
+
|
|
41
|
+
class DecomposeLayersResponse < RunApi::Core::TaskResponse
|
|
42
|
+
required :id, String
|
|
43
|
+
optional :status, String, enum: -> { RunApi::Core::TaskResponse::Status::ALL }
|
|
44
|
+
optional :base_image, -> { Image }
|
|
45
|
+
optional :layers, [-> { Image }]
|
|
46
|
+
optional :error, String
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
class CompletedDecomposeLayersResponse < DecomposeLayersResponse
|
|
50
|
+
required :base_image, -> { Image }
|
|
51
|
+
required :layers, [-> { Image }]
|
|
52
|
+
end
|
|
40
53
|
end
|
|
41
54
|
end
|
|
42
55
|
end
|
data/lib/runapi/seedream.rb
CHANGED
|
@@ -5,6 +5,7 @@ require_relative "seedream/types"
|
|
|
5
5
|
require_relative "seedream/contract_gen"
|
|
6
6
|
require_relative "seedream/resources/text_to_image"
|
|
7
7
|
require_relative "seedream/resources/edit_image"
|
|
8
|
+
require_relative "seedream/resources/decompose_layers"
|
|
8
9
|
require_relative "seedream/client"
|
|
9
10
|
|
|
10
11
|
module RunApi
|
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.
|
|
4
|
+
version: 0.2.12
|
|
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.3.
|
|
18
|
+
version: 0.3.5
|
|
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.3.
|
|
25
|
+
version: 0.3.5
|
|
26
26
|
description: The Seedream Ruby SDK is the language-specific package for Seedream on
|
|
27
27
|
RunAPI. Use this package for image generation, image editing, and creative production
|
|
28
28
|
workflows when your application needs request bodies, task status lookup, and consistent
|
|
@@ -40,6 +40,7 @@ files:
|
|
|
40
40
|
- lib/runapi/seedream.rb
|
|
41
41
|
- lib/runapi/seedream/client.rb
|
|
42
42
|
- lib/runapi/seedream/contract_gen.rb
|
|
43
|
+
- lib/runapi/seedream/resources/decompose_layers.rb
|
|
43
44
|
- lib/runapi/seedream/resources/edit_image.rb
|
|
44
45
|
- lib/runapi/seedream/resources/text_to_image.rb
|
|
45
46
|
- lib/runapi/seedream/types.rb
|