runapi-nano-banana 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: 832dd3e77b5049f32c247319b78e0a05b8c5c7d71c4cc0e16a1626011ba9248b
4
- data.tar.gz: 23d94cd56e9f85984d903d7c8b4c9e1582e58614a48eae82d1f6bdbdcf5c0e1a
3
+ metadata.gz: 3737c1cd6272c4da25d7e643354bd6994e1e5f7deecf0d8e50a477498aaf4069
4
+ data.tar.gz: 91c62e9bf1e746a6aff3e3532045d3a44fee21bc11ee745ed4927d5bb2f9e823
5
5
  SHA512:
6
- metadata.gz: ba6d8452a6ddc1fcc6d700e20943f7cc454f9ebf653e50bdfef36365fd0bb8543e6b961b6400ed3943c6f1c1fc86eec9d9a5116c213ee8cf9338e1726e4f5d50
7
- data.tar.gz: 127d62230b0d4c6a9c5f00fa3a38f49447426dba48299babc64c4ba6d697e5bcaa53b0be2c9fce803a1322eeac44d2cc12d61e0cfa2c9bd318125952fd0409cf
6
+ metadata.gz: e336b5616cbb7537a6c7f12df8d5e18536c397af22d656549cf6e57f867b2b30e33265f1892f9b128cb2187695063f6e71896bb6e893088133c033c1ba21c70e
7
+ data.tar.gz: 6029e2fd0b8b712b86ca2ff62c9c397a0479478630f4f77a10305e9608eb7961bfaf695f0a4947b0dd4dccc3111bf237d49fcf9f8c94d64c7c66dd95ea7c5397
data/README.md CHANGED
@@ -13,7 +13,7 @@ gem install runapi-nano-banana
13
13
  ## Quick start
14
14
 
