Class: RubyLLM::Providers::Bedrock::Mantle::Voxtral

Inherits:
ChatCompletions show all
Defined in:
lib/ruby_llm/providers/bedrock/mantle/voxtral.rb

Overview

Voxtral transcription through Mantle's audio-capable Chat Completions API.

Constant Summary

Constants included from RubyLLM::Providers::Bedrock::Mantle

RESPONSES_MODELS, SIGNING_SERVICE

Instance Attribute Summary

Attributes inherited from RubyLLM::Protocol

#config, #connection, #model, #provider

Instance Method Summary collapse

Methods inherited from ChatCompletions

#completion_url, #supports_provider_file_references?

Methods included from RubyLLM::Providers::Bedrock::Mantle

#initialize

Methods inherited from RubyLLM::Protocol

abstract, #animate_later, #apply_compaction, #apply_compaction_headers, #apply_end_user, #cache_content, #compact, #complete, #count_tokens, #delete_cache, #embed, #extend_cache, #find_cache, #initialize, #list_models, #moderate, #ocr, #paint, #parse_error, #parse_image_responses, #post_image, #post_video, #preprocess_message, #raise_transcription_streaming_unsupported, #refresh_video_job, #render, #render_embedding, #render_video_extension_payload, #rerank, #server_tool_aliases, #speak, #stream_speech, #stream_speech_response, #supports_embedding_media?, #tokenize, #tool_approval_response, #video_extension_attachment, #video_extension_url, #video_request_url

Methods included from RubyLLM::Protocol::BinaryStreaming

#stream_binary

Methods included from RubyLLM::Protocol::Streaming

build_on_data_handler, build_stream_error_response, error_chunk?, failed_http_status, faraday_1?, handle_data, handle_error_chunk, handle_error_event, handle_failed_response, handle_json_error_chunk, handle_sse, handle_stream, json_error_payload?, parse_error_from_json, parse_streaming_error, process_stream_chunk, raise_stream_error, stream_events, stream_response, stream_state

Instance Method Details

#render_transcription_options(timestamps:) ⇒ Object

Raises:

  • (ArgumentError)


22
23
24
25
26
# File 'lib/ruby_llm/providers/bedrock/mantle/voxtral.rb', line 22

def render_transcription_options(timestamps:, **)
  return {} if timestamps.nil?

  raise ArgumentError, 'Bedrock Voxtral does not return timestamps'
end

#transcribe(audio_file, model:, language:, format: nil, speaker_names: nil, speaker_references: nil, provider_options: {}, prompt: nil, temperature: nil, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/ruby_llm/providers/bedrock/mantle/voxtral.rb', line 9

def transcribe(audio_file, model:, language:, format: nil, speaker_names: nil,
               speaker_references: nil, provider_options: {}, prompt: nil, temperature: nil, &block)
  validate_transcription_options(format:, speaker_names:, speaker_references:)

  track_usage(:transcription) do
    payload = render_transcription_payload(audio_file, model:, language:, prompt:, temperature:,
                                                       provider_options:)
    next stream_transcription(payload, model:, &block) if block

    parse_transcription_response(signed_post(completion_url, payload), model:)
  end
end