sdk/runanywhere-kotlin/modules/runanywhere-core-llamacpp/README.md
Optional llama.cpp LLM backend for the RunAnywhere Kotlin SDK — on-device text generation with GGUF models on Android.
Requires the core SDK. Add both to your app module's build.gradle.kts:
dependencies {
implementation("io.github.sanchitmonga22:runanywhere-sdk:0.20.11")
implementation("io.github.sanchitmonga22:runanywhere-llamacpp:0.20.11")
}
Register the backend before RunAnywhere.initialize(), then use the core SDK for model lifecycle and inference:
import com.runanywhere.sdk.llm.llamacpp.LlamaCPP
import com.runanywhere.sdk.public.RunAnywhere
import com.runanywhere.sdk.public.extensions.generate
import com.runanywhere.sdk.public.extensions.loadModel
import ai.runanywhere.proto.v1.ModelCategory
import com.runanywhere.sdk.public.types.RAModelLoadRequest
// At app startup
LlamaCPP.register()
RunAnywhere.initialize(context = this, /* ... */)
// After download/register model via core APIs
RunAnywhere.loadModel(
RAModelLoadRequest(
model_id = "my-gguf-model",
category = ModelCategory.MODEL_CATEGORY_LANGUAGE,
),
)
val result = RunAnywhere.generate("What is on-device AI?")
println(result.text)
For registration, downloads, streaming, and model catalogs, see the Kotlin SDK README.
runanywhere-sdk:0.20.11RunAnywhere License. See LICENSE.