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. 5 Pro and V4 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
Instance Method Summary collapse
- #create(options: nil, **params) ⇒ Object
- #get(id, options: nil) ⇒ Object
-
#initialize(http) ⇒ EditImage
constructor
A new instance of EditImage.
- #run(options: nil, **params) ⇒ Object
Constructor Details
#initialize(http) ⇒ EditImage
Returns a new instance of EditImage.
19 20 21 |
# File 'lib/runapi/seedream/resources/edit_image.rb', line 19 def initialize(http) @http = http end |
Instance Method Details
#create(options: nil, **params) ⇒ Object
28 29 30 31 32 |
# File 'lib/runapi/seedream/resources/edit_image.rb', line 28 def create(options: nil, **params) params = compact_params(params) validate_params!(params) request(:post, ENDPOINT, body: params, options: ) end |
#get(id, options: nil) ⇒ Object
34 35 36 |
# File 'lib/runapi/seedream/resources/edit_image.rb', line 34 def get(id, options: nil) request(:get, "#{ENDPOINT}/#{id}", options: ) end |
#run(options: nil, **params) ⇒ Object
23 24 25 26 |
# File 'lib/runapi/seedream/resources/edit_image.rb', line 23 def run(options: nil, **params) task = create(options: , **params) poll_until_complete { get(task.id, options: ) } end |