<!--
{
  "availability" : [
    "Xcode: 27.0.0 -",
    "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" : "Evaluations",
  "identifier" : "/documentation/Evaluations/ModelSampleProtocol",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Evaluations"
    ],
    "preciseIdentifier" : "s:11Evaluations19ModelSampleProtocolP"
  },
  "title" : "ModelSampleProtocol"
}
-->

# ModelSampleProtocol

A type that defines language model evaluation samples with prompt, instructions, and expectations.

```
protocol ModelSampleProtocol : SampleProtocol where Self.ExpectedValue : Decodable, Self.ExpectedValue : Encodable, Self.ExpectedValue : Sendable
```

## Overview

Extends [`SampleProtocol`](/documentation/Evaluations/SampleProtocol) with prompt, instructions, and evaluation expectations.
Use [`ModelSample`](/documentation/Evaluations/ModelSample) for the common case; create custom conformances when you need
additional properties.

```swift
let sample = ModelSample(
    prompt: "What's the weather?",
    expected: "Sunny",
    expectations: TrajectoryExpectation(ordered: [
        ToolExpectation("get_weather")
    ])
)
```

## Topics

### Associated Types

[`associatedtype Expectation : Decodable, Encodable, Sendable`](/documentation/Evaluations/ModelSampleProtocol/Expectation)

The type of evaluation expectations.

### Instance Properties

[`var input: ModelSampleInput`](/documentation/Evaluations/ModelSampleProtocol/input)

The bundled language model input, including prompt, instructions, and schema.

[`var output: ModelSampleOutput<Self.ExpectedValue, Self.Expectation>`](/documentation/Evaluations/ModelSampleProtocol/output)

The expected output value and evaluation expectations.

## Relationships

### Inherits From

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

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

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

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

[`SampleProtocol`](/documentation/Evaluations/SampleProtocol)

### Conforming Types

[`ModelSample`](/documentation/Evaluations/ModelSample)

---

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)