One Logo Pool Ball
FoundationModels · IOS API REFERENCE

PromptRepresentable

protocol · iOS 26.0+ · SDK 27.1

protocol PromptRepresentable

A type whose value can represent a prompt. - 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. ```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" ) } ```

Members (0)

This type has no directly callable members in this snapshot. See the framework’s skipped declarations for unsupported APIs.

Skipped declarations

No declarations were skipped in this snapshot.

All FoundationModels types →