SampleProtocol
A type that defines evaluation samples.
Declaration
protocol SampleProtocol : Decodable, Encodable, SendableOverview
struct MySample: SampleProtocol {
var input: String
var expected: String?
}Conform to this protocol to define input samples for your evaluation datasets. Each sample has an input that’s displayed in the DataFrame “Input” column, and an optional expected value for comparison.
For language model evaluations, use ModelSampleProtocol which extends this protocol with language-model-specific properties: prompt, instructions, and expectations.
let samples = [
ModelSample(prompt: "Classify: I love this!", expected: "positive"),
]