-
-
Notifications
You must be signed in to change notification settings - Fork 65
/
NOTES
78 lines (58 loc) · 1.83 KB
/
NOTES
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
## TODO
- [ ] `sqlite-vector`
- [ ] light benchmarks
- [ ] INSERT respect transactions
- `pTable->vectors_to_add`
- `xCommit`/`xRollback`
- [ ] DELETE and UPDATE support
- [ ] xUpdate DELETE, with `pTable->ids_to_data` and `xCommit`/`xRollback` support
- [ ] update, call remove_id, add_id?
- [ ] clustering?
- [ ] [Distances](https://faiss.ai/cpp_api/file/distances_8h.html)
- [ ] [extra distances](https://faiss.ai/cpp_api/file/extra__distances_8h.html)
- [ ] binary index
- [ ] hamming distance utils
- [ ] vtab option to store index on disk instead (mmaped)
- [ ] GPU?
```sql
create table articles(
headline text,
body text
);
create virtual table article_vectors using vss(
headline(384) using "Flat,IDMap",
body(384) using "IVF10,PQ4",
);
with similar_headlines as (
select
id,
distance
from article_vectors
where vss_search(headline, vss_params('query', :query, 'k', 50));
)
select
articles.headline
from similar_headlines
left join articles on articles.rowid = similar_headlines.id
```
https://github.com/matsui528/faiss_tips
```
cmake -B build; make -C build
cmake -DCMAKE_BUILD_TYPE=Release -B build_release; make -C build_release
```
```bash
cd build/
cmake .. -DFAISS_ENABLE_GPU=OFF -DFAISS_ENABLE_PYTHON=OFF
make
```
```
PYO3_PYTHON=/Users/alex/projects/research-sqlite-vector/venv/bin/python LIBDIR=/usr/local/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/lib cargo build
PYTHONPATH=/Users/alex/projects/research-sqlite-vector/venv/lib/python3.8/site-packages/ sqlite3x :memory: '.read test.sql'
```
## Embeddings generating
`sqlite-vss` is a **Bring Your Own Vectors** database.
### Option 1: Application Defined Functions
### Option 2: With `sqlite-http`
### Option 3: With `sqlite-openai` or `sqlite-huggingface-inference`
### Option 4: With `sqlite-py`
### Option 5: With `sqlite-bert` (WIP)