dragon_map_pairs: Map columns for preference optimization

View source: R/pairs.R

dragon_map_pairsR Documentation

Map columns for preference optimization

Description

For dragon_prefer(). Each row holds one prompt and two candidate replies: the one you prefer and the one you want the model to move away from. As in dragon_map(), each argument is a column name or a glue::glue() template combining several columns.

Usage

dragon_map_pairs(dataset, prompt, chosen, rejected, system = NULL)

Arguments

dataset

A dragon_dataset.

prompt

Column name or template for the user turn.

chosen

Column name or template for the preferred reply.

rejected

Column name or template for the reply to move away from.

system

Optional column name or template for the system prompt. A template with no braces and no matching column is used as a constant system prompt for every row.

Value

The dataset with the mapping attached.

Examples

df <- data.frame(
  q = c("What is 2 + 2?", "Capital of France?"),
  good = c("4", "Paris"),
  bad = c("5", "Lyon")
)
ds <- dragon_map_pairs(dragon_dataset(df), prompt = "q", chosen = "good", rejected = "bad")
dragon_preview(ds, n = 1)

dragonfarm documentation built on Oct. 12, 2026, 5:07 p.m.