Contents

init(instructions:evaluationTarget:reference:)

Creates a model-as-judge prompt configuration.

Declaration

init(instructions: String = ModelJudgePrompt.defaultInstructions, evaluationTarget: (@Sendable (Input.ExpectedValue) -> String)? = nil, reference: (nonisolated(nonsending) @Sendable (Input, Input.ExpectedValue) async throws -> [String : String])? = nil)

Parameters

  • instructions:

    System instructions for the model-as-judge. Defaults to a general-purpose evaluator prompt.

  • evaluationTarget:

    Optional closure to convert the response to a string. When nil, the response is JSON-serialized.

  • reference:

    Optional closure returning labeled reference data to include in the judge prompt.

Discussion

let prompt = ModelJudgePrompt<ModelSample<String>>(
    instructions: "You are a domain expert."
)

See Also

Creating a prompt configuration