runapi-gemini-omni 0.2.5 → 0.2.7

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: ab0124af9b8dfebb28307d7560455e2e8e7713d44ee4229df842b8a7edcc9af0
4
- data.tar.gz: 4a137b6a2aa7aba8ace50db55f4eb71e78960e32e8881e5890250be48a269118
3
+ metadata.gz: 7befcdce5d30097c0c8ad440c86bd8cd873e14aef90f59304f60d89eed3c2a29
4
+ data.tar.gz: ae2353b876a73b19681e151c46310e67edf1dc2f0c04565b5a5c7b10ff3630ce
5
5
  SHA512:
6
- metadata.gz: 1b165f06bdbce32a051c122726cd03c6aaa101312f8a5a96f5055a7336f0dbb91fd82c946fd4bbbf6ac40f75270d1520ad6170d9681d3ff823a72c5a05140a8f
7
- data.tar.gz: c949b858a8e6a2fca6ffc6273c68f869d93bb946d37621f99390315c321227a0a27b3c4e91fb4a6e88e6fd7716977c6f35f9a0eed5abfa620239b2ed8bb0b170
6
+ metadata.gz: 3bc31cf371de32b41d86090294fa7feb13ca132d777fa2944ec71a13e015cafed6ef6ec1a6a0f99a8b96c0401703e63d4d38f1d1c4f4e91d0b2639a9734a940e
7
+ data.tar.gz: 6056184058b318efb10aaf4eacf012b571fb27d64536faa374f33e1bc182458c1e6dbd2e7cb3b0d7ef2473fc4a07fd3f655bf5d9ce259bcbb4cce672a734b3fd
data/README.md CHANGED
@@ -32,6 +32,8 @@ video = client.text_to_video.run(
32
32
  )
