<!--
{
  "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/Transcript",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation Models"
    ],
    "preciseIdentifier" : "s:16FoundationModels10TranscriptV"
  },
  "title" : "Transcript"
}
-->

# Transcript

A linear history of entries that reflect an interaction with a session.

```
struct Transcript
```

## Overview

Use a `Transcript` to visualize previous instructions, prompts and model responses. If you use tool
calling, a `Transcript` includes a history of tool calls and their results.

```swift
struct HistoryView: View {
    let session: LanguageModelSession

    var body: some View {
        ScrollView {
            ForEach(session.transcript) { entry in
                switch entry {
                case let .instructions(instructions):
                    MyInstructionsView(instructions)
                case let .prompt(prompt):
                    MyPromptView(prompt)
                case let .reasoning(reasoning):
                    MyReasoningView(reasoning)
                case let .toolCalls(toolCalls):
                    MyToolCallsView(toolCalls)
                case let .toolOutput(toolOutput):
                    MyToolOutputView(toolOutput)
                case let .response(response):
                    MyResponseView(response)
                }
            }
        }
    }
}
```

When you create a new [`LanguageModelSession`](/documentation/FoundationModels/LanguageModelSession) it doesn’t contain the state of a
previous session. You can initialize a new session with a list of entries you
get from a session [`transcript`](/documentation/FoundationModels/LanguageModelSession/transcript):

```swift
// Create a new session with the first and last entries from a previous session.
func newContextualSession(with originalSession: LanguageModelSession) -> LanguageModelSession {
    let allEntries = originalSession.transcript

    // Collect the entries to keep from the original session.
    let entries = [allEntries.first, allEntries.last].compactMap { $0 }
    let transcript = Transcript(entries: entries)

    // Create a new session with the result and preload the session resources.
    var session = LanguageModelSession(transcript: transcript)
    session.prewarm()
    return session
}
```

## Topics

### Creating a transcript

[`init(entries:)`](/documentation/FoundationModels/Transcript/init(entries:))

Creates a transcript.

### Accessing the transcript history

[`history`](/documentation/FoundationModels/Transcript/history)

The transcript entries excluding the leading instructions entry, if present.

[`Transcript.HistoryView`](/documentation/FoundationModels/Transcript/HistoryView)

A mutable view into the conversational entries of a [`Transcript`](/documentation/FoundationModels/Transcript).

### Getting the structured transcript

[`structuredTranscript`](/documentation/FoundationModels/Transcript/structuredTranscript)

A structured representation of this transcript, with tool calls, outputs, and responses collected into typed arrays.

### Constructing entries

[`Transcript.Entry`](/documentation/FoundationModels/Transcript/Entry)

An entry in a transcript.

[`Transcript.Instructions`](/documentation/FoundationModels/Transcript/Instructions)

Instructions you provide to the model that define its behavior.

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

A prompt from the user to the model.

[`Transcript.Response`](/documentation/FoundationModels/Transcript/Response)

A response from the model.

[`Transcript.Reasoning`](/documentation/FoundationModels/Transcript/Reasoning)

A reasoning entry from the model.

### Accessing entry segments

[`Transcript.Segment`](/documentation/FoundationModels/Transcript/Segment)

The types of segments that may be included in a transcript entry.

[`Transcript.TextSegment`](/documentation/FoundationModels/Transcript/TextSegment)

A segment containing text.

[`Transcript.StructuredSegment`](/documentation/FoundationModels/Transcript/StructuredSegment)

A segment containing structured content.

[`Transcript.AttachmentSegment`](/documentation/FoundationModels/Transcript/AttachmentSegment)

A segment containing attached files or images.

### Getting the nontext payload

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

The types of attached content.

[`Transcript.ImageAttachment`](/documentation/FoundationModels/Transcript/ImageAttachment)

An image attachment in a transcript entry.

### Inspecting tool calls

[`Transcript.ToolDefinition`](/documentation/FoundationModels/Transcript/ToolDefinition)

A definition of a tool.

[`Transcript.ToolCalls`](/documentation/FoundationModels/Transcript/ToolCalls)

A collection tool calls generated by the model.

[`Transcript.ToolCall`](/documentation/FoundationModels/Transcript/ToolCall)

A tool call generated by the model containing the name of a tool and arguments to pass to it.

[`Transcript.ToolOutput`](/documentation/FoundationModels/Transcript/ToolOutput)

A tool output provided back to the model.

### Configuring the output format

[`Transcript.ResponseFormat`](/documentation/FoundationModels/Transcript/ResponseFormat)

A response format that the model must conform its output to.



---

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)