Module: RubyLLM::Protocols::ElevenLabs::Flows::Media
- Defined in:
- lib/ruby_llm/protocols/elevenlabs/flows/media.rb
Overview
:nodoc: all
Instance Method Summary collapse
Instance Method Details
#parse_generation_status(body) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ruby_llm/protocols/elevenlabs/flows/media.rb', line 24 def parse_generation_status(body) case body['status'] when 'pending', 'generating' { status: :pending, raw: body } when 'completed' raise Error, 'ElevenLabs completed a generation without an output URL' unless body['content_url'] { status: :completed, raw: body } when 'failed' { status: :failed, raw: body, error: body['error_message'] || body['failure_reason'] } else raise Error, "ElevenLabs returned an unknown generation status: #{body['status'].inspect}" end end |
#render_media_reference(attachment) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ruby_llm/protocols/elevenlabs/flows/media.rb', line 8 def render_media_reference() unless .image? || .audio? || .video? raise UnsupportedAttachmentError, .mime_type end if .provider_file? unless .source.provider.to_s == @provider.slug raise ArgumentError, 'ElevenLabs media references require an asset from the same provider' end { type: 'asset', asset_id: .provider_file_id } else { type: 'inline_base64', content_base64: .encoded, mime_type: .mime_type } end end |