2024-04-27 12:05:50 -07:00
|
|
|
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
|
2024-07-14 13:47:41 -07:00
|
|
|
desc: Returns a version string of the current `sqlite-vec` installation.
|
2024-06-24 23:26:29 -07:00
|
|
|
example: select vec_version();
|
2024-04-27 12:05:50 -07:00
|
|
|
vec_debug:
|
|
|
|
|
params: []
|
|
|
|
|
section: meta
|
2024-07-14 13:47:41 -07:00
|
|
|
desc: Returns debugging information of the current `sqlite-vec` installation.
|
|
|
|
|
example: select vec_debug();
|
2024-04-27 12:05:50 -07:00
|
|
|
vec_bit:
|
2024-07-14 13:47:41 -07:00
|
|
|
params: [vector]
|
2024-04-27 12:05:50 -07:00
|
|
|
section: constructor
|
2024-07-14 13:47:41 -07:00
|
|
|
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'));
|
2024-04-27 12:05:50 -07:00
|
|
|
vec_f32:
|
2024-07-14 13:47:41 -07:00
|
|
|
params: [vector]
|
2024-04-27 12:05:50 -07:00
|
|
|
section: constructor
|
2024-07-14 13:47:41 -07:00
|
|
|
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');
|
2024-04-27 12:05:50 -07:00
|
|
|
vec_int8:
|
2024-07-14 13:47:41 -07:00
|
|
|
params: [vector]
|
2024-04-27 12:05:50 -07:00
|
|
|
section: constructor
|
2024-07-14 13:47:41 -07:00
|
|
|
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]');
|
2024-04-27 12:05:50 -07:00
|
|
|
|
|
|
|
|
vec_add:
|
2024-07-14 13:47:41 -07:00
|
|
|
params: [a, b]
|
2024-04-27 12:05:50 -07:00
|
|
|
section: op
|
2024-07-14 13:47:41 -07:00
|
|
|
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]')
|
|
|
|
|
)
|
2024-04-27 12:05:50 -07:00
|
|
|
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
|
2024-07-14 13:47:41 -07:00
|
|
|
- SQLITE_VEC_OMIT_FS
|
2024-06-24 23:26:29 -07:00
|
|
|
|