Contents

Transcripts

Inspect a session’s history and work with the entries, segments, and attachments it contains.

Overview

A Transcript is a linear history of everything exchanged with a LanguageModelSession. It includes the instructions that define the model’s behavior, the prompts you send, the model’s responses and reasoning, and any tool calls made along the way. It’s what the session uses as context, and it’s what you inspect, trim, or pass to a new session to manage the context window.

The history contains a three-level hierarchy:

entry

A single item in the history that represents a role in the conversation, such as a prompt or a response.

segment

The smallest unit of content within a content-bearing entry. An entry holds its content as an array of segments, which may be plain text, schema-shaped structured content, an attachment, or your own custom content.

attachment

The nontext payload, such as an image, that an attachment segment carries.

To present or analyze a transcript, iterate its entries and switch over the segment cases to handle each kind of content.

Topics

Essentials

Transcript entries

Segments

Attachments

Tool calls

Output formatting