resultWithAudio
resultWithAudio(
result,audioData,options?):GadgetExecuteResultWithMedia
Defined in: gadgets/helpers.ts:374
Create a result with a single audio output.
Parameters
Section titled “Parameters”result
Section titled “result”string
Text result string
audioData
Section titled “audioData”Raw audio data (MP3, WAV, OGG, etc.)
Buffer<ArrayBufferLike> | Uint8Array<ArrayBufferLike>
options?
Section titled “options?”AudioOptions
Optional MIME type, description, duration, cost
Returns
Section titled “Returns”A GadgetExecuteResultWithMedia
Example
Section titled “Example”const speech = await generateSpeech(text);return resultWithAudio( `Generated speech for: "${text.slice(0, 50)}..."`, speech, { mimeType: "audio/mp3", durationMs: 5000 });