mirror of
https://github.com/asg017/sqlite-vec.git
synced 2026-04-25 00:36:56 +02:00
wasm tests and fixes
This commit is contained in:
parent
79d6ea1aea
commit
6c97750e48
5 changed files with 134 additions and 3 deletions
1
.github/workflows/test.yaml
vendored
1
.github/workflows/test.yaml
vendored
|
|
@ -51,7 +51,6 @@ jobs:
|
||||||
python-version: "3.12"
|
python-version: "3.12"
|
||||||
- run: ./scripts/vendor.sh
|
- run: ./scripts/vendor.sh
|
||||||
shell: bash
|
shell: bash
|
||||||
- run: ls vendor/
|
|
||||||
- run: make loadable
|
- run: make loadable
|
||||||
- run: pip install pytest numpy; make test-loadable
|
- run: pip install pytest numpy; make test-loadable
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
|
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -20,5 +20,6 @@ examples/supabase-dbpedia
|
||||||
examples/ann-filtering
|
examples/ann-filtering
|
||||||
examples/dbpedia-openai
|
examples/dbpedia-openai
|
||||||
examples/imdb
|
examples/imdb
|
||||||
|
examples/sotu
|
||||||
|
|
||||||
sqlite-vec.h
|
sqlite-vec.h
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include "sqlite3.h"
|
#include "sqlite3.h"
|
||||||
#include "sqlite-vec.h"
|
#include "sqlite-vec.h"
|
||||||
|
|
||||||
int sqlite3_wasm_extra_init(const char *) {
|
int sqlite3_wasm_extra_init(const char * unused) {
|
||||||
sqlite3_auto_extension((void (*)(void)) sqlite3_vec_init);
|
return sqlite3_auto_extension((void (*)(void)) sqlite3_vec_init);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
121
reference.yaml
Normal file
121
reference.yaml
Normal file
|
|
@ -0,0 +1,121 @@
|
||||||
|
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: x
|
||||||
|
example: x
|
||||||
|
vec_debug:
|
||||||
|
params: []
|
||||||
|
section: meta
|
||||||
|
desc: x
|
||||||
|
example: x
|
||||||
|
|
||||||
|
vec_bit:
|
||||||
|
params: []
|
||||||
|
section: constructor
|
||||||
|
desc: x
|
||||||
|
example: x
|
||||||
|
vec_f32:
|
||||||
|
params: []
|
||||||
|
section: constructor
|
||||||
|
desc: x
|
||||||
|
example: x
|
||||||
|
vec_int8:
|
||||||
|
params: []
|
||||||
|
section: constructor
|
||||||
|
desc: x
|
||||||
|
example: x
|
||||||
|
|
||||||
|
vec_add:
|
||||||
|
params: []
|
||||||
|
section: op
|
||||||
|
desc: x
|
||||||
|
example: x
|
||||||
|
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
|
||||||
|
|
||||||
10
tests/test-wasm.mjs
Normal file
10
tests/test-wasm.mjs
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
async function main() {
|
||||||
|
const { default: init } = await import("../dist/.wasm/sqlite3.mjs");
|
||||||
|
const sqlite3 = await init();
|
||||||
|
const vec_version = new sqlite3.oo1.DB(":memory:").selectValue(
|
||||||
|
"select vec_version()"
|
||||||
|
);
|
||||||
|
console.log(vec_version);
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
Loading…
Add table
Add a link
Reference in a new issue