import { RealtimeConnection } from "./connection.js"; export declare enum AudioFormat { PCM_8000 = "pcm_8000", PCM_16000 = "pcm_16000", PCM_22050 = "pcm_22050", PCM_24000 = "pcm_24000", PCM_44100 = "pcm_44100", PCM_48000 = "pcm_48000", ULAW_8000 = "ulaw_8000" } export declare enum CommitStrategy { MANUAL = "manual", VAD = "vad" } /** * Entity categories accepted by {@link BaseOptions.entityDetection}. * `"all"` enables every supported entity type. */ export type EntityDetectionCategory = "all" | "pii" | "phi" | "pci" | "other" | "offensive_language"; /** * A value accepted by {@link BaseOptions.entityDetection}: either one of the * {@link EntityDetectionCategory} values, or a specific entity type such as * `"email_address"` or `"credit_card"`. */ export type EntityDetectionOption = EntityDetectionCategory | (string & {}); interface BaseOptions { /** * Token to use for the WebSocket connection. Obtained from the ElevenLabs API. */ token: string; /** * Strategy for committing transcriptions. * @default CommitStrategy.MANUAL */ commitStrategy?: CommitStrategy; /** * Silence threshold in seconds for VAD (Voice Activity Detection). * Must be a positive number between 0.3 and 3.0 */ vadSilenceThresholdSecs?: number; /** * Threshold for voice activity detection. * Must be between 0.1 and 0.9. */ vadThreshold?: number; /** * Minimum speech duration in milliseconds. * Must be a positive integer between 50 and 2000. */ minSpeechDurationMs?: number; /** * Minimum silence duration in milliseconds. * Must be a positive integer between 50 and 2000. */ minSilenceDurationMs?: number; /** * Model ID to use for transcription. * Must be a valid model ID. */ modelId: string; /** * An ISO-639-1 or ISO-639-3 language_code corresponding to the language of the audio file. * Can sometimes improve transcription performance if known beforehand. */ languageCode?: string; /** * Additional ISO-639-1 or ISO-639-3 language codes that may be present in the audio. * Providing them makes language identification more reliable by only focusing on a * certain set of languages. */ secondaryLanguages?: string[]; /** * Base URI to use for the WebSocket connection. * If not provided, the default URI will be used. */ baseUri?: string; /** * Whether to receive a committed_transcript_with_timestamps event which includes word-level timestamps. * @default false */ includeTimestamps?: boolean; /** * Whether to include detected language information in the transcription results. * @default false */ includeLanguageDetection?: boolean; /** * List of keyterms to bias the model towards. * Maximum 50 keyterms, each up to 20 characters. */ keyterms?: string[]; /** * If true, removes filler words, false starts and disfluencies from the transcript. * @default false */ noVerbatim?: boolean; /** * Detect entities on committed transcripts. Accepts `"all"`, a single entity type or * category, or a list of types/categories. Detected entities are delivered in a separate * committed_transcript_entities event with their text, type, and character positions. */ entityDetection?: EntityDetectionOption | EntityDetectionOption[]; /** * Enable background speech filtering to reduce false activations from nearby conversations * and ambient noise. When enabled without an explicit vadThreshold, the server applies a * lower default threshold. * * @remarks * Cannot be combined with includeTimestamps. * @default false */ filterBackgroundAudio?: boolean; /** * Whether the request may be logged by ElevenLabs. * When set to false, zero retention mode is used for the session, which means * history features are unavailable for it. Zero retention mode may only be * used by enterprise customers. * @default true */ enableLogging?: boolean; } export interface AudioOptions extends BaseOptions { audioFormat: AudioFormat; sampleRate: number; microphone?: never; } /** * Options for automatic microphone streaming in the browser. */ export interface MicrophoneOptions extends BaseOptions { microphone?: { deviceId?: MediaDeviceConstraint; echoCancellation?: boolean; noiseSuppression?: boolean; autoGainControl?: boolean; channelCount?: number; /** * Allows self-hosting the Scribe audio worklet to avoid whitelisting * blob: and data: URLs in the CSP script-src (or script-src-elem) * directive. Point this at a same-origin copy of the processor shipped * at `@elevenlabs/client/worklets/scribeAudioProcessor.js`, e.g. * `{ scribeAudioProcessor: "/vendor/elevenlabs/scribe-audio-processor.js" }`. */ workletPaths?: { scribeAudioProcessor?: string; }; }; audioFormat?: never; sampleRate?: never; } /** * Real-time speech-to-text transcription client for browser environments. * Supports microphone streaming and manual audio chunk transmission. */ export declare class ScribeRealtime { private static readonly DEFAULT_BASE_URI; private static getWebSocketUri; private static buildWebSocketUri; /** * Establishes a WebSocket connection for real-time speech-to-text transcription. * * @param options - Configuration options for the connection * @returns A RealtimeConnection instance * * @example * ```typescript * // Manual audio streaming * const connection = Scribe.connect({ * token: "...", * modelId: "scribe_v2_realtime", * audioFormat: AudioFormat.PCM_16000, * sampleRate: 16000, * }); * * // Automatic microphone streaming * const connection = Scribe.connect({ * token: "...", * modelId: "scribe_v2_realtime", * microphone: { * echoCancellation: true, * noiseSuppression: true * } * }); * ``` */ static connect(options: AudioOptions | MicrophoneOptions): RealtimeConnection; private static streamFromMicrophone; } export {}; //# sourceMappingURL=scribe.d.ts.map