Skip to main content

SarvamAISTT

Sarvam AI speech-to-text (STT) transcriber.

Constructor

apiKey
string
Sarvam AI API key. Defaults to the SARVAM_API_KEY environment variable.
model
SarvamAISTTModel | string
Transcription model id. Default 'saaras:v3'.
language
string
Spoken language code. Default 'en-IN'.
inputSampleRate
number
Sample rate (Hz) of the audio sent in. Default 48000.
outputSampleRate
number
Sample rate in Hz that input audio is resampled to. Default 16000.
mode
string | null
Decoding mode. Default null (provider default).
highVadSensitivity
boolean | null
Use a more sensitive VAD profile. Default null.
flushSignals
boolean | null
Emit flush signals between turns. Default null.
translation
boolean
Translate transcripts to the target language. Default false.
prompt
string | null
Optional prompt to bias transcription. Default null.
inputAudioCodec
string
Input audio codec. Default 'pcm_s16le'.
vadSignals
boolean | null
Emit VAD signals. Default true.
positiveSpeechThreshold
number | null
VAD probability above which a frame counts as speech. Default null.
negativeSpeechThreshold
number | null
VAD probability below which a frame counts as non-speech. Default null.
minSpeechFrames
number | null
Minimum frames of speech to start a turn. Default null.
firstTurnMinSpeechFrames
number | null
Minimum speech frames for the first turn. Default null.
preSpeechPadFrames
number | null
Audio frames of padding prepended before speech. Default null.
interruptMinSpeechFrames
number | null
Minimum speech frames required to interrupt. Default null.

close

Release any resources held by the provider.

closeEmitter

Close the emitter: drop all handlers and stop emitting. Waits up to 2 seconds for in-flight async handlers to settle before returning.

emit

event
string
required

getRuntimeConfig

returns
Record<string, any>

listenerCount

event
string
required
returns
number

off

event
string
required
handler
EventHandler
required

on

event
string
required
handler
EventHandler
required
returns
EventHandler

once

event
string
required
handler
EventHandler
required
returns
EventHandler

onSttTranscript

Register a callback to receive transcripts as they are produced.
callback
SttTranscriptCallback
required

processAudio

Process a buffer of audio frames. Override in a custom provider.

removeAllListeners

event
string

streamTranscribe

Transcribe a streaming audio source, yielding STTResponses. Override in a custom provider.
returns
AsyncIterator<STTResponse>

SarvamAISTTModel

Supported Sarvam AI STT model names.

Fields

toString
string
required
Returns a string representation of a string.
charAt
string
required
Returns the character at the specified index.
charCodeAt
number
required
Returns the Unicode value of the character at the specified location.
concat
string
required
Returns a string that contains the concatenation of two or more strings.
indexOf
number
required
Returns the position of the first occurrence of a substring.
lastIndexOf
number
required
Returns the last occurrence of a substring in the string.
localeCompare
number
required
Determines whether two strings are equivalent in the current locale.
match
RegExpMatchArray | null
required
Matches a string with a regular expression, and returns an array containing the results of that search.
replace
string
required
Replaces text in a string, using a regular expression or search string.
Finds the first substring match in a regular expression search.
slice
string
required
Returns a section of a string.
split
string[]
required
Split a string into substrings using the specified separator and return them as an array.
substring
string
required
Returns the substring at the specified location within a String object.
toLowerCase
string
required
Converts all the alphabetic characters in a string to lowercase.
toLocaleLowerCase
string
required
Converts all alphabetic characters to lowercase, taking into account the host environment’s current locale.
toUpperCase
string
required
Converts all the alphabetic characters in a string to uppercase.
toLocaleUpperCase
string
required
Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment’s current locale.
trim
string
required
Removes the leading and trailing white space and line terminator characters from a string.
length
number
required
Returns the length of a String object.
substr
string
required
Gets a substring beginning at the specified location and having the specified length.
valueOf
string
required
Returns the primitive value of the specified object.
codePointAt
number | undefined
required
Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point value of the UTF-16 encoded code point starting at the string element at position pos in the String resulting from converting this object to a String. If there is no element at that position, the result is undefined. If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.
includes
boolean
required
Returns true if searchString appears as a substring of the result of converting this object to a String, at one or more positions that are greater than or equal to position; otherwise, returns false.
endsWith
boolean
required
Returns true if the sequence of elements of searchString converted to a String is the same as the corresponding elements of this object (converted to a String) starting at endPosition – length(this). Otherwise returns false.
normalize
string
required
Returns the String value result of normalizing the string into the normalization form named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
repeat
string
required
Returns a String value that is made from count copies appended together. If count is 0, the empty string is returned.
startsWith
boolean
required
Returns true if the sequence of elements of searchString converted to a String is the same as the corresponding elements of this object (converted to a String) starting at position. Otherwise returns false.
anchor
string
required
Returns an <a> HTML anchor element and sets the name attribute to the text value
big
string
required
Returns a <big> HTML element
Returns a <blink> HTML element
bold
string
required
Returns a <b> HTML element
fixed
string
required
Returns a <tt> HTML element
fontcolor
string
required
Returns a <font> HTML element and sets the color attribute value
fontsize
string
required
Returns a <font> HTML element and sets the size attribute value
italics
string
required
Returns an <i> HTML element
Returns an <a> HTML element and sets the href attribute value
small
string
required
Returns a <small> HTML element
strike
string
required
Returns a <strike> HTML element
sub
string
required
Returns a <sub> HTML element
sup
string
required
Returns a <sup> HTML element
padStart
string
required
Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length. The padding is applied from the start (left) of the current string.
padEnd
string
required
Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length. The padding is applied from the end (right) of the current string.
trimEnd
string
required
Removes the trailing white space and line terminator characters from a string.
trimStart
string
required
Removes the leading white space and line terminator characters from a string.
trimLeft
string
required
Removes the leading white space and line terminator characters from a string.
trimRight
string
required
Removes the trailing white space and line terminator characters from a string.
matchAll
RegExpStringIterator<RegExpExecArray>
required
Matches a string with a regular expression, and returns an iterable of matches containing the results of that search.
replaceAll
string
required
Replace all instances of a substring in a string, using a regular expression or search string.
at
string | undefined
required
Returns a new String consisting of the single UTF-16 code unit located at the specified index.