Class: RunApi::GeminiOmni::Resources::TextToVideo

Inherits:
Object
  • Object
show all
Includes:
Core::ResourceHelpers
Defined in:
lib/runapi/gemini_omni/resources/text_to_video.rb

Overview

Generates video from a prompt with optional characters, audio voices, reference images, and source video clips. Async – use run for automatic polling or create/get for manual control.

Constant Summary collapse

ENDPOINT =
"/api/v1/gemini_omni/text_to_video"
RESPONSE_CLASS =
Types::TextToVideoResponse
COMPLETED_RESPONSE_CLASS =
Types::CompletedTextToVideoResponse
PROMPT_MAX_LENGTH =
20_000
REFERENCE_IMAGE_URLS_MAX =
7
AUDIO_IDS_MAX =
3
VIDEO_LIST_MAX =
1
CHARACTER_IDS_MAX =
3
REFERENCE_UNITS_MAX =
7
VIDEO_REFERENCE_UNITS =
2
MAX_TRIM_SECONDS =
10

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ TextToVideo

Returns a new instance of TextToVideo.



24
25
26
# File 'lib/runapi/gemini_omni/resources/text_to_video.rb', line 24

def initialize(http)
  @http = http
end

Instance Method Details

#create(**params) ⇒ Object



33
34
35
36
37
# File 'lib/runapi/gemini_omni/resources/text_to_video.rb', line 33

def create(**params)
  params = compact_params(params)
  validate_params!(params)
  request(:post, ENDPOINT, body: params)
end

#get(id) ⇒ Object



39
40
41
# File 'lib/runapi/gemini_omni/resources/text_to_video.rb', line 39

def get(id)
  request(:get, "#{ENDPOINT}/#{id}")
end

#run(**params) ⇒ Object



28
29
30
31
# File 'lib/runapi/gemini_omni/resources/text_to_video.rb', line 28

def run(**params)
  task = create(**params)
  poll_until_complete { get(task.id) }
end