<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FoundationModels",
  "identifier" : "/documentation/FoundationModels/GenerationOptions/init(samplingMode:temperature:maximumResponseTokens:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation Models"
    ],
    "preciseIdentifier" : "s:16FoundationModels17GenerationOptionsV12samplingMode11temperature21maximumResponseTokensA2C08SamplingF0VSg_SdSgSiSgtcfc"
  },
  "title" : "init(samplingMode:temperature:maximumResponseTokens:)"
}
-->

# init(samplingMode:temperature:maximumResponseTokens:)

Creates generation options that control token sampling behavior.

```
@backDeployed(before: iOS 27.0, macOS 27.0, visionOS 27.0)
init(samplingMode: GenerationOptions.SamplingMode? = nil, temperature: Double? = nil, maximumResponseTokens: Int? = nil)
```

## Parameters

`samplingMode`

A strategy to use for sampling from a distribution.

`temperature`

A value between `0` and `1`, inclusive, that controls how sharply the model
favors its most likely responses. A higher value increases variety.

`maximumResponseTokens`

The maximum number of tokens the model produces
before being halted. Must be positive.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)