Class: RubyLLM::Providers::VertexAI::Transcription
- Inherits:
-
VertexAI::Gemini
- Object
- VertexAI::Gemini
- RubyLLM::Providers::VertexAI::Transcription
- Defined in:
- lib/ruby_llm/providers/vertexai/transcription.rb
Overview
:nodoc: all
Instance Method Summary collapse
- #render_transcription_options(timestamps:) ⇒ Object
- #render_transcription_payload(attachment, language:, speaker_names:, provider_options:, prompt:) ⇒ Object
- #validate_transcription_request ⇒ Object
Methods included from RubyLLM::Protocols::Gemini::FileTranscription
Instance Method Details
#render_transcription_options(timestamps:) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/ruby_llm/providers/vertexai/transcription.rb', line 7 def (timestamps:, **) return {} if .nil? raise ArgumentError, 'Vertex AI transcription timestamps must be word' unless == :word { generationConfig: { audioTranscriptionConfig: { wordTimestamp: true } } } end |
#render_transcription_payload(attachment, language:, speaker_names:, provider_options:, prompt:) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/ruby_llm/providers/vertexai/transcription.rb', line 23 def render_transcription_payload(, language:, speaker_names:, provider_options:, prompt:, **) config = { languageCodes: language && Array(language), customVocabulary: prompt && Array(prompt), diarization: speaker_names && true }.compact payload = { contents: [{ role: 'user', parts: [format_audio_part()] }], generationConfig: { audioTranscriptionConfig: config } } Support::Utils.deep_merge(payload, ) end |
#validate_transcription_request ⇒ Object
16 17 18 19 20 21 |
# File 'lib/ruby_llm/providers/vertexai/transcription.rb', line 16 def validate_transcription_request(...) super return if @config.vertexai_location == 'global' raise ArgumentError, 'Vertex AI dedicated transcription requires vertexai_location = "global"' end |