Predict the distinct category an object belongs to
Setosa
Wikipedia, public domain
.95 setosa
.05 virginica
.05 versicolor
Virginica
Wikipedia by Eric Hunt, CC-BY-SA 4.0
.05 setosa
.95 virginica
.05 versicolor
Versicolor
Wikipedia by D. Gordon E. Robertson, CC-BY-SA 3.0
.05 setosa
.05 virginica
.95 versicolor
Specify type structure
Iris versicolor
chat <-chat("anthropic/claude-sonnet-4-20250514")type_flower <-type_object(genus =type_string(),species =type_string(),features =type_string("Focus on morphology"),)str(chat$chat_structured(content_image_file("images/versicolor.jpg"),type = type_flower))
List of 3
$ genus : chr "Iris"
$ species : chr "versicolor"
$ features: chr "Purple-blue flowers with three large falls (drooping petals) and three smaller standards (upright petals), yell"| __truncated__
Mimic traditional ML output
Iris versicolor
prob <-"Probability (0.00-1.00) Iris is {{species}}"type_flower <-type_object(species =type_enum(c("setosa", "virginica", "versicolor")),prob_setosa =type_number(interpolate(prob, species ="setosa")),prob_virginica =type_number(interpolate(prob, species ="virginica")),prob_versicolor =type_number(interpolate(prob, species ="versicolor")))str(chat$clone()$chat_structured(content_image_file("images/versicolor.jpg"), type = type_flower))
List of 4
$ species : chr "versicolor"
$ prob_setosa : num 0.05
$ prob_virginica : num 0.1
$ prob_versicolor: num 0.85
symptoms <-read.csv("cls_health/Symptom2Disease.csv")type_health <-type_object(diagnosis =type_enum(unique(symptoms$label)), # n = 24uncertainty =type_number("Err on the side of caution, and provide a score (0.00-1.00) of uncertainty in your diagnosis."))unique(symptoms$label) |>head(12)
type_crime <-type_object(crime_type =type_enum(c("violent", "property", "drug", "dui offense", "public order", "criminal traffic", "not known/missing"),"If violent and another type clearly applies, choose violent, but only if intent to harm or injure is clearly present. Threats, harassment, stalking, and similar are all violent." ),uncertainty =type_number("Your uncertainty in the classification responses and scores, higher scores reflect unclear or difficult to classify descriptions, ranging from 0.0 to 1.0." ))