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

65 lines (64 loc) 1.6 kB
/** * Text-to-Speech (TTS) Type Definitions for NeuroLink * * This module defines types for TTS audio generation and output. * * @module types/ttsTypes */ /** Valid audio formats as an array for runtime validation */ export const VALID_AUDIO_FORMATS = [ "mp3", "wav", "ogg", "opus", "m4a", "flac", "webm", "mp4", "mpeg", "mpga", "pcm16", ]; /** Valid TTS quality levels as an array for runtime validation */ export const VALID_TTS_QUALITIES = ["standard", "hd"]; /** * Type guard to check if an object is a TTSResult */ export function isTTSResult(value) { if (!value || typeof value !== "object") { return false; } const obj = value; return (Buffer.isBuffer(obj.buffer) && typeof obj.format === "string" && VALID_AUDIO_FORMATS.includes(obj.format) && typeof obj.size === "number" && obj.size >= 0); } /** * Type guard to check if TTSOptions are valid */ export function isValidTTSOptions(options) { if (!options || typeof options !== "object") { return false; } const opts = options; if (opts.speed !== undefined) { if (typeof opts.speed !== "number" || opts.speed < 0.25 || opts.speed > 4.0) { return false; } } if (opts.format !== undefined) { if (!VALID_AUDIO_FORMATS.includes(opts.format)) { return false; } } if (opts.quality !== undefined) { if (!VALID_TTS_QUALITIES.includes(opts.quality)) { return false; } } return true; }