# GenerationConfigKt

# GenerationConfigKt


```
public final class GenerationConfigKt
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull.html https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/GenerationConfig` | `https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/GenerationConfigKt#generationConfig(kotlin.Function1)( @https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html @https://developer.android.com/reference/androidx/annotation/NonNull.html Function1<@https://developer.android.com/reference/androidx/annotation/NonNull.html https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/GenerationConfig.Builder, https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html> init )` Helper method to construct a `https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/GenerationConfig` in a DSL-like manner. |

## Public methods

### generationConfig

```
public static final @NonNull GenerationConfig generationConfig(
    @ExtensionFunctionType @NonNull Function1<@NonNull GenerationConfig.Builder, Unit> init
)
```

Helper method to construct a `https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/GenerationConfig` in a DSL-like manner.

Example usage:

```
// Default generation config - uses ModelConfig.DEFAULT and a default background thread pool.
val config1 = generationConfig {}

// Customized model spec
val config2 = generationConfig {
  workerExecutor = myExecutor
  modelConfig = modelConfig {
    releaseStage = ModelReleaseStage.PREVIEW
    preference = ModelPreference.FAST
  }
}

// Using prebuilt default ModelConfig with a custom executor
val config3 = generationConfig {
  workerExecutor = myExecutor
  modelConfig = ModelConfig.DEFAULT
}
```