<!--
{
  "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/GenerationGuide/maximum(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation Models",
      "FoundationModels"
    ],
    "preciseIdentifier" : "s:16FoundationModels15GenerationGuideVAASo9NSDecimalaRszlE7maximumyACyAEGAEFZ::OverloadGroup"
  },
  "title" : "maximum(_:)"
}
-->

# maximum(_:)

Enforces a maximum value.

```
static func maximum(_ value: Decimal) -> GenerationGuide<Decimal>
```

## Discussion

Use a `maximum` generation guide — whose bounds are inclusive — to ensure the model produces
a value less than or equal to some maximum value. For example, you can specify that the highest level
a character in your game can achieve is 99.9:

```swift
@Generable
struct GameCharacter {
    @Guide(description: "A creative name appropriate for a fantasy RPG character")
    var name: String

    @Guide(description: "A level for the character", .maximum(99.9))
    var level: Decimal
}
```

---

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)