Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
1ee5b65
Index pages outside the navigation for search and the assistant
iamleonie Nov 11, 2026
4e25d71
Show the Ask Assistant box in the desktop header again
iamleonie Nov 11, 2026
05e46cf
Fix LFM2-8B-A1B model name typo on the Ollama page
iamleonie Nov 11, 2026
8b5dedc
Point readers from deprecated models to their replacements
iamleonie Nov 11, 2026
59a7d3e
Redirect old and mistyped URLs that people still visit
iamleonie Nov 11, 2026
37030d6
Add assistant instructions for hardware, benchmark and persona questions
iamleonie Nov 11, 2026
098141e
Name embeddings, reranking and RAG on retrieval model pages
iamleonie Nov 11, 2026
f29f7de
Exclude docs maintenance material from indexing
alay2shah Nov 11, 2026
409f7ae
Restore indexing for deprecated tool references with warnings
alay2shah Nov 11, 2026
4e2c61d
Use format-specific repositories for assistant download sizes
alay2shah Nov 11, 2026
1c733f3
Merge remote-tracking branch 'origin/main' into codex/pr172-indexing
alay2shah Nov 13, 2026
69b1240
Organize ColBERT quickstart by retrieval and reranking
alay2shah Nov 13, 2026
43a91a6
Match Sentence Transformers tab label on embedding page
alay2shah Nov 13, 2026
9a28540
Link invoice extractor readers to newer LFM3 vision model
alay2shah Nov 13, 2026
d35a9ae
Use verified evaluation sources in assistant benchmark answers
alay2shah Nov 13, 2026
b8cc63e
Recommend current audio and decision models in FAQ
alay2shah Nov 13, 2026
1a5d034
Add deprecation notes to remaining legacy audio demos
alay2shah Nov 13, 2026
8e8267f
Lead general model guidance with LFM3
alay2shah Nov 13, 2026
7fcd40d
Link legacy model deprecations directly to current replacements
alay2shah Nov 13, 2026
1b21fbe
Expose LFM3 audio and omni ONNX formats
alay2shah Nov 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .mintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
MODEL-MATRIX.md
DESIGN.md
CLAUDE.md
INTERACTIVE_QUICKSTART_WIDGET.md
27 changes: 27 additions & 0 deletions .mintlify/Assistant.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Liquid Docs assistant instructions

## Speed, memory, and hardware

The docs don't list measured speed, RAM use, or download size for every model and device. When someone asks how fast a model is, how much memory it needs, how big the download is, or whether it runs on a specific device (phone, Raspberry Pi, Jetson, laptop, GPU):

