import { DebugOption } from '../../logger/types.js'; import { AudioAdapter } from './adapter.js'; import { AudioGenerationResult, StreamChunk } from '../../types.js'; /** The adapter kind this activity handles */ export declare const kind: "audio"; /** * Extract provider options from an AudioAdapter via ~types. */ export type AudioProviderOptions = TAdapter extends { '~types': { providerOptions: infer P extends object; }; } ? P : object; /** * Options for the audio generation activity. * The model is extracted from the adapter's model property. * * @template TAdapter - The audio adapter type * @template TStream - Whether to stream the output */ export interface AudioActivityOptions>, TStream extends boolean = false> { /** The audio adapter to use (must be created with a model) */ adapter: TAdapter & { kind: typeof kind; }; /** Text description of the desired audio */ prompt: string; /** Desired duration in seconds */ duration?: number; /** Provider-specific options for audio generation */ modelOptions?: AudioProviderOptions; /** * Whether to stream the generation result. * When true, returns an AsyncIterable for streaming transport. * When false or not provided, returns a Promise. * * @default false */ stream?: TStream; /** * Enable debug logging. Pass `true` to enable all categories, `false` to * silence everything including errors, or a `DebugConfig` object for granular * control and/or a custom `Logger`. */ debug?: DebugOption; } /** * Result type for the audio generation activity. * - If stream is true: AsyncIterable * - Otherwise: Promise */ export type AudioActivityResult = TStream extends true ? AsyncIterable : Promise; /** * Audio generation activity - generates audio from text prompts. * * Uses AI models to create music, sound effects, and other audio content. * * @example Generate music from a prompt * ```ts * import { generateAudio } from '@tanstack/ai' * import { falAudio } from '@tanstack/ai-fal' * * const result = await generateAudio({ * adapter: falAudio('fal-ai/diffrhythm'), * prompt: 'An upbeat electronic track with synths', * duration: 10 * }) * * console.log(result.audio.url) // URL to generated audio * ``` */ export declare function generateAudio>, TStream extends boolean = false>(options: AudioActivityOptions): AudioActivityResult; /** * Create typed options for the generateAudio() function without executing. */ export declare function createAudioOptions>, TStream extends boolean = false>(options: AudioActivityOptions): AudioActivityOptions; export type { AudioAdapter, AudioAdapterConfig, AnyAudioAdapter, } from './adapter.js'; export { BaseAudioAdapter } from './adapter.js';