Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Builder

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/android/adservices/ondevicepersonalization/InferenceInput.Params.Builder "View this page in Java")

```
class Builder
```

|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||
| ↳ | [android.adservices.ondevicepersonalization.InferenceInput.Params.Builder](https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params.Builder#) |

A builder for `https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params`

## Summary

| Public constructors ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params.Builder#Builder(android.adservices.ondevicepersonalization.KeyValueStore,%20kotlin.String)(keyValueStore: https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/KeyValueStore, modelKey: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Creates a new Builder. |

| Public methods ||
|---|---|
| [InferenceInput.Params](https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params) | `https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params.Builder#build()()` Builds the instance. |
| [InferenceInput.Params.Builder](https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params.Builder#) | `https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params.Builder#setDelegateType(kotlin.Int)(value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` The delegate to run model inference. |
| [InferenceInput.Params.Builder](https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params.Builder#) | `https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params.Builder#setKeyValueStore(android.adservices.ondevicepersonalization.KeyValueStore)(value: https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/KeyValueStore)` A `https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/KeyValueStore` where pre-trained model is stored. |
| [InferenceInput.Params.Builder](https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params.Builder#) | `https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params.Builder#setModelKey(kotlin.String)(value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` The key of the table where the corresponding value stores a pre-trained model. |
| [InferenceInput.Params.Builder](https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params.Builder#) | `https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params.Builder#setModelType(kotlin.Int)(value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` The type of the pre-trained model. |
| [InferenceInput.Params.Builder](https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params.Builder#) | `https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params.Builder#setRecommendedNumThreads(kotlin.Int)(value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` The number of threads used for intraop parallelism on CPU, must be positive number. |

## Public constructors

### Builder

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
Builder(
    keyValueStore: KeyValueStore, 
    modelKey: String)
```

Creates a new Builder.

| Parameters ||
|---|---|
| `keyValueStore` | [KeyValueStore](https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/KeyValueStore): a `https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/KeyValueStore` where pre-trained model is stored. This value cannot be `null`. |
| `modelKey` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): key of the table where the corresponding value stores a pre-trained model. This value cannot be `null`. |

## Public methods

### build

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun build(): InferenceInput.Params
```

**Deprecated:** *Deprecated in Java.*

Builds the instance. This builder should not be touched after calling this!

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params` | This value cannot be `null`. |

### setDelegateType

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setDelegateType(value: Int): InferenceInput.Params.Builder
```

**Deprecated:** *Deprecated in Java.*

The delegate to run model inference. If not set, the default value is `https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params#DELEGATE_CPU:kotlin.Int`.

| Parameters ||
|---|---|
| `value` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Value is one of the following: - `https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params#DELEGATE_CPU:kotlin.Int` |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params.Builder#` | This value cannot be `null`. |

### setKeyValueStore

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setKeyValueStore(value: KeyValueStore): InferenceInput.Params.Builder
```

**Deprecated:** *Deprecated in Java.*

A `https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/KeyValueStore` where pre-trained model is stored.

| Parameters ||
|---|---|
| `value` | [KeyValueStore](https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/KeyValueStore): This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params.Builder#` | This value cannot be `null`. |

### setModelKey

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setModelKey(value: String): InferenceInput.Params.Builder
```

**Deprecated:** *Deprecated in Java.*

The key of the table where the corresponding value stores a pre-trained model.

| Parameters ||
|---|---|
| `value` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params.Builder#` | This value cannot be `null`. |

### setModelType

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setModelType(value: Int): InferenceInput.Params.Builder
```

**Deprecated:** *Deprecated in Java.*

The type of the pre-trained model. If not set, the default value is `https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params#MODEL_TYPE_TENSORFLOW_LITE:kotlin.Int` .

| Parameters ||
|---|---|
| `value` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Value is one of the following: - `https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params#MODEL_TYPE_TENSORFLOW_LITE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params#MODEL_TYPE_EXECUTORCH:kotlin.Int` |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params.Builder#` | This value cannot be `null`. |

### setRecommendedNumThreads

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setRecommendedNumThreads(value: Int): InferenceInput.Params.Builder
```

**Deprecated:** *Deprecated in Java.*

The number of threads used for intraop parallelism on CPU, must be positive number. Adopters can set this field based on model architecture. The actual thread number depends on system resources and other constraints.

| Parameters ||
|---|---|
| `value` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Value is 1 or greater |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceInput.Params.Builder#` | This value cannot be `null`. |