import { L as LangVoiceClient } from '../client-pNrzz2-q.mjs'; import { FunctionSchema } from './types.mjs'; /** * Generic/Universal tools for LangVoice TTS * * Works with any AI agent framework that supports function calling. */ interface ToolResult { success: boolean; error?: string; } interface TTSToolResult extends ToolResult { audioBase64?: string; duration?: number; charactersProcessed?: number; } interface VoicesToolResult extends ToolResult { voices?: Array<{ id: string; name: string; }>; } interface LanguagesToolResult extends ToolResult { languages?: Array<{ id: string; name: string; }>; } /** * Universal toolkit for using LangVoice with any AI framework * * @example * ```typescript * import { LangVoiceToolkit } from 'langvoice-sdk/tools'; * * const toolkit = new LangVoiceToolkit({ apiKey: 'your-langvoice-key' }); * * // Direct usage * const result = await toolkit.textToSpeech({ text: 'Hello world!' }); * await toolkit.saveAudio(result, 'output.mp3'); * * // Handle tool calls from any LLM * const result = await toolkit.handleToolCall('langvoice_text_to_speech', { text: 'Hello' }); * * // Get schemas for any framework * const schemas = toolkit.getFunctionSchemas(); * ``` */ declare class LangVoiceToolkit { private readonly client; /** Tool name constants */ static readonly TOOL_TTS: "langvoice_text_to_speech"; static readonly TOOL_MULTI_VOICE: "langvoice_multi_voice_speech"; static readonly TOOL_LIST_VOICES: "langvoice_list_voices"; static readonly TOOL_LIST_LANGUAGES: "langvoice_list_languages"; constructor(options?: { apiKey?: string; }); /** * Get the underlying LangVoice client */ getClient(): LangVoiceClient; /** * Convert text to speech */ textToSpeech(params: { text: string; voice?: string; language?: string; speed?: number; }): Promise; /** * Generate speech with multiple voices */ multiVoiceSpeech(params: { text: string; language?: string; speed?: number; }): Promise; /** * Get available voices */ listVoices(): Promise; /** * Get supported languages */ listLanguages(): Promise; /** * Handle a tool call by name */ handleToolCall(toolName: string, args: Record): Promise; /** * Handle tool call and return JSON string result */ handleToolCallJson(toolName: string, args: Record): Promise; /** * Get OpenAI-compatible function schemas */ getFunctionSchemas(): FunctionSchema[]; /** * Get tools in OpenAI function calling format */ getOpenAITools(): Array<{ type: 'function'; function: FunctionSchema; }>; /** * Save audio from result to file (Node.js only) */ saveAudio(result: TTSToolResult, outputPath: string): Promise; /** * Get audio buffer from result */ getAudioBuffer(result: TTSToolResult): Buffer | null; /** * Get audio as Uint8Array (for browser compatibility) */ getAudioUint8Array(result: TTSToolResult): Uint8Array | null; } /** * Create a LangVoice toolkit instance */ declare function createLangVoiceToolkit(apiKey?: string): LangVoiceToolkit; export { LangVoiceToolkit, type LanguagesToolResult, type TTSToolResult, type ToolResult, type VoicesToolResult, createLangVoiceToolkit };