Package-level declarations

Types

Link copied to clipboard

MemoryPressureObserver driven by Android's ComponentCallbacks2.onTrimMemory / onLowMemory.

Link copied to clipboard
data class BackendConfig(val backend: ComputeBackend = ComputeBackend.AUTO, val gpuLayers: Int = ALL_GPU_LAYERS, val cpuThreads: Int = AUTO_THREADS, val useFlashAttention: Boolean? = null, val useMmap: Boolean = true)

Runtime compute configuration passed to every engine at construction time.

Link copied to clipboard
class BackendUnavailableException(val backend: ComputeBackend?, message: String? = null, cause: Throwable? = null) : InferenceException

The requested compute backend cannot be used on this device or build.

Link copied to clipboard

The compute backend an engine executes on.

Link copied to clipboard

Native inference was aborted through its abort callback.

Link copied to clipboard

Common contract of every Kggml engine (WhisperEngine, LlamaEngine, DiffusionEngine, …).

Link copied to clipboard

Base class of every error surfaced by Kggml engines.

Link copied to clipboard
@RequiresOptIn(level = RequiresOptIn.Level.ERROR, message = "Internal Kggml API; do not use outside Kggml modules.")
annotation class InternalKggmlApi

Marks Kggml plumbing shared between Kggml modules. Not part of the public API: it may change or disappear in any release.

Link copied to clipboard
class InvalidInputException(message: String, cause: Throwable? = null) : InferenceException

The input (audio, prompt, image, grammar, …) was rejected as malformed or out of range.

Link copied to clipboard
Link copied to clipboard

Severity of an OS memory-pressure signal.

Link copied to clipboard

Receives memory-pressure signals from a MemoryPressureObserver.

Link copied to clipboard

Source of OS low-memory signals (Android ComponentCallbacks2.onTrimMemory, iOS UIApplicationDidReceiveMemoryWarningNotification, …). Engines and the model manager subscribe to it to evict KV caches, model weights, and download buffers.

Link copied to clipboard
class ModelLoadException(message: String, cause: Throwable? = null) : InferenceException

The model file is missing, unreadable, corrupt, or incompatible with the engine.

Link copied to clipboard

Structured error codes returned by Kggml's extern "C" native entry points.

Link copied to clipboard
class NativeFailureException(val nativeCode: Int = NativeErrorCode.NATIVE_FAILURE.code, message: String, cause: Throwable? = null) : InferenceException

An unexpected native failure (including C++ exceptions caught at the FFI boundary).

Link copied to clipboard
class OutOfMemoryException(message: String, cause: Throwable? = null) : InferenceException

Native code failed to allocate memory (model weights, KV cache, compute buffers, …).

Link copied to clipboard
enum class StopReason : Enum<StopReason>

Why text generation stopped. Cancellation is reported through coroutine cancellation, not here.

Link copied to clipboard
sealed interface TokenEvent

Events emitted by a streaming text-generation engine (e.g. Flow<TokenEvent>).

Link copied to clipboard
sealed interface TranscriptionEvent

Events emitted by a streaming speech-to-text engine (e.g. Flow<TranscriptionEvent>).