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

# Attachment

An asset provided to the model.

```
struct Attachment<Content>
```

## Overview

Use `Attachment` to include media such as images alongside text in your
prompts and instructions.

```swift
let response = try await session.respond {
    "Describe this image:"
    Attachment(image)
}
```

Use the [`label(_:)`](/documentation/FoundationModels/Attachment/label(_:)) method to assign a label to an attachment. Labels
help the model identify specific attachments when making tool calls.

```swift
Prompt {
    "Compare these two images:"
    Attachment(firstImage)
        .label("image-0")
    Attachment(secondImage)
        .label("image-1")
}
```

## Topics

### Creating an attachment instance

[`init ( _ : orientation :)`](/documentation/FoundationModels/Attachment/init(_:orientation:))

Creates an attachment from a Core Graphics image.

[`init(imageURL:orientation:)`](/documentation/FoundationModels/Attachment/init(imageURL:orientation:))

Creates an attachment from a file URL pointing to an image.

### Assigning a label

[`label(_:)`](/documentation/FoundationModels/Attachment/label(_:))

Assigns a label to an attachment.

## Relationships

### Conforms To

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

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

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

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

---

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)