Experiment
library(mall)
options(.mall_chat = ellmer::chat_google_gemini())
## Using model = "gemini-2.5-flash".
library(tidyverse)
example_palette <- c("grey9", "hotpink", "darkgreen", "midnightblue",
"turquoise", "darkorange", "grey", "brown",
"darkred", "burlywood", "goldenrod2")
example_palette |>
tibble(pal_colors = _) |>
ggplot() +
aes(x = pal_colors, y = "all",
fill = I(pal_colors)) +
geom_tile()

df <- tribble(~item, ~times,
"cat", 11,
"peacock", 20,
"dolphin", 30,
"sloth", 22) |>
llm_classify(item,
labels = example_palette,
pred_name = ".color")
## ! There were 1 predictions with invalid output, they were coerced to NA
df
## # A tibble: 4 × 3
## item times .color
## <chr> <dbl> <chr>
## 1 cat 11 grey
## 2 peacock 20 turquoise
## 3 dolphin 30 <NA>
## 4 sloth 22 brown
df |>
ggplot() +
aes(x = item) +
geom_bar() +
aes(fill = I(.color))
