OptionallastIf a previous function returned an error, the error description will be available in this property
OptionaltoolsOptional array of Drafts' tools to make available to the model. Tools are experimental and likely to change in upcoming releases. Use enableAllTools() to add all Drafts-specific tools. Supported values:
draft.query: Allows the model to query drafts in your draft library by tags or query string.draft.find: Allow locating individual drafts by UUID.draft.create: Supports creation of drafts with content.draft.append: Supports appending content to a draft.draft.prepend: Supports prepending content to a draft.editor.open: Supports opening drafts in the editor.action.run: Supports running actions by name.workspace.find: Allows the model to know the workspaces you have created.Enable all known Drafts' tools for the session. Tools can also be enabled individually by setting tools
Get a response from the on-device language model.
Text prompt to submit to the model.
Optionalschema: SystemLanguageModelSchemaOptional schema object to get responses in a structured format. If schema is not passed, responses will be in string format.
Prompt the on-device SystemLanguageModel, part of the Foundation Models API introduced in iOS/macOS 26. Requires OS 26 and a device that supports (and has enabled) Apple Intelligence.
While not as powerful as larger, cloud-based LLMs, the local model is useful for a variety of smaller tasks, and operates completely privately and locally on the device.
Be aware that use of this class is best suited to small tasks, as it is subject to the 4k token limit per session.
For example actions, see User Guide
Example
Prompting the On-Device LLM