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: README.md
+33-33Lines changed: 33 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,6 +56,39 @@ Or embed it directly into your application.
56
56
57
57
You can download the WebAssembly (WASM) version of SQLite with the SQLite Vector extension enabled from: https://www.npmjs.com/package/@sqliteai/sqlite-wasm
58
58
59
+
## Example Usage
60
+
61
+
```sql
62
+
-- Create a regular SQLite table
63
+
CREATETABLEimages (
64
+
id INTEGERPRIMARY KEY,
65
+
embedding BLOB, -- store Float32/UInt8/etc.
66
+
label TEXT
67
+
);
68
+
69
+
-- Insert a BLOB vector (Float32, 384 dimensions) using bindings
70
+
INSERT INTO images (embedding, label) VALUES (?, 'cat');
-- Run a nearest neighbor query on the quantized version (returns top 20 closest vectors)
87
+
SELECTe.id, v.distanceFROM images AS e
88
+
JOIN vector_quantize_scan('images', 'embedding', ?, 20) AS v
89
+
ONe.id=v.rowid;
90
+
```
91
+
59
92
### Swift Package
60
93
61
94
You can [add this repository as a package dependency to your Swift project](https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app#Add-a-package-dependency). After adding the package, you'll need to set up SQLite with extension loading by following steps 4 and 5 of [this guide](https://github.com/sqliteai/sqlite-extensions-guide/blob/main/platforms/ios.md#4-set-up-sqlite-with-extension-loading).
@@ -112,39 +145,6 @@ pip install sqliteai-vector
112
145
113
146
For usage details and examples, see the [Python package documentation](./packages/python/README.md).
114
147
115
-
## Example Usage
116
-
117
-
```sql
118
-
-- Create a regular SQLite table
119
-
CREATETABLEimages (
120
-
id INTEGERPRIMARY KEY,
121
-
embedding BLOB, -- store Float32/UInt8/etc.
122
-
label TEXT
123
-
);
124
-
125
-
-- Insert a BLOB vector (Float32, 384 dimensions) using bindings
126
-
INSERT INTO images (embedding, label) VALUES (?, 'cat');
0 commit comments