Melange
API ReferenceFlutter

MultimodalPipeline

API reference for LFM2.5-Audio embedding-prefill inference in Flutter.

This preview API reflects zetic_mlange 1.11.1.

ZeticMLangeMultimodalPipeline runs the supported LFM2.5-Audio embedding-prefill profile. Supply embeddings from a compatible external audio encoder; raw audio inputs, backend selection, and generation tuning are not part of the public API.

Import

import 'package:zetic_mlange/zetic_mlange.dart';

MultimodalProfile

MultimodalProfile.lfmAudioPrefill({
  required String backboneGgufPath,
})

lfmAudioPrefill(...) is the only supported public multimodal profile. Its embedding must be compatible with the selected LFM2.5-Audio backbone.

Create a Pipeline

static Future<ZeticMLangeMultimodalPipeline> create({
  required MultimodalProfile profile,
})

Creation completes with MlangeException when the native pipeline cannot be initialized.

final pipeline = await ZeticMLangeMultimodalPipeline.create(
  profile: MultimodalProfile.lfmAudioPrefill(
    backboneGgufPath: backbonePath,
  ),
);

Stream a Response

Stream<String> respond({
  required String systemPrompt,
  required String userText,
  required Float32List embedding,
})

respond(...) emits UTF-8 text fragments as they are generated. A generation failure is delivered through the stream as MlangeException; cancelling the subscription cancels native generation and completes the stream normally.

await for (final token in pipeline.respond(
  systemPrompt: 'Answer briefly.',
  userText: 'What did you hear?',
  embedding: audioEmbedding,
)) {
  append(token);
}

Cancelling the StreamSubscription stops native generation and completes the stream normally. Consume or cancel a response before starting another operation on the same pipeline.

Reset and Close

void resetSession()
void close()
bool get isClosed

resetSession() clears the conversation state so the next response starts fresh. Call close() when the pipeline is no longer needed.

On this page