sqlite-vec/reference.yaml
2024-07-14 13:47:41 -07:00

158 lines
3.6 KiB
YAML

sections:
meta: Meta functions
constructor: Vector constructor functions
op: Vector operation functions
distance: Vector distance functions
quantize: Vector quantization functions
functions:
vec_version:
params: []
section: meta
desc: Returns a version string of the current `sqlite-vec` installation.
example: select vec_version();
vec_debug:
params: []
section: meta
desc: Returns debugging information of the current `sqlite-vec` installation.
example: select vec_debug();
vec_bit:
params: [vector]
section: constructor
desc: Creates a binary vector from a BLOB.
example:
- select vec_bit(X'F0');
- select subtype(vec_bit(X'F0'));
- select vec_to_json(vec_bit(X'F0'));
vec_f32:
params: [vector]
section: constructor
desc: |
Creates a float vector from a BLOB or JSON text. If a BLOB is provided,
the length must be divisible by 4, as a float takes up 4 bytes of space each.
example:
- select vec_float32('[.1, .2, .3, 4]');
- select subtype(vec_float32('[.1, .2, .3, 4]'));
- select vec_float32(X'AABBCCDD');
- select vec_to_json(vec_float32(X'AABBCCDD'));
- select vec_float32(X'AA');
vec_int8:
params: [vector]
section: constructor
desc: |
Creates a 8-bit integer vector from a BLOB or JSON text. If a BLOB is provided,
the length must be divisible by 4, as a float takes up 4 bytes of space each.
If JSON text is provided, each element must be an integer between -128 and 127 inclusive.
example:
- select vec_int8('[1, 2, 3, 4]');
- select subtype(vec_int8('[1, 2, 3, 4]'));
- select vec_int8(X'AABBCCDD');
- select vec_to_json(vec_int8(X'AABBCCDD'));
- select vec_int8('[999]');
vec_add:
params: [a, b]
section: op
desc: |
Adds each element in vector `a` with vector `b`, returning a new vector `c`. Both vectors
must be of the same type, and can only be a `float32` or `int8` vector.
example: |
- select vec_add(
'[.1, .2, .3]',
'[.4, .5, .6]'
);
- |
select vec_to_json(
vec_add(
'[.1, .2, .3]',
'[.4, .5, .6]'
)
);
- |
select vec_to_json(
vec_int8('[1, 2, 3]'),
vec_int8('[4, 5, 6]')
)
vec_length:
params: []
section: op
desc: x
example: x
vec_normalize:
params: []
section: op
desc: x
example: x
vec_slice:
params: []
section: op
desc: x
example: x
vec_sub:
params: []
section: op
desc: x
example: x
vec_to_json:
params: []
section: op
desc: x
example: x
vec_distance_cosine:
params: []
section: distance
desc: x
example: x
vec_distance_hamming:
params: []
section: distance
desc: x
example: x
vec_distance_l2:
params: []
section: distance
desc: x
example: x
vec_quantize_binary:
params: []
section: quantization
desc: x
example: x
vec_quantize_i8:
params: []
section: quantization
desc: x
example: x
vec_quantize_i8:
params: []
section: quantization
desc: x
example: x
table_functions:
vec_each:
columns: [rowid, value]
inputs: ["vector"]
desc:
example:
vec_npy_each:
columns: [rowid, vector]
inputs: ["input"]
desc:
example:
virtual_tables:
vec0:
desc:
example:
entrypoints:
sqlite3_vec_init: {}
sqlite3_vec_fs_read_init: {}
compile_options:
- SQLITE_VEC_ENABLE_AVX
- SQLITE_VEC_ENABLE_NEON
- SQLITE_VEC_OMIT_FS