Taxonomy classification
A taxonomy is a tree of labels. The support taxonomy below has four top-level areas and four leaves under each of the first two. One flat classify call puts every leaf against every other leaf, so leaves from far-apart branches steal probability from each other.
Walk the tree instead. Each level is one classify call over the children of the winner from the level above.
Try flat first. The array form of labels accepts 2 to 64 labels. The object form carries no documented count cap. The cost of a classify call does not change with the label count. If every leaf fits in one call and the leaf descriptions do not overlap, send them all at once.
The taxonomy
Give every label a description. The model reads "name: description" when a description exists, and a bare name otherwise. Descriptions improve accuracy, as Writing good statements and labels shows.
Walk the tree
Classify the top level
Send the text with the four top-level labels. Keep label, probability and confidence.
Each level is a separate call, so it re-sends the full text. A three-level walk makes three calls and sends the text three times, so it costs three times as much. You pay $0.04 per million input tokens and $0 per output token. See Pricing. One classify call took 1.18 s end to end in our measurement, so budget the depth.
A clean descent
The first call picks the branch. The second call picks the leaf inside that branch.
Level 1 result:
Level 2 sends the same text with the four children of billing:
The walk returns billing > subscription_change. Level 1 confidence 0.607 clears the 0.60 bar in the code below. Level 2 confidence 0.553 clears the 0.45 bar.
When confidence drops
This ticket is clear at level 1 and ambiguous at level 2:
I was charged twice for my annual subscription on 3 March and the second charge has not been refunded.
Two leaves tie at 0.434 and confidence reports 0.285. The ticket describes a duplicate charge and a refund request. Stop at billing and send the leaf choice to a person.
Never read label alone on a deep walk. The winner at a tie is still a single name, and a wrong level-1 branch makes every level below it wrong. Leaves inside one branch describe close cases, so expect lower confidence deeper in the tree. Set a threshold per level, not one threshold for the whole tree.
The walk in code
A node with one child needs no call. The walk appends that child and moves down. The array form of labels also rejects a single label with invalid_request, so skip the call.
Tune the thresholds
Pick the numbers per level from real data, not from a guess.
Build a golden set of 50 to 200 real tickets with the full path labelled. Then score each level on its own and tune the thresholds per level.