/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { llmSpeechSpeakStreaming } from "../../funcs/llmSpeechSpeakStreaming.js"; import * as operations from "../../models/operations/index.js"; import { formatResult, ToolDefinition } from "../tools.js"; const args = { request: operations.TextToSpeechStreamingRequest$inboundSchema, }; export const tool$llmSpeechSpeakStreaming: ToolDefinition = { name: "llm-speech-speak-streaming", description: `Streaming text to speech Convert text to speech with real-time streaming audio delivery. **Key Features:** - Low-latency audio streaming - playback can start immediately as chunks arrive - Automatic language detection - Multiple format support: MP3 or PCM/WAV - High-quality audio: 24kHz sample rate, 16-bit mono **Request Body:** - \`text\`: Input text to convert to speech - required - \`language\`: Language code (default: "auto") - "auto" for automatic detection, or ISO 639-1 codes: en, zh, hi, es, ar, bn, pt, ru, ja, pa, de, ko, fr, tr, it, th, pl, nl, id, vi, ur - \`format\`: Audio format (default: "mp3") - "mp3" for compressed MPEG audio (96 kbps) or "pcm" for uncompressed WAV - \`model\`: TTS model identifier (default: "auto") - "auto" selects the default provider; a registry-resolvable id dispatches to the matching provider (note: not all providers support \`format: "mp3"\`) **Response:** - Streams audio chunks in real-time - Returns \`X-Language-Code\` header with detected/used language - Content-Type: \`audio/mpeg\` (MP3) or \`audio/wav\` (PCM) - When \`store\` is \`true\`, returns the \`X-Tts-Id\` header with the id the history record will be stored under; persistence is best-effort and completes shortly after the stream ends **Use Cases:** - Real-time applications requiring immediate audio playback - Interactive voice responses - Low-latency text-to-speech scenarios`, args, tool: async (client, args, ctx) => { const [result, apiCall] = await llmSpeechSpeakStreaming( client, args.request, { fetchOptions: { signal: ctx.signal } }, ).$inspect(); if (!result.ok) { return { content: [{ type: "text", text: result.error.message }], isError: true, }; } const value = result.value.result; return formatResult(value, apiCall); }, };