<!--
{
  "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/LanguageModelSession/prewarm(promptPrefix:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation Models",
      "FoundationModels"
    ],
    "preciseIdentifier" : "s:16FoundationModels20LanguageModelSessionC7prewarm12promptPrefixyAA6PromptVSg_tF"
  },
  "title" : "prewarm(promptPrefix:)"
}
-->

# prewarm(promptPrefix:)

Loads the resources required for this session into memory ahead of a request.

```
final func prewarm(promptPrefix: Prompt? = nil)
```

## Discussion

This method can be useful in cases where you have a strong signal that the user will interact with
session within a few seconds. For example, you might call `prewarm(promptPrefix:)` when
a person begins typing into a text field.

If you know a prefix for the future prompt, passing it to `prewarm(promptPrefix:)` allows
the system to process the prompt eagerly and reduce latency for the future request.

> Important: You should only use prewarm when you have a window of at least 1 second before
> the call to a respond method, like ``doc://com.apple.foundationmodels/documentation/FoundationModels/LanguageModelSession/respond(to:options:)-6a2gb`` or
> ``doc://com.apple.foundationmodels/documentation/FoundationModels/LanguageModelSession/streamResponse(to:options:)-2nlni``.

Calling this method doesn’t guarantee that the system loads your assets immediately, particularly if
your app is running in the background or the system is under load.

---

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)