React Native binding for llama.cpp
Top 55.4% on sourcepulse
This library provides React Native bindings for llama.cpp
, enabling on-device large language model inference within mobile applications. It targets React Native developers seeking to integrate powerful AI capabilities directly into their iOS and Android apps without relying on external APIs.
How It Works
The library wraps the C++ llama.cpp
inference engine, exposing its functionality through a JavaScript interface. It leverages pre-built binaries for iOS and Android, with options to build from source. The design mirrors llama.cpp
's server examples, mapping API endpoints to methods like completion
, tokenize
, and embedding
on a LlamaContext
object. It supports advanced features like tool calling via Jinja templating and grammar-based sampling using GBNF.
Quick Start & Requirements
npm install llama.rn
npx pod-install
. Set RNLLAMA_BUILD_FROM_SOURCE=1
in Podfile to build from source. Extended Virtual Addressing recommended. Metal support requires Apple7 GPU or higher; iOS simulator is not supported.rnllamaBuildFromSource=true
in gradle.properties
to build from source. Currently supports arm64-v8a/x86_64; 64-bit platforms recommended. No integrated GPU backend.Highlighted Details
chat.cpp
.Maintenance & Community
llama.node
(Node.js binding with similar API).Licensing & Compatibility
Limitations & Caveats
iOS Metal support has minimum GPU requirements and is not available on the simulator. Android is limited to specific architectures and lacks GPU acceleration.
20 hours ago
1 day