glody007/leapsdk-skills
Overview
This skill describes the Liquid AI LEAP Edge SDK for on-device AI inference on Android and iOS. It focuses on integrating LeapClient, ModelRunner, and conversation-based streaming responses to run small language models locally. Use it to build offline chat, local LLM features, and model deployment workflows on mobile devices.
How this skill works
The SDK loads and runs quantized Liquid Foundational Models (LFM) on-device via LeapClient/Leap.load and ModelRunner instances. Conversations are created from a ModelRunner and generateResponse produces streamed token chunks, reasoning chunks, and completion events for incremental UI updates. Downloaders (LeapDownloader / LeapModelDownloader) can fetch model bundles and save them to app storage for later local loading.
When to use it
- Building mobile apps with on-device LLM capabilities
- Implementing chat interfaces with streaming responses
- Deploying small language models to edge devices with limited connectivity
- Converting cloud LLM calls to local inference for latency or privacy
- Testing model behavior on physical Android/iOS devices
Best practices
- Load models off the main thread or use background tasks to avoid UI blocking
- Reuse a single ModelRunner instance and create multiple conversations as needed
- Stream tokens to the UI and update incremental assistant messages rather than blocking until completion
- Test on physical devices (arm64, 3GB+ RAM) and monitor memory usage
- Handle download/load errors and support cancellation for in-progress generation
Example use cases
- Offline chat assistant in a mobile app using LFM2-700M with Q5_K_M quantization
- Customer support agent that streams partial replies while reasoning tokens are processed
- Mobile companion app that downloads models on first run and runs local inference
- Privacy-first note-taking app that keeps all model inference on-device
- Prototyping conversational features without server costs by running LFM2-350M locally
FAQ
Prefer arm64 devices with at least 3GB RAM. Android min SDK 31 and Xcode 15/iOS 18 are recommended.
How do I keep the UI responsive during model load?
Load models in background coroutines (Android) or async tasks (iOS). Use progress state and avoid blocking the main thread.
Can I cancel generation?
Yes. Both platforms support cancelling in-progress generation tasks; stop generation when users navigate away or start a new prompt.