UNPKG

@juspay/neurolink

Version:

Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio

61 lines (60 loc) 2.18 kB
/** * Google Cloud Speech-to-Text Handler * * Implementation of STT using Google Cloud Speech-to-Text API. * * @module voice/providers/GoogleSTT */ import type { TTSAudioFormat, STTHandler, STTLanguage, STTOptions, STTResult, TranscriptionSegment } from "../../types/index.js"; /** * Google Cloud Speech-to-Text Handler * * Supports transcription with speaker diarization, word timestamps, and punctuation. * * @see https://cloud.google.com/speech-to-text/docs */ export declare class GoogleSTT implements STTHandler { private readonly apiKey; private readonly credentialsPath; private readonly baseUrl; /** * Maximum audio duration in seconds for the synchronous recognize endpoint. * For longer audio, use the async longrunningrecognize endpoint (not yet implemented). */ readonly maxAudioDuration = 60; /** * True streaming requires gRPC (not yet implemented). * transcribeStream() uses a chunk-and-batch workaround. */ readonly supportsStreaming = false; constructor(apiKey?: string, credentialsPath?: string); isConfigured(): boolean; getSupportedFormats(): TTSAudioFormat[]; getSupportedLanguages(): Promise<STTLanguage[]>; transcribe(audio: Buffer | ArrayBuffer, options?: STTOptions): Promise<STTResult>; /** * Streaming transcription (placeholder - requires WebSocket/gRPC) */ transcribeStream(audioStream: AsyncIterable<Buffer>, options: STTOptions): AsyncIterable<TranscriptionSegment>; /** * Get encoding string for audio format */ private getEncoding; /** * Parse duration string (e.g., "1.5s") to seconds */ private parseDuration; /** * Calculate average confidence from results */ private calculateAverageConfidence; /** * Get access token from service account credentials. * * M3: previously caught all errors and returned `""`, which then caused * a silent 401 from the Google API and a confusing downstream HTTP error * with no trace of the original auth failure. Now rethrows as STTError so * the caller sees the auth root cause. */ private getAccessToken; }