OnDeviceConfig

@PublicPreviewAPI
class OnDeviceConfig


Configuration for on-device AI model inference.

Summary

Public companion properties

OnDeviceConfig

A default configuration that only uses in-cloud inference.

Public constructors

OnDeviceConfig(
    mode: InferenceMode,
    maxOutputTokens: Int?,
    temperature: Float?,
    topK: Int?,
    seed: Int?,
    candidateCount: Int,
    modelOption: OnDeviceModelOption?
)

Public properties

Int

The number of generated responses to return.

Int?

The maximum number of tokens to generate in the response.

InferenceMode

The InferenceMode to use for the model.

OnDeviceModelOption?

Configuration for the on-device model selection and performance.

Int?

The seed to use for generation to ensure reproducibility.

Float?

A parameter controlling the degree of randomness in token selection.

Int?

The topK parameter changes how the model selects tokens for output.

Public companion properties

IN_CLOUD

val IN_CLOUD: OnDeviceConfig

A default configuration that only uses in-cloud inference.

Public constructors

OnDeviceConfig

OnDeviceConfig(
    mode: InferenceMode,
    maxOutputTokens: Int? = null,
    temperature: Float? = null,
    topK: Int? = null,
    seed: Int? = null,
    candidateCount: Int = 1,
    modelOption: OnDeviceModelOption? = null
)

Public properties

candidateCount

val candidateCount: Int

The number of generated responses to return. See GenerationConfig for more detail. By default it's set to 1.

maxOutputTokens

val maxOutputTokens: Int?

The maximum number of tokens to generate in the response. See GenerationConfig for more detail.

mode

val mode: InferenceMode

The InferenceMode to use for the model.

modelOption

val modelOption: OnDeviceModelOption?

Configuration for the on-device model selection and performance.

seed

val seed: Int?

The seed to use for generation to ensure reproducibility. See GenerationConfig for more detail.

temperature

val temperature: Float?

A parameter controlling the degree of randomness in token selection. See GenerationConfig for more detail.

topK

val topK: Int?

The topK parameter changes how the model selects tokens for output. See GenerationConfig for more detail.