class RubyLLM::TranscriptionChunk
A TranscriptionChunk is one event from a streaming transcription. RubyLLM.transcribe yields these to its block as the provider transcribes the audio, then returns the final Transcription.
RubyLLM.transcribe("meeting.wav", model: "gpt-4o-transcribe") do |chunk| print chunk.delta if chunk.delta? end
Constants
- DELTA
-
Text deltas, arriving as the model transcribes.
- DONE
-
The final event, carrying the complete transcript.
- PARTIAL
-
A tentative transcript that may change before its segment completes.
- SEGMENT
-
A completed segment, on models that return timed or diarized segments.
Attributes
The text added by this event, or nil for events that add no text.
The segment this event completed as a Hash, or nil. Diarization models label each segment with a speaker.
The transcript for a partial event or the complete final transcript.
The normalized event type, such as "transcript.text.delta".
Public Instance Methods
Source
# File lib/ruby_llm/transcription_chunk.rb, line 53 def delta? = !delta.nil?
Whether this event carries a text delta.
Source
# File lib/ruby_llm/transcription_chunk.rb, line 62 def done? = type == DONE
Whether this is the final event of the transcription.
Source
# File lib/ruby_llm/transcription_chunk.rb, line 56 def partial? = type == PARTIAL
Whether this is a tentative transcript, replacing the previous partial.
Source
# File lib/ruby_llm/transcription_chunk.rb, line 59 def segment? = !segment.nil?
Whether this event completed a segment.