---
title: ImageReference
framework: foundationmodels
role: symbol
role_heading: Structure
path: foundationmodels/imagereference
---

# ImageReference

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

## Declaration

```swift
struct ImageReference
```

## Mentioned in

Analyzing images with multimodal prompting

## Overview

Overview Use ImageReference to allow the model to reference images from the current LanguageModelSession’s transcript. You can define an ImageReference as an argument to a Tool. Retrieve the referenced image from the transcript during the tool call. 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.resolve(in: history) else {       throw ImageToolError.imageNotFound(arguments.image.attachmentLabel)     }     let image = imageAttachment.cgImage     ...   } }

## Topics

### Getting the image label

- [attachmentLabel](foundationmodels/imagereference/attachmentlabel.md)

### Accessing the referenced image

- [resolve(in:)](foundationmodels/imagereference/resolve(in:).md)

## Relationships

### Conforms To

- [ConvertibleFromGeneratedContent](foundationmodels/convertiblefromgeneratedcontent.md)
- [ConvertibleToGeneratedContent](foundationmodels/convertibletogeneratedcontent.md)
- [Copyable](swift/copyable.md)
- [Equatable](swift/equatable.md)
- [Escapable](swift/escapable.md)
- [Generable](foundationmodels/generable.md)
- [InstructionsRepresentable](foundationmodels/instructionsrepresentable.md)
- [PromptRepresentable](foundationmodels/promptrepresentable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Prompt attachments

- [Analyzing images with multimodal prompting](foundationmodels/analyzing-images-with-multimodal-prompting.md)
- [Attachment](foundationmodels/attachment.md)
- [AttachmentContent](foundationmodels/attachmentcontent.md)
- [ImageAttachmentContent](foundationmodels/imageattachmentcontent.md)
