create_color_palette <- function(brand_yml,
chat_fn = ellmer::chat_google_gemini,
...){
semantic_colors_list <- semantic_colors_as_hex_codes(brand_yml$color)
# Make one string
semantic_colors <- paste(names(semantic_colors_list),
semantic_colors_list,
sep = "=",
collapse = ", ")
client_ccp <- make_chat(
chat_fn,
system_prompt = system_prompt_ccp,
...
)
palette_type <- ellmer::type_object(
"A collection of color palettes for ggplot2",
discrete1 = ellmer::type_array(
"First discrete palette: a list of color hex codes without names or comments.",
items = ellmer::type_string()
),
discrete2 = ellmer::type_array(
"Second discrete palette: a list of color hex codes without names or comments.",
items = ellmer::type_string()
),
sequential1 = ellmer::type_array(
"First sequential palette: a list of color hex codes without names or comments.",
items = ellmer::type_string()
),
sequential2 = ellmer::type_array(
"Second sequential palette: a list of color hex codes without names or comments.",
items = ellmer::type_string()
),
sequential3 = ellmer::type_array(
"Third sequential palette: a list of color hex codes without names or comments.",
items = ellmer::type_string()
),
diverging1 = ellmer::type_array(
"First diverging palette: a list of color hex codes without names or comments.",
items = ellmer::type_string()
),
diverging2 = ellmer::type_array(
"Second diverging palette: a list of color hex codes without names or comments.",
items = ellmer::type_string()
)
)
client_ccp$chat_structured(
semantic_colors,
type = palette_type,
echo = FALSE
)
}