Class: RunApi::Seedream::Resources::EditImage
- Inherits:
-
Object
- Object
- RunApi::Seedream::Resources::EditImage
- Includes:
- Core::ResourceHelpers
- Defined in:
- lib/runapi/seedream/resources/edit_image.rb
Overview
Seedream image editing resource. Modifies source images according to a text prompt. V4 models accept up to 10 source images; 4.5 and 5-lite accept up to 14.
Constant Summary collapse
- ENDPOINT =
"/api/v1/seedream/edit_image"- RESPONSE_CLASS =
Types::EditImageResponse
- COMPLETED_RESPONSE_CLASS =
Types::CompletedEditImageResponse
- PROMPT_MAX_LENGTH =
3000- V4_PROMPT_MAX_LENGTH =
5000- PROMPT_MIN_LENGTH_LITE =
3- V4_OUTPUT_COUNT_RANGE =
(1..6)
Instance Method Summary collapse
- #create(**params) ⇒ Object
- #get(id) ⇒ Object
-
#initialize(http) ⇒ EditImage
constructor
A new instance of EditImage.
- #run(**params) ⇒ Object
Constructor Details
#initialize(http) ⇒ EditImage
Returns a new instance of EditImage.
20 21 22 |
# File 'lib/runapi/seedream/resources/edit_image.rb', line 20 def initialize(http) @http = http end |
Instance Method Details
#create(**params) ⇒ Object
29 30 31 32 33 |
# File 'lib/runapi/seedream/resources/edit_image.rb', line 29 def create(**params) params = compact_params(params) validate_params!(params) request(:post, ENDPOINT, body: params) end |
#get(id) ⇒ Object
35 36 37 |
# File 'lib/runapi/seedream/resources/edit_image.rb', line 35 def get(id) request(:get, "#{ENDPOINT}/#{id}") end |
#run(**params) ⇒ Object
24 25 26 27 |
# File 'lib/runapi/seedream/resources/edit_image.rb', line 24 def run(**params) task = create(**params) poll_until_complete { get(task.id) } end |