AiliaLLM

Kotlin binding for ailia LLM library. Provides Large Language Model inference capabilities.

Calls JNI directly from Kotlin without going through Java wrappers.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun close()

Implements Closeable for use with use { } blocks.

Link copied to clipboard
fun destroy()

Destroys the AiliaLLM instance and releases resources.

Link copied to clipboard

Generates one token.

Link copied to clipboard

Gets the context size of the model.

Link copied to clipboard

Gets the generated text (delta).

Link copied to clipboard

Gets the multimodal capabilities of the loaded model.

Link copied to clipboard

Gets the prompt token count.

Link copied to clipboard

Gets the token count for a text.

Link copied to clipboard
fun openModelFile(path: String, nCtx: Int)

Opens a model file.

Link copied to clipboard

Opens a multimodal projector file for vision/audio support. Must be called after openModelFile() to enable multimodal capabilities.

Link copied to clipboard

Sets the prompt for generation.

Sets the prompt for generation with multimodal support. Automatically detects whether to use text-only or multimodal processing based on the presence of media data.

Link copied to clipboard
fun setSamplingParams(topK: Int, topP: Float, temp: Float, seed: Int)

Sets sampling parameters.

Link copied to clipboard
fun setThinking(enable: Boolean)

Enable or disable thinking (reasoning output). Controls whether thinking models (e.g. Gemma4) output their reasoning process. Must be called before setPrompt.