7.5 ai.classify — the per-row projection
MATCH (me:AssistantUser)-[:TRACKS]->(n:NewsItem)RETURN n.title, ai.classify(n, 'urgency: high, medium, or low') AS urgency, ai.classify(n, 'topic in one word') AS topicMeans: “return the fetched news, and label each item along a dimension there is no column for” — a computed, LLM-decided category rather than a stored field.
How it executes:
- Fetch as above.
- Label — one batched call per dimension. Each fetched row’s text is labelled for the named dimension
(if the dimension lists categories, the label is one of them; otherwise a short free label). Every row is
kept and its label stamped under a per-dimension slug property (
ai_classify_urgency…), so two classifications in oneRETURNnever collide. - Rewrite & run. As with
ai.score, the executor rewrites eachai.classify(n, '…')in the executed query tocoalesce(n.ai_classify_<slug>, '')(blank for any unlabelled row), and the projection returns it.
Use it only for a subjective label no property holds; when a real field already carries the value, return
that. (It is a projection, not a filter — to keep only one category, classify and then WHERE label = '…',
or use ai.relevant directly.)

