DIRECTION
A cone from the origin — thematic alignment regardless of magnitude.
DIRECTION defines a cone in embedding space. A message matches when its
embedding points the same way as the direction vector, within a half-angle of
cone radians — however strongly or weakly it does so.
MATCH DIRECTION(["customer frustration", "billing complaint"]) CONE 0.4
NAMESPACE "org:acme-corp"
WINDOW 48h
{
"match": { "direction": { "toward": ["customer frustration", "billing complaint"], "cone": 0.4 } },
"namespace": { "include": ["org:acme-corp"] },
"window": "PT48H"
}
Fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
toward |
string | string[] | yes | — | Direction concept or concepts |
cone |
number | no | 0.3 |
Half-angle in radians |
Why magnitude is ignored
This is the clause with no keyword-search equivalent, and the reason to reach for SemQL at all.
Embedding magnitude tends to track how strongly a text is about something. A
one-line aside about a billing problem and a detailed complaint thread point in
roughly the same direction but at very different magnitudes. A sphere
(DISTANCE) separates them; a cone does not.
Use DIRECTION when you are watching for a subject and want the passing mention
as well as the essay. Use DISTANCE when you want the essay.
cone is a half-angle in radians
Not degrees, and not a similarity. The valid range is [0, π], and a smaller
value is stricter — the opposite direction from within, because this is
genuinely an angle.
The default of 0.3 radians is about 17°.
Multiple anchors average
When toward is an array, the direction vector is the normalized mean of the
embedded concepts. That is a single averaged direction, not a union: listing
concepts that point different ways produces a mean between them that may
resemble none of them.
For "this or that", use two DIRECTION clauses joined with
OR instead.
At most 8 anchors may appear in the list — see limits.
Grammar
direction_clause = "DIRECTION" "(" anchor_list ")" [ direction_opts ] ;
direction_opts = "CONE" number ;
Errors
| Message | Cause |
|---|---|
direction: at least one toward anchor is required |
Empty toward |
direction: cone must be between 0 and π |
Out-of-range angle |
direction: cone must be a finite number |
NaN or an infinity |