Jadpo is experimental and not ready for production. These docs follow the compiler's main branch as of 5 Nov 2026. What's built · Install 0.3.0
jadpo
ReferenceMaths and data

LanguageValues and typesStandard typesMaths and data

Vector

On this page

A list of numbers, as an AI model's embedding holds them.

Use it for similarity search. To keep the numbers with the model that made them, use Embedding. For a fixed length, build your own type with dimensions:.

Shape

A list of Decimal.

Example

example
[0.5, -0.25, 1.0]

Good to know

  • It holds from 1 to 16,000 numbers.
  • == tells you whether two are the same. < and list.sort_by don't take it.

In JSON

An array of its items, in a request, a response or json.write:

json
[0.5,-0.25,1][0.0123,-0.00456,0.789][1250.5]

Details

Text form, storage, how it is shown, and operations

Vector is in the group Maths and data, and has been in Jadpo since 0.1.0.

Text form

It has no single text form, so text.from and text.parse don't take it.

How it is stored

It is stored in one column named for the field, of type vector. [0.0123,-0.00456,0.789] is stored as '[0.0123,-0.00456,0.789]'::vector.

How it is shown to people

text.format(value, locale:) shows it to people in their locale.

With locale: Locale.en_gb:

Value Shown
[0.5,-0.25,1] [0.5; -0.25; 1]
[0.0123,-0.00456,0.789] [0.0123; -0.00456; 0.789]
[1250.5] [1,250.5]

Operations

  • ai.distance(a: Vector, b: Vector) -> Decimal: How far apart a and b are, two vectors of one type, as that type's distance: compares them and pgvector works it out: smaller is nearer. Cosine, the default, is from 0 to 2; euclidean from 0; inner product is the negative inner product.

It also takes text.format, json.read, json.write and ==. How every standard type behaves says how they work.

Markdown for agents: /docs/types/type-vector.md.Built from Jadpo main at aee2e8f.