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

# init(samplingMode:temperature:maximumResponseTokens:toolCallingMode:)

Creates generation options that control token sampling behavior.

```
init(samplingMode: GenerationOptions.SamplingMode? = nil, temperature: Double? = nil, maximumResponseTokens: Int? = nil, toolCallingMode: GenerationOptions.ToolCallingMode?)
```

## 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 is allowed
to produce before being artificially halted. Must be positive.

`toolCallingMode`

The requirements defining how the model should call tools.

---

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)