33
33
  ```
34
34
 
35
+ 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.
36
+
35
37
  ## Links
36
38
 
37
39
  - Model page: https://runapi.ai/models/gemini-omni
@@ -2,14 +2,29 @@
2
2
 
3
3
  module RunApi
4
4
  module GeminiOmni
5
- class Client
6
- attr_reader :create_audio, :create_character, :text_to_video
5
+ # Gemini Omni multimodal generation client for voice presets, character creation,
6
+ # and text-to-video with optional characters, audio voices, and reference media.
7
+ #
8
+ # @example
9
+ # client = RunApi::GeminiOmni::Client.new(api_key: "sk-...")
10
+ #
11
+ # audio = client.create_audio.run(audio_id: "zephyr", name: "Narrator")
12
+ # video = client.text_to_video.run(
13
+ # prompt: "A narrator walks through a futuristic city",
14
+ # duration_seconds: 6,
15
+ # audio_ids: [audio.audio.id]
16
+ # )
17
+ # puts video.videos.first.url
18
+ class Client < RunApi::Core::Client
19
+ # @return [Resources::CreateAudio] Registers reusable voice presets (synchronous).
20
+ attr_reader :create_audio
21
+ # @return [Resources::CreateCharacter] Builds reusable characters from reference images (synchronous).
22
+ attr_reader :create_character
23
+ # @return [Resources::TextToVideo] Generates video from prompts with optional characters and voices (async).
24
+ attr_reader :text_to_video
7
25
 
8
26
  def initialize(api_key: nil, **options)
9
- @api_key = Core::Auth.resolve_api_key(api_key)
10
-
11
- client_options = Core::ClientOptions.new(api_key: @api_key, **options)
12
- http = client_options.http_client || Core::HttpClient.new(client_options)
27
+ super
13
28
  @create_audio = Resources::CreateAudio.new(http)
14
29
  @create_character = Resources::CreateCharacter.new(http)
15
30
  @text_to_video = Resources::TextToVideo.new(http)
@@ -3,6 +3,8 @@
3
3
  module RunApi
4
4
  module GeminiOmni
5
5
  module Resources
6
+ # Registers a reusable voice preset from a built-in voice identity.
7
+ # Synchronous -- only +run+ is available (no create/get polling).
6
8
  class CreateAudio
7
9
  include RunApi::Core::ResourceHelpers
8
10
 
@@ -3,6 +3,9 @@
3
3
  module RunApi
4
4
  module GeminiOmni
5
5
  module Resources
6
+ # Builds a reusable character from a reference image and description.
7
+ # Attach audio IDs to give the character a specific voice.
8
+ # Synchronous -- only +run+ is available (no create/get polling).
6
9
  class CreateCharacter
7
10
  include RunApi::Core::ResourceHelpers
8
11
 
@@ -10,7 +13,6 @@ module RunApi
10
13
  RESPONSE_CLASS = Types::CreateCharacterResponse
11
14
  DESCRIPTIONS_MAX_LENGTH = 20_000
12
15
  CHARACTER_NAME_MAX_LENGTH = 210
13
- IMAGE_URLS_MAX = 1
14
16
 
15
17
  def initialize(http)
16
18
  @http = http
@@ -26,10 +28,8 @@ module RunApi
26
28
 
27
29
  def validate_params!(params)
28
30
  validate_required!(params, :descriptions)
29
- validate_required!(params, :image_urls)
30
- validate_array!(params, :image_urls)
31
+ validate_required!(params, :reference_image_url)
31
32
  validate_array!(params, :audio_ids) if param(params, :audio_ids)
32
- validate_image_count!(params)
33
33
  validate_length!(params, :descriptions, DESCRIPTIONS_MAX_LENGTH)
34
34
  validate_length!(params, :character_name, CHARACTER_NAME_MAX_LENGTH)
35
35
  end
@@ -52,12 +52,6 @@ module RunApi
52
52
  raise Core::ValidationError, "#{key} must be an array"
53
53
  end
54
54
 
55
- def validate_image_count!(params)
56
- return if param(params, :image_urls).length <= IMAGE_URLS_MAX
57
-
58
- raise Core::ValidationError, "image_urls accepts at most #{IMAGE_URLS_MAX} image"
59
- end
60
-
61
55
  def validate_length!(params, key, max_length)
62
56
  value = param(params, key)
63
57
  return if value.nil? || value.to_s.length <= max_length
@@ -3,6 +3,9 @@
3
3
  module RunApi
4
4
  module GeminiOmni
5
5
  module Resources
6
+ # Generates video from a prompt with optional characters, audio voices,
7
+ # reference images, and source video clips.
8
+ # Async -- use +run+ for automatic polling or +create+/+get+ for manual control.
6
9
  class TextToVideo
7
10
  include RunApi::Core::ResourceHelpers
8
11
 
@@ -10,7 +13,7 @@ module RunApi
10
13
  RESPONSE_CLASS = Types::TextToVideoResponse
11
14
  COMPLETED_RESPONSE_CLASS = Types::CompletedTextToVideoResponse
12
15
  PROMPT_MAX_LENGTH = 20_000
13
- IMAGE_URLS_MAX = 7
16
+ REFERENCE_IMAGE_URLS_MAX = 7
14
17
  AUDIO_IDS_MAX = 3
15
18
  VIDEO_LIST_MAX = 1
16
19
  CHARACTER_IDS_MAX = 3
@@ -41,12 +44,12 @@ module RunApi
41
44
 
42
45
  def validate_params!(params)
43
46
  validate_required!(params, :prompt)
44
- validate_required!(params, :duration)
47
+ validate_required!(params, :duration_seconds)
45
48
  validate_length!(params, :prompt, PROMPT_MAX_LENGTH)
46
- validate_optional!(params, :duration, Types::DURATIONS)
49
+ validate_optional!(params, :duration_seconds, Types::DURATIONS)
47
50
  validate_optional!(params, :aspect_ratio, Types::ASPECT_RATIOS)
48
- validate_optional!(params, :resolution, Types::RESOLUTIONS)
49
- validate_array!(params, :image_urls, IMAGE_URLS_MAX) if param(params, :image_urls)
51
+ validate_optional!(params, :output_resolution, Types::OUTPUT_RESOLUTIONS)
52
+ validate_array!(params, :reference_image_urls, REFERENCE_IMAGE_URLS_MAX) if param(params, :reference_image_urls)
50
53
  validate_array!(params, :audio_ids, AUDIO_IDS_MAX) if param(params, :audio_ids)
51
54
  validate_array!(params, :video_list, VIDEO_LIST_MAX) if param(params, :video_list)
52
55
  validate_array!(params, :character_ids, CHARACTER_IDS_MAX) if param(params, :character_ids)
@@ -99,12 +102,12 @@ module RunApi
99
102
  end
100
103
 
101
104
  def validate_reference_units!(params)
102
- units = Array(param(params, :image_urls)).count +
105
+ units = Array(param(params, :reference_image_urls)).count +
103
106
  (Array(param(params, :video_list)).count * VIDEO_REFERENCE_UNITS) +
104
107
  Array(param(params, :character_ids)).count
105
108
  return if units <= REFERENCE_UNITS_MAX
106
109
 
107
- raise Core::ValidationError, "image_urls + video_list*2 + character_ids must use #{REFERENCE_UNITS_MAX} reference units or fewer"
110
+ raise Core::ValidationError, "reference_image_urls + video_list*2 + character_ids must use #{REFERENCE_UNITS_MAX} reference units or fewer"
108
111
  end
109
112
 
110
113
  def validate_seed!(params)
@@ -2,7 +2,9 @@
2
2
 
3
3
  module RunApi
4
4
  module GeminiOmni
5
+ # Type definitions and constants for the Gemini Omni API.
5
6
  module Types
7
+ # The 30 preset voice identities, each with distinct pitch, cadence, and personality.
6
8
  AUDIO_VOICES = %w[
7
9
  achernar achird algenib algieba alnilam aoede autonoe callirrhoe charon
8
10
  despina enceladus erinome fenrir gacrux iapetus kore laomedeia leda orus
@@ -10,42 +12,59 @@ module RunApi
10
12
  vindemiatrix zephyr zubenelgenubi
11
13
  ].freeze
12
14
 
15
+ # A created voice preset with its server-assigned ID.
13
16
  class Audio < RunApi::Core::BaseModel
14
17
  required :id, String
15
18
  optional :name, String
16
19
  end
17
20
 
21
+ # Result of a synchronous create-audio call.
18
22
  class CreateAudioResponse < RunApi::Core::BaseModel
19
23
  required :id, String
20
24
  optional :audio, -> { Audio }
21
25
  optional :error, String
22
26
  end
23
27
 
28
+ # URL to a generated or reference image.
29
+ class Image < RunApi::Core::BaseModel
30
+ optional :url, String
31
+ end
32
+
33
+ # A created character with its ID, name, and reference images.
24
34
  class Character < RunApi::Core::BaseModel
25
35
  required :id, String
26
36
  optional :name, String
27
- optional :image_url, String
37
+ optional :images, [-> { Image }]
28
38
  end
29
39
 
40
+ # Result of a synchronous create-character call.
30
41
  class CreateCharacterResponse < RunApi::Core::BaseModel
31
42
  required :id, String
32
43
  optional :character, -> { Character }
33
44
  optional :error, String
34
45
  end
35
46
 
36
- DURATIONS = %w[4 6 8 10].freeze
47
+ # Allowed video durations in seconds. Longer durations consume more credits.
48
+ DURATIONS = [4, 6, 8, 10].freeze
49
+ # Output aspect ratios: landscape (16:9) or portrait (9:16).
37
50
  ASPECT_RATIOS = %w[16:9 9:16].freeze
38
- RESOLUTIONS = %w[720p 1080p 4k].freeze
51
+ # Output resolutions -- higher values produce sharper video at higher cost.
52
+ OUTPUT_RESOLUTIONS = %w[720p 1080p 4k].freeze
53
+ # Valid seed range for reproducible generation.
39
54
  SEED_RANGE = (0..2_147_483_647)
40
55
 
56
+ # URL to a generated video file.
41
57
  class Video < RunApi::Core::BaseModel
42
58
  optional :url, String
43
59
  end
44
60
 
61
+ # Async text-to-video task result with lifecycle status and generated videos.
45
62
  class TextToVideoResponse < RunApi::Core::TaskResponse
46
63
  optional :videos, [-> { Video }]
47
64
  end
48
65
 
66
+ # Narrowed response returned by +run+ once polling confirms completion.
67
+ # Videos are guaranteed present.
49
68
  class CompletedTextToVideoResponse < TextToVideoResponse
50
69
  required :videos, [-> { Video }]
51
70
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runapi-gemini-omni
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.7
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.4
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.4
25
+ version: 0.2.6
26
26
  description: The gemini omni api Ruby SDK is the language-specific package for Gemini
27
27
  Omni on RunAPI. Use this package for voice resources, character resources, and multimodal
28
28
  video workflows that need JSON request bodies, task status lookup, and consistent