Discover a new category
Open in playground →Task
File an expense under one of your categories, or name a new one when none of them fits.
Challenges
categorylists your categories plusnew.new_categoryruns only when the answer isnew:"when": {"category": "new"}, and it sees that answer, so it names what the expense actually is.- Bar association dues are not travel, meals, software or office supplies, so this one comes back
new, namedprofessional_fees. A flight, "Flight from Boston to Chicago for the client meeting, $312.", came backtravel, andnew_categorywas skipped.
Laying out…
Generation(
result={
'category': {
'value': 'new',
'probabilities': {
'travel': 0.001,
'meals': 0.001,
'software': 0.001,
'office_supplies': 0.001,
'new': 0.996,
},
'confidence': 0.995,
},
'new_category': 'professional_fees',
},
thinking={},
usage=Usage(input_tokens=111, thinking_tokens=0),
)Build it into a task: Classification with category discovery, in the cookbook.