generateMusic abstract method

Future<GenerationResult> generateMusic(
  1. MusicRequest request, {
  2. void onProgress(
    1. GenerationProgress
    )?,
})

Generates a music track for request.

Calls onProgress with lifecycle updates when provided. Completes with a GenerationResult whose bytes are the encoded audio.

Throws an AiException subclass when the call fails: AiAuthException for rejected credentials, AiRateLimitException when rate limited, AiInvalidRequestException for a rejected request, AiTransientException for a network or 5xx failure, or AiResponseException for an unusable response body. A provider that runs the request as a long-running job (polled until it finishes) throws an AiTimeoutException when the poll deadline passes.

Implementation

Future<GenerationResult> generateMusic(
  MusicRequest request, {
  void Function(GenerationProgress)? onProgress,
});