init(_:samples:targetCount:sessionProvider:samplingStrategy:validator:)
Creates a generator for sample values with a generable-expected value type.
Declaration
init<T>(_ prompt: Prompt, samples: [SampleType], targetCount: Int, sessionProvider: (@Sendable () -> LanguageModelSession)? = nil, samplingStrategy: SampleGenerator<SampleType>.SamplingStrategy? = .random(), validator: (nonisolated(nonsending) @Sendable (SampleType) async throws -> Bool)? = nil) where SampleType == ModelSample<T>, T : Generable, T : Decodable, T : Encodable, T : SendableParameters
- prompt:
The prompt the generator sends to the language model session.
- samples:
The initial set of evaluation samples that provide context.
- targetCount:
The total number of samples in the resulting dataset.
- sessionProvider:
A closure that creates a new language model session.
- samplingStrategy:
The strategy for selecting example samples.
- validator:
An optional closure that decides whether a generated sample is valid.