instructionsRepresentation
TypeScriptget instructionsRepresentation(): InstructionsSwift declarationvar instructionsRepresentation: Instructions { get }An instance that represents the instructions.
struct · iOS 26.0+ · SDK 27.1
struct InstructionsDetails you provide that define the model's intended behavior on prompts. You typically provide instructions to define the role and behavior of the model. In the code below, the instructions specify that the model replies with topics rather than, for example, a recipe: ```swift let instructions = """ Suggest related topics. Keep them concise (three to seven words) and make sure they \ build naturally from the person's topic. """ let session = LanguageModelSession(instructions: instructions) let prompt = "Making homemade bread" let response = try await session.respond(to: prompt) ``` Don't include untrusted content in instructions: the model is typically trained to obey instructions over any commands it receives in prompts. For more on how instructions impact generation quality and safety, see <doc:improving-the-safety-of-generative-model-output>. All input to the model contributes tokens to the context window of the ``LanguageModelSession`` --- including the ``Instructions``, ``Prompt``, ``Tool``, and ``Generable`` types, and the model's responses. If your session exceeds the available context size, it throws ``LanguageModelError/contextSizeExceeded(_:)``. Instructions can consume a lot of tokens that contribute to the context window size. To reduce your instruction size: - Write shorter instructions to save tokens. - Provide only the information necessary to perform the task. - Use concise and imperative language instead of indirect or jargon that the model might misinterpret. - Aim for one to three paragraphs instead of including a significant amount of background information, policy, or extra content. For more information on managing the context window size, see <doc:managing-the-context-window>.
get instructionsRepresentation(): InstructionsSwift declarationvar instructionsRepresentation: Instructions { get }An instance that represents the instructions.
static init(content: (() => Instructions)): InstructionsSwift declarationinit(@InstructionsBuilder _ content: () throws -> Instructions) rethrowsstatic init78303(content: SDKHandle): InstructionsSwift declarationinit(_ content: some InstructionsRepresentable)Creates an instance with the content you specify.
1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.
Instructions.body
This protocol needs associated types that cannot yet cross the bridge.