if (FALSE) {
library(dplyr)
library(tidyr)
# Build experiments with expand_grid
experiments <- expand_grid(
condition = c("control", "treatment"),
model_type = c("small", "large"),
rep = 1:10
) |>
mutate(
config = case_when(
model_type == "small" ~ list(small_config),
model_type == "large" ~ list(large_config)
),
messages = case_when(
condition == "control" ~ list(control_messages),
condition == "treatment" ~ list(treatment_messages)
)
)
setup_llm_parallel(workers = 4)
results <- call_llm_par(experiments, progress = TRUE)
reset_llm_parallel()
# All metadata preserved for analysis
results |>
group_by(condition, model_type) |>
summarise(mean_response = mean(as.numeric(response_text), na.rm = TRUE))
}
Run the code above in your browser using DataLab