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
Encodes a vector into the required internal BLOB format to ensure correct storage and compatibility with the system’s vector representation.
180
+
A real conversion is performed ONLY in case of JSON input. When input is a BLOB, it is assumed to be already properly formatted.
180
181
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.
182
+
Functions in the `vector_as_` 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.
182
183
183
184
**Parameters:**
184
185
@@ -193,10 +194,10 @@ Functions in the `vector_convert_` family should be used in all `INSERT`, `UPDAT
193
194
194
195
```sql
195
196
-- Insert a Float32 vector using JSON
196
-
INSERT INTO documents(embedding) VALUES(vector_convert_f32('[0.1, 0.2, 0.3]'));
197
+
INSERT INTO documents(embedding) VALUES(vector_as_f32('[0.1, 0.2, 0.3]'));
197
198
198
199
-- Insert a UInt8 vector using raw BLOB (ensure correct formatting!)
199
-
INSERT INTO compressed_vectors(embedding) VALUES(vector_convert_u8(X'010203'));
200
+
INSERT INTO compressed_vectors(embedding) VALUES(vector_as_u8(X'010203'));
200
201
```
201
202
202
203
---
@@ -219,7 +220,7 @@ Performs a brute-force nearest neighbor search using the given vector. Despite i
219
220
220
221
```sql
221
222
SELECT rowid, distance
222
-
FROM vector_full_scan('documents', 'embedding', vector_convert_f32('[0.1, 0.2, 0.3]'), 5);
223
+
FROM vector_full_scan('documents', 'embedding', vector_as_f32('[0.1, 0.2, 0.3]'), 5);
223
224
```
224
225
225
226
---
@@ -250,7 +251,7 @@ You **must run `vector_quantize()`** before using `vector_quantize_scan()` and w
250
251
251
252
```sql
252
253
SELECT rowid, distance
253
-
FROM vector_quantize_scan('documents', 'embedding', vector_convert_f32('[0.1, 0.2, 0.3]'), 10);
254
+
FROM vector_quantize_scan('documents', 'embedding', vector_as_f32('[0.1, 0.2, 0.3]'), 10);
0 commit comments