Read or validate a prompt template for pairwise comparisons
Source:R/prompt_template.R
set_prompt_template.RdThis function returns a default prompt template that includes
placeholders for the trait name, trait description, and two
writing samples. Any custom template must contain the
placeholders {TRAIT_NAME}, {TRAIT_DESCRIPTION},
{SAMPLE_1}, and {SAMPLE_2}.
Details
Save the returned text and pass it as prompt_template to a comparison
function. Despite its name, this function does not change a global active
template. Keep custom template files in your own project, rather than
editing the installed package. Use register_prompt_template() and
get_prompt_template() to manage named templates for the current session.
Examples
# Get the default template shipped with the package
tmpl <- set_prompt_template()
cat(substr(tmpl, 1, 200), "...\n")
#> You are a debate adjudicator. Your task is to weigh the comparative strengths of two writing samples regarding a specific trait.
#>
#> TRAIT: {TRAIT_NAME}
#> DEFINITION: {TRAIT_DESCRIPTION}
#>
#> SAMPLES:
#>
#> === SAM ...
# Use a custom template defined in-line
custom <- "
You are an expert writing assessor for {TRAIT_NAME}.
{TRAIT_NAME} is defined as {TRAIT_DESCRIPTION}.
Which of the samples below is better on {TRAIT_NAME}?
SAMPLE 1:
{SAMPLE_1}
SAMPLE 2:
{SAMPLE_2}
<BETTER_SAMPLE>SAMPLE_1</BETTER_SAMPLE> or
<BETTER_SAMPLE>SAMPLE_2</BETTER_SAMPLE>
"
tmpl2 <- set_prompt_template(template = custom)
cat(substr(tmpl2, 1, 120), "...\n")
#>
#> You are an expert writing assessor for {TRAIT_NAME}.
#>
#> {TRAIT_NAME} is defined as {TRAIT_DESCRIPTION}.
#>
#> Which of the sam ...