15
15
  ```ruby
16
- require "runapi-nano-banana"
16
+ require "runapi/nano_banana"
17
17
 
18
18
  client = RunApi::NanoBanana::Client.new
19
19
  task = client.text_to_image.create(
@@ -20,7 +20,7 @@ module RunApi
20
20
  }
21
21
  },
22
22
  "text-to-image" => {
23
- "models" => ["nano-banana", "nano-banana-2", "nano-banana-pro"],
23
+ "models" => ["nano-banana", "nano-banana-2", "nano-banana-2-lite", "nano-banana-pro"],
24
24
  "fields_by_model" => {
25
25
  "nano-banana" => {
26
26
  "aspect_ratio" => {
@@ -41,6 +41,18 @@ module RunApi
41
41
  "enum" => ["1k", "2k", "4k"]
42
42
  }
43
43
  },
44
+ "nano-banana-2-lite" => {
45
+ "aspect_ratio" => {
46
+ "enum" => ["1:1", "1:4", "1:8", "2:3", "3:2", "3:4", "4:1", "4:3", "4:5", "5:4", "8:1", "9:16", "16:9", "21:9", "auto"],
47
+ "required" => true
48
+ },
49
+ "prompt" => {
50
+ "required" => true,
51
+ "min" => 1,
52
+ "max" => 20000,
53
+ "length" => true
54
+ }
55
+ },
44
56
  "nano-banana-pro" => {
45
57
  "aspect_ratio" => {
46
58
  "enum" => ["1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9", "auto"]
@@ -52,7 +64,13 @@ module RunApi
52
64
  "enum" => ["1k", "2k", "4k"]
53
65
  }
54
66
  }
55
- }
67
+ },
68
+ "rules" => [{
69
+ "when" => {
70
+ "model" => "nano-banana-2-lite"
71
+ },
72
+ "forbidden" => ["output_resolution", "output_format"]
73
+ }]
56
74
  }
57
75
  }.freeze
58
76
  end
@@ -21,27 +21,27 @@ module RunApi
21
21
  #
22
22
  # @param params [Hash] edit parameters
23
23
  # @return [RunApi::NanoBanana::Types::CompletedEditImageResponse] completed edit with image results
24
- def run(**params)
25
- task = create(**params)
26
- poll_until_complete { get(task.id) }
24
+ def run(options: nil, **params)
25
+ task = create(options: options, **params)
26
+ poll_until_complete { get(task.id, options: options) }
27
27
  end
28
28
 
29
29
  # Create an image edit task.
30
30
  #
31
31
  # @param params [Hash] edit parameters
32
32
  # @return [RunApi::NanoBanana::Types::EditImageResponse] task creation result with id
33
- def create(**params)
33
+ def create(options: nil, **params)
34
34
  params = compact_params(params)
35
35
  validate_params!(params)
36
- request(:post, ENDPOINT, body: params)
36
+ request(:post, ENDPOINT, body: params, options: options)
37
37
  end
38
38
 
39
39
  # Get edit status by task ID.
40
40
  #
41
41
  # @param id [String] task ID
42
42
  # @return [RunApi::NanoBanana::Types::EditImageResponse] current edit status
43
- def get(id)
44
- request(:get, "#{ENDPOINT}/#{id}")
43
+ def get(id, options: nil)
44
+ request(:get, "#{ENDPOINT}/#{id}", options: options)
45
45
  end
46
46
 
47
47
  private
@@ -19,29 +19,36 @@ module RunApi
19
19
 
20
20
  # Generate an image and wait until complete.
21
21
  #
22
- # @param params [Hash] generation parameters
22
+ # @param params [Hash] generation parameters (see {#create} for accepted keys)
23
23
  # @return [RunApi::NanoBanana::Types::CompletedTextToImageResponse] completed generation with image results
24
- def run(**params)
25
- task = create(**params)
26
- poll_until_complete { get(task.id) }
24
+ def run(options: nil, **params)
25
+ task = create(options: options, **params)
26
+ poll_until_complete { get(task.id, options: options) }
27
27
  end
28
28
 
29
29
  # Create an image generation task.
30
30
  #
31
31
  # @param params [Hash] generation parameters
32
+ # @option params [String] :model model slug, e.g. "nano-banana", "nano-banana-pro", "nano-banana-2", "nano-banana-2-lite"
33
+ # @option params [String] :prompt required; image description
34
+ # @option params [String] :aspect_ratio optional; required for nano-banana-2-lite
35
+ # @option params [String] :output_format optional; "png", "jpeg", or "jpg" (not supported by nano-banana-2-lite)
36
+ # @option params [String] :output_resolution optional; "1k", "2k", or "4k" (nano-banana-pro / nano-banana-2)
37
+ # @option params [Array<String>] :reference_image_urls optional; reference image URLs for visual
38
+ # guidance (nano-banana / nano-banana-pro up to 8, nano-banana-2 up to 14, nano-banana-2-lite up to 10; <=30MB each)
32
39
  # @return [RunApi::NanoBanana::Types::TextToImageResponse] task creation result with id
33
- def create(**params)
40
+ def create(options: nil, **params)
34
41
  params = compact_params(params)
35
42
  validate_params!(params)
36
- request(:post, ENDPOINT, body: params)
43
+ request(:post, ENDPOINT, body: params, options: options)
37
44
  end
38
45
 
39
46
  # Get generation status by task ID.
40
47
  #
41
48
  # @param id [String] task ID
42
49
  # @return [RunApi::NanoBanana::Types::TextToImageResponse] current generation status
43
- def get(id)
44
- request(:get, "#{ENDPOINT}/#{id}")
50
+ def get(id, options: nil)
51
+ request(:get, "#{ENDPOINT}/#{id}", options: options)
45
52
  end
46
53
 
47
54
  private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runapi-nano-banana
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.9
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.9
26
26
  description: The Nano Banana Ruby SDK is the language-specific package for Nano Banana
27
27
  on 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