Melange
API ReferenceAndroid

Enums and Constants

Reference for all enums and constants in the Melange Android SDK.

The LLM sections on this page reflect ZeticMLange Android 1.5.9.

This page documents the enums and configuration types most commonly used from the Android SDK.

Package

com.zeticai.mlange

ModelMode

Controls inference mode selection for general, non-LLM models.

enum class ModelMode {
    RUN_AUTO,
    RUN_SPEED,
    RUN_ACCURACY
}

LLMModelMode

Controls automatic target selection for ZeticMLangeLLMModel.

enum class LLMModelMode {
    RUN_AUTO,
    RUN_SPEED,
    RUN_ACCURACY,
}
ValueDescription
RUN_AUTODefault. Uses metadata-based selection to balance practical speed and quality.
RUN_SPEEDPrioritizes lower latency.
RUN_ACCURACYPrioritizes higher score or lower loss.
val model = ZeticMLangeLLMModel(
    context = context,
    personalKey = PERSONAL_KEY,
    name = MODEL_NAME,
    modelMode = LLMModelMode.RUN_SPEED,
)

LLMDataSetType

Optional dataset hint for RUN_ACCURACY.

enum class LLMDataSetType {
    MMLU,
    TRUTHFULQA,
    CNN_DAILYMAIL,
    GSM8K,
}
ValueDescription
MMLUMassive Multitask Language Understanding.
TRUTHFULQATruthfulness and informativeness benchmark.
CNN_DAILYMAILSummarization benchmark.
GSM8KGrade-school math reasoning benchmark.
val model = ZeticMLangeLLMModel(
    context = context,
    personalKey = PERSONAL_KEY,
    name = MODEL_NAME,
    modelMode = LLMModelMode.RUN_ACCURACY,
    dataSetType = LLMDataSetType.MMLU,
)

Pass null when you do not want to specify a dataset.

LLMKVCacheCleanupPolicy

Controls how the conversation KV cache is handled when it reaches capacity.

enum class LLMKVCacheCleanupPolicy {
    CLEAN_UP_ON_FULL,
    DO_NOT_CLEAN_UP
}
ValueDescription
CLEAN_UP_ON_FULLClears the conversation context when the KV cache is full. Default.
DO_NOT_CLEAN_UPKeeps the context as-is. You must call cleanUp() before the next conversation.

LLMInitOption

Configures LLM runtime initialization.

data class LLMInitOption(
    val kvCacheCleanupPolicy: LLMKVCacheCleanupPolicy = LLMKVCacheCleanupPolicy.CLEAN_UP_ON_FULL,
    val nCtx: Int = 2048,
)
FieldTypeDescription
kvCacheCleanupPolicyLLMKVCacheCleanupPolicyKV-cache cleanup behavior during generation.
nCtxIntRequested context length.

nCtx is not guaranteed to be applied exactly as provided. The runtime can adjust it internally depending on the model or backend.

LLMTarget

Manual runtime selection target for ZeticMLangeLLMModel.

LLMTarget.LLAMA_CPP
ValueDescription
LLAMA_CPPUse this value for explicit GGUF selection.

LLMQuantType

GGUF quantization types used with LLMTarget.LLAMA_CPP.

enum class LLMQuantType {
    GGUF_QUANT_ORG,
    GGUF_QUANT_F16,
    GGUF_QUANT_BF16,
    GGUF_QUANT_Q8_0,
    GGUF_QUANT_Q6_K,
    GGUF_QUANT_Q4_K_M,
    GGUF_QUANT_Q3_K_M,
    GGUF_QUANT_Q2_K,
    GGUF_QUANT_NUM_TYPES,
}

APType

Processor type used with explicit runtime selection.

enum class APType {
    CPU,
    GPU,
    NPU,
    NA,
}
Device / runtimeSupported values
Qualcomm Android + LLAMA_CPPCPU, GPU, NPU
Other Android devices + LLAMA_CPPCPU

ModelCacheHandlingPolicy

Managed artifact cache policy for downloaded model files.

enum class ModelCacheHandlingPolicy {
    REMOVE_OVERLAPPING,
    KEEP_EXISTING,
}
ValueDescription
REMOVE_OVERLAPPINGDefault. Removes overlapping cached aliases for the same model entry.
KEEP_EXISTINGKeeps older cached aliases and artifacts.

Detailed semantics for ModelCacheHandlingPolicy are currently TBD. See Cache Management.

ModelLoadingStatus

Status values delivered by the Android-only onStatusChanged callback.

enum class ModelLoadingStatus {
    UNKNOWN,
    PENDING,
    DOWNLOADING,
    TRANSFERRING,
    COMPLETED,
    FAILED,
    CANCELED,
    WAITING_FOR_WIFI,
    NOT_INSTALLED,
    REQUIRES_USER_CONFIRMATION,
}

See Also

On this page