foundry_grader_string_check: String-check grader

View source: R/evals.R

foundry_grader_string_checkR Documentation

String-check grader

Description

Compare a templated input string against a reference string with an exact or pattern operation. Useful for deterministic pass/fail checks such as verifying an extracted field matches a known value.

Usage

foundry_grader_string_check(
  name,
  input,
  reference,
  operation = c("eq", "ne", "like", "ilike")
)

Arguments

name

Character. Grader name shown in results.

input

Character. Input text, typically a template such as "{{sample.output_text}}".

reference

Character. Reference text, typically a template such as "{{item.expected}}".

operation

Character. One of "eq", "ne", "like", or "ilike".

Value

A named list describing a string_check grader, for use in the testing_criteria of foundry_eval_create().

Examples

foundry_grader_string_check(
  name = "exact-match",
  input = "{{sample.output_text}}",
  reference = "{{item.answer}}",
  operation = "eq"
)

foundryR documentation built on Sept. 25, 2026, 1:10 a.m.