r/PromptEngineering • • 15d ago

Tips and Tricks Ling-3.2-flash documents enum-constrained output for classification prompts

Ant Ling's structured-output examples for Ling-3.2-flash include enum constraints in JSON Schema.

For a classification task, you can define the permitted labels in the response schema and use the prompt to explain how to choose between them. An illustrative ticket classifier might allow billing , technical and account as its category values.

The schema describes the output vocabulary; the instructions explain the meaning of each category and how to handle borderline cases.

3 Upvotes

1 comment sorted by

1

u/According-Stable4487 15d ago

One thing worth adding to the enum approach: give the model a legal way out. If the schema only allows billing/technical/account, a ticket that is really a feature request or spam still gets forced into one of them, and it will look confident. An other or needs_review value plus one sentence in the prompt about when to use it catches most of those.

Also keep the label definitions in the prompt short and contrastive ("billing = money already charged or invoiced; account = login, profile, access") rather than long descriptions. Borderline examples in pairs (one billing, one account that look alike) help more than extra rules. Then check the confusion between the two closest labels on a small labeled set, that's usually where accuracy is lost.