Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,5 @@ Thumbs.db
env
env/*

__pycache__/
__pycache__/
devlog/
5 changes: 5 additions & 0 deletions deployment/on-device/android/advanced-features.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
description: "API reference for constrained generation and function calling in the LEAP Android SDK"
---

<Warning>
**Legacy Documentation** — This page documents the standalone iOS/Android SDK which has been superseded by the unified [LEAP SDK](/deployment/on-device/leap-sdk/quick-start-guide). New projects should use the LEAP SDK.
</Warning>


## Constrained Generation

Please refer to [Constrained Generation](./constrained-generation) guide on detailed usage.
Expand All @@ -28,7 +33,7 @@
- `klass`: the Kotlin class object created from `T::class`. It must be a data class annotated with `Generatable`.
- `indentSpaces`: a non null value will format the JSON output into a pretty style with the given indent spaces.

If the data class cannot be supported or any other issues blocking the generation of JSONSchema, an `LeapGeneratableSchematizationException` will be thrown.

Check warning on line 36 in deployment/on-device/android/advanced-features.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/advanced-features.mdx#L36

Did you really mean 'JSONSchema'?

### GeneratableFactory

Expand All @@ -53,8 +58,8 @@

The single parameter version can be called if the returned data type can be inferred from the context. It's only a wrapper of the complete version.

- `jsonObject`: the JSON object as the data source for creating the generatable data class instance.

Check warning on line 61 in deployment/on-device/android/advanced-features.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/advanced-features.mdx#L61

Did you really mean 'generatable'?
- `klass`: the Koltin class object created from `T::class`. It must be a data class annotated with `Generatable`.

Check warning on line 62 in deployment/on-device/android/advanced-features.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/advanced-features.mdx#L62

Did you really mean 'Koltin'?

### Annotations

Expand All @@ -68,7 +73,7 @@
annotation class Guide(val description: String)
```

`Generatable` annotation is for the data class to be used as the generation constraints. `Guide` is for the fields of the generatable data class to add helpful

Check warning on line 76 in deployment/on-device/android/advanced-features.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/advanced-features.mdx#L76

Did you really mean 'generatable'?
descriptions for the fields.

## Function Calling
Expand Down Expand Up @@ -104,7 +109,7 @@
)
```

- `name` Name of the paramter.

Check warning on line 112 in deployment/on-device/android/advanced-features.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/advanced-features.mdx#L112

Did you really mean 'paramter'?
- `type` Data type of the parameter.
- `description` A human and LLM readable description for the parameter.
- `optional`: Whether this parameter is optional.
Expand Down Expand Up @@ -152,7 +157,7 @@
```

- `name` Name of the function to be called
- `arguments` The arguments (parameters) of this call in a map. Values could be strings, numbers, booleans, null, lists for arrays, or maps for objects.

Check warning on line 160 in deployment/on-device/android/advanced-features.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/advanced-features.mdx#L160

Did you really mean 'booleans'?

### LeapFunctionCallParser

Expand Down
5 changes: 5 additions & 0 deletions deployment/on-device/android/ai-agent-usage-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
description: "Complete reference for using the LEAP Android SDK"
---

<Warning>
**Legacy Documentation** — This page documents the standalone iOS/Android SDK which has been superseded by the unified [LEAP SDK](/deployment/on-device/leap-sdk/quick-start-guide). New projects should use the LEAP SDK.
</Warning>


## Core Architecture

```
Expand All @@ -17,7 +22,7 @@

## Installation

### Gradle Dependencies

Check warning on line 25 in deployment/on-device/android/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/ai-agent-usage-guide.mdx#L25

Did you really mean 'Gradle'?

**Recommended**: Use version catalog for dependency management.

Expand Down Expand Up @@ -139,7 +144,7 @@
}
```

Available models and quantizations: [LEAP Model Library](https://leap.liquid.ai/models)

Check warning on line 147 in deployment/on-device/android/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/ai-agent-usage-guide.mdx#L147

Did you really mean 'quantizations'?

### Method 2: Download Without Loading

Expand Down Expand Up @@ -197,7 +202,7 @@

### Method 3: Cross-Platform LeapDownloader

For Kotlin Multiplatform projects (iOS, macOS, JVM, Android):

Check warning on line 205 in deployment/on-device/android/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/ai-agent-usage-guide.mdx#L205

Did you really mean 'Multiplatform'?

```kotlin
import ai.liquid.leap.LeapDownloader
Expand Down Expand Up @@ -447,7 +452,7 @@
**Methods**:
- `createConversation(systemPrompt: String? = null): Conversation` - Start new chat
- `createConversationFromHistory(history: List<ChatMessage>): Conversation` - Restore chat
- `suspend fun unload()` - Free memory (MUST call in onCleared with runBlocking)

Check warning on line 455 in deployment/on-device/android/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/ai-agent-usage-guide.mdx#L455

Did you really mean 'onCleared'?

Check warning on line 455 in deployment/on-device/android/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/ai-agent-usage-guide.mdx#L455

Did you really mean 'runBlocking'?

### Conversation
Manages chat history and generation state.
Expand Down Expand Up @@ -622,7 +627,7 @@
}
```

## Multimodal Input

Check warning on line 630 in deployment/on-device/android/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/ai-agent-usage-guide.mdx#L630

Did you really mean 'Multimodal'?

### Vision (Image + Text)
```kotlin
Expand Down Expand Up @@ -681,7 +686,7 @@
- **LFM2-1.2B**: Stable version
- **LFM2-1.2B-Tool**: Optimized for function calling

### Multimodal Models

Check warning on line 689 in deployment/on-device/android/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/ai-agent-usage-guide.mdx#L689

Did you really mean 'Multimodal'?
- **LFM2.5-VL-1.6B**: Vision + text
- **LFM2.5-Audio-1.5B**: Audio + text (TTS, ASR, voice chat)

Expand Down Expand Up @@ -902,7 +907,7 @@

### Model won't load
- Check internet connection (first download)
- Verify minSdk = 31 in build.gradle.kts

Check warning on line 910 in deployment/on-device/android/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/ai-agent-usage-guide.mdx#L910

Did you really mean 'minSdk'?
- Use physical device (emulators may crash)
- Check storage space (models: 500MB-2GB)

Expand All @@ -917,6 +922,6 @@
- Check sample rate (16kHz recommended)

### Memory issues
- Call `modelRunner?.unload()` in onCleared

Check warning on line 925 in deployment/on-device/android/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/ai-agent-usage-guide.mdx#L925

Did you really mean 'onCleared'?
- Don't load multiple models simultaneously
- Use appropriate quantization (Q4_K_M recommended)
5 changes: 5 additions & 0 deletions deployment/on-device/android/android-quick-start-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
description: "Get up and running with the LEAP Android SDK in minutes. Install the SDK, load models, and start generating content."
---

<Warning>
**Legacy Documentation** — This page documents the standalone iOS/Android SDK which has been superseded by the unified [LEAP SDK](/deployment/on-device/leap-sdk/quick-start-guide). New projects should use the LEAP SDK.
</Warning>


Latest version: `v0.9.7`

<Info>
Expand Down Expand Up @@ -99,7 +104,7 @@
The SDK uses **GGUF manifests** for loading models (recommended for all new projects due to superior inference performance and better default generation parameters).

<Info>
Legacy Executorch bundle support is available in the accordion below for existing projects.

Check warning on line 107 in deployment/on-device/android/android-quick-start-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/android-quick-start-guide.mdx#L107

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

## Loading from GGUF Manifest
Expand All @@ -108,7 +113,7 @@

### Android: Using LeapModelDownloader (Recommended)

For Android, `LeapModelDownloader` provides the best experience with background downloads, WorkManager integration, and notification support. This function takes some time to finish as loading the model is a heavy I/O operation, but it is safe to call on the main thread. The function should be executed in a coroutine scope.

Check warning on line 116 in deployment/on-device/android/android-quick-start-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/android-quick-start-guide.mdx#L116

Did you really mean 'coroutine'?

**ViewModel**

Expand Down Expand Up @@ -302,7 +307,7 @@

### Loading from local bundle file

The `LeapClient.loadModel` suspend function loads a model bundle file and returns a model runner instance for invoking the model. This function takes some time to finish as loading the model is a heavy I/O operation, but it is safe to call on the main thread. The function should be executed in a coroutine scope.

Check warning on line 310 in deployment/on-device/android/android-quick-start-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/android-quick-start-guide.mdx#L310

Did you really mean 'coroutine'?

```kotlin
lifecycleScope.launch {
Expand Down
5 changes: 5 additions & 0 deletions deployment/on-device/android/cloud-ai-comparison.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@
sidebar_position: 5
---

<Warning>
**Legacy Documentation** — This page documents the standalone iOS/Android SDK which has been superseded by the unified [LEAP SDK](/deployment/on-device/leap-sdk/quick-start-guide). New projects should use the LEAP SDK.
</Warning>


If you are familiar with cloud-based AI APIs (e.g. [OpenAI API](https://openai.com/api/)), this document
shows the similarity and differences between these clould APIs and Leap.

Check warning on line 13 in deployment/on-device/android/cloud-ai-comparison.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/cloud-ai-comparison.mdx#L13

Did you really mean 'clould'?

We will inspect this piece of Python-based OpenAI API chat completion request to figure out how to migrate it to LeapSDK.
This example code is modified from [OpenAI API documentation](https://platform.openai.com/docs/guides/streaming-responses?api-mode=chat).
Expand Down Expand Up @@ -138,10 +143,10 @@
}.collect()
```

## Coroutine scope

Check warning on line 146 in deployment/on-device/android/cloud-ai-comparison.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/cloud-ai-comparison.mdx#L146

Did you really mean 'Coroutine'?

Hopefully by now it is clear how similar LeapSDK API is to cloud-based APIs. It is worth noting that most LeapSDK
Android APIs are based on [Kotlin coroutine](https://kotlinlang.org/docs/coroutines-basics.html). You will need to use

Check warning on line 149 in deployment/on-device/android/cloud-ai-comparison.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/cloud-ai-comparison.mdx#L149

Did you really mean 'coroutine'?
a coroutine scope to execute these functions. In Android, we recommend using `viewModelScope` in a ViewModel:

```kotlin
Expand Down
5 changes: 5 additions & 0 deletions deployment/on-device/android/constrained-generation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
sidebar_position: 3
---

<Warning>
**Legacy Documentation** — This page documents the standalone iOS/Android SDK which has been superseded by the unified [LEAP SDK](/deployment/on-device/leap-sdk/quick-start-guide). New projects should use the LEAP SDK.
</Warning>


Setting the `jsonSchemaConstraint` field in [`GenerationOptions`](./conversation-generation#generationoptions) will enable constrained generation. While it is possible to
directly set the constraint with raw JSON Schema strings, we recommend to create the constraints with the `Generatable` annotation.

Expand All @@ -18,7 +23,7 @@

Only Kotlin data classes can be annotated with `Generatable`, and all the fields of the data class should be declared in the parameter of the constructor. `Guide` annotation can be used to add further descriptions to the fields.

For example, here is a generatable data class for holding information of a city:

Check warning on line 26 in deployment/on-device/android/constrained-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/constrained-generation.mdx#L26

Did you really mean 'generatable'?

```kotlin
@Generatable(description="Facts about a city")
Expand All @@ -37,7 +42,7 @@
)
```

## Apply Generatable data class in GenerationOptions

Check warning on line 45 in deployment/on-device/android/constrained-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/constrained-generation.mdx#L45

Did you really mean 'Generatable'?

Then we can use `setResponseFormatType()` in `GenerationOptions` to set up the constraint.

Expand All @@ -53,7 +58,7 @@
conversation.generateResponse("Show the city facts about Tokyo", options)
```

If you want to add the JSON Schema into the prompt to help the generation, you can get the raw JSONSchema with `JSONSchemaGenerator`:

Check warning on line 61 in deployment/on-device/android/constrained-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/constrained-generation.mdx#L61

Did you really mean 'JSONSchema'?

```kotlin
val jsonSchema = JSONSchemaGenerator.getJSONSchema(CityFact::class)
Expand All @@ -67,9 +72,9 @@

If the JSON Schema cannot be created from the provided data class, a `LeapGeneratableSchematizationException` will be thrown.

## Deserialize Generatable data class

Check warning on line 75 in deployment/on-device/android/constrained-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/constrained-generation.mdx#L75

Did you really mean 'Deserialize'?

Check warning on line 75 in deployment/on-device/android/constrained-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/constrained-generation.mdx#L75

Did you really mean 'Generatable'?

Finally, you can use `GeneratableFactory.createFromJSONObject()` to deserialize the JSON string generated by the model into the generatable data class:

Check warning on line 77 in deployment/on-device/android/constrained-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/constrained-generation.mdx#L77

Did you really mean 'deserialize'?

Check warning on line 77 in deployment/on-device/android/constrained-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/constrained-generation.mdx#L77

Did you really mean 'generatable'?

```kotlin
import ai.liquid.leap.structuredoutput.GeneratableFactory
Expand All @@ -90,7 +95,7 @@
}.collect()
```

If the JSON string generated by the model is not valid for creating instances of the generatable data class, a `LeapGeneratableDeserializationException` will be thrown.

Check warning on line 98 in deployment/on-device/android/constrained-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/constrained-generation.mdx#L98

Did you really mean 'generatable'?

## Supported data types

Expand All @@ -101,7 +106,7 @@
- Number (`Float` and `Double` in Kotlin)
- Boolean (`Boolean` in Kotlin)
- Enum (Enum class in Kotlin. The plain name string will be used as values)
- Object (Any data classes annotated with [Generatable])

Check warning on line 109 in deployment/on-device/android/constrained-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/constrained-generation.mdx#L109

Did you really mean 'Generatable'?
- Array (`List` and `MutableList` of any other supported data types, and arrays of integer, float numbers and boolean in Kotlin)

Only if the data types of the fields of object types and the items of array types are supported, these composition data types can be supported.
5 changes: 5 additions & 0 deletions deployment/on-device/android/conversation-generation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
description: "API reference for conversations, model runners, and generation in the LEAP Android SDK"
---

<Warning>
**Legacy Documentation** — This page documents the standalone iOS/Android SDK which has been superseded by the unified [LEAP SDK](/deployment/on-device/leap-sdk/quick-start-guide). New projects should use the LEAP SDK.
</Warning>


<Info>
All functions listed in this document are safe to call from the main or UI thread and all callbacks will be run on the main thread, unless there are explicit instructions or explanations.
</Info>
Expand Down Expand Up @@ -78,7 +83,7 @@

### Cancellation of the generation

Generation will be stopped when the coroutine job that runs the flow is canceled, but it may (no guarantee) keep going as long as the job of the flow is still active.

Check warning on line 86 in deployment/on-device/android/conversation-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/conversation-generation.mdx#L86

Did you really mean 'coroutine'?

We highly recommend using a ViewModel with `viewModelScope` to manage generation lifecycle. The generation will be automatically canceled when the ViewModel is cleared. Here is an example:

Expand Down Expand Up @@ -225,7 +230,7 @@

### `generateFromConversation`

This function is **not** recommended to be called by the app directly. It is an internal interface for the model runner implementation to expose the generation ability to LEAP SDK. `Conversation.generateResponse` is the better wrapper of this method, which relies on Kotlin coroutines to connect with lifecycle-aware components.

Check warning on line 233 in deployment/on-device/android/conversation-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/conversation-generation.mdx#L233

Did you really mean 'coroutines'?

<Warning>
This function may block the caller thread. If you must use it, please call it outside the main
Expand Down
5 changes: 5 additions & 0 deletions deployment/on-device/android/function-calling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
sidebar_position: 4
---

<Warning>
**Legacy Documentation** — This page documents the standalone iOS/Android SDK which has been superseded by the unified [LEAP SDK](/deployment/on-device/leap-sdk/quick-start-guide). New projects should use the LEAP SDK.
</Warning>


<Warning>
Not all models support function calling. Please check the model card before using the model for function calling.
</Warning>
Expand Down Expand Up @@ -31,7 +36,7 @@
)
```

Generally speaking, function names and parameter names should be normal identifiers that are recongized by most common programming languages (e.g. Python, Javascript, etc).

Check warning on line 39 in deployment/on-device/android/function-calling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/function-calling.mdx#L39

Did you really mean 'recongized'?
We recommend to use descriptive names that are composed by only letters, underscores and digits (not as the beginning).

## Handle Function Calling Response
Expand Down Expand Up @@ -106,7 +111,7 @@
)
```

`name` is the function name. It is recommneded to use only English letters, underscores and digits (not to start with digits) to compose the

Check warning on line 114 in deployment/on-device/android/function-calling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/function-calling.mdx#L114

Did you really mean 'recommneded'?
function names because this format is supported by most models. `description` tells the model what this function is doing. `parameters` is
the ordered list to declare what arguments (parameters) this function accepts.

Expand All @@ -126,7 +131,7 @@
- `description` Tells the model what this parameter is about.
- `optional` Whether the function is optional.

`LeapFunctionParameterType` describes the data types of the parameteres. They will be translated into JSON Schema for model to understand.

Check warning on line 134 in deployment/on-device/android/function-calling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/function-calling.mdx#L134

Did you really mean 'parameteres'?
Following types are supported:

```kotlin
Expand All @@ -150,7 +155,7 @@
- `Object`: Objects which has its own properties. `properties` is the map between the property names to the property data types. `required` list contains the name of
all non-optional properties.

All fields accepts an optional parameter of `description`, but it will be overrided if it is directly used as `LeapFunctionParameter.type`. It only plays a role if

Check warning on line 158 in deployment/on-device/android/function-calling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/function-calling.mdx#L158

Did you really mean 'overrided'?
the type instance is used as `Array.itemType` or the types in object properties.

For any type that accepts a parameter of `enumValues`, this parameter provides the instructions to the models on the legit values to fill.
Expand Down
5 changes: 5 additions & 0 deletions deployment/on-device/android/messages-content.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
description: "API reference for chat messages and content types in the LEAP Android SDK"
---

<Warning>
**Legacy Documentation** — This page documents the standalone iOS/Android SDK which has been superseded by the unified [LEAP SDK](/deployment/on-device/leap-sdk/quick-start-guide). New projects should use the LEAP SDK.
</Warning>


## `ChatMessage`

Data class that is compatible with the message object in OpenAI chat completion API.
Expand Down Expand Up @@ -38,7 +43,7 @@
Construct a `ChatMessage` instance from a `JSONObject`. Not all JSON object variants in `ChatCompletionRequestMessage` of OpenAI API are acceptable. As of now, `role` supports `user`, `system` and `assistant`; `content` can be a string or an array.

<Info>
`LeapSerializationException` will be thrown if the provided JSONObject cannot be recognized as a

Check warning on line 46 in deployment/on-device/android/messages-content.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/messages-content.mdx#L46

Did you really mean 'JSONObject'?
message.
</Info>

Expand Down Expand Up @@ -86,7 +91,7 @@
- `Audio`: WAV-encoded audio content

<Info>
`LeapSerializationException` will be thrown if the provided JSONObject cannot be recognized as a

Check warning on line 94 in deployment/on-device/android/messages-content.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/messages-content.mdx#L94

Did you really mean 'JSONObject'?
message.
</Info>

Expand Down Expand Up @@ -135,7 +140,7 @@
| Property | Required Value | Notes |
|----------|---------------|-------|
| **Format** | WAV (RIFF) | Only WAV format is supported |
| **Sample Rate** | 16000 Hz (16 kHz) recommended | Other sample rates are automatically resampled to 16 kHz |

Check warning on line 143 in deployment/on-device/android/messages-content.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/messages-content.mdx#L143

Did you really mean 'resampled'?
| **Encoding** | PCM (various bit depths) | Supports Float32, Int16, Int24, Int32 |
| **Channels** | Mono (1 channel) | **Required** - stereo audio will be rejected |
| **Byte Order** | Little-endian | Standard WAV format |
Expand All @@ -151,7 +156,7 @@
</Warning>

<Info>
**Automatic Resampling**: The inference engine automatically resamples audio to 16 kHz if provided at a different sample rate. However, for best performance and quality, provide audio at 16 kHz to avoid resampling overhead.

Check warning on line 159 in deployment/on-device/android/messages-content.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/messages-content.mdx#L159

Did you really mean 'resamples'?

Check warning on line 159 in deployment/on-device/android/messages-content.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/messages-content.mdx#L159

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

<Warning>
Expand Down
5 changes: 5 additions & 0 deletions deployment/on-device/android/model-loading.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
description: "API reference for loading models in the LEAP SDK"
---

<Warning>
**Legacy Documentation** — This page documents the standalone iOS/Android SDK which has been superseded by the unified [LEAP SDK](/deployment/on-device/leap-sdk/quick-start-guide). New projects should use the LEAP SDK.
</Warning>


<Info>
The LEAP SDK is now **Kotlin Multiplatform** and provides two model loading options:
- **`LeapModelDownloader`** - Android-specific, recommended for Android apps (background downloads, notifications, WorkManager)
Expand Down Expand Up @@ -104,7 +109,7 @@
The `LeapDownloader` class is a **cross-platform** model loader available in the core `leap-sdk` module. It works on Android, iOS, macOS, and JVM platforms. Use this for:
- iOS and macOS applications
- JVM/Desktop applications
- Cross-platform Kotlin Multiplatform code

Check warning on line 112 in deployment/on-device/android/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/model-loading.mdx#L112

Did you really mean 'Multiplatform'?
- Android apps that don't need background download features

```kotlin
Expand All @@ -113,7 +118,7 @@

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `config` | `LeapDownloaderConfig` | No | `LeapDownloaderConfig()` | Configuration options for the downloader. See [`LeapDownloaderConfig`](#leapdownloaderconfig) for more details. |

Check warning on line 121 in deployment/on-device/android/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/model-loading.mdx#L121

Did you really mean 'downloader'?

<br/>
### `loadModel`
Expand Down Expand Up @@ -233,7 +238,7 @@

- `path`: A local path pointing to model bundle file. Both `.bundle` files and `.gguf` files are supported.
- `options`: Options for loading the model.
- `mmprojPath`: Optional multimodal projection model path. This parameter should only be filled if the model needs a separate multimodal projection model to parsing multimodal (image, audio, etc.) contents.

Check warning on line 241 in deployment/on-device/android/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/model-loading.mdx#L241

Did you really mean 'multimodal'?

Check warning on line 241 in deployment/on-device/android/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/model-loading.mdx#L241

Did you really mean 'multimodal'?

Check warning on line 241 in deployment/on-device/android/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/model-loading.mdx#L241

Did you really mean 'multimodal'?

<Info>
The function will throw `LeapModelLoadingException` if LEAP fails to load the model.
Expand All @@ -253,9 +258,9 @@
```

- `modelPath`: Main model path.
- `mmprojPath`: Multimodal projection model path.

Check warning on line 261 in deployment/on-device/android/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/model-loading.mdx#L261

Did you really mean 'Multimodal'?
- `audioDecoderPath`: Audio decoder model path.
- `audioTokenizerPath`: Audio tokenizer model path.

Check warning on line 263 in deployment/on-device/android/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/model-loading.mdx#L263

Did you really mean 'tokenizer'?

### `loadModelAsResult`

Expand Down
5 changes: 5 additions & 0 deletions deployment/on-device/android/utilities.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
description: "API reference for error handling, serialization, and utilities in the LEAP Android SDK"
---

<Warning>
**Legacy Documentation** — This page documents the standalone iOS/Android SDK which has been superseded by the unified [LEAP SDK](/deployment/on-device/leap-sdk/quick-start-guide). New projects should use the LEAP SDK.
</Warning>


## Error Handling

All errors are thrown as `LeapException`, which has following subclasses:
Expand All @@ -10,11 +15,11 @@
- `LeapModelLoadingException` : error in loading the model
- `LeapGenerationException` : error in generating content
- `LeapGenerationPromptExceedContextLengthException`: the prompt text exceeds the maximum context length so no content will be generated
- `LeapSerializationException` : error in serializing / deserializing data.

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

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/utilities.mdx#L18

Did you really mean 'deserializing'?

## Serialization Support

The LEAP SDK uses [kotlinx.serialization](https://github.com/Kotlin/kotlinx.serialization) for JSON serialization and deserialization. This is built into the core SDK and requires no additional dependencies.

Check warning on line 22 in deployment/on-device/android/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/utilities.mdx#L22

Did you really mean 'deserialization'?

The following types are `@Serializable`:

Expand All @@ -23,7 +28,7 @@
- [`LeapFunctionCall`](./function-calling)
- [`Manifest`](./model-loading#manifest)

### Serializing and Deserializing Conversation History

Check warning on line 31 in deployment/on-device/android/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/utilities.mdx#L31

Did you really mean 'Deserializing'?

**Add kotlinx.serialization to your project:**

Expand Down Expand Up @@ -84,11 +89,11 @@
`LeapModelDownloader` is the **recommended** option for Android applications. It provides background downloads with WorkManager, foreground service notifications, and robust handling of network interruptions.
</Info>

The LeapSDK Android Model Downloader module is a production-ready helper for downloading models from the LEAP Model Library on Android. It runs as a [foreground service](https://developer.android.com/develop/background-work/services/fgs) and displays notifications to users during downloads.

Check warning on line 92 in deployment/on-device/android/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/utilities.mdx#L92

Did you really mean 'Downloader'?

### Permission Setup

The model downloader requires notification permissions to display download progress. You need to:

Check warning on line 96 in deployment/on-device/android/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/utilities.mdx#L96

Did you really mean 'downloader'?

1. **Add permissions to AndroidManifest.xml**:
```xml
Expand Down Expand Up @@ -184,7 +189,7 @@
fun getModelFile(model: DownloadableModel): File
fun requestDownloadModel(model: DownloadableModel, forceDownload: Boolean = false)
fun requestStopDownload(model: DownloadableModel)
suspend fun queryStatus(model: DownloadableModel): ModelDownloadStatus

Check warning on line 192 in deployment/on-device/android/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/utilities.mdx#L192

Did you really mean 'queryStatus'?
fun requestStopService()
}
```
Expand All @@ -205,7 +210,7 @@
Make a request to download the model. If the model file already exists locally, it won't be downloaded.

- `model`: A [`DownloadableModel`](#downloadablemodel) instance.
- `forceDownload`: If it's true, downloader will remove the model bundle file that exists locally and to conduct the download.

Check warning on line 213 in deployment/on-device/android/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/utilities.mdx#L213

Did you really mean 'downloader'?

#### requestStopDownload

Expand Down Expand Up @@ -236,11 +241,11 @@

#### requestStopService

Make a request to stop the foreground service of the model downloader.

Check warning on line 244 in deployment/on-device/android/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/utilities.mdx#L244

Did you really mean 'downloader'?

### DownloadableModel

`DownloadableModel` is an interface to describe the model can be downloaded by the LeapSDK Model Downloader.

Check warning on line 248 in deployment/on-device/android/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/utilities.mdx#L248

Did you really mean 'Downloader'?

```kotlin
interface DownloadableModel {
Expand Down Expand Up @@ -271,4 +276,4 @@
The `resolve` method accepts 2 parameters:

- `modelSlug`: The model slug that identifies the model. It is usually the lowercase string of the model name. For example, the slug of `LFM2-1.2B` is `lfm2-1.2b`.
- `quantizationSlug`: The model quantization slug. It can be found in the "Available quantizations" section of the model card.

Check warning on line 279 in deployment/on-device/android/utilities.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/android/utilities.mdx#L279

Did you really mean 'quantizations'?
5 changes: 5 additions & 0 deletions deployment/on-device/ios/advanced-features.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
description: "API reference for constrained generation and function calling in the LEAP iOS SDK"
---

<Warning>
**Legacy Documentation** — This page documents the standalone iOS/Android SDK which has been superseded by the unified [LEAP SDK](/deployment/on-device/leap-sdk/quick-start-guide). New projects should use the LEAP SDK.
</Warning>


## `GenerationOptions`

Tune generation behavior with `GenerationOptions`.
Expand All @@ -28,7 +33,7 @@
```

- Leave a field as `nil` to fall back to the defaults packaged with the model bundle.
- `functionCallParser` controls how tool-call tokens are parsed. `LFMFunctionCallParser` (the default) handles Liquid Foundation Model Pythonic function calling. Supply `HermesFunctionCallParser()` for Hermes/Qwen3 formats, or set the parser to `nil` to receive raw tool-call text in `MessageResponse.chunk`.

Check warning on line 36 in deployment/on-device/ios/advanced-features.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/advanced-features.mdx#L36

Did you really mean 'Pythonic'?
- `jsonSchemaConstraint` activates constrained generation. Use `setResponseFormat(type:)` to populate it from a type annotated with the `@Generatable` macro.

```swift
Expand Down
5 changes: 5 additions & 0 deletions deployment/on-device/ios/ai-agent-usage-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
description: "Complete reference for using the LEAP iOS SDK"
---

<Warning>
**Legacy Documentation** — This page documents the standalone iOS/Android SDK which has been superseded by the unified [LEAP SDK](/deployment/on-device/leap-sdk/quick-start-guide). New projects should use the LEAP SDK.
</Warning>


## Core Architecture

```
Expand Down Expand Up @@ -66,7 +71,7 @@
}
```

Available models and quantizations: [LEAP Model Library](https://leap.liquid.ai/models)

Check warning on line 74 in deployment/on-device/ios/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/ai-agent-usage-guide.mdx#L74

Did you really mean 'quantizations'?

### Method 2: Download Without Loading

Expand Down Expand Up @@ -424,7 +429,7 @@
}
```

### Multimodal Input (Vision)

Check warning on line 432 in deployment/on-device/ios/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/ai-agent-usage-guide.mdx#L432

Did you really mean 'Multimodal'?

```swift
func sendImageMessage(image: UIImage, prompt: String) {
Expand Down Expand Up @@ -879,5 +884,5 @@

- **iOS:** 15.0+
- **macOS:** 12.0+
- **Xcode:** 15.0+ with Swift 5.9+

Check warning on line 887 in deployment/on-device/ios/ai-agent-usage-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/ai-agent-usage-guide.mdx#L887

Did you really mean 'Xcode'?
- **Device RAM:** 3GB minimum (6GB+ recommended for larger models)
Expand Down
5 changes: 5 additions & 0 deletions deployment/on-device/ios/cloud-ai-comparison.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@
sidebar_position: 5
---

<Warning>
**Legacy Documentation** — This page documents the standalone iOS/Android SDK which has been superseded by the unified [LEAP SDK](/deployment/on-device/leap-sdk/quick-start-guide). New projects should use the LEAP SDK.
</Warning>


If you are familiar with cloud-based AI APIs (e.g. [OpenAI API](https://openai.com/api/)), this document
shows the similarity and differences between these clould APIs and Leap.

Check warning on line 13 in deployment/on-device/ios/cloud-ai-comparison.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/cloud-ai-comparison.mdx#L13

Did you really mean 'clould'?

We will inspect this piece of Python-based OpenAI API chat completion request to figure out how to migrate it to LeapSDK.
This example code is modified from [OpenAI API document](https://platform.openai.com/docs/guides/streaming-responses?api-mode=chat).
Expand Down Expand Up @@ -100,7 +105,7 @@

## Process generated contents

In clould API Python code, a for-loop on the stream object retrieves the contents.

Check warning on line 108 in deployment/on-device/ios/cloud-ai-comparison.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/cloud-ai-comparison.mdx#L108

Did you really mean 'clould'?

```python
for chunk in stream:
Expand Down
5 changes: 5 additions & 0 deletions deployment/on-device/ios/constrained-generation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
sidebar_position: 3
---

<Warning>
**Legacy Documentation** — This page documents the standalone iOS/Android SDK which has been superseded by the unified [LEAP SDK](/deployment/on-device/leap-sdk/quick-start-guide). New projects should use the LEAP SDK.
</Warning>


LeapSDK provides powerful constrained generation capabilities using Swift macros that enable you to generate structured JSON output with compile-time validation. This feature ensures the AI model produces responses that conform to your predefined Swift types.

## Overview
Expand Down Expand Up @@ -145,7 +150,7 @@

### Complex Nested Structures

You can define complex types with arrays, optionals, and nested objects:

Check warning on line 153 in deployment/on-device/ios/constrained-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/constrained-generation.mdx#L153

Did you really mean 'optionals'?

```swift
@Generatable("A recipe with ingredients and instructions")
Expand Down Expand Up @@ -419,7 +424,7 @@
This typically means there's an issue with the macro plugin. Try:

1. Clean your build folder (Cmd+Shift+K)
2. Restart Xcode

Check warning on line 427 in deployment/on-device/ios/constrained-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/constrained-generation.mdx#L427

Did you really mean 'Xcode'?
3. Ensure you're using Swift 5.9 or later

### Generated JSON doesn't match expected format
Expand Down
5 changes: 5 additions & 0 deletions deployment/on-device/ios/conversation-generation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
description: "API reference for conversations, model runners, and generation in the LEAP iOS SDK"
---

<Warning>
**Legacy Documentation** — This page documents the standalone iOS/Android SDK which has been superseded by the unified [LEAP SDK](/deployment/on-device/leap-sdk/quick-start-guide). New projects should use the LEAP SDK.
</Warning>


<Info>
All functions listed in this document are safe to call from the main thread and all callbacks will be run on the main thread, unless there are explicit instructions or explanations.
</Info>
Expand Down Expand Up @@ -30,7 +35,7 @@

- Create conversations using `createConversation(systemPrompt:)` or `createConversationFromHistory(history:)`.
- Hold a strong reference to the `ModelRunner` for as long as you need to perform generations.
- Call `unload()` when you are done to release native resources (optional, happens automatically on deinit).

Check warning on line 38 in deployment/on-device/ios/conversation-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/conversation-generation.mdx#L38

Did you really mean 'deinit'?
- Access `modelId` to identify the loaded model (for analytics, debugging, or UI labels).

### Low-level generation API
Expand Down Expand Up @@ -234,7 +239,7 @@
```

- Leave a field as `nil` to fall back to the defaults packaged with the model bundle.
- `functionCallParser` controls how tool-call tokens are parsed. `LFMFunctionCallParser` (the default) handles Liquid Foundation Model Pythonic function calling. Supply `HermesFunctionCallParser()` for Hermes/Qwen3 formats, or set the parser to `nil` to receive raw tool-call text in `MessageResponse.chunk`.

Check warning on line 242 in deployment/on-device/ios/conversation-generation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/conversation-generation.mdx#L242

Did you really mean 'Pythonic'?
- `jsonSchemaConstraint` activates constrained generation. Use `setResponseFormat(type:)` to populate it from a type annotated with the `@Generatable` macro.

```swift
Expand Down
5 changes: 5 additions & 0 deletions deployment/on-device/ios/function-calling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ description: "Function calling allows the model to make requests to call some pr
sidebar_position: 4
---

<Warning>
**Legacy Documentation** — This page documents the standalone iOS/Android SDK which has been superseded by the unified [LEAP SDK](/deployment/on-device/leap-sdk/quick-start-guide). New projects should use the LEAP SDK.
</Warning>


<Warning>
Not all models support function calling. Please check the model card before using the model for function calling.
</Warning>
Expand Down
5 changes: 5 additions & 0 deletions deployment/on-device/ios/ios-quick-start-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
description: "Get up and running with the LEAP iOS SDK in minutes. Install the SDK, load models, and start generating content."
---

<Warning>
**Legacy Documentation** — This page documents the standalone iOS/Android SDK which has been superseded by the unified [LEAP SDK](/deployment/on-device/leap-sdk/quick-start-guide). New projects should use the LEAP SDK.
</Warning>


Latest version: `v0.9.2`

## Prerequisites[​](#prerequisites "Direct link to Prerequisites")

Make sure you have:

* Xcode 15.0 or later with Swift 5.9.

Check warning on line 17 in deployment/on-device/ios/ios-quick-start-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/ios-quick-start-guide.mdx#L17

Did you really mean 'Xcode'?
* An iOS project targeting **iOS 15.0+** (macOS 12.0+ or Mac Catalyst 15.0+ are also supported).
* A physical iPhone or iPad with at least 3 GB RAM for best performance. The simulator works for development but runs models much slower.

Expand Down Expand Up @@ -49,7 +54,7 @@
</Tab>
<Tab title="Manual">
1. Download `LeapSDK.xcframework.zip` (and optionally `LeapModelDownloader.xcframework.zip`) from the [GitHub releases](https://github.com/Liquid4All/leap-ios/releases).
2. Unzip and drag the XCFramework(s) into Xcode.

Check warning on line 57 in deployment/on-device/ios/ios-quick-start-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/ios-quick-start-guide.mdx#L57

Did you really mean 'Xcode'?
3. Set the Embed setting to **Embed & Sign** for each framework.
</Tab>
</Tabs>
Expand All @@ -63,7 +68,7 @@
The SDK uses **GGUF manifests** for loading models (recommended for all new projects due to superior inference performance and better default generation parameters).

<Info>
Legacy Executorch bundle support is available in the accordion below for existing projects.

Check warning on line 71 in deployment/on-device/ios/ios-quick-start-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/ios-quick-start-guide.mdx#L71

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

### Loading from GGUF manifest
Expand Down Expand Up @@ -151,7 +156,7 @@

You can either:

* **Ship it with the app** - drag the bundle into your Xcode project and ensure it is added to the main target.

Check warning on line 159 in deployment/on-device/ios/ios-quick-start-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/ios-quick-start-guide.mdx#L159

Did you really mean 'Xcode'?
* **Download at runtime** - use `LeapModelDownloader` to fetch bundles on demand.

<Accordion title="Alternative: Download at runtime">
Expand Down Expand Up @@ -275,7 +280,7 @@

### Send images and audio (optional)[​](#send-images-and-audio-optional "Direct link to Send images and audio (optional)")

When the loaded model ships with multimodal weights (and companion files were detected), you can mix text, image, and audio content in the same message:

Check warning on line 283 in deployment/on-device/ios/ios-quick-start-guide.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/ios-quick-start-guide.mdx#L283

Did you really mean 'multimodal'?

```swift
let message = ChatMessage(
Expand Down
5 changes: 5 additions & 0 deletions deployment/on-device/ios/messages-content.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
description: "API reference for chat messages and content types in the LEAP iOS SDK"
---

<Warning>
**Legacy Documentation** — This page documents the standalone iOS/Android SDK which has been superseded by the unified [LEAP SDK](/deployment/on-device/leap-sdk/quick-start-guide). New projects should use the LEAP SDK.
</Warning>


## Chat Messages

### Roles
Expand Down Expand Up @@ -54,7 +59,7 @@
}
```

Provide JPEG-encoded bytes for `.image` and WAV data for `.audio`. Helper initializers such as `ChatMessageContent.fromUIImage`, `ChatMessageContent.fromNSImage`, `ChatMessageContent.fromWAVData`, and `ChatMessageContent.fromFloatSamples(_:sampleRate:channelCount:)` simplify interop with platform-native buffers. On the wire, image parts are encoded as OpenAI-style `image_url` payloads and audio parts as `input_audio` arrays with Base64 data.

Check warning on line 62 in deployment/on-device/ios/messages-content.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/messages-content.mdx#L62

Did you really mean 'initializers'?

Check warning on line 62 in deployment/on-device/ios/messages-content.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/messages-content.mdx#L62

Did you really mean 'interop'?

### Audio Format Requirements

Expand All @@ -63,7 +68,7 @@
| Property | Required Value | Notes |
|----------|---------------|-------|
| **Format** | WAV (RIFF) | Only WAV format is supported |
| **Sample Rate** | 16000 Hz (16 kHz) recommended | Other sample rates are automatically resampled to 16 kHz |

Check warning on line 71 in deployment/on-device/ios/messages-content.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/messages-content.mdx#L71

Did you really mean 'resampled'?
| **Encoding** | PCM (various bit depths) | Supports Float32, Int16, Int24, Int32 |
| **Channels** | Mono (1 channel) | **Required** - stereo audio will be rejected |
| **Byte Order** | Little-endian | Standard WAV format |
Expand All @@ -79,7 +84,7 @@
</Warning>

<Info>
**Automatic Resampling**: The inference engine automatically resamples audio to 16 kHz if provided at a different sample rate. However, for best performance and quality, provide audio at 16 kHz to avoid resampling overhead.

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

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

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

Did you really mean 'resamples'?

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

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

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

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

<Warning>
Expand Down
5 changes: 5 additions & 0 deletions deployment/on-device/ios/model-loading.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
description: "API reference for loading models in the LEAP iOS SDK"
---

<Warning>
**Legacy Documentation** — This page documents the standalone iOS/Android SDK which has been superseded by the unified [LEAP SDK](/deployment/on-device/leap-sdk/quick-start-guide). New projects should use the LEAP SDK.
</Warning>


## `Leap`

`Leap` is the static entry point for loading on-device models.
Expand Down Expand Up @@ -87,7 +92,7 @@

- Throws `LeapError.modelLoadingFailure` if the file cannot be loaded.
- Automatically detects companion files placed alongside your model:
- `mmproj-*.gguf` enables multimodal vision tokens for both bundle and GGUF flows.

Check warning on line 95 in deployment/on-device/ios/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/model-loading.mdx#L95

Did you really mean 'multimodal'?
- Audio decoder artifacts whose filename contains "audio" and "decoder" with a `.gguf` or `.bin` extension unlock audio input/output for compatible checkpoints.
- Must be called from an async context (for example inside an `async` function or a `Task`). Keep the returned `ModelRunner` alive while you interact with the model.

Expand Down Expand Up @@ -126,17 +131,17 @@
- `cpuThreads`: Number of CPU threads for token generation.
- `contextSize`: Override the default maximum context length for the model.
- `nGpuLayers`: Number of layers to offload to GPU (for macOS/macCatalyst targets with Metal support).
- `mmProjPath`: Optional path to an auxiliary multimodal projection model. Leave `nil` to auto-detect a sibling `mmproj-*.gguf`.

Check warning on line 134 in deployment/on-device/ios/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/model-loading.mdx#L134

Did you really mean 'multimodal'?
- `audioDecoderPath`: Optional audio decoder model. Leave `nil` to auto-detect nearby decoder artifacts.
- `chatTemplate`: Advanced override for backend chat templating.
- `audioTokenizerPath`: Optional tokenizer for audio-capable checkpoints.

Check warning on line 137 in deployment/on-device/ios/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/model-loading.mdx#L137

Did you really mean 'tokenizer'?
- `extras`: Backend-specific configuration payload (advanced use only).

<Info>
Backend selection is automatic: `.bundle` files run on the ExecuTorch backend, while `.gguf`
checkpoints use the embedded llama.cpp backend. Bundled models reference their projection data in
metadata; GGUF checkpoints look for sibling companion files (multimodal projection, audio decoder,

Check warning on line 143 in deployment/on-device/ios/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/model-loading.mdx#L143

Did you really mean 'multimodal'?
audio tokenizer) unless you override the paths through `LiquidInferenceEngineOptions`. Ensure

Check warning on line 144 in deployment/on-device/ios/model-loading.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

deployment/on-device/ios/model-loading.mdx#L144

Did you really mean 'tokenizer'?
these artifacts are co-located when you want vision or audio features.
</Info>

Expand Down
5 changes: 5 additions & 0 deletions deployment/on-device/ios/utilities.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ title: "Utilities"
description: "API reference for error handling and utilities in the LEAP iOS SDK"
---

<Warning>
**Legacy Documentation** — This page documents the standalone iOS/Android SDK which has been superseded by the unified [LEAP SDK](/deployment/on-device/leap-sdk/quick-start-guide). New projects should use the LEAP SDK.
</Warning>


## Errors

Errors are surfaced as `LeapError` values. The most common cases are:
Expand Down
Loading
Loading