Platforms to show: All Mac Windows Linux Cross-Platform
LanguageModelSessionsMBS class
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| class | Foundation Models | MBS Swift Plugin | 25.5 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
A session is a single context that you use to generate content with, and maintains state between requests. You can reuse the existing instance or create a new one each time you call the model. When you create a session you can provide instructions that tells the model what its role is and provides guidance on how to respond.
The framework records each call to the model in a Transcript that includes all prompts and responses. If your session exceeds the available context size, you receive an error.
Requires macOS 26, iOS 26 or newer.
- 6 properties
- property Handle as Integer
- property Instructions as Variant
- property isResponding as Boolean
- property maximumResponseTokens as Integer
- property SystemLanguageModel as SystemLanguageModelsMBS
- property temperature as Double
- 9 methods
- method Constructor(Model as SystemLanguageModelsMBS = nil, Instructions as InstructionsMBS)
- method Constructor(Model as SystemLanguageModelsMBS = nil, Instructions as String)
- method Constructor(Model as SystemLanguageModelsMBS = nil, Transcript as TranscriptMBS)
- method prewarm(Prompt as PromptMBS = nil)
- method respond(prompt as PromptMBS) as ResponseMBS
- method respond(prompt as PromptMBS, theDelegate as ResponseCompletedMBS, tag as Variant = nil)
- method respond(prompt as String) as String
- method respond(prompt as String, theDelegate as ResponseCompletedMBS, tag as Variant = nil)
- method transcript as TranscriptMBS
- delegate ResponseCompletedMBS(Response as ResponseMBS, ErrorString as String, Tag as Variant)
This class has no sub classes.
Blog Entries
- MonkeyBread Software Releases the MBS Xojo Plugins in version 25.5
- Use Foundation Models in Xojo
- MBS Xojo Plugins, version 25.5pr1
Release notes
- Version 25.5
- Added FoundationModels classes for using Apple LLM. See LanguageModelSessionsMBS, SystemLanguageModelsMBS and others.
Some related classes:
- class InstructionsMBS
- class PromptMBS
- class ResponseMBS
- class SystemLanguageModelsMBS
- class TranscriptMBS
The items on this page are in the following plugins: MBS Swift Plugin.
LAContextMBS - LargeBinaryStreamMBS