bodhi-realtime-agent / GeminiBatchSTTProvider
Class: GeminiBatchSTTProvider
Defined in: src/transport/gemini-batch-stt-provider.ts:99
STTProvider that uses a separate Gemini model via generateContent() for batch transcription of buffered user audio.
Extracted from GeminiLiveTransport. Audio is buffered via feedAudio(), then transcribed when commit() is called (triggered by model turn start).
Implements
Constructors
Constructor
new GeminiBatchSTTProvider(
config):GeminiBatchSTTProvider
Defined in: src/transport/gemini-batch-stt-provider.ts:112
Parameters
config
Returns
GeminiBatchSTTProvider
Properties
onPartialTranscript?
optionalonPartialTranscript?: (text) =>void
Defined in: src/transport/gemini-batch-stt-provider.ts:110
Partial/interim transcription (streaming providers only). Replaces any previous partial for the same turn.
Parameters
text
string
Returns
void
Implementation of
STTProvider.onPartialTranscript
onTranscript?
optionalonTranscript?: (text,turnId) =>void
Defined in: src/transport/gemini-batch-stt-provider.ts:109
Final transcription of user speech.
Parameters
text
string
The transcribed text.
turnId
number | undefined
The turn this transcript belongs to (from commit()). Undefined when a streaming provider's VAD auto-commits before the framework calls commit().
Returns
void
Implementation of
Methods
buildPrompt()
buildPrompt():
string
Defined in: src/transport/gemini-batch-stt-provider.ts:151
Build the user-part transcription prompt, with the vocabulary hint when present. The output rules stay in the system instruction; the hint rides with the user part because it can change between commits. Falls back to the base prompt when the hint is absent, blank, or its function throws. Exposed for tests.
Returns
string
commit()
commit(
turnId):void
Defined in: src/transport/gemini-batch-stt-provider.ts:188
Signal that the user's turn has ended (model started responding). For batch providers, this triggers transcription. For streaming providers, this may trigger a manual commit.
Parameters
turnId
number
Monotonically increasing turn counter for ordering.
Returns
void
Implementation of
configure()
configure(
audio):void
Defined in: src/transport/gemini-batch-stt-provider.ts:157
Configure the audio format that feedAudio() will deliver. Called once before start(). The provider MUST resample or reject if it cannot handle the given format.
Parameters
audio
Returns
void
Implementation of
feedAudio()
feedAudio(
base64Pcm):void
Defined in: src/transport/gemini-batch-stt-provider.ts:176
Feed audio data. Format matches the STTAudioConfig from configure().
Parameters
base64Pcm
string
Base64-encoded PCM audio chunk.
Returns
void
Implementation of
handleInterrupted()
handleInterrupted():
void
Defined in: src/transport/gemini-batch-stt-provider.ts:237
Signal that the current turn was interrupted by the user. Providers MUST preserve buffered audio for the next commit().
Returns
void
Implementation of
handleTurnComplete()
handleTurnComplete():
void
Defined in: src/transport/gemini-batch-stt-provider.ts:241
Signal a natural turn completion (model finished, no interruption). Batch providers SHOULD clear buffers. Streaming providers may no-op.
Returns
void
Implementation of
STTProvider.handleTurnComplete
setContextHint()
setContextHint(
hint):void
Defined in: src/transport/gemini-batch-stt-provider.ts:119
Set/replace the domain vocabulary hint after construction.
Parameters
hint
string | (() => string | undefined) | undefined
Returns
void
start()
start():
Promise<void>
Defined in: src/transport/gemini-batch-stt-provider.ts:167
Start the STT session (e.g. open WebSocket).
Returns
Promise<void>
Implementation of
stop()
stop():
Promise<void>
Defined in: src/transport/gemini-batch-stt-provider.ts:171
Stop the STT session (e.g. close WebSocket).
Returns
Promise<void>