whisper-nodejs-wrapper
Version:
Node.js wrapper for OpenAI Whisper speech recognition with TypeScript support
56 lines • 1.51 kB
TypeScript
export interface WhisperWord {
text: string;
start: number;
end: number;
}
export interface WhisperSegment {
text: string;
start: number;
end: number;
words?: WhisperWord[];
}
export interface WhisperResult {
text: string;
segments: WhisperSegment[];
language?: string;
duration?: number;
}
export interface WhisperOptions {
language?: string;
modelSize?: 'tiny' | 'base' | 'small' | 'medium' | 'large';
pythonPath?: string;
cpuOnly?: boolean;
verbose?: boolean;
}
export declare class WhisperTranscriber {
private pythonScriptPath;
private pythonPath;
private isInitialized;
constructor(options?: {
pythonPath?: string;
});
private findPython;
/**
* Check if Whisper and dependencies are installed
*/
checkDependencies(): Promise<boolean>;
/**
* Install Whisper and required dependencies
*/
installDependencies(): Promise<void>;
/**
* Initialize the transcriber (check/install dependencies)
*/
initialize(): Promise<void>;
/**
* Transcribe an audio file
*/
transcribe(audioPath: string, options?: WhisperOptions): Promise<WhisperResult>;
/**
* Transcribe with automatic retry on failure
*/
transcribeWithRetry(audioPath: string, options?: WhisperOptions, maxRetries?: number): Promise<WhisperResult>;
}
export declare const whisper: WhisperTranscriber;
export default WhisperTranscriber;
//# sourceMappingURL=index.d.ts.map