You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: API.md
+14-9Lines changed: 14 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,13 @@
2
2
3
3
This extension enables efficient vector operations directly inside SQLite databases, making it ideal for on-device and edge AI applications. It supports various vector types and SIMD-accelerated distance functions.
4
4
5
+
### Getting started
6
+
7
+
* All vectors must have a fixed dimension per column, set during `vector_init`.
8
+
* Only tables explicitly initialized using `vector_init` are eligible for vector search.
9
+
* You **must run `vector_quantize()`** before using `vector_quantize_scan()`.
10
+
* You can preload quantization at database open using `vector_quantize_preload()`.
Performs quantization on the specified table and column. This precomputes internal data structures to support fast approximate nearest neighbor (ANN) search.
98
+
Read more about quantization [here](https://github.com/sqliteai/sqlite-vector/blob/main/QUANTIZATION.md).
Loads the quantized representation for the specified table and column into memory. Should be used at startup to ensure optimal query performance.
132
140
141
+
Execute it after `vector_quantize()` to reflect changes.
142
+
133
143
**Example:**
134
144
135
145
```sql
@@ -170,15 +180,15 @@ Encodes a vector into the required internal BLOB format to ensure correct storag
170
180
171
181
Functions in the `vector_convert_` family should be used in all `INSERT`, `UPDATE`, and `DELETE` statements to properly format vector values. However, they are *not* required when specifying input vectors for the `vector_full_scan` or `vector_quantize_scan` virtual tables.
172
182
173
-
Optionally, these functions accept a `dimension INT` argument (placed before the vector value) to enforce a stricter sanity check, ensuring the input vector has the expected dimensionality.
174
-
175
183
**Parameters:**
176
184
177
185
*`value` (TEXT or BLOB):
178
186
179
187
* If `TEXT`, it must be a JSON array (e.g., `"[0.1, 0.2, 0.3]"`).
180
188
* If `BLOB`, no check is performed; the user must ensure the format matches the specified type and dimension.
181
189
190
+
*`dimension` (INT, optional): Enforce a stricter sanity check, ensuring the input vector has the expected dimensionality.
191
+
182
192
**Usage by format:**
183
193
184
194
```sql
@@ -221,6 +231,8 @@ FROM vector_full_scan('documents', 'embedding', vector_convert_f32('[0.1, 0.2, 0
221
231
**Description:**
222
232
Performs a fast approximate nearest neighbor search using the pre-quantized data. This is the **recommended query method** for large datasets due to its excellent speed/recall/memory trade-off.
223
233
234
+
You **must run `vector_quantize()`** before using `vector_quantize_scan()` and when data initialized for vectors changes.
235
+
224
236
**Parameters:**
225
237
226
238
*`table` (TEXT): Name of the target table.
@@ -242,10 +254,3 @@ FROM vector_quantize_scan('documents', 'embedding', vector_convert_f32('[0.1, 0.
242
254
```
243
255
244
256
---
245
-
246
-
## 📌 Notes
247
-
248
-
* All vectors must have a fixed dimension per column, set during `vector_init`.
249
-
* Only tables explicitly initialized using `vector_init` are eligible for vector search.
250
-
* You **must run `vector_quantize()`** before using `vector_quantize_scan()`.
251
-
* You can preload quantization at database open using `vector_quantize_preload()`.
0 commit comments