Skip to content

A query language for semantic vector space.

A query language for geometric predicates over semantic vector space. Describe a region of meaning; match everything that falls inside it.

One query, two forms

Every SemQL query has a text form for people and a JSON form for wires. They carry the same query.

MATCH DIRECTION(["sovereign debt concern", "emerging market stress"]) CONE 0.4
  AND CONTRAST(
        ATTRACT ["credit spreads", "bond yields"],
        REPEL   ["routine monetary policy", "scheduled rate decision"]
      )
NAMESPACE "org:hedgefund", GLOBAL
{
  "match": {
    "and": [
      { "direction": { "toward": ["sovereign debt concern", "emerging market stress"], "cone": 0.4 } },
      { "contrast": {
          "attract": ["credit spreads", "bond yields"],
          "repel": ["routine monetary policy", "scheduled rate decision"] } }
    ]
  },
  "namespace": { "include": ["org:hedgefund"], "global": true }
}

Three clauses

A keyword query asks which documents contain a word. A SemQL query asks which embeddings fall inside a region. The region is built from three clause shapes, composed with AND, OR, and NOT.

Clause Shape Reads as
DISTANCE sphere around one anchor close to this
DIRECTION cone from the origin pointing this way, at any magnitude
CONTRAST sphere around a composite like these, unlike those

DIRECTION is the one without a keyword equivalent. It ignores magnitude entirely, so it matches a passing mention and a detailed analysis of the same theme equally — which is what you want when you are watching for a subject rather than retrieving a document.

What this site is

The language: its grammar, its clauses, its wire format, the limits every implementation enforces, and the errors it returns.

It is not documentation for any particular service that speaks SemQL. Nothing here needs an account, an endpoint, or an API key.