MultimodalPipeline
API reference for LFM2.5-Audio embedding-prefill inference on iOS.
This preview API reflects ZeticMLange iOS 1.11.0.
MultimodalPipeline 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 ZeticMLangeMultimodalProfile
static func lfmAudioPrefill(
backboneGgufPath: String
) -> MultimodalProfilelfmAudioPrefill(backboneGgufPath:) is the only supported public multimodal profile. Its embedding must be compatible with the selected LFM2.5-Audio backbone.
Create a Pipeline
public static func create(
profile: MultimodalProfile
) throws -> MultimodalPipelineCreation throws when the pipeline cannot be initialized, including a missing or incompatible backbone.
let pipeline = try MultimodalPipeline.create(
profile: .lfmAudioPrefill(backboneGgufPath: backbonePath)
)Stream a Response
public func respond(
systemPrompt: String,
userText: String,
embedding: [Float]
) -> AsyncThrowingStream<String, Error>respond(...) yields UTF-8 text fragments as they are generated. Generation failures terminate the stream with an error; cancelling iteration stops generation and ends the stream normally.
for try await token in pipeline.respond(
systemPrompt: "Answer briefly.",
userText: "What did you hear?",
embedding: audioEmbedding
) {
append(token)
}Cancelling the consuming task stops native generation and completes the stream normally. Consume or cancel a response before starting another operation on the same pipeline.
Errors
MultimodalPipeline.PipelineError reports pipeline creation and native generation failures. Its localized description is suitable for displaying or logging the immediate failure reason.
Reset a Session
public func resetSession()resetSession() clears the conversation state so the next response starts fresh.