Skip to content

Commit a064bda

Browse files
minor changes on api doc
1 parent e6a375a commit a064bda

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

API.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
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.
44

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()`.
11+
512
---
613

714
## `vector_version()`
@@ -88,6 +95,7 @@ SELECT vector_init('documents', 'embedding', 'dimension=384,type=FLOAT32,distanc
8895

8996
**Description:**
9097
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).
9199

92100
**Parameters:**
93101

@@ -130,6 +138,8 @@ SELECT vector_quantize_memory('documents', 'embedding');
130138
**Description:**
131139
Loads the quantized representation for the specified table and column into memory. Should be used at startup to ensure optimal query performance.
132140

141+
Execute it after `vector_quantize()` to reflect changes.
142+
133143
**Example:**
134144

135145
```sql
@@ -170,15 +180,15 @@ Encodes a vector into the required internal BLOB format to ensure correct storag
170180

171181
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.
172182

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-
175183
**Parameters:**
176184

177185
* `value` (TEXT or BLOB):
178186

179187
* If `TEXT`, it must be a JSON array (e.g., `"[0.1, 0.2, 0.3]"`).
180188
* If `BLOB`, no check is performed; the user must ensure the format matches the specified type and dimension.
181189

190+
* `dimension` (INT, optional): Enforce a stricter sanity check, ensuring the input vector has the expected dimensionality.
191+
182192
**Usage by format:**
183193

184194
```sql
@@ -221,6 +231,8 @@ FROM vector_full_scan('documents', 'embedding', vector_convert_f32('[0.1, 0.2, 0
221231
**Description:**
222232
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.
223233

234+
You **must run `vector_quantize()`** before using `vector_quantize_scan()` and when data initialized for vectors changes.
235+
224236
**Parameters:**
225237

226238
* `table` (TEXT): Name of the target table.
@@ -242,10 +254,3 @@ FROM vector_quantize_scan('documents', 'embedding', vector_convert_f32('[0.1, 0.
242254
```
243255

244256
---
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

Comments
 (0)