runapi-imagen-4 0.2.7 → 0.2.9

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: ea234432febf88c1855e89f392cd149536bbe684e53ff1925ae96cef7389860c
4
- data.tar.gz: 01eaf089e6d251e3bb5c96c17b9f1a228bf8fca32869040796f1d961d42a96a6
3
+ metadata.gz: 517f2ddbc1ed3d973626c6eb9721d15e4f66247409a89670972740206b13d697
4
+ data.tar.gz: 8a774175edc67f550c07a190c7ea300c8f60e0d5ed0ebe0a0797f9e388cdac0f
5
5
  SHA512:
6
- metadata.gz: 6192d061bdd620f15a8cf5436aaa2c53c6a0ec8a780650f10c92f46be7cc112a1398e6cb2769dca74f16df7b92bb3b4a53927fb6f77eb0075a2c4f978eb1ebca
7
- data.tar.gz: 5cba0828fa53be275b8e835b310a163d1d6b7fce906f3579b9a0f43509724138d5c40e58887c3ee8c1c1dc73dff89bc1a61aaf3faee378c7ca0f86e1eba510de
6
+ metadata.gz: ee9415adf2afdea17f4741d9728b5adf6d687277b3c6d6472c9a62ca93978e0da849b7df0552f87424f30680f7b0673bac02373b8dd78e26c6e33fd4c0fd0f86
7
+ data.tar.gz: c730f85447da42722b352f5f96372b05c95552a1abd8b08cf92b16122b61fc2e10b3ea721c821934498e2ff3b01997024c7c397524a762e5686fb3aac154269e
data/README.md CHANGED
@@ -13,7 +13,7 @@ gem install runapi-imagen-4
13
13
  ## Quick start
14
14
 
15
15
  ```ruby
16
- require "runapi-imagen-4"
16
+ require "runapi/imagen_4"
17
17
 
18
18
  client = RunApi::Imagen4::Client.new
19
19
  task = client.text_to_image.create(
@@ -17,7 +17,9 @@ module RunApi
17
17
  "enum" => ["1k", "2k", "4k"]
18
18
  },
19
19
  "source_image_urls" => {
20
- "required" => true
20
+ "required" => true,
21
+ "min_items" => 1,
22
+ "max_items" => 8
21
23
  }
22
24
  }
23
25
  }
@@ -29,20 +31,13 @@ module RunApi
29
31
  "aspect_ratio" => {
30
32
  "enum" => ["1:1", "16:9", "9:16", "3:4", "4:3"]
31
33
  },
32
- "output_count" => {
33
- "type" => "integer"
34
- },
35
34
  "seed" => {
36
35
  "type" => "integer"
37
36
  }
38
37
  },
39
38
  "imagen-4-fast" => {
40
39
  "aspect_ratio" => {
41
- "enum" => ["1:1", "16:9", "9:16", "3:4", "4:3"]
42
- },
43
- "output_count" => {
44
- "enum" => [1, 2, 3, 4],
45
- "type" => "integer"
40
+ "enum" => ["1:1", "16:9", "9:16", "3:4", "4:3", "auto"]
46
41
  },
47
42
  "seed" => {
48
43
  "type" => "integer"
@@ -52,9 +47,6 @@ module RunApi
52
47
  "aspect_ratio" => {
53
48
  "enum" => ["1:1", "16:9", "9:16", "3:4", "4:3"]
54
49
  },
55
- "output_count" => {
56
- "type" => "integer"
57
- },
58
50
  "seed" => {
59
51
  "type" => "integer"
60
52
  }
@@ -11,25 +11,24 @@ module RunApi
11
11
  ENDPOINT = "/api/v1/imagen_4/remix_image"
12
12
  RESPONSE_CLASS = Types::RemixImageResponse
13
13
  COMPLETED_RESPONSE_CLASS = Types::CompletedRemixImageResponse
14
- SOURCE_IMAGE_URLS_MAX = 8
15
14
 
16
15
  def initialize(http)
17
16
  @http = http
18
17
  end
19
18
 
20
- def run(**params)
21
- task = create(**params)
22
- poll_until_complete { get(task.id) }
19
+ def run(options: nil, **params)
20
+ task = create(options: options, **params)
21
+ poll_until_complete { get(task.id, options: options) }
23
22
  end
24
23
 
25
- def create(**params)
24
+ def create(options: nil, **params)
26
25
  params = compact_params(params)
27
26
  validate_params!(params)
28
- request(:post, ENDPOINT, body: params)
27
+ request(:post, ENDPOINT, body: params, options: options)
29
28
  end
30
29
 
31
- def get(id)
32
- request(:get, "#{ENDPOINT}/#{id}")
30
+ def get(id, options: nil)
31
+ request(:get, "#{ENDPOINT}/#{id}", options: options)
33
32
  end
34
33
 
35
34
  private
@@ -38,11 +37,6 @@ module RunApi
38
37
  validate_contract!(CONTRACT["remix-image"], params)
39
38
 
40
39
  raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
41
-
42
- urls = param(params, :source_image_urls)
43
- return unless urls.respond_to?(:size) && urls.size > SOURCE_IMAGE_URLS_MAX
44
-
45
- raise Core::ValidationError, "source_image_urls supports up to #{SOURCE_IMAGE_URLS_MAX} images"
46
40
  end
47
41
  end
48
42
  end
@@ -4,7 +4,7 @@ module RunApi
4
4
  module Imagen4
5
5
  module Resources
6
6
  # Imagen 4 text-to-image generation resource.
7
- # Generate images from text with three quality tiers; imagen-4-fast supports batch output.
7
+ # Generate images from text with three quality tiers.
8
8
  class TextToImage
9
9
  include RunApi::Core::ResourceHelpers
10
10
 
@@ -16,19 +16,19 @@ module RunApi
16
16
  @http = http
17
17
  end
18
18
 
19
- def run(**params)
20
- task = create(**params)
21
- poll_until_complete { get(task.id) }
19
+ def run(options: nil, **params)
20
+ task = create(options: options, **params)
21
+ poll_until_complete { get(task.id, options: options) }
22
22
  end
23
23
 
24
- def create(**params)
24
+ def create(options: nil, **params)
25
25
  params = compact_params(params)
26
26
  validate_params!(params)
27
- request(:post, ENDPOINT, body: params)
27
+ request(:post, ENDPOINT, body: params, options: options)
28
28
  end
29
29
 
30
- def get(id)
31
- request(:get, "#{ENDPOINT}/#{id}")
30
+ def get(id, options: nil)
31
+ request(:get, "#{ENDPOINT}/#{id}", options: options)
32
32
  end
33
33
 
34
34
  private
@@ -37,10 +37,6 @@ module RunApi
37
37
  validate_contract!(CONTRACT["text-to-image"], params)
38
38
 
39
39
  raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
40
-
41
- if param(params, :output_count) && param(params, :model) != "imagen-4-fast"
42
- raise Core::ValidationError, "output_count is only supported for imagen-4-fast"
43
- end
44
40
  end
45
41
  end
46
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runapi-imagen-4
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.9
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.2.7
18
+ version: 0.2.14
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.7
25
+ version: 0.2.14
26
26
  description: The Imagen 4 Ruby SDK is the language-specific package for Imagen 4 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