promptRepresentation
TypeScriptget promptRepresentation(): PromptSwift declarationvar promptRepresentation: Prompt { get }An instance that represents a prompt.
struct · iOS 26.0+ · SDK 27.1
struct PromptA prompt from a person to the model. Prompts can contain content written by you, an outside source, or input directly from people using your app. You can initialize a `Prompt` from a string literal: ```swift let prompt = Prompt("What are miniature schnauzers known for?") ``` Use ``PromptBuilder`` to dynamically control the prompt's content based on your app's state. The code below shows if the Boolean is `true`, the prompt includes a second line of text: ```swift let responseShouldRhyme = true let prompt = Prompt { "Answer the following question: Do Siberian Huskies love cold weather?" if responseShouldRhyme { "Your response MUST rhyme!" } } ``` If your prompt includes input from people, consider wrapping the input in a string template with your own prompt to better steer the model's response. For more information on handling inputs in your prompts, see <doc:improving-the-safety-of-generative-model-output>. Prompting the same session eventually leads to exceeding the context window size. You can recover from this error by removing entries from the transcript and trying again. For more information on managing the context window size, see <doc:managing-the-context-window>.
get promptRepresentation(): PromptSwift declarationvar promptRepresentation: Prompt { get }An instance that represents a prompt.
static init(content: (() => Prompt)): PromptSwift declarationinit(@PromptBuilder _ content: () throws -> Prompt) rethrowsstatic init35397(content: SDKHandle): PromptSwift declarationinit(_ content: some PromptRepresentable)Creates an instance with the content you specify.
No declarations were skipped in this snapshot.