Contents

init(_:samples:targetCount:sessionProvider:samplingStrategy:validator:)

Creates a generator for custom, generable evaluation samples.

Declaration

init(_ 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 : Generable

Parameters

  • 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.