<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FoundationModels",
  "identifier" : "/documentation/FoundationModels/PromptRepresentable",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Foundation Models"
    ],
    "preciseIdentifier" : "s:16FoundationModels19PromptRepresentableP"
  },
  "title" : "PromptRepresentable"
}
-->

# PromptRepresentable

A type whose value can represent a prompt.

```
protocol PromptRepresentable
```

## Overview> Important: Conformance to this protocol is provided automatically by the
> `@Generable` macro, you should **not** override its implementations. Overriding
> may negatively impact runtime performance and cause bugs.

For types that are not [`Generable`](/documentation/FoundationModels/Generable), you may provide your own implementation.

Experiment with different representations to find one that works well for
your type. Generally, any format that is easily understandable to humans
will work well for the model as well.

```swift
struct FamousHistoricalFigure: PromptRepresentable {
    var name: String
    var biggestAccomplishment: String

    var promptRepresentation: Prompt {
        """
        Famous Historical Figure:
        - name: \(name)
        - best known for: \(biggestAccomplishment)
        """
    }
}

let response = try await LanguageModelSession().respond {
    "Tell me more about..."
    FamousHistoricalFigure(
        name: "Albert Einstein",
        biggestAccomplishment: "Theory of Relativity"
    )
}
```

## Topics

### Getting the representation

[`var promptRepresentation: Prompt`](/documentation/FoundationModels/PromptRepresentable/promptRepresentation)

An instance that represents a prompt.

## Relationships

### Inherited By

[`Generable`](/documentation/FoundationModels/Generable)

[`ConvertibleToGeneratedContent`](/documentation/FoundationModels/ConvertibleToGeneratedContent)

### Conforming Types

[`GeneratedContent`](/documentation/FoundationModels/GeneratedContent)

[`ImageReference`](/documentation/FoundationModels/ImageReference)

[`Prompt`](/documentation/FoundationModels/Prompt)

[`Attachment`](/documentation/FoundationModels/Attachment)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)