runapi-imagen-4 0.2.5 → 0.2.6

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: 4f4e5fd22878c20e6318ec7fc7bdd5e7effe61fae9befa12bffdba5db425a4f7
4
- data.tar.gz: ec0458e1aae7aa8258c38b5087fd4cdf082eb296a7e7bd310cec8aade7591f49
3
+ metadata.gz: 0bbf9045af4c340dcafd79540eb6ad94787e442eca639d8d274553212b94fe4b
4
+ data.tar.gz: 3dbfbfe5bb5b55cc79425a7c453299cb293805d0069e506dc31062811329fdb6
5
5
  SHA512:
6
- metadata.gz: 7bd0e43504a2503944520588dfbc0d54bfdd9853e14d278cc8f8cefe89415e7925ae5b44cf9f966ed3d647b64f5b4800f505da2baf2cffbd375ce8cc624bbd40
7
- data.tar.gz: f4af6fed80942b5b91c87ea59b4ca1c2779acc988e10f2c1ee744983181aa532cc2d8a1ef514b457e1b97b474112c2895ad8505dc456ebcb4fa6b5eb9a388df9
6
+ metadata.gz: a88bfe60addfcf7ff41e0dba18c93b3809c57330d837c2dacc5ca1e630edc770cfcddf7ae818632fa13f4c206426824104d1d735740a6a94bb9a9491a9069a74
7
+ data.tar.gz: 600070f645056e36fa40caafcfb165e746ff69a572dcb4da4c9fb5d91bdd801f4cdcc77fff0668968cd01e902f3515f7020cb34ccb9c77d67b128efea0771dde
data/README.md CHANGED
@@ -24,6 +24,8 @@ status = client.generations.get(task.id)
24
24
 
25
25
  Use `create` when you want to submit a task and return quickly, `get` when you need the latest task state, and `run` when a script should create and poll until completion. In web request handlers, prefer `create` plus webhook or later `get` polling so a worker is not held open.
26
26
 
27
+ RunAPI-generated file URLs are temporary. Download and store generated images, videos, audio, or other files in your own durable storage within 7 days; do not treat returned URLs as long-term assets.
28
+
27
29
  ## Language notes
28
30
 
29
31
  Use Ruby keyword arguments and the `RunApi::Imagen4` error classes when building image jobs, Rails workers, or scripts. The available resources include generations. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
@@ -2,13 +2,24 @@
2
2
 
3
3
  module RunApi
4
4
  module Imagen4
5
- class Client
6
- attr_reader :text_to_image, :remix_image
5
+ # Imagen 4 text-to-image and remix API client.
6
+ #
7
+ # Three text-to-image quality tiers (imagen-4, imagen-4-fast, imagen-4-ultra)
8
+ # and a dedicated remix model for guided image transformation.
9
+ #
10
+ # @example
11
+ # client = RunApi::Imagen4::Client.new(api_key: "your-api-key")
12
+ # result = client.text_to_image.run(
13
+ # model: "imagen-4", prompt: "A photorealistic mountain landscape"
14
+ # )
15
+ class Client < RunApi::Core::Client
16
+ # @return [Resources::TextToImage] Text-to-image generation across quality tiers.
17
+ attr_reader :text_to_image
18
+ # @return [Resources::RemixImage] Remix existing images with text-guided transformations.
19
+ attr_reader :remix_image
7
20
 
8
21
  def initialize(api_key: nil, **options)
9
- @api_key = Core::Auth.resolve_api_key(api_key)
10
- client_options = Core::ClientOptions.new(api_key: @api_key, **options)
11
- http = client_options.http_client || Core::HttpClient.new(client_options)
22
+ super
12
23
  @text_to_image = Resources::TextToImage.new(http)
13
24
  @remix_image = Resources::RemixImage.new(http)
14
25
  end
@@ -3,6 +3,8 @@
3
3
  module RunApi
4
4
  module Imagen4
5
5
  module Resources
6
+ # Imagen 4 image remix resource.
7
+ # Transform source images guided by a text prompt (up to 8 source images).
6
8
  class RemixImage
7
9
  include RunApi::Core::ResourceHelpers
8
10
 
@@ -3,6 +3,8 @@
3
3
  module RunApi
4
4
  module Imagen4
5
5
  module Resources
6
+ # Imagen 4 text-to-image generation resource.
7
+ # Generate images from text with three quality tiers; imagen-4-fast supports batch output.
6
8
  class TextToImage
7
9
  include RunApi::Core::ResourceHelpers
8
10
 
@@ -2,16 +2,22 @@
2
2
 
3
3
  module RunApi
4
4
  module Imagen4
5
+ # Imagen 4 type constants and response models.
6
+ # Text-to-image supports three quality tiers; remix accepts source images
7
+ # with extended aspect ratios, resolution, and format control.
5
8
  module Types
6
9
  TEXT_MODELS = %w[imagen-4 imagen-4-fast imagen-4-ultra].freeze
7
10
  REMIX_MODELS = %w[imagen-4-pro-remix-image].freeze
8
11
  MODELS = (TEXT_MODELS + REMIX_MODELS).freeze
9
12
  TEXT_ASPECT_RATIOS = %w[1:1 16:9 9:16 3:4 4:3].freeze
13
+ # Extended aspect ratios for remix, including "auto" which infers from source images.
10
14
  PRO_ASPECT_RATIOS = %w[1:1 2:3 3:2 3:4 4:3 4:5 5:4 9:16 16:9 21:9 auto].freeze
11
15
  OUTPUT_RESOLUTIONS = %w[1k 2k 4k].freeze
12
16
  OUTPUT_FORMATS = %w[png jpg].freeze
17
+ # Batch sizes for imagen-4-fast (the only model supporting multi-image output).
13
18
  OUTPUT_COUNTS = [1, 2, 3, 4].freeze
14
19
 
20
+ # A generated image with its CDN URL and optional unprocessed origin URL.
15
21
  class Image < RunApi::Core::BaseModel
16
22
  optional :url, String
17
23
  optional :origin_url, String
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.5
4
+ version: 0.2.6
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.5
18
+ version: 0.2.6
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.5
25
+ version: 0.2.6
26
26
  description: The imagen api Ruby SDK is the language-specific package for Imagen 4
27
27
  on RunAPI. Use this imagen api package for text-to-image, image editing, and creative
28
28
  production flows when your application needs JSON request bodies, task status lookup,