prewarm(promptPrefix:)
Requests that the system eagerly load the resources required for this session into memory and optionally caches a prefix of your prompt.
Declaration
final func prewarm(promptPrefix: Prompt? = nil)Mentioned in
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 when the user begins typing into a text field.
If you know a prefix for the future prompt, passing it to prewarm will allow the system to process the prompt eagerly and reduce latency for the future request.
Calling this method does not guarantee that the system loads your assets immediately, particularly if your app is running in the background or the system is under load.