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

# ImageReference

A reference to an image in a session’s transcript.

```
struct ImageReference
```

## Overview

Use `ImageReference` to allow the model to reference images from the transcript of the current `LanguageModelSession`.

You can define an `ImageReference` as an argument to a `Tool`. Retrieve the referenced image from the transcript during the tool call.

```swift
struct MyTool: Tool {
  @SessionProperty(\.history) var history

  @Generable
  struct Arguments {
    var image: ImageReference
  }

  public func call(arguments: Arguments) async throws -> Output {
    guard let imageAttachment = arguments.image.resolved(in: history) else {
      throw ImageToolError.imageNotFound(arguments.image.attachmentLabel)
    }
    let image = imageAttachment.cgImage
    ...
  }
}
```

## Topics

### Getting the image label

[`let attachmentLabel: String`](/documentation/FoundationModels/ImageReference/attachmentLabel)

The label of the referenced image.

### Accessing the referenced image

[`func resolved(in: some Sequence<Transcript.Entry>) -> Transcript.ImageAttachment?`](/documentation/FoundationModels/ImageReference/resolved(in:))

Returns the referenced image from the transcript.

### Default Implementations

[Generable Implementations](/documentation/FoundationModels/ImageReference/Generable-Implementations)

## Relationships

### Conforms To

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

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

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

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

[`Equatable`](/documentation/Swift/Equatable)

[`Sendable`](/documentation/Swift/Sendable)

[`Escapable`](/documentation/Swift/Escapable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Copyable`](/documentation/Swift/Copyable)

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

---

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)