GenerationConfig
data class GenerationConfig(val topK: Int? = null, val topP: Float? = null, val temperature: Float? = null, val maxTokens: Int? = null, val accelerator: Accelerator? = null)
Optional load-time tuning for an on-device LLM. Every field is nullable — null means "leave the backend's own default alone". Backends apply what their engine exposes and ignore the rest:
MediaPipe (Gemma) — maxTokens + accelerator + the topK ceiling are load-time options; the topK/topP/temperature sampler is applied per inference session.
ML Kit GenAI (Gemini Nano) and Foundation Models (iOS) — the OS owns decoding, so the config is accepted and ignored. Kept uniform so a caller wires one config regardless of backend.
Constructors
Link copied to clipboard
constructor(topK: Int? = null, topP: Float? = null, temperature: Float? = null, maxTokens: Int? = null, accelerator: Accelerator? = null)