llm_cross_design: Cross a data frame with LLM configs

View source: R/LLM_parallel_utils.R

llm_cross_designR Documentation

Cross a data frame with LLM configs

Description

Creates an experimental design tibble that crosses every row in .data with every config in configs, evaluating glue prompt templates row-by-row. The result has config and messages list-columns ready for call_llm_par().

Usage

llm_cross_design(
  .data,
  configs,
  prompt = NULL,
  .messages = NULL,
  .system_prompt = NULL
)

Arguments

.data

A data frame containing variables for the glue prompt.

configs

A list of llm_config objects (or a single llm_config).

prompt

A glue string for a single user turn.

.messages

Optional named character vector of glue templates (roles as names).

.system_prompt

Optional system prompt template (glue string).

Value

A tibble with all original data columns plus config and messages list-columns.

See Also

expand_llm_config(), call_llm_par(), build_factorial_experiments()

Examples

## Not run: 
cities <- data.frame(city = c("Cairo", "Lima"))
cfgs <- list(llm_config("groq", "openai/gpt-oss-20b"), llm_config("deepseek", "deepseek-chat"))
design <- llm_cross_design(cities, cfgs, prompt = "What country is {city} in?")
results <- call_llm_par(design)

## End(Not run)


LLMR documentation built on July 11, 2026, 1:06 a.m.