---
title: PromptRepresentable
framework: foundationmodels
role: symbol
role_heading: Protocol
path: foundationmodels/promptrepresentable
---

# PromptRepresentable

A type whose value can represent a prompt.

## Declaration

```swift
protocol PromptRepresentable
```

## Overview

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, 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. 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

- [promptRepresentation](foundationmodels/promptrepresentable/promptrepresentation.md)

## Relationships

### Inherited By

- [ConvertibleToGeneratedContent](foundationmodels/convertibletogeneratedcontent.md)
- [Generable](foundationmodels/generable.md)
- [Transcript.CustomSegment](foundationmodels/transcript/customsegment.md)

### Conforming Types

- [Attachment](foundationmodels/attachment.md)
- [GeneratedContent](foundationmodels/generatedcontent.md)
- [ImageReference](foundationmodels/imagereference.md)
- [Prompt](foundationmodels/prompt.md)

## See Also

### Creating a prompt

- [init(_:)](foundationmodels/prompt/init(_:).md)
- [PromptBuilder](foundationmodels/promptbuilder.md)