- Give any figure that the model's own page states, and cite that page.
- Point them to [Pipette](https://pipette.liquid.ai), Liquid AI's benchmarking site with speed and memory measured on real devices.
- For download size, start with the model's documentation page and follow its exact Hugging Face link for the requested format and precision (HF, GGUF, MLX, ONNX, or another listed format). Preserve the repository owner and name; conversions may be published by `mlx-community` or `onnx-community`, not only `LiquidAI`. Don't construct repository URLs from the model name.
- Link the selected repository's Files tab. Quote a size only if it is stated in the docs or verified in that file listing. If the format or precision is unspecified, explain that download size depends on those choices and link the available formats.
- Count the selected weights and any required shards, projectors, codecs, or other companion files described by the model's setup instructions. A repository's total size may include several alternative quantizations; it is not the download size for one choice. Download size is not runtime RAM usage.

Don't estimate tokens per second or RAM use yourself.

## Benchmark scores and model comparisons

When someone asks for benchmark results, quality scores, or a comparison with other models:

- Start with the model's documentation page and cite any published evaluation results it provides.
- Follow the exact Hugging Face model-card links or evaluation sources linked from that page. Don't construct repository URLs from the model name.
- Don't assume every model has a Hugging Face repository or published benchmark scores. For API-only models such as d1-ultra and d1.1, use published evaluation sources linked from their documentation when available. If no published results are available in those sources, say so.
- Don't make up or estimate scores.

## Questions about this assistant

If someone asks which model powers you, say you're the Liquid Docs assistant, provided by Mintlify, and that you don't run on a Liquid Foundation Model.
To try LFMs, point them to the [Liquid Playground](https://playground.liquid.ai) to chat with the models in the browser, the [Liquid API quickstart](/api/quickstart).
1 change: 0 additions & 1 deletion deployment/on-device/leap-sdk-changelog.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
title: "Changelog"
description: "Release notes for the LEAP SDK, including the 0.9.x → 0.10.x Kotlin Multiplatform transition."

Check warning on line 3 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L3

Did you really mean 'Multiplatform'?
noindex: true
---

<Warning>
Expand All @@ -12,9 +11,9 @@

This page covers user-visible changes in the LEAP SDK across releases. For per-build commit detail, see the release notes on [`Liquid4All/leap-sdk`](https://github.com/Liquid4All/leap-sdk/releases).

## 0.9.x → 0.10.x: Kotlin Multiplatform unification

Check warning on line 14 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L14

Did you really mean 'Multiplatform'?

Starting with v0.10.0, the LEAP SDK ships from a single Kotlin Multiplatform codebase. The two previously separate distributions (the Android-only `ai.liquid.leap:*` Maven artifacts and the iOS-only `Liquid4All/leap-ios` Swift package) were collapsed into one source tree that publishes to:

Check warning on line 16 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L16

Did you really mean 'Multiplatform'?

- **Swift Package Manager** — [`Liquid4All/leap-sdk`](https://github.com/Liquid4All/leap-sdk) (new repo, for iOS / macOS consumers).
- **Maven Central** — `ai.liquid.leap:*` (Android, JVM, and Kotlin/Native targets).
Expand All @@ -30,7 +29,7 @@
| `LeapSDK` | `ai.liquid.leap:leap-sdk` | Core inference + conversation API |
| `LeapModelDownloader` | `ai.liquid.leap:leap-model-downloader` | Hosted / manifest-based model fetch |
| `LeapOpenAIClient` | `ai.liquid.leap:leap-openai-client` | OpenAI-compatible cloud chat client (new in 0.10.0) |
| `LeapUI` | `ai.liquid.leap:leap-ui` | Voice assistant widget — Compose Multiplatform (new in 0.10.0) |

Check warning on line 32 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L32

Did you really mean 'Multiplatform'?
| `LeapSDKMacros` | _(Swift only)_ | `@Generatable` / `@Guide` constrained-generation macros |

### Breaking changes for iOS consumers
Expand All @@ -41,8 +40,8 @@

- **SPM URL change.** Point your Swift Package Manager dependency at `https://github.com/Liquid4All/leap-sdk.git` (not the deprecated `leap-ios` repo).
- **CocoaPods removed.** The SDK ships exclusively through SPM in v0.10.0 onward.
- **Toolchain bump.** Xcode 16 and Swift 6.0 are required.

Check warning on line 43 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L43

Did you really mean 'Toolchain'?

Check warning on line 43 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L43

Did you really mean 'Xcode'?
- **Swift downloader name.** In current 0.10.x, Swift code instantiates `ModelDownloader` from the `LeapModelDownloader` SPM product. Android code still uses the Kotlin class `ai.liquid.leap.downloader.LeapModelDownloader`. See [Model Loading](/deployment/on-device/sdk/model-loading) for the constructor signatures.

Check warning on line 44 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L44

Did you really mean 'downloader'?

## Major additions since 0.9.x

Expand All @@ -56,11 +55,11 @@

### Voice assistant widget

`LeapUI` / `leap-ui` is a Compose Multiplatform module that ships a drop-in voice assistant widget — an animated orb, mic button, and status label — backed by a state machine that handles recording, generation, and audio playback. Stable on iOS, macOS, Android, and JVM; Wasm/Web is present in the source tree as preview.

Check warning on line 58 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L58

Did you really mean 'Multiplatform'?

See [Voice Assistant Widget](/deployment/on-device/sdk/voice-assistant).

### Sideloading models from explicit paths

Check warning on line 62 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L62

Did you really mean 'Sideloading'?

`LeapDownloader.loadSimpleModel` and `LeapModelDownloader.loadSimpleModel` load a model from explicit resource paths or URLs without going through the LEAP Model Library manifest. Useful for ADB-pushed bundles, app-bundled models, or any setup where you've already placed the model files on disk.

Expand All @@ -68,16 +67,16 @@

### iOS background downloads

The iOS / macOS Swift `ModelDownloader(sessionConfiguration:)` initializer accepts an optional `URLSessionConfiguration?` so downloads can continue when the app is suspended or killed. See [Model Loading → Constructing the downloader](/deployment/on-device/sdk/model-loading#constructing-the-downloader).

Check warning on line 70 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L70

Did you really mean 'initializer'?

### `autoDetectCompanionFiles`

`Leap.load(url:options:)` on iOS gained an `autoDetectCompanionFiles: Bool = true` parameter that picks up companion files sitting next to the model file (e.g. multimodal projection weights).

Check warning on line 74 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L74

Did you really mean 'multimodal'?

### Swift ergonomics

- **Compatibility layer** keeps 0.9.x call sites (`Leap.load(...)`, `Conversation.generateResponse(...)`) compiling on top of the unified KMP surface.
- **`onEnum(of:)`** — SKIE-bridged sealed-class switching for Kotlin enums and sealed hierarchies (e.g. `MessageResponse`).

Check warning on line 79 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L79

Did you really mean 'enums'?
- **`ChatMessageContent` static factories** — `.text(...)`, `.image(...)`, `.audio(...)` helpers instead of constructor calls.
- **Builder-style options** — `LiquidInferenceEngineOptions.with(cacheOptions:)`, etc.

Expand All @@ -85,11 +84,11 @@

Starting in **v0.10.4** and on by default through the current release, the inference engine loads model weights via `mmap` (`use_mmap=true`). It's the default behavior for every loaded model. On mobile this is the most user-visible runtime change in the 0.10.x line. A public opt-out arrived in **v0.10.5** as `ModelLoadingOptions.useMmap: Boolean?` (Kotlin) / `LiquidInferenceEngineOptions(useMmap:)` (Swift) — leave it `null`/`nil` to keep the default, or set `false` for filesystems where `mmap` misbehaves (some Android scoped-storage paths, certain network mounts).

**What changed.** Previously the engine `read(2)`-ed the entire model file into a heap-allocated buffer before running prefill. Now it memory-maps the file: the kernel maps the on-disk weights into the process's virtual address space and loads pages lazily as they're accessed.

Check warning on line 87 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L87

Did you really mean 'prefill'?

**Performance implications on mobile:**

- **Lower private RSS.** mmap'd weights are file-backed pages, not "anonymous private" RSS. iOS's jetsam and Android's low-memory killer both score apps primarily by anonymous RSS, so a 1.2B-Q4 model that previously counted as ~700 MB of dirty heap now shows as backing pages the OS may evict for free. Foreground apps are significantly less likely to be terminated under memory pressure.

Check warning on line 91 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L91

Did you really mean 'mmap'd'?
- **Faster cold load.** The constructor returns as soon as the file is mapped — typically tens of milliseconds — instead of waiting for the entire model to be read into RAM. The first inference pays the page-in cost incrementally as the engine touches weights.
- **Faster warm reloads.** After the first load, the kernel's page cache holds the model's hot pages. Re-creating a runner on the same model (e.g. after a background termination and relaunch within the same boot) is near-instant — pages stream from the page cache, not disk.
- **Multi-model sharing.** Two processes (or two runners in one process) loading the same model file share physical pages via the page cache, with no extra RAM cost.
Expand All @@ -97,7 +96,7 @@

**Trade-offs:**

- **First-token latency on cold pages.** The first generation against a freshly-mapped model triggers page faults as the engine walks the weights. This adds disk-I/O latency to TTFT on the first call after process start. The KV cache reuse documented [above](#kv-cache-reuse-across-generations) compounds well here: cached prefixes skip both prefill compute *and* the page-fault cost for weights touched during prefill.

Check warning on line 99 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L99

Did you really mean 'prefill'?

Check warning on line 99 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L99

Did you really mean 'prefill'?
- **Storage type matters.** On devices with slow eMMC / external SD storage, lazy page-in can be noticeably slower than the old eager-read flow that loaded the whole file once. Internal flash on every shipped iOS device and any modern Android device is fast enough that this isn't visible in practice.
- **Opt-out available since v0.10.5.** Pass `useMmap = false` on `ModelLoadingOptions` (Kotlin) or `LiquidInferenceEngineOptions(useMmap: false)` (Swift) to force the legacy full-read loader. Use only when `mmap` misbehaves on the target filesystem; the default of `null`/`nil` keeps the engine default.

Expand All @@ -105,13 +104,13 @@

### KV cache reuse across generations

`CacheOptions` (new in v0.10.4, ergonomic Swift surface in v0.10.4.3) lets the engine persist KV-cache data between `generateResponse` calls so requests that share a prompt prefix skip the prefill work for the shared tokens.

Check warning on line 107 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L107

Did you really mean 'prefill'?

<Warning>
**Disabled by default.** `cacheOptions` is `nil` (Swift) / `null` (Kotlin) until you explicitly pass `LiquidCacheOptions.enabled(path:)` / `ModelLoadingOptions.cacheOptions(path:)`. Apps that don't opt in see no prefix reuse and no on-disk cache directory created — same behavior as 0.9.x and pre-0.10.4 builds.
</Warning>

**Why it matters.** Transformer inference has two phases: **prefill** (compute keys and values for every prompt token) and **decode** (generate one new token at a time, reusing those K/V vectors). On mobile, prefill dominates time-to-first-token for any prompt longer than a few hundred tokens. With `CacheOptions` enabled, a previously seen prefix is read from disk instead of recomputed — TTFT can drop from seconds to under a hundred milliseconds on cache hits. Per-token decode cost is unchanged.

Check warning on line 113 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L113

Did you really mean 'prefill'?

Check warning on line 113 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L113

Did you really mean 'prefill'?

**When it speeds things up.** Anywhere the same tokens appear at the start of many requests:

Expand All @@ -119,7 +118,7 @@
- **RAG / retrieval-augmented generation.** Many queries share the retrieved-document preamble.
- **Few-shot prompting.** A fixed set of examples precedes every request.
- **Agent loops.** Tool definitions, role instructions, and task scaffold are stable across iterations.
- **Voice assistant continuations.** Conversation history grows; everything before the latest user turn is cacheable.

Check warning on line 121 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L121

Did you really mean 'cacheable'?

The cache is a bounded LRU — the engine caps cache size and evicts the least-recently-used entries automatically; you do not need to manage the directory yourself. See [Model Loading → KV cache reuse](/deployment/on-device/sdk/model-loading#kv-cache-reuse) for the per-platform configuration.

Expand Down Expand Up @@ -158,14 +157,14 @@

**New targets on `leap-openai-client`** ([PR #256](https://github.com/Liquid4All/leap-android-sdk/pull/256)):

- **`jvm`** (Ktor CIO engine) — Maven Central now publishes `ai.liquid.leap:leap-openai-client-jvm:0.10.7`. Pure-JVM desktop / server apps can route OpenAI-compatible chat completions without dragging in Android or KMP targets. (The 0.10.0 — 0.10.6 SPM cascade only shipped Android + Apple + Linux/MinGW K/N + wasmJs metadata; the JVM slice was absent.)

Check warning on line 160 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L160

Did you really mean 'Ktor'?

Check warning on line 160 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L160

Did you really mean 'wasmJs'?
- **`wasmJs`** (Ktor Js engine) — browser-side chat-completions client matching what `leap-sdk` already targets.

Check warning on line 161 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L161

Did you really mean 'Ktor'?

Check warning on line 161 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L161

Did you really mean 'Js'?

The Apple slice (`LeapOpenAIClient.xcframework`) ships unchanged — same SSE-stream surface, same `OpenAiClientConfig`, same OpenRouter extra-headers support. SKIE is still not applied to this module in v0.10.7, so the Kotlin/Native exports remain the same as v0.10.6: `Flow<ChatCompletionEvent>` is not bridged to Swift `AsyncSequence`, and `onEnum(of:)` is not generated for `ChatCompletionEvent`. **The next release will enable SKIE on `leap-sdk-openai-client`**, bringing `for try await` over the stream, exhaustive `onEnum(of:)` switching, and SKIE-bundled Swift convenience inits — see the [OpenAI client page](/deployment/on-device/sdk/openai-client) for the current pinning guidance.

Check warning on line 163 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L163

Did you really mean 'inits'?

**Bytecode hardening:**

- The `leap-sdk-jvm`, `leap-openai-client-jvm`, `leap-ui-jvm`, and `leap-ui-android` artifacts had been silently shipping Java 17 / Java 21 bytecode against the project's stated JVM-target-11 stance. All ten published JVM / Android slices now consistently emit class-file major version `0x37` (Java 11). Consumers running on JDK 11 — particularly long-running services and JDK-11-pinned Android Gradle builds — are no longer at risk of `UnsupportedClassVersionError`.

Check warning on line 167 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L167

Did you really mean 'Gradle'?

**Internal: KMP build centralization** (no consumer-visible API change):

Expand All @@ -178,7 +177,7 @@

**iOS surface (unchanged from v0.10.6):**

The four XCFrameworks (`LeapSDK`, `LeapModelDownloader`, `LeapOpenAIClient`, `LeapUi`) ship the same Swift APIs as v0.10.6. The v0.10.6 ObjC class rename to `ModelDownloader`, the dual-import guard, the dynamic `LeapModelDownloader` framework, and the `LeapDownloaderConfig()` parameterless init all remain in place.

Check warning on line 180 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L180

Did you really mean 'XCFrameworks'?

### v0.10.6 — 2026-05-12

Expand All @@ -186,9 +185,9 @@

**New iOS API on `ModelDownloader`:**

- **`loadModel(modelName:, quantizationType:, options:, generationTimeParameters:, forceDownload:, downloadProgress:)`** — downloads (when needed) and loads in one call. The transfer registers in `queryStatus`, is cancellable via `requestStopDownload`, and continues across backgrounding when constructed with `sessionConfiguration: .backgroundSessionConfiguration(withIdentifier:)`.

Check warning on line 188 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L188

Did you really mean 'backgrounding'?
- **`loadModel(manifestUrl:, options:, generationTimeParameters:, forceDownload:, downloadProgress:)`** — same flow keyed by a manifest URL.
- **`loadSimpleModel(model: ModelSource, options:, generationTimeParameters:, downloadProgress:)`** — sideload from explicit paths or URLs; HTTPS sources stream through `URLSession`, local paths pass straight through.

Check warning on line 190 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L190

Did you really mean 'sideload'?
- **`forceDownload: Bool = false`** on all three load methods. Resolves the manifest first, then deletes the local cache, then re-downloads — a registry failure on resolve leaves the previously-working cached copy intact.
- **Resource-lookup helpers** that previously lived only on the cross-platform `LeapDownloader`: `getModelResourceFolder(...)`, `getCachedManifest(...)`, `getCachedFilePath(...)`, `resolve(...)`, `deleteModelFile(...)`.
- **`requestDownloadModel(manifestUrl:, forceDownload:)`** overload for symmetry with `removeModel(manifestUrl:)` / `queryStatus(manifestUrl:)`.
Expand All @@ -202,18 +201,18 @@
```
- **Parameter labels renamed across the iOS `ModelDownloader` surface** — `model:` / `quantization:` → `modelName:` / `quantizationType:` on every method that already existed: `downloadModel(...)`, `requestDownloadModel(...)`, `requestStopDownload(...)`, `queryStatus(...)`, `removeModel(...)`, `getModelSize(...)`. Every loader now uses the same labels across Swift and Kotlin — `ModelDownloader` (iOS, macOS), `LeapModelDownloader` (Android), and `LeapDownloader` (cross-platform) all share `modelName:` / `quantizationType:`.
- **`LeapModelDownloader` SPM library product is now single-target.** It no longer bundles the `LeapSDK` target. Apps depending on this product must drop any direct `LeapSDK` SPM dependency from the same target — `import LeapModelDownloader` re-exports every LeapSDK Kotlin type (`Conversation`, `ModelRunner`, `ChatMessage`, `Leap`, the convenience extensions, …). Keeping both library products on the same target double-bundles the inference engine dylibs and triggers a build-time `#error` from the LMD umbrella header (see "dual-import guard" below); the `LeapUI` library product still bundles `LeapSDK` because LeapUI does not re-emit those types in its ObjC binding.
- **`LeapModelDownloader.xcframework` is now a dynamic framework.** It was a static archive in 0.10.5. SPM applies Embed & Sign automatically; manual integrators must add the framework with "Embed & Sign" instead of "Do Not Embed". The shipped XCFramework now also bundles the inference engine dylibs (`libinference_engine.dylib`, `libinference_engine_llamacpp_backend.dylib`, `libie_zip.dylib`) under `Frameworks/` with an `@loader_path/Frameworks` LC_RPATH — consumers using LMD on its own no longer need `LeapSDK.framework/Frameworks` on their search path.

Check warning on line 204 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L204

Did you really mean 'XCFramework'?

Check warning on line 204 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L204

Did you really mean 'dylibs'?
- **Dual-import build-time guard.** LMD's umbrella header carries a `__has_include(<LeapSDK/LeapSDK.h>) && !defined(LEAP_DUAL_IMPORT_ALLOW)` check that fires `#error` at the consumer's preprocessing time when both `LeapSDK` and `LeapModelDownloader` frameworks are reachable in the same target. To opt out for legitimate combinations (e.g. transitive linkage via `LeapUI`), add `LEAP_DUAL_IMPORT_ALLOW=1` to `OTHER_CFLAGS`.

**New Swift conveniences:**

- **`ModelDownloader()`**, **`ModelDownloader(sessionConfiguration:)`**, **`ModelDownloader(config:)`** — Kotlin/Native ObjC export strips default-argument metadata, so 0.10.5 forced Swift callers to pass every parameter (and `LeapDownloaderConfig` has seven). These new SKIE-bundled convenience inits restore the parameterless / single-arg forms.
- **`LeapDownloaderConfig()`** parameterless convenience init mirroring the Kotlin defaults (`saveDir = "leap_models"`, `validateSha256 = true`, etc.). Same rationale — `LeapDownloaderConfig` is a Kotlin `data class` with seven defaulted fields that the ObjC export couldn't carry through.

Check warning on line 210 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L210

Did you really mean 'parameterless'?

**Behavior changes:**

- **`requestDownloadModel(forceDownload: false)`** now short-circuits when a cached manifest already exists *and* every resource referenced by that manifest is present on disk — matches both the Android downloader's idempotent-call semantics and what `queryStatus(...)` already reports. Earlier 0.10.5 builds would short-circuit on the manifest alone, leaving the caller stuck if any resource file had been removed. Pass `forceDownload: true` to re-download on top of a cache.

Check warning on line 214 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L214

Did you really mean 'downloader's'?
- **Cached-file lookup** uses Ktor URL parsing instead of substring slicing, so URLs with fragments or query strings now produce the same filename the loader expects (`getCachedFilePath` was previously brittle for those shapes).

Check warning on line 215 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L215

Did you really mean 'Ktor'?

Check warning on line 215 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L215

Did you really mean 'substring'?

**Fixes:**

Expand All @@ -233,11 +232,11 @@

- **`ModelLoadingOptions.cacheDir: String?` → `cacheOptions: EngineOptions.CacheOptions?`** — KV cache configuration moves to a bounded-LRU `CacheOptions` value with explicit `enabled` master switch, per-tier caps (`maxEntriesDisk`, `maxEntriesMemory`, `maxBytesMemory`), and optional `diskDisabled = true` for memory-only mode. Migrate via the `ModelLoadingOptions.cacheOptions(path = ...)` factory (preserves the historical 40-entry disk budget and sets `enabled = true`). Constructing a raw `CacheOptions` requires `enabled = true` to enable the cache — a positive `maxEntries` alone is no longer sufficient.
- **`LeapDownloader.loadModel(modelName, quantizationSlug, modelLoadingOptions, …)` → `loadModel(modelName, quantizationType, options, …)`** — parameter renames bring `LeapDownloader` in line with `LeapModelDownloader`. The same rename applies to `loadSimpleModel(model, modelLoadingOptions, …)` → `loadSimpleModel(model, options, …)` and `loadModelFromManifestUrl(…)`. Swift sites that called `downloader.loadModel(modelName:, quantizationSlug:, modelLoadingOptions:)` need to swap to `quantizationType:` / `options:` after upgrading.
- **`progress` is now nullable** (`progress: ((ProgressData) -> Unit)? = null`) — pass `null` to opt out (was an empty-lambda default).

Check warning on line 235 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L235

Did you really mean 'nullable'?

**New features:**

- **`ModelLoadingOptions.useMmap: Boolean? = null`** — exposes the engine's `use_mmap` toggle to Kotlin/Swift callers. `null` (default) defers to the engine default of `true`. Set `false` only on filesystems where `mmap` misbehaves (some Android scoped-storage paths, certain network mounts). On Swift, `LiquidInferenceEngineOptions` gained a matching `.with(useMmap:)` builder. Previously mmap could not be disabled from the SDK.

Check warning on line 239 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L239

Did you really mean 'mmap'?
- **Leap Model Service (Android)** — `leap-model-service` is a new optional Android service that hosts loaded models in its own process and lets multiple client apps share them. Apps using `LeapModelDownloader.loadModel(...)` route through the service transparently when it's installed on the device; otherwise they fall back to in-process loading. Per-UID session quotas, persistent foreground notification, disk-backed KV cache reuse across cold starts, and AIDL-routed `registerFunction(s)`. Pass `forceLocal = true` on `LeapModelDownloader.loadModel(...)` to bypass the service for testing. See [Model Loading](/deployment/on-device/sdk/model-loading) for the routing model.
- **Service-side load progress** — when routing through the model service, `LeapModelDownloader.loadModel`'s `progress` callback now fires for service-side downloads too (was previously local-path-only).

Expand Down Expand Up @@ -266,7 +265,7 @@
- New `with(cacheOptions:)` builders on `LiquidInferenceEngineOptions` and `LiquidInferenceEngineManifestOptions`.
- New `LiquidCacheOptions.enabled(path:)` static factory — Swift analog of `ModelLoadingOptions.cacheOptions(path:)`.

(v0.10.4.2 was staged to Sonatype but never released; superseded by 0.10.4.3.)

Check warning on line 268 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L268

Did you really mean 'Sonatype'?

### v0.10.4.1 — 2026-05-07

Expand All @@ -274,10 +273,10 @@

### v0.10.4 — 2026-05-06

- **Bounded-LRU `CacheOptions` API** across JVM, Android, Kotlin/Native, Apple, and wasmJs.

Check warning on line 276 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L276

Did you really mean 'wasmJs'?
- **`use_mmap=true` is now the engine default** (via vendored IE pin `v26.02.1-79+`). Model weights are memory-mapped instead of `read(2)`-ed into a heap buffer. See [Memory-mapped model loading by default](#memory-mapped-model-loading-by-default) above for the mobile performance impact.

Check warning on line 277 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L277

Did you really mean 'vendored'?
- K/N Linux link fix (`--allow-shlib-undefined` for `libinference_engine.so` against modern glibc).

Check warning on line 278 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L278

Did you really mean 'glibc'?
- Dynamic vendor pipeline + `DT_NEEDED`-based shipped-libs verify; `inference_engine` RUNPATH=`$ORIGIN` cascade for Linux/Windows shared vendor libs.

Check warning on line 279 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L279

Did you really mean 'libs'?
- `NativeLibLoader` cross-platform load fixes (resource extraction + Windows pre-load topo-retry).
- Three release-gate smokes (Linux K/N, Apple SwiftPM consumer, Windows JVM) wired into CI.

Expand All @@ -286,9 +285,9 @@
Additive fix release for Linux/MinGW Kotlin/Native consumers. Apple/SPM consumers see no API or behavior changes vs v0.10.0.

- `leap-sdk` Linux/MinGW K/N artifacts on Maven Central now publish a `-natives.zip` classifier containing the runtime `.so`/`.dll` libraries.
- New `ai.liquid.leap.nativelibs` Gradle plugin auto-wires the natives ZIP into consumer K/N executables.

Check warning on line 288 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L288

Did you really mean 'Gradle'?
- `leap-openai-client` now publishes Linux/MinGW K/N klibs.

Check warning on line 289 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L289

Did you really mean 'klibs'?

### v0.10.0 — 2026-04-28

Initial Kotlin Multiplatform unification release. See [the 0.9.x → 0.10.x section above](#0-9-x-0-10-x-kotlin-multiplatform-unification) for the full migration story.

Check warning on line 293 in deployment/on-device/leap-sdk-changelog.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/leap-sdk-changelog.mdx#L293

Did you really mean 'Multiplatform'?
2 changes: 1 addition & 1 deletion deployment/on-device/ollama.mdx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
---
title: "Ollama"
description: "Deploy Liquid AI LFM models with Ollama. Pull, configure, and serve LFM2.5 models locally with an OpenAI-compatible API."

Check warning on line 3 in deployment/on-device/ollama.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ollama.mdx#L3

Did you really mean 'Ollama'?
---

<Tip>
Use Ollama for quick local model serving with a simple CLI or Docker-based deployment.

Check warning on line 7 in deployment/on-device/ollama.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ollama.mdx#L7

Did you really mean 'Ollama'?
</Tip>

Ollama uses GGUF models and supports GPU acceleration (CUDA, Metal, ROCm).

Check warning on line 10 in deployment/on-device/ollama.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ollama.mdx#L10

Did you really mean 'Ollama'?

Check warning on line 10 in deployment/on-device/ollama.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ollama.mdx#L10

Did you really mean 'ROCm'?

<Warning>
The official Ollama v0.17.0 (latest stable) from [ollama.com](https://ollama.com) fails with a `missing tensor 'output_norm.weight'` error on the `lfm2moe` architecture. This affects all LFM MoE models (e.g. LFM2-24B-A2B, LFM2-8A-A1B). To run any LFM MoE model you specifically need [v0.17.1-rc0](https://github.com/ollama/ollama/releases/tag/v0.17.1-rc0) or later.
The official Ollama v0.17.0 (latest stable) from [ollama.com](https://ollama.com) fails with a `missing tensor 'output_norm.weight'` error on the `lfm2moe` architecture. This affects all LFM MoE models (e.g. LFM2-24B-A2B, LFM2-8B-A1B). To run any LFM MoE model you specifically need [v0.17.1-rc0](https://github.com/ollama/ollama/releases/tag/v0.17.1-rc0) or later.

Check warning on line 13 in deployment/on-device/ollama.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ollama.mdx#L13

Did you really mean 'Ollama'?
</Warning>

<div className="colab-link">
<a href="https://colab.research.google.com/github/Liquid4All/docs/blob/main/notebooks/LFM2_Inference_with_Ollama.ipynb" target="_blank">
<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"></img>

Check warning on line 18 in deployment/on-device/ollama.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ollama.mdx#L18

Did you really mean 'Colab'?
</a>
</div>

Expand Down Expand Up @@ -52,15 +52,15 @@
docker exec -it ollama ollama run hf.co/LiquidAI/LFM2.5-1.2B-Instruct-GGUF
```

See the [Ollama Docker documentation](https://ollama.com/blog/ollama-is-now-available-as-an-official-docker-image) for more details.

Check warning on line 55 in deployment/on-device/ollama.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ollama.mdx#L55

Did you really mean 'Ollama'?
</Tab>
</Tabs>

## Using LFM2 Models

Ollama can load GGUF models directly from Hugging Face or from local files.

Check warning on line 61 in deployment/on-device/ollama.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ollama.mdx#L61

Did you really mean 'Ollama'?

### Running GGUFs

Check warning on line 63 in deployment/on-device/ollama.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ollama.mdx#L63

Did you really mean 'GGUFs'?

You can run LFM2 models directly from Hugging Face:

Expand Down Expand Up @@ -107,7 +107,7 @@
PARAMETER stop "<|endoftext|>"
```

Import the model with the Modelfile:

Check warning on line 110 in deployment/on-device/ollama.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ollama.mdx#L110

Did you really mean 'Modelfile'?

```bash
ollama create my-model -f Modelfile
Expand Down Expand Up @@ -138,11 +138,11 @@
ollama run hf.co/LiquidAI/LFM2.5-1.2B-Instruct-GGUF "What is machine learning?"
```

If you imported a model with a custom name using a Modelfile, use that name instead (e.g., `ollama run my-model`).

Check warning on line 141 in deployment/on-device/ollama.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ollama.mdx#L141

Did you really mean 'Modelfile'?

## Serving Models

Ollama automatically starts a server on `http://localhost:11434` with an OpenAI-compatible API for programmatic access.

Check warning on line 145 in deployment/on-device/ollama.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ollama.mdx#L145

Did you really mean 'Ollama'?

### Python Client

Expand All @@ -166,7 +166,7 @@
```

<Accordion title="Curl request examples">
Ollama provides two native API endpoints:

Check warning on line 169 in deployment/on-device/ollama.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ollama.mdx#L169

Did you really mean 'Ollama'?

**Generate API** (simple completion):

Expand All @@ -191,7 +191,7 @@

## Vision Models

LFM2-VL GGUF models can also be used for multimodal inference with Ollama.

Check warning on line 194 in deployment/on-device/ollama.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ollama.mdx#L194

Did you really mean 'multimodal'?

Check warning on line 194 in deployment/on-device/ollama.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ollama.mdx#L194

Did you really mean 'Ollama'?

<Accordion title="Interactive Chat with Images">
Run a vision model directly and provide images in the chat:
Expand All @@ -215,7 +215,7 @@

<Accordion title="Using the API">
```python
from openai import OpenAI

Check warning on line 218 in deployment/on-device/ollama.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ollama.mdx#L218

Did you really mean 'openai'?
import base64

client = OpenAI(
Expand All @@ -224,8 +224,8 @@
)

# Encode image to base64
with open("image.jpg", "rb") as image_file:

Check warning on line 227 in deployment/on-device/ollama.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ollama.mdx#L227

Did you really mean 'rb'?

Check warning on line 227 in deployment/on-device/ollama.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ollama.mdx#L227

Did you really mean 'image_file'?
image_data = base64.b64encode(image_file.read()).decode("utf-8")

Check warning on line 228 in deployment/on-device/ollama.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ollama.mdx#L228

Did you really mean 'image_data'?

response = client.chat.completions.create(
model="hf.co/LiquidAI/LFM2.5-VL-1.6B-GGUF",
Expand Down
1 change: 0 additions & 1 deletion deployment/on-device/sdk/advanced-features.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
title: "Advanced Features"
description: "GenerationOptions, JSONSchemaGenerator, function-calling type references — same surface everywhere."
noindex: true
---

<Warning>
Expand All @@ -16,22 +15,22 @@

<Tabs>
<Tab title="Swift (iOS / macOS)">
`GenerationOptions` is a Kotlin `data class` bridged into Swift. Kotlin parameter defaults don't survive the ObjC bridge, so the canonical Swift idiom is the parameterless init plus chained `.with(...)` builders:

Check warning on line 18 in deployment/on-device/sdk/advanced-features.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/advanced-features.mdx#L18

Did you really mean 'parameterless'?

```swift
public class GenerationOptions {
public var temperature: Float?
public var topP: Float?
public var minP: Float?
public var repetitionPenalty: Float?

Check warning on line 25 in deployment/on-device/sdk/advanced-features.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/advanced-features.mdx#L25

Did you really mean 'repetitionPenalty'?
public var topK: Int32?
public var rngSeed: Int64?

Check warning on line 27 in deployment/on-device/sdk/advanced-features.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/advanced-features.mdx#L27

Did you really mean 'rngSeed'?
public var jsonSchemaConstraint: String?
public var functionCallParser: LeapFunctionCallParser?
public var injectSchemaIntoPrompt: Bool // default true
public var maxTokens: Int32?

Check warning on line 31 in deployment/on-device/sdk/advanced-features.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/advanced-features.mdx#L31

Did you really mean 'maxTokens'?
public var inlineThinkingTags: Bool // default false
public var enableThinking: Bool // default false

Check warning on line 33 in deployment/on-device/sdk/advanced-features.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/advanced-features.mdx#L33

Did you really mean 'enableThinking'?
public var extras: String?

public convenience init()
Expand Down Expand Up @@ -77,7 +76,7 @@
</Tab>
</Tabs>

- **Sampling fields** — `temperature`, `topP`, `minP`, `topK`, and `repetitionPenalty`. Use the model bundle's recommended values; arbitrary defaults from generic tutorials usually underperform.

Check warning on line 79 in deployment/on-device/sdk/advanced-features.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/advanced-features.mdx#L79

Did you really mean 'underperform'?
- **`rngSeed`** — deterministic sampling seed for tests and reproducible runs.
- **`maxTokens`** — maximum completion tokens to generate. Prompt tokens do not count toward this cap.
- **`jsonSchemaConstraint`** — JSON Schema string for constrained generation. Use the higher-level helpers — Swift `options.with(jsonSchema: T.jsonSchema())` / Kotlin `setResponseFormatType<T>()` — instead of writing the schema by hand.
Expand Down
1 change: 0 additions & 1 deletion deployment/on-device/sdk/ai-agent-usage-guide.mdx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
---
title: "AI Agent Usage Guide"
description: "End-to-end recipes for building AI agents with the LEAP SDK — same patterns across iOS, macOS, Android, JVM, and native."
noindex: true
---

<Warning>
The LEAP SDK is deprecated and this page is no longer maintained. Build on llama.cpp directly instead — see [Migrating from LEAP SDK](/deployment/on-device/llama-cpp/migrating-from-leap-sdk).
</Warning>

This guide walks through the patterns for building a real AI agent — multi-turn conversation, function calling with tool dispatch, multimodal inputs, and a complete view-model wiring. The cross-platform pages cover individual APIs in depth — start here for the full picture, then drill into the dedicated references when you need details.

Check warning on line 10 in deployment/on-device/sdk/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/ai-agent-usage-guide.mdx#L10

Did you really mean 'multimodal'?

## Architecture

Expand Down Expand Up @@ -46,7 +45,7 @@
private func handle(_ response: MessageResponse) {
switch onEnum(of: response) {
case .chunk(let chunk):
currentText += chunk.text

Check warning on line 48 in deployment/on-device/sdk/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/ai-agent-usage-guide.mdx#L48

Did you really mean 'currentText'?
case .reasoningChunk(let reasoning):
log("Reasoning:", reasoning.reasoning)
case .functionCalls(let payload):
Expand All @@ -57,7 +56,7 @@
// `audio.samples` is `KotlinFloatArray` — bridge to `[Float]` via
// `LeapSDK.ArrayConversionsKt.floatArrayToNSData(array:)` if your
// renderer expects a Swift array (see the demo in leap-ui-demo/shared/).
audioPlayer.enqueue(audio.samples, sampleRate: Int(audio.sampleRate))

Check warning on line 59 in deployment/on-device/sdk/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/ai-agent-usage-guide.mdx#L59

Did you really mean 'sampleRate'?
case .complete(let completion):
currentText = ""
if let stats = completion.stats {
Expand All @@ -74,7 +73,7 @@
is MessageResponse.Chunk -> _text.value += response.text
is MessageResponse.ReasoningChunk -> Log.d(TAG, "Reasoning: ${response.reasoning}")
is MessageResponse.FunctionCalls -> {
response.functionCalls.forEach { call -> dispatch(call) }

Check warning on line 76 in deployment/on-device/sdk/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/ai-agent-usage-guide.mdx#L76

Did you really mean 'functionCalls'?
}
is MessageResponse.AudioSample -> audioPlayer.enqueue(response.samples, response.sampleRate)
is MessageResponse.Complete -> {
Expand Down Expand Up @@ -168,20 +167,20 @@

Define `runtimeDispatch(_:)` as your tool-call → result router: validate arguments, call the underlying implementation, JSON-encode the result. Register the corresponding `LeapFunction` definitions on the conversation before you start the loop — see [Function Calling](./function-calling).

## Multimodal inputs

Check warning on line 170 in deployment/on-device/sdk/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/ai-agent-usage-guide.mdx#L170

Did you really mean 'Multimodal'?

<Info>
**Multimodality is model-specific.** Most multimodal models ship as text + one other modality (vision OR audio), not both. Send image parts (Swift `ChatMessageContent.fromJPEGData(_:)` / Kotlin `ImageUtils.fromBitmap(...)`) only to a vision-capable model, and audio parts (Swift `ChatMessageContent.fromWAVData(_:)` / Kotlin `ChatMessageContent.Audio(...)`) only to an audio-capable model. Verify on the model's [Hugging Face card](https://huggingface.co/LiquidAI) before wiring up the input.

Check warning on line 173 in deployment/on-device/sdk/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/ai-agent-usage-guide.mdx#L173

Did you really mean 'multimodal'?
</Info>

<Tabs>
<Tab title="Swift (iOS / macOS)">
```swift
// Vision-capable model
let imageMessage = ChatMessage(

Check warning on line 180 in deployment/on-device/sdk/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/ai-agent-usage-guide.mdx#L180

Did you really mean 'imageMessage'?
role: .user,
content: [.text("Describe what you see."), ChatMessageContent.fromJPEGData(jpegData)],
reasoningContent: nil,

Check warning on line 183 in deployment/on-device/sdk/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/ai-agent-usage-guide.mdx#L183

Did you really mean 'reasoningContent'?
functionCalls: nil
)

Expand All @@ -206,7 +205,7 @@
<Tab title="Kotlin (all platforms)">
```kotlin
// Vision-capable model
val imageMessage = ChatMessage(

Check warning on line 208 in deployment/on-device/sdk/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/ai-agent-usage-guide.mdx#L208

Did you really mean 'imageMessage'?
role = ChatMessage.Role.USER,
content = listOf(
ChatMessageContent.Text("Describe what you see."),
Expand Down Expand Up @@ -267,7 +266,7 @@
isLoading = true
defer { isLoading = false }
do {
let runner = try await downloader.loadModel(

Check warning on line 269 in deployment/on-device/sdk/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/ai-agent-usage-guide.mdx#L269

Did you really mean 'downloader'?
modelName: "LFM2.5-1.2B-Instruct",
quantizationType: "Q4_K_M"
)
Expand Down Expand Up @@ -433,7 +432,7 @@
- **Always handle every `MessageResponse` case.** Even if you only care about `.chunk` and `.complete`, give `.functionCalls`, `.audioSample`, and `.reasoningChunk` explicit (empty) branches — otherwise an exhaustive switch will fail to compile when a new variant is added.
- **Cancel before re-issuing.** Don't start a second `generateResponse(...)` while one is in flight. Either cancel the previous `Task` / `Job`, or check `conversation.isGenerating` first.
- **Don't `runBlocking` in production paths.** It's fine in `onCleared()` for guaranteed cleanup (because `viewModelScope` is already cancelled at that point). Anywhere else, it freezes the calling thread.
- **Use `cacheDir` (Android) / `cachesDirectory` (iOS) for KV-cache reuse paths.** They're regenerable — letting the OS reclaim them on storage pressure is the right semantics. See [Model Loading → KV cache reuse](./model-loading#kv-cache-reuse).

Check warning on line 435 in deployment/on-device/sdk/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/ai-agent-usage-guide.mdx#L435

Did you really mean 'regenerable'?
- **Validate tool-call arguments before dispatching.** The `arguments: Map<String, Any?>` (Kotlin) / `[String: Any?]` (Swift) shape is unsafe by design — defensively coerce types and apply business-level invariants.
- **Match the model's recommended sampling parameters.** The LEAP bundle manifest (`sampling_parameters` under `generation_time_parameters` in each `<Quant>.json` on [LiquidAI/LeapBundles](https://huggingface.co/LiquidAI/LeapBundles)) carries defaults tuned per checkpoint for the llama.cpp engine the SDK runs. Overriding `temperature` and friends often hurts quality more than it helps — start from the manifest values rather than the HF model card defaults (the two can differ).

Expand All @@ -442,22 +441,22 @@
<Tabs>
<Tab title="iOS / macOS">
- iOS deployment target: **17.0+** · macOS: **15.0+**
- Xcode 16.0+, Swift 6.0

Check warning on line 444 in deployment/on-device/sdk/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/ai-agent-usage-guide.mdx#L444

Did you really mean 'Xcode'?
- Run model loads inside a `Task` from a `@MainActor` view model. `ModelDownloader` background downloads (via `URLSessionConfiguration.background(withIdentifier:)`) survive app suspension; see [Model Loading](./model-loading#constructing-the-downloader).
- The voice widget exists on UIKit and AppKit — see [Voice Assistant Widget](./voice-assistant).

Check warning on line 446 in deployment/on-device/sdk/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/ai-agent-usage-guide.mdx#L446

Did you really mean 'UIKit'?
</Tab>
<Tab title="Android">
- **Min SDK 31** (Android 12).
- Use a real device for testing — the emulator may crash loading model bundles.
- `LeapModelDownloader` (the Android one) requires `POST_NOTIFICATIONS` at runtime on Android 13+ and a few manifest entries — see [Quick Start → Install the SDK](./quick-start#2-install-the-sdk).
- Background prefetch uses `requestDownloadModel(...)`, which enqueues the WorkManager downloader and runs it as a foreground worker while files transfer. The SDK ships notification configuration via `LeapModelDownloaderNotificationConfig`.

Check warning on line 452 in deployment/on-device/sdk/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/ai-agent-usage-guide.mdx#L452

Did you really mean 'prefetch'?

Check warning on line 452 in deployment/on-device/sdk/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/ai-agent-usage-guide.mdx#L452

Did you really mean 'enqueues'?
- For most cases, hold the runner in a `ViewModel` with `viewModelScope`. Unload via `runBlocking(Dispatchers.IO) { runner.unload() }` in `onCleared()`.
</Tab>
<Tab title="JVM / Linux native / Windows native">
- JVM: JDK 11+. No `Context` parameter, no foreground service, no notifications — `LeapDownloader` is a simple async fetcher with a configurable `saveDir`.
- Linux native runtime: glibc **2.34+** (Ubuntu 22.04, Debian 12, RHEL 9 or newer). Older hosts fail at process start.

Check warning on line 457 in deployment/on-device/sdk/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/ai-agent-usage-guide.mdx#L457

Did you really mean 'glibc'?
- Windows native: Windows 10+. DLLs co-locate next to the `.exe` (Windows' standard search order finds them).

Check warning on line 458 in deployment/on-device/sdk/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/ai-agent-usage-guide.mdx#L458

Did you really mean 'DLLs'?
- **Pin to 0.10.7 or newer** for Kotlin/Native — earlier 0.10.x releases (0.10.0, 0.10.1) have unresolved cinterop / linker issues that prevent producing a working executable; the fixes shipped in the 0.10.4.x point releases (SPM) and v0.10.6 / v0.10.7 (Android-SDK repo). See [Desktop & Native Platforms](./desktop-platforms).

Check warning on line 459 in deployment/on-device/sdk/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/ai-agent-usage-guide.mdx#L459

Did you really mean 'cinterop'?
</Tab>
</Tabs>

Expand All @@ -465,12 +464,12 @@

| Symptom | Likely cause / fix |
|---|---|
| `LeapModelLoadingException` / `LeapError.modelLoadingFailure` | Missing companion file for multimodal model (mmproj / audio decoder). Verify the manifest or pass explicit paths via `loadSimpleModel(ModelSource(...))`. |

Check warning on line 467 in deployment/on-device/sdk/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/ai-agent-usage-guide.mdx#L467

Did you really mean 'multimodal'?

Check warning on line 467 in deployment/on-device/sdk/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/ai-agent-usage-guide.mdx#L467

Did you really mean 'mmproj'?
| Model loads but generates gibberish | Wrong sampling parameters or wrong function-call parser for the model family. Check the model card; default to `LFMFunctionCallParser` for LFM models, `HermesFunctionCallParser` for Qwen3/Hermes. |
| "ZIP archive corrupted" on download | Network hiccup mid-download. `LeapDownloader` / `LeapModelDownloader` validates SHA-256, so a partial file fails the check. Remove the cache directory and retry. |
| Generation hangs after `cancel()` | Cancellation is cooperative — the engine checks between tokens. There's at most one extra token of slack. If it's longer, you may be missing a `Job` cancel or the stream is being awaited on a thread other than the one you're cancelling from. |
| Voice widget records silence | Missing microphone permission, or `AVAudioSession`/Android audio config not set to `playAndRecord` / mono / 16 kHz. See [Voice Assistant Widget](./voice-assistant). |
| K/N executable fails at start with `dlsym@GLIBC_2.34` | Runtime host's glibc is older than 2.34. Upgrade to Ubuntu 22.04+, Debian 12+, RHEL 9+, or build for an older runtime target. |

Check warning on line 472 in deployment/on-device/sdk/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/ai-agent-usage-guide.mdx#L472

Did you really mean 'glibc'?
| Compile error "@Guide annotation missing" (Swift) | All properties on a `@Generatable` `struct` need a `@Guide`. Annotate every stored property. |

For deeper failure-mode coverage, see [Utilities → Errors](./utilities#errors).
1 change: 0 additions & 1 deletion deployment/on-device/sdk/cloud-ai-comparison.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
title: "Cloud AI Comparison"
description: "Mapping LEAP SDK concepts to cloud chat-completion APIs like OpenAI."
noindex: true
---

<Warning>
Expand Down Expand Up @@ -58,25 +57,25 @@
</Tab>
<Tab title="Kotlin (Android)">
```kotlin
val downloader = LeapModelDownloader(context)

Check warning on line 60 in deployment/on-device/sdk/cloud-ai-comparison.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/cloud-ai-comparison.mdx#L60

Did you really mean 'downloader'?
val runner = downloader.loadModel(
modelName = "LFM2.5-1.2B-Instruct",

Check warning on line 62 in deployment/on-device/sdk/cloud-ai-comparison.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/cloud-ai-comparison.mdx#L62

Did you really mean 'modelName'?
quantizationType = "Q4_K_M",

Check warning on line 63 in deployment/on-device/sdk/cloud-ai-comparison.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/cloud-ai-comparison.mdx#L63

Did you really mean 'quantizationType'?
)
```
</Tab>
<Tab title="Kotlin (JVM / native)">
```kotlin
val downloader = LeapDownloader(LeapDownloaderConfig(saveDir = cacheDir))

Check warning on line 69 in deployment/on-device/sdk/cloud-ai-comparison.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/cloud-ai-comparison.mdx#L69

Did you really mean 'downloader'?

Check warning on line 69 in deployment/on-device/sdk/cloud-ai-comparison.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/cloud-ai-comparison.mdx#L69

Did you really mean 'cacheDir'?
val runner = downloader.loadModel(
modelName = "LFM2.5-1.2B-Instruct",

Check warning on line 71 in deployment/on-device/sdk/cloud-ai-comparison.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/cloud-ai-comparison.mdx#L71

Did you really mean 'modelName'?
quantizationType = "Q4_K_M",

Check warning on line 72 in deployment/on-device/sdk/cloud-ai-comparison.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/cloud-ai-comparison.mdx#L72

Did you really mean 'quantizationType'?
)
```
</Tab>
</Tabs>

The returned `ModelRunner` plays the same role as the cloud API's client object — except it carries the model weights. Release it and you'll have to load again before generating.

Check warning on line 78 in deployment/on-device/sdk/cloud-ai-comparison.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/cloud-ai-comparison.mdx#L78

Did you really mean 'API's'?

## 2. Request generation

Expand Down Expand Up @@ -192,7 +191,7 @@
```
</Tab>
<Tab title="Kotlin (Android)">
Use `viewModelScope` (or `lifecycleScope` for activity-bound work). The flow is collected on the coroutine; cancellation is cooperative.

Check warning on line 194 in deployment/on-device/sdk/cloud-ai-comparison.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/cloud-ai-comparison.mdx#L194

Did you really mean 'coroutine'?

```kotlin
class ChatViewModel(application: Application) : AndroidViewModel(application) {
Expand All @@ -219,7 +218,7 @@
```
</Tab>
<Tab title="Kotlin (JVM / native)">
Use any coroutine scope — `runBlocking` for CLIs, a custom `CoroutineScope` for server-side code, or `MainScope()` for Compose for Desktop.

Check warning on line 221 in deployment/on-device/sdk/cloud-ai-comparison.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/cloud-ai-comparison.mdx#L221

Did you really mean 'coroutine'?

Check warning on line 221 in deployment/on-device/sdk/cloud-ai-comparison.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/cloud-ai-comparison.mdx#L221

Did you really mean 'CLIs'?

```kotlin
fun main() = runBlocking {
Expand All @@ -243,7 +242,7 @@
| Concept | OpenAI | LEAP |
|---|---|---|
| Role-tagged messages | `{"role": "user", "content": "..."}` | `ChatMessage(role: .user, textContent: "...")` |
| Streaming responses | `stream=True` iterator | `SkieSwiftFlow<MessageResponse>` (Swift, iterable with `for try await`) / `Flow<MessageResponse>` (Kotlin) |

Check warning on line 245 in deployment/on-device/sdk/cloud-ai-comparison.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/cloud-ai-comparison.mdx#L245

Did you really mean 'iterable'?
| Function calling | Tool definitions + `tool_calls` field | `registerFunction(LeapFunction)` + `MessageResponse.FunctionCalls` |
| Structured output | `response_format = json_schema` | Swift `options.with(jsonSchema: T.jsonSchema())` / Kotlin `setResponseFormatType<T>()` |
| Token usage stats | `usage` object on completion | `Complete.stats` (`promptTokens`, `completionTokens`, `tokenPerSecond`) |
Expand All @@ -252,8 +251,8 @@

- **No remote endpoint.** You ship the model with the app (or download it the first time it runs). Latency is bounded by device CPU/GPU, not network round-trips.
- **Explicit lifecycle.** Hold a `ModelRunner` reference; `unload()` when done. Cloud clients never load anything explicitly.
- **Multimodal inputs go in `content` array, same as OpenAI.** Image and audio parts use the same OpenAI `image_url` / `input_audio` wire format.

Check warning on line 254 in deployment/on-device/sdk/cloud-ai-comparison.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/cloud-ai-comparison.mdx#L254

Did you really mean 'Multimodal'?
- **Companion files for multimodal models.** Vision and audio-capable models need an `mmproj` (vision) and/or audio decoder/tokenizer co-located on disk. Manifest-based loading handles this automatically; `loadSimpleModel` accepts explicit `mmprojPath` / `audioDecoderPath` / `audioTokenizerPath`.

Check warning on line 255 in deployment/on-device/sdk/cloud-ai-comparison.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/cloud-ai-comparison.mdx#L255

Did you really mean 'multimodal'?

## Next steps

Expand Down
1 change: 0 additions & 1 deletion deployment/on-device/sdk/constrained-generation.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
title: "Constrained Generation"
description: "Generate structured JSON output with compile-time validation — same approach on every platform."
noindex: true
---

<Warning>
Expand Down Expand Up @@ -104,7 +103,7 @@
generationOptions: options
) {
if case .complete(let completion) = onEnum(of: response) {
let jsonText = completion.fullMessage.content.compactMap { part -> String? in

Check warning on line 106 in deployment/on-device/sdk/constrained-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/constrained-generation.mdx#L106

Did you really mean 'jsonText'?
if case let .text(t) = onEnum(of: part) { return t.text }
return nil
}.joined()
Expand Down Expand Up @@ -150,12 +149,12 @@
<Tabs>
<Tab title="Swift (iOS / macOS)">
```swift
let schemaString = JSONSchemaGenerator.getJSONSchema(for: Joke.self)

Check warning on line 152 in deployment/on-device/sdk/constrained-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/constrained-generation.mdx#L152

Did you really mean 'schemaString'?
let message = ChatMessage(
role: .user,
content: [.text("Tell me a programming joke following this JSON Schema: \(schemaString)")],
reasoningContent: nil,

Check warning on line 156 in deployment/on-device/sdk/constrained-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/constrained-generation.mdx#L156

Did you really mean 'reasoningContent'?
functionCalls: nil

Check warning on line 157 in deployment/on-device/sdk/constrained-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/constrained-generation.mdx#L157

Did you really mean 'functionCalls'?
)
```

Expand All @@ -163,9 +162,9 @@
</Tab>
<Tab title="Kotlin (all platforms)">
```kotlin
val jsonSchema = JSONSchemaGenerator.getJSONSchema<CityFact>()

Check warning on line 165 in deployment/on-device/sdk/constrained-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/constrained-generation.mdx#L165

Did you really mean 'jsonSchema'?
conversation.generateResponse(
"Show the city facts about Tokyo following this JSON Schema: $jsonSchema",

Check warning on line 167 in deployment/on-device/sdk/constrained-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/constrained-generation.mdx#L167

Did you really mean 'jsonSchema'?
options
)
```
Expand All @@ -185,7 +184,7 @@
| Enum | `String` with constrained `enumValues` | Kotlin `enum class` (plain name used as value) |
| Object | nested `@Generatable` `struct` | nested `@Generatable` `data class` |
| Array | `[T]` of any supported type | `List<T>` / `MutableList<T>` of supported type |
| Optional | `Optional<T>` (`T?`) | nullable `T?` |

Check warning on line 187 in deployment/on-device/sdk/constrained-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/constrained-generation.mdx#L187

Did you really mean 'nullable'?

## Complex nested structures

Expand All @@ -193,7 +192,7 @@
<Tab title="Swift (iOS / macOS)">
```swift
@Generatable("A recipe with ingredients and instructions")
struct Recipe: Codable {

Check warning on line 195 in deployment/on-device/sdk/constrained-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/constrained-generation.mdx#L195

Did you really mean 'Codable'?
@Guide("Name of the dish")
let name: String

Expand Down Expand Up @@ -285,7 +284,7 @@

### Lower temperature for structured output

Temperature `0.1–0.3` typically improves adherence to the schema — high-temperature sampling adds variation that doesn't help when you need parseable JSON. Use the per-model defaults the LFM model cards recommend (e.g. `0.1` for instruct/VL, `0.3` for LFM2 text) and lower from there if the model strays.

Check warning on line 287 in deployment/on-device/sdk/constrained-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/constrained-generation.mdx#L287

Did you really mean 'parseable'?

### Validate the decoded output

Expand Down Expand Up @@ -332,12 +331,12 @@
| Error | When it happens |
|---|---|
| `LeapGeneratableSchematizationException` (Kotlin) | The data class can't be translated to JSON Schema (unsupported field type, missing primary-constructor declaration). |
| `LeapGeneratableDeserializationException` (Kotlin) | The generated JSON can't be deserialized into the target data class. |

Check warning on line 334 in deployment/on-device/sdk/constrained-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/constrained-generation.mdx#L334

Did you really mean 'deserialized'?
| Swift `DecodingError` | `JSONDecoder` rejects the generated payload — usually because the model output contains stray prose alongside the JSON; filter `Complete.fullMessage.content` for the `.text` fragments first. |

## Troubleshooting

**"External macro implementation could not be found" (Swift)** — clean the build folder, restart Xcode, verify Swift 5.9+.

Check warning on line 339 in deployment/on-device/sdk/constrained-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/constrained-generation.mdx#L339

Did you really mean 'Xcode'?

**Generated JSON includes prose alongside the JSON object** — common with low-quality prompts. Add "Reply with only the JSON object" to the user message, lower temperature, and filter `.text` content fragments before decoding.

Expand Down
1 change: 0 additions & 1 deletion deployment/on-device/sdk/conversation-generation.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
title: "Conversation & Generation"
description: "Reference for ModelRunner, Conversation, MessageResponse, and GenerationOptions — same API on every platform."
noindex: true
---

<Warning>
Expand Down Expand Up @@ -65,7 +64,7 @@

<Tabs>
<Tab title="Swift (iOS / macOS)">
`Conversation` is a Kotlin `interface` bridged to Swift as a protocol — the get-only properties surface as `{ get }` in Swift. The generation methods return a SKIE-bridged `SkieSwiftFlow<MessageResponse>` (iterable with `for try await`):

Check warning on line 67 in deployment/on-device/sdk/conversation-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/conversation-generation.mdx#L67

Did you really mean 'iterable'?

```swift
public protocol Conversation {
Expand Down Expand Up @@ -134,12 +133,12 @@

### Streaming generation

The async stream is the recommended way to drive generation — both platforms emit the same `MessageResponse` cases in the same order. Cancel the consuming task / coroutine to stop generation cleanly.

Check warning on line 136 in deployment/on-device/sdk/conversation-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/conversation-generation.mdx#L136

Did you really mean 'coroutine'?

<Tabs>
<Tab title="Swift (iOS / macOS)">
```swift
let user = ChatMessage(role: .user, textContent: "Hello! What can you do?")

Check warning on line 141 in deployment/on-device/sdk/conversation-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/conversation-generation.mdx#L141

Did you really mean 'textContent'?
let options = GenerationOptions()
.with(temperature: 0.3)
.with(minP: 0.15)
Expand Down Expand Up @@ -226,7 +225,7 @@
</Tabs>

<Info>
**Cancellation.** Cancelling the Swift `Task` or the Kotlin coroutine `Job` stops generation and frees native resources. On both platforms cancellation is cooperative — the engine checks between tokens, so there's at most one extra token of slack after `cancel()`.

Check warning on line 228 in deployment/on-device/sdk/conversation-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/conversation-generation.mdx#L228

Did you really mean 'coroutine'?
</Info>

### Export chat history
Expand All @@ -236,7 +235,7 @@
<Tabs>
<Tab title="Swift (iOS / macOS)">
```swift
let jsonString: String = conversation.exportToJSON()

Check warning on line 238 in deployment/on-device/sdk/conversation-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/conversation-generation.mdx#L238

Did you really mean 'jsonString'?
```
</Tab>
<Tab title="Kotlin (all platforms)">
Expand Down Expand Up @@ -290,7 +289,7 @@
- **`ReasoningChunk`** — thinking-style tokens emitted by reasoning models (wrapped between `<think>` / `</think>` upstream). Only fires when `GenerationOptions.enableThinking = true` *and* the model supports it.
- **`FunctionCalls`** — one or more tool invocations the model wants you to execute. See [Function Calling](./function-calling).
- **`AudioSample`** — float32 mono PCM frames from audio-capable checkpoints. The sample rate is constant for a generation; route the frames to a renderer.
- **`Complete`** — final marker. `fullMessage` is the assembled assistant `ChatMessage` (also present in `conversation.history`). `stats` is nullable (`GenerationStats?`); when present it holds `promptTokens`, `completionTokens`, `totalTokens`, `tokenPerSecond` (non-nullable `Float`), and `cachedPromptTokens`.

Check warning on line 292 in deployment/on-device/sdk/conversation-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/conversation-generation.mdx#L292

Did you really mean 'nullable'?

### `GenerationFinishReason`

Expand All @@ -310,22 +309,22 @@

<Tabs>
<Tab title="Swift (iOS / macOS)">
`GenerationOptions` is a Kotlin `data class` bridged into Swift. Kotlin parameter defaults don't survive the ObjC bridge, so the canonical Swift idiom is the parameterless init plus chained `.with(...)` builders from `ConvenienceExtensions.swift`:

Check warning on line 312 in deployment/on-device/sdk/conversation-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/conversation-generation.mdx#L312

Did you really mean 'parameterless'?

```swift
public class GenerationOptions {
public var temperature: Float?
public var topP: Float?
public var minP: Float?
public var repetitionPenalty: Float?

Check warning on line 319 in deployment/on-device/sdk/conversation-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/conversation-generation.mdx#L319

Did you really mean 'repetitionPenalty'?
public var topK: Int32?
public var rngSeed: Int64?

Check warning on line 321 in deployment/on-device/sdk/conversation-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/conversation-generation.mdx#L321

Did you really mean 'rngSeed'?
public var jsonSchemaConstraint: String?
public var functionCallParser: LeapFunctionCallParser?
public var injectSchemaIntoPrompt: Bool // default true
public var maxTokens: Int32?

Check warning on line 325 in deployment/on-device/sdk/conversation-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/conversation-generation.mdx#L325

Did you really mean 'maxTokens'?
public var inlineThinkingTags: Bool // default false
public var enableThinking: Bool // default false

Check warning on line 327 in deployment/on-device/sdk/conversation-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/conversation-generation.mdx#L327

Did you really mean 'enableThinking'?
public var extras: String?

public convenience init() // builder entry point
Expand Down Expand Up @@ -395,12 +394,12 @@
</Tab>
</Tabs>

- **Sampling fields** (`temperature`, `topP`, `minP`, `topK`, `repetitionPenalty`) — standard sampling knobs. Use the values from the LEAP bundle manifest (`sampling_parameters` under `generation_time_parameters` in each model's `<Quant>.json` on [LiquidAI/LeapBundles](https://huggingface.co/LiquidAI/LeapBundles)); they're tuned per checkpoint by the training team and differ from the HF model card defaults (the manifest values are the llama.cpp-engine path the SDK runs). Arbitrary "0.7" defaults from generic AI tutorials usually underperform.

Check warning on line 397 in deployment/on-device/sdk/conversation-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/conversation-generation.mdx#L397

Did you really mean 'underperform'?
- **`rngSeed`** — set for deterministic / reproducible output (testing, debugging). Default is non-deterministic.
- **`maxTokens`** — cap the response length. The model stops after this many completion tokens (prompt tokens don't count). Defaults to "until EOS or context limit." Useful for cost control with constrained output.
- **`jsonSchemaConstraint`** — JSON Schema string for constrained generation. Use the higher-level helpers — Swift `options.with(jsonSchema: T.jsonSchema())` (or `GenerationOptionsCompat.setResponseFormat(jsonSchema:)`) / Kotlin `setResponseFormatType<T>()` — with `@Generatable` types. See [Constrained Generation](./constrained-generation).
- **`injectSchemaIntoPrompt`** — when `true` (default), the schema is appended to the system message for semantic guidance *in addition* to the structural constraint at decode time. Set `false` to skip the prompt injection (matches `llama-server` grammar mode) — saves prompt tokens for large schemas.
- **`functionCallParser`** — picks the tokenizer expected by the model. `LFMFunctionCallParser` (default) for Liquid Foundation Models; `HermesFunctionCallParser()` for Hermes/Qwen3 formats; `null` to receive raw tool-call text in `Chunk`s.

Check warning on line 402 in deployment/on-device/sdk/conversation-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/conversation-generation.mdx#L402

Did you really mean 'tokenizer'?
- **`enableThinking`** — turn on reasoning mode for models that support it (e.g. LFM2.5-Thinking). Reasoning tokens arrive as `ReasoningChunk`s.
- **`inlineThinkingTags`** — when `true`, thinking tokens are emitted as ordinary `Chunk`s with the literal `<think>...</think>` tags intact (instead of `ReasoningChunk`). `ChatMessage.reasoningContent` is still populated on the final message.
- **`extras`** — backend-specific JSON payload (internal use).
Expand All @@ -416,4 +415,4 @@
cache is disabled or missed.
```

`cachedPromptTokens` is useful for observing KV-cache effectiveness — a high ratio of cached tokens to total prompt tokens means the prefix matched and you skipped the prefill compute for those tokens.

Check warning on line 418 in deployment/on-device/sdk/conversation-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/conversation-generation.mdx#L418

Did you really mean 'prefill'?
1 change: 0 additions & 1 deletion deployment/on-device/sdk/desktop-platforms.mdx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
---
title: "Desktop & Native Platforms"
description: "Run the LEAP SDK on JVM desktop, native Linux, native Windows, and macOS — same API as Android and iOS."
noindex: true
---

<Warning>
The LEAP SDK is deprecated and this page is no longer maintained. Build on llama.cpp directly instead — see [Migrating from LEAP SDK](/deployment/on-device/llama-cpp/migrating-from-leap-sdk).
</Warning>

The LEAP SDK is a Kotlin Multiplatform library. The same conversation, model-loading, and generation APIs you use on Android and iOS run unchanged on JVM desktop and Kotlin/Native targets. This page covers installation and per-platform notes for everything outside the mobile guides.

Check warning on line 10 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L10

Did you really mean 'Multiplatform'?

<Info>
**Where to start by platform:**
Expand All @@ -28,12 +27,12 @@
|---|---|---|---|---|
| **Android** | ARM64 | API 31 (Android 12) | JNI | See [Quick Start](/deployment/on-device/sdk/quick-start). |
| **JVM Desktop** | macOS ARM64 · Linux x86_64 · Linux aarch64 · Windows x86_64 · Windows aarch64 | JDK 11 | JNI | This page. |
| **Linux native** | x86_64 · aarch64 | glibc 2.34+ (Ubuntu 22.04, Debian 12, RHEL 9) | C-interop (Kotlin/Native) | This page. |

Check warning on line 30 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L30

Did you really mean 'glibc'?
| **Windows native** | x86_64 (MinGW toolchain) | Windows 10+ | C-interop (Kotlin/Native) | This page. |

Check warning on line 31 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L31

Did you really mean 'toolchain'?
| **iOS** | ARM64 (device + simulator) | iOS 17 | C-interop | See [Quick Start](/deployment/on-device/sdk/quick-start). |
| **macOS** | ARM64 (Apple Silicon) | macOS 15 | C-interop (Kotlin/Native `macosArm64`) | Swift API: see [Quick Start](/deployment/on-device/sdk/quick-start). For JVM on macOS, use the **JVM Desktop** row above. The `macosArm64` Kotlin/Native klib is niche — see [macOS (Apple Silicon)](#macos-apple-silicon) below. |

Check warning on line 33 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L33

Did you really mean 'klib'?

x86 JVM hosts (e.g. Linux/Windows x86_64 desktop JVMs) load the engine via JNI. JNI binaries ship inside the `leap-sdk` JAR — no extra setup needed.

Check warning on line 35 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L35

Did you really mean 'JVMs'?

## JVM Desktop

Expand Down Expand Up @@ -109,7 +108,7 @@

### Loading a model

`LeapDownloader` is the cross-platform downloader. Point it at a writable directory and call `loadModel(modelName:, quantizationType:)` for manifest-based downloads, or `loadSimpleModel(model: ModelSource(...))` for a GGUF you already have on disk.

Check warning on line 111 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L111

Did you really mean 'downloader'?

```kotlin
import ai.liquid.leap.manifest.LeapDownloader
Expand Down Expand Up @@ -150,7 +149,7 @@
}
```

### Loading a sideloaded GGUF

Check warning on line 152 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L152

Did you really mean 'sideloaded'?

When the file already lives somewhere on disk (CI artifact, app resource folder, network share), skip the manifest lookup:

Expand All @@ -170,11 +169,11 @@

- **Memory.** Plan for at least `model_size_on_disk + 1 GiB` of free RAM. With `use_mmap=true` (the default since v0.10.4 — see the [changelog](/deployment/on-device/leap-sdk-changelog#memory-mapped-model-loading-by-default)) the OS pages weights in lazily, so resident memory grows as the model is exercised rather than at load time.
- **Threads.** The engine defaults to a sensible CPU thread count for the host (`CpuThreadAdvisor.getRecommendedThreadCount()`). Override by passing `ModelLoadingOptions(cpuThreads = N)` through `loadModel(...)` if you need to share the box with other workloads.
- **GPU acceleration.** Available on macOS (Metal, automatic) and on Linux JVM builds with a CUDA-capable GPU when the matching native variant is on the classpath. GPU offload is configured through the `extras` JSON payload on `ModelLoadingOptions` (advanced use only — most desktop workloads run pure-CPU).

Check warning on line 172 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L172

Did you really mean 'classpath'?

## Linux native (Kotlin/Native)

For statically-targeted Linux binaries — CLIs, daemons, embedded server processes — the SDK ships `linuxX64` and `linuxArm64` Kotlin/Native targets. The engine is shipped as a separate `-natives.zip` classifier artifact rather than embedded in a JAR, because Kotlin/Native has no runtime resource-extraction equivalent to JVM's `getResourceAsStream`.

Check warning on line 176 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L176

Did you really mean 'CLIs'?

### Installation (recommended: `ai.liquid.leap.nativelibs` plugin)

Expand Down Expand Up @@ -218,10 +217,10 @@
./gradlew linkReleaseExecutableLinuxX64
```

The resulting binary lives at `build/bin/linuxX64/releaseExecutable/`, alongside the `.so` files the plugin installed (`libinference_engine.so`, `libinference_engine_llamacpp_backend.so`, `libie_zip.so`, plus their transitive dependencies). Keep them co-located when you ship — the cinterop manifest bakes `-rpath=$ORIGIN` into the binary so the dynamic linker resolves siblings.

Check warning on line 220 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L220

Did you really mean 'cinterop'?

<Warning>
**Versions 0.10.0 and 0.10.1 cannot link a working Kotlin/Native executable** due to Maven Central / cinterop issues; v0.10.2 and v0.10.3 were never published, and the fixes shipped across v0.10.4.x, v0.10.6, and v0.10.7. Maven Central is immutable per GAV, so the older versions cannot be republished — pin to **0.10.7 or newer**. See [the changelog](/deployment/on-device/leap-sdk-changelog#kotlin-native-linux-windows) for the full story.

Check warning on line 223 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L223

Did you really mean 'cinterop'?
</Warning>

### Manual recipe (if you can't apply the plugin)
Expand Down Expand Up @@ -259,8 +258,8 @@

### Runtime requirements

- **glibc 2.34+** — Ubuntu 22.04, Debian 12, RHEL 9, or newer. The pinned glibc-2.19 sysroot Kotlin/Native links against is *only* used at link time; the engine `.so` is built against modern glibc and calls into symbols like `dlsym@GLIBC_2.34` at runtime. Older hosts fail at process start with a glibc version error.

Check warning on line 261 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L261

Did you really mean 'glibc'?

Check warning on line 261 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L261

Did you really mean 'glibc'?

Check warning on line 261 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L261

Did you really mean 'sysroot'?

Check warning on line 261 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L261

Did you really mean 'glibc'?
- **Co-located `.so` files** — the dynamic linker uses `rpath=$ORIGIN` from the binary, plus `DT_RUNPATH=$ORIGIN:$ORIGIN/../lib` from the engine `.so` itself. The Copy task installs every dependent library (umbrella libs, `libllama`, `libmtmd`, `libggml*`, per-CPU-microarch GGML variants, SONAME aliases). Don't cherry-pick from the natives ZIP — ship the whole set.

Check warning on line 262 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L262

Did you really mean 'libs'?

The Maven coordinates for the `-natives.zip` artifacts:

Expand All @@ -269,7 +268,7 @@

## Windows native (MinGW x64)

The same Kotlin/Native flow works for Windows x86_64 via the MinGW-w64 toolchain.

Check warning on line 271 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L271

Did you really mean 'toolchain'?

```kotlin
plugins {
Expand All @@ -292,7 +291,7 @@
./gradlew linkReleaseExecutableMingwX64
```

The plugin installs `inference_engine.dll`, `libinference_engine_llamacpp_backend.dll`, `ie_zip.dll`, and their transitive DLLs into the link output directory. Windows' standard DLL search order finds DLLs co-located with the `.exe` before checking `PATH`, so no `rpath` plumbing is needed — just ship the executable and its sibling DLLs together.

Check warning on line 294 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L294

Did you really mean 'DLLs'?

Check warning on line 294 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L294

Did you really mean 'DLLs'?

Check warning on line 294 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L294

Did you really mean 'DLLs'?

The Maven coordinates for the `-natives.zip` artifact:

Expand All @@ -313,7 +312,7 @@
| iOS | macOS |
|---|---|
| `UIViewControllerRepresentable` | `NSViewControllerRepresentable` |
| `VoiceAssistantViewController` (UIKit) | `VoiceAssistantNSViewController` (AppKit) |

Check warning on line 315 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L315

Did you really mean 'UIKit'?
| `UIHostingController` | `NSHostingController` |
| `import UIKit` | `import AppKit` |
| Deployment target: iOS 17 | Deployment target: macOS 15 |
Expand All @@ -326,11 +325,11 @@
)
```

The XCFramework slice for macOS ARM64 is in the same zip as the iOS slices. The released framework ships exactly three slices — `ios-arm64`, `ios-arm64-simulator`, `macos-arm64`; **Mac Catalyst is not supported**, and the iOS simulator slice is ARM64-only (Intel-Mac simulator hosts cannot run it).

Check warning on line 328 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L328

Did you really mean 'XCFramework'?

### From Kotlin (JVM, Compose for Desktop)

If you're targeting macOS as a JVM host — for example with Compose Multiplatform Desktop, IntelliJ-style tooling, or a Kotlin CLI — use the [JVM Desktop instructions](#jvm-desktop) above. The `leap-sdk` JAR ships a macOS ARM64 JNI binary.

Check warning on line 332 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L332

Did you really mean 'Multiplatform'?

```kotlin
dependencies {
Expand All @@ -342,7 +341,7 @@
The voice widget renders via Compose for Desktop on JVM macOS; the same `VoiceAssistantStore` API you use on iOS/Android works unchanged.

<Info>
**`macosArm64` Kotlin/Native target.** The SDK also ships a `macosArm64` Kotlin/Native klib for shared-code KMP projects that want to compile native macOS binaries directly (no JVM, no Swift). Most macOS consumers should prefer either Swift (via SPM) or JVM — the Kotlin/Native macOS path exists primarily so KMP `commonMain` code is portable to macOS, not as a recommended end-user entry point.

Check warning on line 344 in deployment/on-device/sdk/desktop-platforms.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/desktop-platforms.mdx#L344

Did you really mean 'klib'?
</Info>

## Picking the right target
Expand Down
1 change: 0 additions & 1 deletion deployment/on-device/sdk/function-calling.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
title: "Function Calling"
description: "Tool use with LeapFunction — same API on every platform, with Hermes and Pythonic parsers."

Check warning on line 3 in deployment/on-device/sdk/function-calling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/function-calling.mdx#L3

Did you really mean 'Pythonic'?
noindex: true
---

<Warning>
Expand Down Expand Up @@ -157,9 +156,9 @@
<Tabs>
<Tab title="Swift (iOS / macOS)">
```swift
let toolMessage = ChatMessage(

Check warning on line 159 in deployment/on-device/sdk/function-calling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/function-calling.mdx#L159

Did you really mean 'toolMessage'?
role: .tool,
textContent: #"{"temperature":72,"conditions":"sunny"}"#

Check warning on line 161 in deployment/on-device/sdk/function-calling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/function-calling.mdx#L161

Did you really mean 'textContent'?
)

let updatedHistory = conversation.history + [toolMessage]
Expand All @@ -169,7 +168,7 @@
</Tab>
<Tab title="Kotlin (all platforms)">
```kotlin
val toolMessage = ChatMessage(

Check warning on line 171 in deployment/on-device/sdk/function-calling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/function-calling.mdx#L171

Did you really mean 'toolMessage'?
role = ChatMessage.Role.TOOL,
content = listOf(
ChatMessageContent.Text("""{"temperature":72,"conditions":"sunny"}""")
Expand All @@ -188,12 +187,12 @@

<Tabs>
<Tab title="Swift (iOS / macOS)">
Both types are Kotlin `data class`es bridged into Swift. `@ObjCName` annotations rename the `description` parameter on the Swift inits to `functionDescription:` / `parameterDescription:`.

Check warning on line 190 in deployment/on-device/sdk/function-calling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/function-calling.mdx#L190

Did you really mean 'inits'?

```swift
public class LeapFunction {
public var name: String
public var functionDescription: String // ObjC-renamed from Kotlin `description`

Check warning on line 195 in deployment/on-device/sdk/function-calling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/function-calling.mdx#L195

Did you really mean 'functionDescription'?
public var parameters: [LeapFunctionParameter]

public init(name: String, functionDescription: String, parameters: [LeapFunctionParameter])
Expand All @@ -202,13 +201,13 @@
public class LeapFunctionParameter {
public var name: String
public var type: LeapFunctionParameterType
public var parameterDescription: String // ObjC-renamed from Kotlin `description`

Check warning on line 204 in deployment/on-device/sdk/function-calling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/function-calling.mdx#L204

Did you really mean 'parameterDescription'?
public var optional: Bool

public init(
name: String,
type: LeapFunctionParameterType,
parameterDescription: String,

Check warning on line 210 in deployment/on-device/sdk/function-calling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/function-calling.mdx#L210

Did you really mean 'parameterDescription'?
optional: Bool // no default in Swift — pass `false` for required
)
}
Expand Down Expand Up @@ -285,13 +284,13 @@
<Tab title="Swift (iOS / macOS)">
```swift
LeapFunction(
name: "get_weather",

Check warning on line 287 in deployment/on-device/sdk/function-calling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/function-calling.mdx#L287

Did you really mean 'get_weather'?
functionDescription: "Query the weather of cities",
parameters: [
LeapFunctionParameter(
name: "cities",
type: LeapFunctionParameterType.LeapArr(
itemType: LeapFunctionParameterType.LeapStr(enumValues: nil, description: nil),

Check warning on line 293 in deployment/on-device/sdk/function-calling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/function-calling.mdx#L293

Did you really mean 'itemType'?

Check warning on line 293 in deployment/on-device/sdk/function-calling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/function-calling.mdx#L293

Did you really mean 'enumValues'?
description: nil
),
parameterDescription: "Names of the cities to query weather for",
Expand All @@ -300,7 +299,7 @@
LeapFunctionParameter(
name: "unit",
type: LeapFunctionParameterType.LeapStr(
enumValues: ["celsius", "fahrenheit"],

Check warning on line 302 in deployment/on-device/sdk/function-calling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/function-calling.mdx#L302

Did you really mean 'celsius'?

Check warning on line 302 in deployment/on-device/sdk/function-calling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/function-calling.mdx#L302

Did you really mean 'fahrenheit'?
description: nil
),
parameterDescription: "Temperature unit",
Expand All @@ -313,20 +312,20 @@
<Tab title="Kotlin (all platforms)">
```kotlin
LeapFunction(
name = "get_weather",

Check warning on line 315 in deployment/on-device/sdk/function-calling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/function-calling.mdx#L315

Did you really mean 'get_weather'?
description = "Get the weather forecast of cities",
parameters = listOf(
LeapFunctionParameter(
name = "cities",
type = LeapFunctionParameterType.LeapArr(
itemType = LeapFunctionParameterType.LeapStr()

Check warning on line 321 in deployment/on-device/sdk/function-calling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/function-calling.mdx#L321

Did you really mean 'itemType'?
),
description = "City names to query",
),
LeapFunctionParameter(
name = "temperature_unit",

Check warning on line 326 in deployment/on-device/sdk/function-calling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/function-calling.mdx#L326

Did you really mean 'temperature_unit'?
type = LeapFunctionParameterType.LeapStr(
enumValues = listOf("Fahrenheit", "Celsius", "Kelvin")

Check warning on line 328 in deployment/on-device/sdk/function-calling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/function-calling.mdx#L328

Did you really mean 'enumValues'?
),
description = "Units for temperature",
),
Expand Down
1 change: 0 additions & 1 deletion deployment/on-device/sdk/messages-content.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
title: "Messages & Content"
description: "ChatMessage, ChatMessageContent, audio format requirements — same shape on every platform."
noindex: true
---

<Warning>
Expand All @@ -20,8 +19,8 @@
public class ChatMessage {
public var role: ChatMessage.Role
public var content: [ChatMessageContent]
public var reasoningContent: String?

Check warning on line 22 in deployment/on-device/sdk/messages-content.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/messages-content.mdx#L22

Did you really mean 'reasoningContent'?
public var functionCalls: [LeapFunctionCall]?

Check warning on line 23 in deployment/on-device/sdk/messages-content.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/messages-content.mdx#L23

Did you really mean 'functionCalls'?

// Primary init — pass `reasoningContent: nil, functionCalls: nil` for ordinary messages.
public init(
Expand Down Expand Up @@ -81,11 +80,11 @@

### Serialization

Round-trip the message through `kotlinx.serialization` — there is no separate "from `[String: Any]`" initializer on either platform.

Check warning on line 83 in deployment/on-device/sdk/messages-content.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/messages-content.mdx#L83

Did you really mean 'initializer'?

<Tabs>
<Tab title="Swift (iOS / macOS)">
Encode with `LeapJson.encodeToString` (or your own `JSONEncoder` against the OpenAI shape) and decode with the matching Kotlin serializer. See [Utilities → Serialization](./utilities#serialization) for examples that route through `LeapJson`.

Check warning on line 87 in deployment/on-device/sdk/messages-content.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/messages-content.mdx#L87

Did you really mean 'serializer'?
</Tab>
<Tab title="Kotlin (all platforms)">
`ChatMessage` is `@Serializable`. Encode with `Json.encodeToString(message)` and decode with `Json.decodeFromString<ChatMessage>(jsonString)` — see [Utilities → Serialization](./utilities#serialization). On error, expect a `LeapSerializationException` (not `LeapSerializationError`).
Expand All @@ -96,7 +95,7 @@

<Tabs>
<Tab title="Swift (iOS / macOS)">
`ChatMessageContent` is the Kotlin `sealed class` bridged to Swift — switch on its subclasses with SKIE's `onEnum(of:)` helper. There is no native Swift `enum`, no positional `.image(_:)` / `.audio(_:)` factory, and no `init(from json:)`. Use the static factories on the Swift overlay:

Check warning on line 98 in deployment/on-device/sdk/messages-content.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/messages-content.mdx#L98

Did you really mean 'SKIE's'?

```swift
// Text (cross-platform):
Expand Down Expand Up @@ -193,11 +192,11 @@
</Warning>

<Warning>
**Mono required.** Stereo or multi-channel WAVs are rejected with an error. Downmix to mono first.

Check warning on line 195 in deployment/on-device/sdk/messages-content.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/messages-content.mdx#L195

Did you really mean 'WAVs'?

Check warning on line 195 in deployment/on-device/sdk/messages-content.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/messages-content.mdx#L195

Did you really mean 'Downmix'?
</Warning>

<Info>
**Automatic resampling.** The engine resamples to 16 kHz when needed, but providing 16 kHz audio directly avoids the resampling overhead. For best quality, record at 16 kHz mono.

Check warning on line 199 in deployment/on-device/sdk/messages-content.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/messages-content.mdx#L199

Did you really mean 'resampling'?

Check warning on line 199 in deployment/on-device/sdk/messages-content.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/messages-content.mdx#L199

Did you really mean 'resamples'?
</Info>

## Creating audio content
Expand All @@ -207,8 +206,8 @@
<Tabs>
<Tab title="Swift (iOS / macOS)">
```swift
let wavURL = Bundle.main.url(forResource: "audio", withExtension: "wav")!

Check warning on line 209 in deployment/on-device/sdk/messages-content.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/messages-content.mdx#L209

Did you really mean 'withExtension'?

Check warning on line 209 in deployment/on-device/sdk/messages-content.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/messages-content.mdx#L209

Did you really mean 'wav'?
let wavData = try Data(contentsOf: wavURL)

Check warning on line 210 in deployment/on-device/sdk/messages-content.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/messages-content.mdx#L210

Did you really mean 'wavData'?

let message = ChatMessage(
role: .user,
Expand All @@ -223,7 +222,7 @@
</Tab>
<Tab title="Kotlin (all platforms)">
```kotlin
val wavBytes = File("/path/to/audio.wav").readBytes()

Check warning on line 225 in deployment/on-device/sdk/messages-content.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/messages-content.mdx#L225

Did you really mean 'wavBytes'?
val audio = ChatMessageContent.Audio(wavBytes)

val message = ChatMessage(
Expand Down Expand Up @@ -360,7 +359,7 @@
<Tabs>
<Tab title="Swift (iOS / macOS)">
```swift
for try await response in conversation.generateResponse(message: userMessage) {

Check warning on line 362 in deployment/on-device/sdk/messages-content.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/messages-content.mdx#L362

Did you really mean 'userMessage'?
if case .audioSample(let audio) = onEnum(of: response) {
// audio.samples: [Float] in [-1.0, 1.0]
// audio.sampleRate: Int (typically 24000 for audio-gen models)
Expand Down
1 change: 0 additions & 1 deletion deployment/on-device/sdk/model-loading.mdx
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
---
title: "Model Loading"
description: "Reference for ModelDownloader, LeapDownloader, loadModel, loadSimpleModel, and KV cache reuse."

Check warning on line 3 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L3

Did you really mean 'loadModel'?
noindex: true
---

<Warning>
The LEAP SDK is deprecated and this page is no longer maintained. Build on llama.cpp directly instead — see [Migrating from LEAP SDK](/deployment/on-device/llama-cpp/migrating-from-leap-sdk).
</Warning>

The LEAP SDK ships two downloader classes built on the same pipeline. They differ by what platform integration they add:

Check warning on line 10 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L10

Did you really mean 'downloader'?

| Platform | Class | What it does |
|---|---|---|
| **Android** | `LeapModelDownloader` | One-shot `loadModel(...)` that routes through the optional [Leap Model Service](#leap-model-service-android) when installed, plus WorkManager-backed background download staging (`requestDownloadModel` / `observeDownloadProgress`) and foreground-service notifications. |
| **iOS / macOS (Swift)** | `ModelDownloader` | One-shot `loadModel(...)` and `loadSimpleModel(...)` that route every file transfer through `URLSession`. Pass `sessionConfiguration: .background(withIdentifier:)` for downloads that survive app suspension. Also exposes the underlying `downloadModel` / `requestDownloadModel` / `queryStatus` lifecycle for prefetch flows. The class ships in the `LeapModelDownloader` SPM library product. |

Check warning on line 15 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L15

Did you really mean 'prefetch'?
| **All platforms (iOS, Android, JVM, Linux native, Windows native, macOS Kotlin)** | `LeapDownloader` | The cross-platform manifest loader. One-shot `loadModel(...)` and `loadSimpleModel(...)`. No platform-native background integration — the iOS `ModelDownloader` and Android `LeapModelDownloader` classes wrap one of these internally. |

All downloader classes return the same `ModelRunner` type. They share an on-disk model cache when pointed at the same directory: `LeapDownloaderConfig.saveDir` for Swift / JVM / native, and `modelFileDir` for Android `LeapModelDownloader`. Once a download has landed, calling `LeapDownloader.loadModel(...)` against the shared cache picks up the files without re-downloading.

Check warning on line 18 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L18

Did you really mean 'downloader'?

<Info>
**Parameter naming.** Every loader uses the same parameter labels across Swift and Kotlin:

- Manifest loaders and lifecycle methods use `modelName:` / `quantizationType:` consistently. Swift `ModelDownloader` exposes `downloadModel(...)`, `requestDownloadModel(...)`, `queryStatus(...)`, and `removeModel(...)`; Android `LeapModelDownloader` exposes `requestDownloadModel(...)`, `requestStopDownload(...)`, `queryStatus(...)`, and `getModelResourceFolder(...)`; cross-platform `LeapDownloader` exposes foreground `downloadModel(...)` / `loadModel(...)` plus cache cleanup helpers.
- **`ModelSource` (sideloaded)** uses `quantizationId` — the field is part of the source descriptor, not a loader parameter.

Check warning on line 24 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L24

Did you really mean 'sideloaded'?
</Info>

<Info>
**Swift class vs. SPM product name (v0.10.6+).** In Swift code the class is `ModelDownloader`; the SPM library product / framework module / `import` statement is `LeapModelDownloader`. In 0.10.5 both shared one name, which made the class effectively uninstantiable from Swift due to type-vs-module shadowing. The Kotlin class — and therefore Android consumers — still see `LeapModelDownloader`.

Check warning on line 28 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L28

Did you really mean 'uninstantiable'?
</Info>

## Constructing the downloader

Check warning on line 31 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L31

Did you really mean 'downloader'?

<Tabs>
<Tab title="Swift (iOS / macOS)">
Expand Down Expand Up @@ -73,9 +72,9 @@
class LeapModelDownloader(
private val context: Context,
modelFileDir: File? = null,
private val notificationConfig: LeapModelDownloaderNotificationConfig = LeapModelDownloaderNotificationConfig(),

Check warning on line 75 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L75

Did you really mean 'notificationConfig'?
private val downloaderConfig: LeapDownloaderConfig = LeapDownloaderConfig(),

Check warning on line 76 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L76

Did you really mean 'downloaderConfig'?
private val ioDispatcher: CoroutineDispatcher = Dispatchers.IO,

Check warning on line 77 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L77

Did you really mean 'ioDispatcher'?
)
```

Expand Down Expand Up @@ -117,11 +116,11 @@
```swift
extension ModelDownloader {
public func loadModel(
modelName: String,

Check warning on line 119 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L119

Did you really mean 'modelName'?
quantizationType: String,

Check warning on line 120 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L120

Did you really mean 'quantizationType'?
options: LiquidInferenceEngineManifestOptions? = nil,
generationTimeParameters: GenerationTimeParameters? = nil,
forceDownload: Bool = false,

Check warning on line 123 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L123

Did you really mean 'forceDownload'?
downloadProgress: ((_ fraction: Double, _ bytesPerSecond: Int64) -> Void)? = nil
) async throws -> ModelRunner
}
Expand Down Expand Up @@ -180,11 +179,11 @@
<Tab title="Kotlin (Android)">
```kotlin
suspend fun loadModel(
modelName: String,

Check warning on line 182 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L182

Did you really mean 'modelName'?
quantizationType: String,

Check warning on line 183 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L183

Did you really mean 'quantizationType'?
options: ModelLoadingOptions? = null,
forceDownload: Boolean = false,
forceLocal: Boolean = false,

Check warning on line 186 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L186

Did you really mean 'forceLocal'?
progress: ((ProgressData) -> Unit)? = null,
): ModelRunner
```
Expand Down Expand Up @@ -213,8 +212,8 @@
<Tab title="Kotlin (JVM / native)">
```kotlin
suspend fun loadModel(
modelName: String,

Check warning on line 215 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L215

Did you really mean 'modelName'?
quantizationType: String,

Check warning on line 216 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L216

Did you really mean 'quantizationType'?
options: ModelLoadingOptions? = null,
generationTimeParameters: GenerationTimeParameters? = null,
forceDownload: Boolean = false,
Expand All @@ -238,9 +237,9 @@

Find available model and quantization slugs in the [LEAP Model Library](https://leap.liquid.ai/models).

## Sideloaded files

Check warning on line 240 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L240

Did you really mean 'Sideloaded'?

Use this path when you ship the model as an app asset, `adb push` it for development, download it via your own pipeline, or stage a multimodal model with its companion files in a known directory — anything that doesn't go through the LEAP manifest registry.

Check warning on line 242 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L242

Did you really mean 'multimodal'?

<Tabs>
<Tab title="Swift (iOS / macOS)">
Expand Down Expand Up @@ -391,7 +390,7 @@

## Fetch without loading

Useful for onboarding flows that prefetch over Wi-Fi or staging models you'll load later. A subsequent `loadModel(...)` call with the same identifiers picks up the cached files without re-downloading.

Check warning on line 393 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L393

Did you really mean 'prefetch'?

<Tabs>
<Tab title="Swift (iOS / macOS)">
Expand All @@ -399,7 +398,7 @@
extension ModelDownloader {
public func downloadModel(
modelName: String,
quantizationType: String,

Check warning on line 401 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L401

Did you really mean 'quantizationType'?
downloadProgress: ((_ fraction: Double, _ bytesPerSecond: Int64) -> Void)? = nil
) async throws -> DownloadedModelManifest

Expand All @@ -408,11 +407,11 @@
// (matches Android idempotent-call semantics).
public func requestDownloadModel(
modelName: String,
quantizationType: String,

Check warning on line 410 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L410

Did you really mean 'quantizationType'?
forceDownload: Bool = false
)
public func requestStopDownload(modelName: String, quantizationType: String)

Check warning on line 413 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L413

Did you really mean 'quantizationType'?
public func queryStatus(modelName: String, quantizationType: String) async -> ModelDownloadStatus

Check warning on line 414 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L414

Did you really mean 'quantizationType'?
public func removeModel(modelName: String, quantizationType: String) async

// Manifest-URL flavours — same shape, keyed by NSURL.
Expand Down Expand Up @@ -440,13 +439,13 @@
public let localMultimodalProjectorPath: String?
public let localAudioDecoderPath: String?
public let localAudioTokenizerPath: String?
public let chatTemplate: String?

Check warning on line 442 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L442

Did you really mean 'chatTemplate'?
}
```
</Tab>
<Tab title="Kotlin (Android)">
```kotlin
// Enqueues a unique WorkManager download worker and returns after staging it.

Check warning on line 448 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L448

Did you really mean 'Enqueues'?
suspend fun requestDownloadModel(modelName: String, quantizationType: String, forceDownload: Boolean = false)
suspend fun requestStopDownload(modelName: String, quantizationType: String)
suspend fun queryStatus(modelName: String, quantizationType: String): ModelDownloadStatus
Expand Down Expand Up @@ -480,16 +479,16 @@
```swift
public struct LiquidInferenceEngineOptions {
public let bundlePath: String
public let cacheOptions: LiquidCacheOptions?

Check warning on line 482 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L482

Did you really mean 'cacheOptions'?
public let cpuThreads: UInt32?

Check warning on line 483 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L483

Did you really mean 'cpuThreads'?
public let contextSize: UInt32?

Check warning on line 484 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L484

Did you really mean 'contextSize'?
public let nGpuLayers: UInt32?
public let mmProjPath: String?
public let audioDecoderPath: String?
public let audioTokenizerPath: String?
public let audioDecoderUseGpu: Bool // default false
public let chatTemplate: String?
public let useMmap: Bool?

Check warning on line 491 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L491

Did you really mean 'useMmap'?
public let extras: String?
}

Expand Down Expand Up @@ -537,7 +536,7 @@
<Tab title="Kotlin (all platforms)">
```kotlin
data class ModelLoadingOptions(
var randomSeed: Long? = null,

Check warning on line 539 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L539

Did you really mean 'randomSeed'?
var cpuThreads: Int = CpuThreadAdvisor.getRecommendedThreadCount(),
var chatTemplate: String? = null,
var cacheOptions: EngineOptions.CacheOptions? = null,
Expand Down Expand Up @@ -577,7 +576,7 @@

- **`cpuThreads`** — CPU thread count for token generation. Kotlin defaults to `CpuThreadAdvisor.getRecommendedThreadCount()`; Swift defaults to engine pick when `nil`.
- **`contextSize`** — override the maximum context length. Kotlin defaults to **8192**; Swift defaults to model's recommendation when `nil`.
- **`useMmap`** — tristate `Boolean?`. `null` (default) defers to the engine default of `true`. Set to `false` to force full-read loading on filesystems where `mmap` misbehaves (some Android scoped-storage paths, certain network mounts). Added in v0.10.5.

Check warning on line 579 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L579

Did you really mean 'tristate'?
- **`nGpuLayers`** (Swift) — number of transformer blocks to offload to GPU (macOS Metal). `-1` offloads everything.
- **`audioDecoderUseGpu`** (Swift) — opt the audio decoder onto the Metal backend.
- **`randomSeed`** (Kotlin) — reproducible sampling seed.
Expand All @@ -587,7 +586,7 @@
- **`extras`** — backend-specific configuration payload (JSON string).

<Info>
**Companion files.** GGUF checkpoints look for sibling vision (`mmproj`) and audio (decoder / tokenizer) files unless you override the paths. Co-locate them next to the model file or pass explicit paths via `ModelSource` for vision and audio features.

Check warning on line 589 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L589

Did you really mean 'tokenizer'?
</Info>

### `GenerationTimeParameters` & `SamplingParameters` (Kotlin)
Expand Down Expand Up @@ -615,7 +614,7 @@

## KV cache reuse

`EngineOptions.CacheOptions` (Kotlin) / `LiquidCacheOptions` (Swift) tells the engine to persist KV-cache data between generations so requests sharing a prompt prefix can skip the prefill work for the shared tokens. Added in v0.10.4; Swift convenience surface in v0.10.4.3; per-tier bounded-LRU caps stabilized in v0.10.5.

Check warning on line 617 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L617

Did you really mean 'prefill'?

<Warning>
**Disabled by default.** Cache options are `null`/`nil` until you explicitly pass them. Apps that don't opt in see no prefix reuse and no on-disk cache directory — runner load behaves exactly as it did pre-v0.10.4. On Kotlin, `enabled = true` is the sole opt-in gate: a positive `maxEntries` alone is *not* sufficient.
Expand All @@ -625,10 +624,10 @@

Transformer inference has two phases:

- **Prefill** — the model runs the full prompt through every layer and stores the attention keys and values (the "KV cache") for each prompt token. `O(prompt_length)`. Dominates time-to-first-token (TTFT) for prompts longer than a few hundred tokens on-device.

Check warning on line 627 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L627

Did you really mean 'Prefill'?
- **Decode** — each new output token only attends back to the cached K/V vectors. `O(1)` per token in prompt length.

When the cache is enabled, the SDK keeps those K/V vectors around on disk after generation finishes. The next call checks whether the new prompt shares a prefix with any cached entry; matching tokens are loaded from disk instead of recomputed. Per-token decode speed is unchanged — the win is entirely in prefill avoidance.

Check warning on line 630 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L630

Did you really mean 'prefill'?

The cache is a **bounded LRU**: the SDK enforces a size budget and evicts least-recently-used entries automatically. Don't clean up the directory yourself; deleting it manually is a hard reset.

Expand All @@ -650,10 +649,10 @@
<Tabs>
<Tab title="Swift (iOS / macOS)">
```swift
let cacheDir = FileManager.default

Check warning on line 652 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L652

Did you really mean 'cacheDir'?
.urls(for: .cachesDirectory, in: .userDomainMask)[0]
.appendingPathComponent("leap-kv-cache")
try? FileManager.default.createDirectory(at: cacheDir, withIntermediateDirectories: true)

Check warning on line 655 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L655

Did you really mean 'cacheDir'?

let options = LiquidInferenceEngineManifestOptions(
cacheOptions: .enabled(path: cacheDir.path),
Expand All @@ -673,13 +672,13 @@
</Tab>
<Tab title="Kotlin (Android)">
```kotlin
val cacheDir = context.cacheDir.resolve("leap-kv-cache").apply { mkdirs() }

Check warning on line 675 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L675

Did you really mean 'cacheDir'?

val runner = downloader.loadModel(
modelName = "LFM2-1.2B",
quantizationType = "Q5_K_M",
options = ModelLoadingOptions().apply {
cacheOptions = ModelLoadingOptions.cacheOptions(path = cacheDir.absolutePath)

Check warning on line 681 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L681

Did you really mean 'cacheDir'?
},
)
```
Expand Down Expand Up @@ -728,8 +727,8 @@
- **Cross-launch.** Cached entries survive process restarts. Delete the directory to reset.
- **First call.** The first request for a given prefix sees no speedup — it's the call that writes the entry. Subsequent calls hit the cache.
- **Memory-only mode.** Pass `EngineOptions.CacheOptions(path = ..., enabled = true, diskDisabled = true)` to skip the disk tier entirely — useful for benchmarking or callers that don't need cross-restart persistence.
- **wasmJs caveat.** The WASM bridge currently drops the entire `cache_options` block; a one-shot warning is logged when `enabled = true` is set on wasmJs. Native (Apple, Linux, MinGW), JVM, and Android propagate all fields end-to-end.

Check warning on line 730 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L730

Did you really mean 'wasmJs'?

Check warning on line 730 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L730

Did you really mean 'wasmJs'?
- **Swift backwards compat.** Prior to v0.10.4.3 the `cacheOptions` parameter was only reachable through the verbose Obj-C designated init with `KotlinUInt(unsignedInt:)` wrapping. New code should use `.enabled(path:)` and the `with(...)` builders.

Check warning on line 731 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L731

Did you really mean 'compat'?

See the [SDK changelog — KV cache reuse](/deployment/on-device/leap-sdk-changelog#kv-cache-reuse-across-generations) for the cross-platform overview.

Expand Down Expand Up @@ -761,7 +760,7 @@
- **Cross-app model sharing.** Multiple apps that load the same model + quantization share one in-memory copy.
- **Persistent foreground notification** with live state ("Loading model…", "Generating… N active", "Ready — N models loaded").
- **Per-UID session quotas** (max 3 sessions per client app, enforced by the service).
- **Disk-backed KV cache reuse across cold starts** — the service maintains its own KV cache directory, so prefill warmup persists across process restarts and across client apps.

Check warning on line 763 in deployment/on-device/sdk/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/model-loading.mdx#L763

Did you really mean 'prefill'?
- **Service-side progress** — when routing through the service, `LeapModelDownloader.loadModel(...)`'s `progress` callback fires for service-side downloads too. Passing `null` (the default) preserves the original deferred-load behavior (the model loads on first session creation rather than eagerly inside `loadModel`).
- **AIDL-routed function calling** — `Conversation.registerFunction(...)` and `registerFunctions(...)` are forwarded to the service and applied on the shared session.

Expand Down
1 change: 0 additions & 1 deletion deployment/on-device/sdk/openai-client.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
title: "OpenAI-Compatible Client"
description: "Lightweight client for OpenAI-compatible chat completions APIs — ideal for hybrid on-device + cloud routing."
noindex: true
---

<Warning>
Expand Down Expand Up @@ -192,9 +191,9 @@
// warning for the full reasoning.
let client = OpenAiClientKt.OpenAiClient(
config: OpenAiClientConfig(
apiKey: "sk-or-…",

Check warning on line 194 in deployment/on-device/sdk/openai-client.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/openai-client.mdx#L194

Did you really mean 'apiKey'?
baseUrl: "https://openrouter.ai/api/v1",

Check warning on line 195 in deployment/on-device/sdk/openai-client.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/openai-client.mdx#L195

Did you really mean 'baseUrl'?
extraHeaders: [

Check warning on line 196 in deployment/on-device/sdk/openai-client.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/openai-client.mdx#L196

Did you really mean 'extraHeaders'?
"HTTP-Referer": "https://yourapp.example.com",
"X-Title": "Your App"
]
Expand All @@ -206,9 +205,9 @@
```kotlin
val client = OpenAiClient(
OpenAiClientConfig(
apiKey = "sk-or-…",

Check warning on line 208 in deployment/on-device/sdk/openai-client.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/openai-client.mdx#L208

Did you really mean 'apiKey'?
baseUrl = "https://openrouter.ai/api/v1",

Check warning on line 209 in deployment/on-device/sdk/openai-client.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/openai-client.mdx#L209

Did you really mean 'baseUrl'?
extraHeaders = mapOf(

Check warning on line 210 in deployment/on-device/sdk/openai-client.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/openai-client.mdx#L210

Did you really mean 'extraHeaders'?
"HTTP-Referer" to "https://yourapp.example.com",
"X-Title" to "Your App",
),
Expand All @@ -225,8 +224,8 @@
```swift
let client = OpenAiClientKt.OpenAiClient(
config: OpenAiClientConfig(
apiKey: "anything", // Required by config but typically unused

Check warning on line 227 in deployment/on-device/sdk/openai-client.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/openai-client.mdx#L227

Did you really mean 'apiKey'?
baseUrl: "http://10.0.0.42:8000/v1"

Check warning on line 228 in deployment/on-device/sdk/openai-client.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/openai-client.mdx#L228

Did you really mean 'baseUrl'?
)
)
```
Expand All @@ -235,8 +234,8 @@
```kotlin
val client = OpenAiClient(
OpenAiClientConfig(
apiKey = "anything",

Check warning on line 237 in deployment/on-device/sdk/openai-client.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/openai-client.mdx#L237

Did you really mean 'apiKey'?
baseUrl = "http://10.0.0.42:8000/v1",

Check warning on line 238 in deployment/on-device/sdk/openai-client.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/openai-client.mdx#L238

Did you really mean 'baseUrl'?
)
)
```
Expand Down Expand Up @@ -299,7 +298,7 @@

@MainActor
final class HybridChatViewModel: ObservableObject {
private let onDevice: Conversation

Check warning on line 301 in deployment/on-device/sdk/openai-client.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/openai-client.mdx#L301

Did you really mean 'onDevice'?
private let cloud: OpenAiClient

init(onDevice: Conversation, cloud: OpenAiClient) {
Expand All @@ -308,7 +307,7 @@
}

func send(_ text: String, useCloud: Bool) async throws {
if useCloud {

Check warning on line 310 in deployment/on-device/sdk/openai-client.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/openai-client.mdx#L310

Did you really mean 'useCloud'?
// Cloud path: leap-sdk-openai-client has no SKIE — collect the Kotlin
// Flow manually and downcast each event with `as?`. Note the flattened
// Swift type names (`ChatMessageUser`, `ChatCompletionEventDelta`).
Expand Down Expand Up @@ -422,7 +421,7 @@
<Tabs>
<Tab title="Swift (iOS / macOS)">
```swift
deinit { client.close() }

Check warning on line 424 in deployment/on-device/sdk/openai-client.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/openai-client.mdx#L424

Did you really mean 'deinit'?
```

The lower-level constructor that accepts an externally-managed `HttpClient` is part of the Kotlin/Ktor surface and isn't a useful entry point from Swift — the Ktor engine machinery isn't bridged into the public Swift API. Use `OpenAiClientKt.OpenAiClient(config:)` and let the SDK own the session. If multiple consumers share a client, share the `OpenAiClient` instance and `close()` once at teardown.
Expand Down
1 change: 0 additions & 1 deletion deployment/on-device/sdk/overview.mdx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
---
title: "LEAP SDK (archived)"
description: "The LEAP SDK is deprecated. This archived reference is kept for teams still shipping it; new projects should use llama.cpp directly."
noindex: true
---

<Warning>
The **LEAP SDK is deprecated** and no longer receives new releases. It was a Kotlin Multiplatform wrapper around llama.cpp, and everything it provided is available from llama.cpp directly. New projects should follow the [Build with llama.cpp](/deployment/on-device/llama-cpp/mobile) guides; existing users can find a concept-by-concept mapping in [Migrating from LEAP SDK](/deployment/on-device/llama-cpp/migrating-from-leap-sdk).

Check warning on line 7 in deployment/on-device/sdk/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/overview.mdx#L7

Did you really mean 'Multiplatform'?
</Warning>

Published LEAP SDK artifacts remain available (Swift Package Manager via [`Liquid4All/leap-sdk`](https://github.com/Liquid4All/leap-sdk), Maven Central under `ai.liquid.leap:*`), but they are frozen at their last release and are not updated for new LFM checkpoints. Sampling defaults, chat templates, and tool-call parsing for current models are maintained upstream in llama.cpp.
Expand Down
1 change: 0 additions & 1 deletion deployment/on-device/sdk/quick-start.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
title: "Quick Start"
description: "Install the LEAP SDK on iOS, macOS, Android, JVM, Linux, or Windows — same API everywhere."
noindex: true
---

<Warning>
Expand All @@ -10,18 +9,18 @@

Latest version: `v0.10.7`

The Leap SDK is a Kotlin Multiplatform library: the same `ModelRunner` / `Conversation` / `MessageResponse` API runs on every supported target. The code differs only in **language** (Swift vs. Kotlin) and **packaging** (SPM, Gradle, or Kotlin/Native plugin) — the call shapes are identical. For background on what the SDK is and what first-class LFM support means in practice, see the [Overview](/deployment/on-device/sdk/overview).

Check warning on line 12 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L12

Did you really mean 'Multiplatform'?

Check warning on line 12 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L12

Did you really mean 'Gradle'?

<Info>
**Migrating from 0.9.x?** v0.10.0 unifies the SDK into a single Kotlin Multiplatform distribution published from [`Liquid4All/leap-sdk`](https://github.com/Liquid4All/leap-sdk). The standalone `Liquid4All/leap-ios` repo is no longer the source-of-truth. See the [SDK changelog](/deployment/on-device/leap-sdk-changelog#0-9-x-0-10-x-kotlin-multiplatform-unification) for the transition story and drop-in replacements for legacy `Leap.load(...)` / `LiquidEngine(...)` call sites.

Check warning on line 15 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L15

Did you really mean 'Multiplatform'?
</Info>

## 1. Prerequisites

<Tabs>
<Tab title="iOS / macOS">
- Xcode 16.0+ with Swift 6.0.

Check warning on line 22 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L22

Did you really mean 'Xcode'?
- iOS **17.0+** or macOS **15.0+** (Apple Silicon only — Mac Catalyst is **not** supported; the shipped XCFrameworks contain only `ios-arm64`, `ios-arm64-simulator`, and `macos-arm64` slices, and `Package.swift` declares only `.iOS(.v17)` / `.macOS(.v15)` platforms).

Check warning on line 23 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L23

Did you really mean 'XCFrameworks'?
- A physical iPhone or iPad with at least 3 GB RAM for best performance. The simulator works for development but runs models much slower.

<Warning>
Expand All @@ -29,7 +28,7 @@
</Warning>
</Tab>
<Tab title="Android">
- Kotlin Android Plugin **2.3.0+** and Android Gradle Plugin **8.13.0+**:

Check warning on line 31 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L31

Did you really mean 'Gradle'?
```kotlin
plugins {
id("com.android.application") version "8.13.2" apply false
Expand All @@ -48,15 +47,15 @@
</Warning>
</Tab>
<Tab title="JVM Desktop">
- **JDK 11+** (Hotspot or any standard JVM).

Check warning on line 50 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L50

Did you really mean 'Hotspot'?
- Kotlin 2.3.0+ if you're writing Kotlin (Java consumers work too).
- Supported hosts: macOS ARM64, Linux x86_64, Linux aarch64, Windows x86_64, Windows aarch64.

The `leap-sdk` JAR bundles the JNI binaries for every supported OS/arch — no extra setup needed.
</Tab>
<Tab title="Linux / Windows native">
- Kotlin **2.3.20+** and Gradle 8.x for the Kotlin/Native build.

Check warning on line 57 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L57

Did you really mean 'Gradle'?
- **Linux runtime:** glibc **2.34+** (Ubuntu 22.04, Debian 12, RHEL 9, or newer).

Check warning on line 58 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L58

Did you really mean 'glibc'?
- **Windows runtime:** Windows 10+.

<Warning>
Expand Down Expand Up @@ -247,7 +246,7 @@

## 3. Load a model

The recommended path is **manifest-based** loading. On every platform, the platform downloader's `loadModel(...)` downloads (if needed) and loads in one call — `ModelDownloader.loadModel(...)` on iOS / macOS, `LeapModelDownloader.loadModel(...)` on Android, and `LeapDownloader.loadModel(...)` on JVM and Linux / Windows Kotlin/Native. All paths fetch from the [LEAP Model Library](https://leap.liquid.ai/models) on first use and load from cache thereafter.

Check warning on line 249 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L249

Did you really mean 'downloader's'?

<Tabs>
<Tab title="Swift (iOS / macOS)">
Expand Down Expand Up @@ -278,7 +277,7 @@
defer { isLoading = false }
do {
let runner = try await downloader.loadModel(
modelName: "LFM2-1.2B",

Check warning on line 280 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L280

Did you really mean 'modelName'?
quantizationType: "Q5_K_M"
) { fraction, _ in
// fraction: Double (0...1) · bytesPerSecond: Int64
Expand Down Expand Up @@ -395,7 +394,7 @@
</Tab>
</Tabs>

### Loading a sideloaded GGUF

Check warning on line 397 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L397

Did you really mean 'sideloaded'?

When you already have a model file on disk — shipped as an app asset, `adb push`-ed for development, or downloaded by your own pipeline — use `loadSimpleModel(model: ModelSource(...))` to skip the LEAP Model Library lookup entirely.

Expand All @@ -404,9 +403,9 @@
```swift
let runner = try await downloader.loadSimpleModel(
model: ModelSource(
modelPath: bundledURL.path,

Check warning on line 406 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L406

Did you really mean 'modelPath'?
modelName: "LFM2-1.2B-Instruct",
quantizationId: "Q4_K_M"

Check warning on line 408 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L408

Did you really mean 'quantizationId'?
)
)
```
Expand All @@ -417,9 +416,9 @@
```kotlin
val runner = downloader.loadSimpleModel(
model = ModelSource(
modelPath = "/path/to/lfm2-1_2b-q4_k_m.gguf",

Check warning on line 419 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L419

Did you really mean 'modelPath'?
modelName = "LFM2-1.2B-Instruct",
quantizationId = "Q4_K_M"

Check warning on line 421 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L421

Did you really mean 'quantizationId'?
)
)
```
Expand All @@ -437,8 +436,8 @@
```swift
func send(_ text: String) {
guard let conversation else { return }
generationTask?.cancel()

Check warning on line 439 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L439

Did you really mean 'generationTask'?
let userMessage = ChatMessage(role: .user, textContent: text)

Check warning on line 440 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L440

Did you really mean 'userMessage'?

Check warning on line 440 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L440

Did you really mean 'textContent'?
let options = GenerationOptions()
.with(temperature: 0.3)
.with(minP: 0.15)
Expand Down Expand Up @@ -468,7 +467,7 @@
case .audioSample(let audio):
audioRenderer.enqueue(audio.samples, sampleRate: Int(audio.sampleRate))
case .functionCalls(let payload):
handleFunctionCalls(payload.functionCalls)

Check warning on line 470 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L470

Did you really mean 'functionCalls'?
case .complete(let completion):
if let stats = completion.stats {
print("Finished with \(stats.totalTokens) tokens")
Expand Down Expand Up @@ -505,14 +504,14 @@
</Tab>
</Tabs>

Cancel the in-flight task (Swift) or coroutine job (Kotlin) to interrupt generation early.

Check warning on line 507 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L507

Did you really mean 'coroutine'?

## 5. Send images and audio (optional)

If the loaded model is multimodal (and its companion files were detected), you can attach a non-text part — an image, a WAV blob, or raw PCM samples — alongside the text in a `ChatMessage`.

Check warning on line 511 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L511

Did you really mean 'multimodal'?

<Info>
**Multimodality is model-specific.** Most multimodal models we ship are text + one other modality: text + vision (the VLM family) or text + audio (the audio family) — not both in the same checkpoint. Send image content (`fromJPEGData(_:)`, `image(url:)`, `fromBitmap(...)` / `fromUIImage(_:)`) only to a vision-capable model, and audio content (`fromWAVData(_:)`, `fromFloatSamples(_:sampleRate:)`) only to an audio-capable model. Mixing modalities a model wasn't trained on will either fail to load the companion file or produce nonsense. Check the model's [Hugging Face card](https://huggingface.co/LiquidAI) before wiring up a non-text input path.

Check warning on line 514 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L514

Did you really mean 'multimodal'?
</Info>

<Tabs>
Expand All @@ -520,10 +519,10 @@
```swift
// Text + image (vision-capable model). Use `ChatMessageContent.fromJPEGData(_:)`
// for raw JPEG bytes, or `.image(url:)` for a data URL / remote URL.
let imageMessage = ChatMessage(

Check warning on line 522 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L522

Did you really mean 'imageMessage'?
role: .user,
content: [.text("Describe what you see."), ChatMessageContent.fromJPEGData(jpegData)],
reasoningContent: nil,

Check warning on line 525 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L525

Did you really mean 'reasoningContent'?
functionCalls: nil
)

Expand Down Expand Up @@ -551,7 +550,7 @@
<Tab title="Kotlin (all platforms)">
```kotlin
// Text + image (vision-capable model)
val imageMessage = ChatMessage(

Check warning on line 553 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L553

Did you really mean 'imageMessage'?
role = ChatMessage.Role.USER,
content = listOf(
ChatMessageContent.Text("Describe what you see."),
Expand Down Expand Up @@ -593,7 +592,7 @@
</Card>

<Card title="Function Calling" icon="wrench" href="/deployment/on-device/sdk/function-calling">
Tool use with Hermes and Pythonic parsers.

Check warning on line 595 in deployment/on-device/sdk/quick-start.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/quick-start.mdx#L595

Did you really mean 'Pythonic'?
</Card>

<Card title="Constrained Generation" icon="brackets-curly" href="/deployment/on-device/sdk/constrained-generation">
Expand Down
1 change: 0 additions & 1 deletion deployment/on-device/sdk/utilities.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
title: "Utilities"
description: "Error handling, serialization, Android-specific downloader internals, and a putting-it-together example."

Check warning on line 3 in deployment/on-device/sdk/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/utilities.mdx#L3

Did you really mean 'downloader'?
noindex: true
---

<Warning>
Expand Down Expand Up @@ -39,7 +38,7 @@

## Serialization

`ChatMessage`, `ChatMessageContent`, `LeapFunctionCall`, and `Manifest` are serializable on every platform and round-trip cleanly into JSON compatible with OpenAI's chat-completions schema.

Check warning on line 41 in deployment/on-device/sdk/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/utilities.mdx#L41

Did you really mean 'serializable'?

<Tabs>
<Tab title="Swift (iOS / macOS)">
Expand All @@ -57,7 +56,7 @@
// round-trip that talks to your sync backend.
```

Persist `data` to disk, UserDefaults, or your sync backend. On restore, decode the JSON via Kotlin's `LeapJson` (re-exported through SKIE) into a `[ChatMessage]` and rebuild via `modelRunner.createConversationFromHistory(history:)`. There is no Swift-native dictionary-based `ChatMessage` initializer — the Kotlin serializer is the source of truth on both platforms.

Check warning on line 59 in deployment/on-device/sdk/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/utilities.mdx#L59

Did you really mean 'initializer'?

Check warning on line 59 in deployment/on-device/sdk/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/utilities.mdx#L59

Did you really mean 'serializer'?
</Tab>
<Tab title="Kotlin (all platforms)">
The SDK uses [kotlinx.serialization](https://github.com/Kotlin/kotlinx.serialization) — `@Serializable` is already declared on the relevant types in the core SDK.
Expand Down Expand Up @@ -113,7 +112,7 @@

### Permission setup

`requestDownloadModel(...)` enqueues a WorkManager download worker. During transfer, the worker runs in the foreground and displays notifications, so declare these in your `AndroidManifest.xml`:

Check warning on line 115 in deployment/on-device/sdk/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/utilities.mdx#L115

Did you really mean 'enqueues'?

```xml
<uses-permission android:name="android.permission.INTERNET" />
Expand Down Expand Up @@ -152,7 +151,7 @@
private val downloaderConfig: LeapDownloaderConfig = LeapDownloaderConfig(),
private val ioDispatcher: CoroutineDispatcher = Dispatchers.IO,
) {
suspend fun requestDownloadModel(modelName: String, quantizationType: String, forceDownload: Boolean = false)

Check warning on line 154 in deployment/on-device/sdk/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/utilities.mdx#L154

Did you really mean 'modelName'?

Check warning on line 154 in deployment/on-device/sdk/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/utilities.mdx#L154

Did you really mean 'quantizationType'?
suspend fun requestStopDownload(modelName: String, quantizationType: String)
suspend fun queryStatus(modelName: String, quantizationType: String): ModelDownloadStatus
fun observeDownloadProgress(modelName: String, quantizationType: String): StateFlow<ModelDownloadProgress?>
Expand All @@ -179,9 +178,9 @@
}
```

Refer to the nested status type as `LeapModelDownloader.ModelDownloadStatus.NotOnLocal` / `.DownloadInProgress` / `.Downloaded` on Android — the Android downloader does not expose a top-level `ai.liquid.leap.downloader.ModelDownloadStatus`. (Apple ships a top-level `ai.liquid.leap.downloader.ModelDownloadStatus` `sealed interface` with a different payload — `DownloadInProgress(progress: Double)` and a `data object Downloaded` with no size — so don't share status-decoding code unmodified across platforms.)

Check warning on line 181 in deployment/on-device/sdk/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/utilities.mdx#L181

Did you really mean 'downloader'?

- **`requestDownloadModel`** — `suspend` fire-and-forget prefetch. It enqueues a unique WorkManager download worker; the download itself survives app restarts, and the call returns after staging the work request.

Check warning on line 183 in deployment/on-device/sdk/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/utilities.mdx#L183

Did you really mean 'prefetch'?

Check warning on line 183 in deployment/on-device/sdk/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/utilities.mdx#L183

Did you really mean 'enqueues'?
- **`requestStopDownload`** — `suspend`; cancels an in-flight background download.
- **`queryStatus`** — `suspend` one-shot status check.
- **`observeDownloadProgress`** — `StateFlow<ModelDownloadProgress?>` for UI updates during a background download. It emits `null` when no download is active.
Expand All @@ -190,7 +189,7 @@

### Removing a downloaded model

Use the Android downloader's resource folder to clean up disk, or construct a cross-platform `LeapDownloader` with the same `saveDir` and call its instance method `deleteModelResources(...)`:

Check warning on line 192 in deployment/on-device/sdk/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/utilities.mdx#L192

Did you really mean 'downloader's'?

```kotlin
val resourceFolder = downloader.getModelResourceFolder(
Expand All @@ -214,8 +213,8 @@
<Tab title="Swift (iOS / macOS)">
```swift
let caches = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first!.path
let modelsDir = (caches as NSString).appendingPathComponent("leap_models")

Check warning on line 216 in deployment/on-device/sdk/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/utilities.mdx#L216

Did you really mean 'modelsDir'?
let downloader = ModelDownloader(config: LeapDownloaderConfig(saveDir: modelsDir))

Check warning on line 217 in deployment/on-device/sdk/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/utilities.mdx#L217

Did you really mean 'downloader'?

Check warning on line 217 in deployment/on-device/sdk/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/utilities.mdx#L217

Did you really mean 'modelsDir'?

let runner = try await downloader.loadModel(
modelName: "LFM2.5-1.2B-Instruct",
Expand Down Expand Up @@ -250,7 +249,7 @@
// pass `cacheDir.absolutePath`, not the `File` itself. On Android, prefer
// `LeapModelDownloader(application)` (the cross-platform `LeapDownloader` works
// too, but doesn't integrate with WorkManager).
val downloader = LeapDownloader(LeapDownloaderConfig(saveDir = cacheDir.absolutePath))

Check warning on line 252 in deployment/on-device/sdk/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/utilities.mdx#L252

Did you really mean 'downloader'?
val runner = downloader.loadModel(
modelName = "LFM2.5-1.2B-Instruct",
quantizationType = "Q4_K_M"
Expand Down
1 change: 0 additions & 1 deletion deployment/on-device/sdk/voice-assistant.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
title: "Voice Assistant Widget"
description: "Drop-in Compose Multiplatform voice UI — runs on iOS, macOS, Android, and JVM Desktop."

Check warning on line 3 in deployment/on-device/sdk/voice-assistant.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/voice-assistant.mdx#L3

Did you really mean 'Multiplatform'?
noindex: true
---

<Warning>
Expand All @@ -10,13 +9,13 @@

The `leap-ui` module (introduced in v0.10.0) ships a ready-to-use voice assistant widget — an animated orb, mic button, and status label — backed by a state machine that handles recording, generation, and audio playback. Wire it to a model and it handles the rest.

`leap-ui` is a Compose Multiplatform module, so the same widget runs on:

Check warning on line 12 in deployment/on-device/sdk/voice-assistant.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/voice-assistant.mdx#L12

Did you really mean 'Multiplatform'?

- **iOS** — bridged to UIKit via `VoiceAssistantViewController` and exposed to SwiftUI through `UIViewControllerRepresentable`.

Check warning on line 14 in deployment/on-device/sdk/voice-assistant.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/voice-assistant.mdx#L14

Did you really mean 'UIKit'?
- **macOS** — bridged to AppKit via `VoiceAssistantNSViewController`. SwiftUI hosts via `NSViewControllerRepresentable` + `NSHostingController`.
- **Android** — direct Compose for Android.
- **JVM Desktop** — Compose for Desktop. Same Maven artifact; you provide audio I/O implementations (the demo apps in `leap-ui-demo/` ship patterns you can adapt).
- **Web (Wasm, experimental)** — present in the source tree (`leap-ui-demo/web`) but not yet covered by the stable release notes through v0.10.7 — treat as preview.

Check warning on line 18 in deployment/on-device/sdk/voice-assistant.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/voice-assistant.mdx#L18

Did you really mean 'Wasm'?

## Add the dependency

Expand Down Expand Up @@ -80,7 +79,7 @@

<Tabs>
<Tab title="Swift (iOS / macOS)">
The factory `VoiceAssistantStore.makeForApple()` hides Kotlin coroutine plumbing from Swift callers. It creates the store with a `MainScope()`, the default Apple audio recorder and player, and an EMA-smoothed amplitude.

Check warning on line 82 in deployment/on-device/sdk/voice-assistant.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/voice-assistant.mdx#L82

Did you really mean 'coroutine'?

```swift
import LeapModelDownloader
Expand Down Expand Up @@ -494,7 +493,7 @@
| `VoiceAssistantStore` | State machine + orchestrator. Apple platforms: `makeForApple()`. |
| `VoiceAssistantStateHolder` | Compose-friendly state container, exposed to Swift. |
| `VoiceAssistantWidget` (Compose) | The widget itself. Drop into any Compose tree (Android, JVM, iOS via host controller, macOS via host controller). |
| `VoiceAssistantViewController` (UIKit) / `VoiceAssistantNSViewController` (AppKit) | Pre-built hosts for Apple. |

Check warning on line 496 in deployment/on-device/sdk/voice-assistant.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/sdk/voice-assistant.mdx#L496

Did you really mean 'UIKit'?
| `AppleAudioRecorder` / `AppleAudioPlayer` | Default audio I/O on iOS / macOS. |
| `VoiceConversation` | Adapter interface you implement to bridge the store to a `Conversation`. |
| `VoiceWidgetLabels`, `VoiceWidgetColors` | Theming (use `.companion.Default` to access the canonical palette). |
Expand Down
5 changes: 4 additions & 1 deletion deployment/tools/model-bundling/authentication.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
---
title: "Authentication"
description: "Authentication commands for the LEAP Bundle CLI"
noindex: true
---

<Warning>
The LEAP Model Bundling Service is deprecated and no longer maintained. For new deployments, download GGUF files from [Hugging Face](https://huggingface.co/LiquidAI) and run them with [llama.cpp](/deployment/on-device/llama-cpp).
</Warning>

## `login`

Authenticate with the LEAP platform using your API token.
Expand Down
5 changes: 4 additions & 1 deletion deployment/tools/model-bundling/bundle-creation.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
---
title: "Bundle Creation"
description: "Commands for creating and validating bundle requests in the LEAP Bundle CLI"
noindex: true
---

<Warning>
The LEAP Model Bundling Service is deprecated and no longer maintained. For new deployments, download GGUF files from [Hugging Face](https://huggingface.co/LiquidAI) and run them with [llama.cpp](/deployment/on-device/llama-cpp).
</Warning>

## `create`

Create a new bundle request by uploading a model directory.
Expand All @@ -26,7 +29,7 @@
- If both `--parallel` and `--sequential` are specified, `--parallel` takes precedence.
- `--executorch` (deprecated): Use ExecuTorch bundling instead of GGUF. By default, the CLI uses GGUF bundling. This option may be removed in a future version.
- `--quantization <type>`: Specify the quantization type for the model bundle. Options include `Q4_K_M` (default), `Q8_0`, `F16`, and [other llama.cpp quantization types](https://github.com/ggml-org/llama.cpp/blob/0a0bba05e8390ab7e4a54bb8c0ed0a25da64cf62/tools/quantize/quantize.cpp#L22-L58).
- `--mmproj-quantization <type>`: (GGUF only) Specify the mmproj quantization type for vision-language or audio models. Valid options: `q4`, `q8` (default), `f16`.

Check warning on line 32 in deployment/tools/model-bundling/bundle-creation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/tools/model-bundling/bundle-creation.mdx#L32

Did you really mean 'mmproj'?

**Behavior**

Expand Down Expand Up @@ -65,7 +68,7 @@
# Create GGUF bundle with specific quantization
leap-bundle create ./my-model-directory --quantization Q8_0

# Create GGUF bundle for VL model with mmproj quantization

Check warning on line 71 in deployment/tools/model-bundling/bundle-creation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/tools/model-bundling/bundle-creation.mdx#L71

Did you really mean 'mmproj'?
leap-bundle create ./my-vl-model-directory --mmproj-quantization f16
```

Expand Down Expand Up @@ -110,7 +113,7 @@
**Process Flow**

1. Validates input directory exists
2. Calculates directory hash for deduplication

Check warning on line 116 in deployment/tools/model-bundling/bundle-creation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/tools/model-bundling/bundle-creation.mdx#L116

Did you really mean 'deduplication'?
3. Creates bundle request via API
4. Uploads directory contents to S3 using signed URLs
5. Updates request status to track progress
Expand Down
5 changes: 4 additions & 1 deletion deployment/tools/model-bundling/bundle-management.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
---
title: "Bundle Management"
description: "Commands for listing and canceling bundle requests in the LEAP Bundle CLI"
noindex: true
---

<Warning>
The LEAP Model Bundling Service is deprecated and no longer maintained. For new deployments, download GGUF files from [Hugging Face](https://huggingface.co/LiquidAI) and run them with [llama.cpp](/deployment/on-device/llama-cpp).
</Warning>

## `list`

List bundle requests or get details for a specific request.
Expand Down
5 changes: 4 additions & 1 deletion deployment/tools/model-bundling/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
title: "LEAP Bundle CLI Changelog"
sidebarTitle: "Changelog"
description: "Release history for leap-bundle, the Liquid AI model bundling CLI tool."
noindex: true
---

<Warning>
The LEAP Model Bundling Service is deprecated and no longer maintained. For new deployments, download GGUF files from [Hugging Face](https://huggingface.co/LiquidAI) and run them with [llama.cpp](/deployment/on-device/llama-cpp).
</Warning>

## `v0.9.0` - 2026-01-02

**New features**
Expand Down
5 changes: 4 additions & 1 deletion deployment/tools/model-bundling/configuration.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
---
title: "Configuration"
description: "Configuration commands and file format for the LEAP Bundle CLI"
noindex: true
---

<Warning>
The LEAP Model Bundling Service is deprecated and no longer maintained. For new deployments, download GGUF files from [Hugging Face](https://huggingface.co/LiquidAI) and run them with [llama.cpp](/deployment/on-device/llama-cpp).
</Warning>

## `config`

View CLI configuration settings.
Expand Down
5 changes: 4 additions & 1 deletion deployment/tools/model-bundling/data-privacy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
title: "Data Privacy"
description: "This page outlines how the LEAP Model Bundling Service handles your data, what information we collect and delete."
sidebar_position: 3
noindex: true
---

<Warning>
The LEAP Model Bundling Service is deprecated and no longer maintained. For new deployments, download GGUF files from [Hugging Face](https://huggingface.co/LiquidAI) and run them with [llama.cpp](/deployment/on-device/llama-cpp).
</Warning>

### Bundle Request Information

When you create a bundle request using `leap-bundle create`, we store the following information:

- **Input file path**: The path of your input model directory.
- **Input file hash**: A cryptographic hash of your model directory contents for deduplication.

Check warning on line 16 in deployment/tools/model-bundling/data-privacy.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/tools/model-bundling/data-privacy.mdx#L16

Did you really mean 'deduplication'?
- **Bundle arguments**: All command-line arguments passed to the bundling service. E.g. required quantization type.
- **Request metadata**: Creation time, etc.
- **User identification**: Your internal user ID to associate requests with your account.
Expand Down
5 changes: 4 additions & 1 deletion deployment/tools/model-bundling/download.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
---
title: "Download"
description: "Download commands for bundle requests and LEAP models in the LEAP Bundle CLI"
noindex: true
---

<Warning>
The LEAP Model Bundling Service is deprecated and no longer maintained. For new deployments, download GGUF files from [Hugging Face](https://huggingface.co/LiquidAI) and run them with [llama.cpp](/deployment/on-device/llama-cpp).
</Warning>

The `download` command supports two modes of operation:

<Tabs>
Expand Down
1 change: 0 additions & 1 deletion deployment/tools/model-bundling/quick-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
title: "LEAP Bundle CLI Quick Start"
sidebarTitle: "Quick Start"
description: "The Bundling Service helps users create and manage model bundles for Liquid Edge AI Platform (LEAP). Currently users interact with it through a command-line interface (CLI)."
noindex: true
---

<Warning>
Expand Down
5 changes: 4 additions & 1 deletion deployment/tools/model-bundling/reference.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
---
title: "Reference"
description: "Reference information for the LEAP Bundle CLI including limitations, error handling, and exit codes"
noindex: true
---

<Warning>
The LEAP Model Bundling Service is deprecated and no longer maintained. For new deployments, download GGUF files from [Hugging Face](https://huggingface.co/LiquidAI) and run them with [llama.cpp](/deployment/on-device/llama-cpp).
</Warning>

## All Commands

| Command | Description |
Expand All @@ -28,7 +31,7 @@

## Current Limitations

- The bundle tool only works on these model types for now: LFM2, LFM2-VL, Qwen.

Check warning on line 34 in deployment/tools/model-bundling/reference.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/tools/model-bundling/reference.mdx#L34

Did you really mean 'Qwen'?
- We are working on expanding support to more models.

## Error Handling
Expand Down
33 changes: 33 additions & 0 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"name": "Liquid AI Docs",
"description": "Documentation for Liquid AI Foundation Models (LFM)",
"seo": {
"indexing": "all",
"organization": {
"name": "Liquid AI",
"url": "https://www.liquid.ai",
Expand Down Expand Up @@ -619,6 +620,38 @@
{
"source": "/lfm/fine-tuning",
"destination": "/lfm/fine-tuning/overview"
},
{
"source": "/lfm/getting-started/intro",
"destination": "/lfm/getting-started/welcome"
},
{
"source": "/lfm/inference/lmstudio",
"destination": "/deployment/on-device/lm-studio"
},
{
"source": "/lfm/key-concepts/models",
"destination": "/lfm/models/complete-library"
},
{
"source": "/deployment/tools/model-bundling",
"destination": "/deployment/on-device/llama-cpp"
},
{
"source": "/lfm/models/lfm3-1-7b",
"destination": "/lfm/models/lfm3-1.7b"
},
{
"source": "/lfm/getting-started/text-generation-and-prompting",
"destination": "/lfm/key-concepts/text-generation-and-prompting"
},
{
"source": "/lfm/frameworks/leap",
"destination": "/deployment/on-device/llama-cpp/migrating-from-leap-sdk"
},
{
"source": "/lfm/getting-started/vision",
"destination": "/lfm/key-concepts/vision-capabilities"
}
],
"ai": {
Expand Down
4 changes: 4 additions & 0 deletions examples/laptop-examples/audio-car-cockpit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
Browse the complete example on GitHub
</Card>

<Note>
This demo uses LFM2.5-Audio-1.5B and LFM2-1.2B-Tool, both of which are deprecated. For new projects, see [LFM3-Audio-2B](/lfm/models/lfm3-audio-2b) for speech and [LFM2.5-1.2B-Instruct](/lfm/models/lfm25-1.2b-instruct) for tool calling. The demo and commands below use the original models.
</Note>

## What's inside?

Combines [LFM2.5-Audio-1.5B](https://huggingface.co/LiquidAI/LFM2.5-Audio-1.5B-GGUF) in TTS and STT modes with [LFM2-1.2B-Tool](https://huggingface.co/LiquidAI/LFM2-1.2B-Tool-GGUF) within a mockup of a car cockpit, letting the user control the car functionalities by voice.

Check warning on line 16 in examples/laptop-examples/audio-car-cockpit.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

examples/laptop-examples/audio-car-cockpit.mdx#L16

Did you really mean 'mockup'?

All running locally in real-time.

Expand Down
8 changes: 6 additions & 2 deletions examples/laptop-examples/audio-to-text-in-real-time.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
Browse the complete example on GitHub
</Card>

This example demonstrates how to use the [LFM2.5-Audio-1.5B](https://docs.liquid.ai/lfm/models/lfm25-audio-1.5b) model with llama.cpp to transcribe audio files locally in real-time.
<Note>
This example uses LFM2.5-Audio-1.5B, which is deprecated. For new projects, use [LFM3-Audio-2B](/lfm/models/lfm3-audio-2b).
</Note>

This example demonstrates how to use the [LFM2.5-Audio-1.5B](/lfm/models/lfm25-audio-1.5b) model with llama.cpp to transcribe audio files locally in real-time.

Intelligent audio assistants on the edge are possible, and this repository is just one step towards that.

Expand All @@ -19,7 +23,7 @@
cd cookbook/examples/audio-transcription-cli
```

2. Install uv on your system, if you don't have it already.

Check warning on line 26 in examples/laptop-examples/audio-to-text-in-real-time.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

examples/laptop-examples/audio-to-text-in-real-time.mdx#L26

Did you really mean 'uv'?

<Accordion title="Click to see installation instructions for uv">
**macOS/Linux:**
Expand Down Expand Up @@ -80,7 +84,7 @@

## llama.cpp support for audio models

[llama.cpp](https://github.com/ggerganov/llama.cpp) is a super fast and lightweight open-source inference engine for Language Models. It is written in C++ and can be used to run LLMs on your local machine. For example, our Python CLI used llama.cpp under the hood to deliver fast transcriptions, instead of using either `PyTorch` or the higher-level `transformers` library.

Check warning on line 87 in examples/laptop-examples/audio-to-text-in-real-time.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

examples/laptop-examples/audio-to-text-in-real-time.mdx#L87

Did you really mean 'LLMs'?

In the [examples.sh](https://github.com/Liquid4All/cookbook/blob/main/examples/audio-transcription-cli/examples.sh) script you will find 3 examples on how to run inference with LFM2.5-Audio-1.5B for 3 common use cases:

Expand Down Expand Up @@ -135,7 +139,7 @@

### What is LFM2.5-350M?

[LFM2.5-350M](https://docs.liquid.ai/lfm/models/lfm25-350m) is a small text-to-text model that can be used for tasks like text cleaning. To achieve optimal performance for your particular use case, you need to optimize your system and user prompts.
[LFM2.5-350M](/lfm/models/lfm25-350m) is a small text-to-text model that can be used for tasks like text cleaning. To achieve optimal performance for your particular use case, you need to optimize your system and user prompts.

## Need help?

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
---
title: "Invoice extractor tool"
description: "Extract structured payment details from invoice PDFs using LFM2.5-VL-1.6B and llama.cpp, running fully local."

Check warning on line 3 in examples/laptop-examples/invoice-extractor-tool-with-liquid-nanos.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

examples/laptop-examples/invoice-extractor-tool-with-liquid-nanos.mdx#L3

Did you really mean 'PDFs'?
---

<Card title="View Source Code" icon="github" href="https://github.com/Liquid4All/cookbook/tree/main/examples/invoice-parser">
Browse the complete example on GitHub
</Card>

<Note>
**Newer model available:** This example uses LFM2.5-VL-1.6B. For new projects, see [LFM3-VL-2B](/lfm/models/lfm3-vl-2b).
</Note>

A Python CLI that extracts payment details from invoice PDFs.

Check warning on line 14 in examples/laptop-examples/invoice-extractor-tool-with-liquid-nanos.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

examples/laptop-examples/invoice-extractor-tool-with-liquid-nanos.mdx#L14

Did you really mean 'PDFs'?

![Invoice extraction: a utility bill image goes through LFM2.5-VL-1.6B on llama.cpp and comes out as structured JSON](https://github.com/Liquid4All/cookbook/raw/main/examples/invoice-parser/media/diagram.jpg)

Expand All @@ -23,7 +27,7 @@

* **Set up local AI inference** using llama.cpp to run Liquid models entirely on your machine without requiring cloud services or API keys
* **Build a file monitoring system** that automatically processes new files dropped into a directory
* **Extract structured output from images** using [LFM2.5-VL-1.6B](https://docs.liquid.ai/lfm/models/lfm25-vl-1.6b), a small vision-language model.
* **Extract structured output from images** using [LFM2.5-VL-1.6B](/lfm/models/lfm25-vl-1.6b), a small vision-language model.

## Environment setup

Expand Down
4 changes: 4 additions & 0 deletions examples/web/audio-webgpu-demo.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
Browse the complete example on Hugging Face
</Card>

<Note>
This demo uses LFM2.5-Audio-1.5B, which is deprecated. For new projects, see [LFM3-Audio-2B](/lfm/models/lfm3-audio-2b). The instructions below use the original model.
</Note>

This example showcases the **LFM2.5-Audio-1.5B** model running entirely within a web browser using WebGPU and ONNX Runtime Web technology. The demo provides three powerful audio processing modes: automatic speech recognition, text-to-speech synthesis, and interleaved conversations.

## What's Inside?
Expand Down Expand Up @@ -62,12 +66,12 @@
**2. Text-to-Speech (TTS)**
- Input: Written text
- Output: Natural-sounding audio
- Use case: Create voice assistants, audiobooks, or accessibility features

Check warning on line 69 in examples/web/audio-webgpu-demo.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

examples/web/audio-webgpu-demo.mdx#L69

Did you really mean 'audiobooks'?

**3. Interleaved Mode**
- Input: Mixed audio and text
- Output: Conversational responses in text or audio
- Use case: Interactive voice assistants and chatbots

Check warning on line 74 in examples/web/audio-webgpu-demo.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

examples/web/audio-webgpu-demo.mdx#L74

Did you really mean 'chatbots'?

## System Requirements

Expand Down
Loading
Loading