prewarm(promptPrefix:)
Loads the resources required for this session into memory, and optionally caches a prefix of your prompt to reduce request latency.
Declaration
final func prewarm(promptPrefix: Prompt? = nil)Mentioned in
Discussion
Use this method when you know a person will launch and interact with your session within a few seconds to preload the required session resources. For example, you might call this method when a person begins typing into a text field.
If you have a prefix for a future prompt, passing it to this method allows the system to process the prompt eagerly and reduce latency for the future request.
Calling this method doesn’t guarantee that the system loads your resources immediately, particularly if your app is running in the background or the system is under load.