if (FALSE) {
questions <- tidyllm_schema(
late = field_lgl("Was the payment late?"),
tone = field_fct("Tone of the message", .levels = c("polite", "angry")),
severity = field_fct("How severe is the complaint?",
.levels = c("low", "medium", "high"), .ordered = TRUE)
)
decide("The invoice arrived three weeks late and nobody answers my mails.",
questions, jev())
# Many texts: one tibble with a state and state_id column
mails <- c("Payment is three weeks late.", "Thanks, all fine.")
decide(mails, questions, openai())
# An image, and two labelled images in one item
cat_q <- tidyllm_schema(cat = field_lgl("Is the animal in the picture a cat?"))
decide(img("cat.jpg"), cat_q, openai(.detail = "low"))
pets <- tidyllm_schema(
a_dog = field_lgl("Is the animal in photo_a a dog?"),
b_dog = field_lgl("Is the animal in photo_b a dog?")
)
decide(list(list(photo_a = img("cat.jpg"), photo_b = img("dog.jpg"))), pets, jev())
# Many images: one item per element
files <- c("cat.jpg", "dog.jpg")
decide(purrr::map(files, img), cat_q, gemini(.resolution = "low"))
}
Run the code above in your browser using DataLab