@sqliteai/sqlite-vector 0.9.46 → 0.9.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +15 -187
  2. package/package.json +8 -8
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # @sqliteai/sqlite-vector
2
2
 
3
- [![npm version](https://badge.fury.io/js/@sqliteai%2Fsqlite-vector.svg)](https://www.npmjs.com/package/@sqliteai/sqlite-vector)
4
- [![License](https://img.shields.io/badge/license-Elastic%202.0-blue.svg)](../../../LICENSE.md)
3
+ [![npm version](https://badge.fury.io/js/@sqliteai%2Fsqlite-vector.svg)](https://badge.fury.io/js/@sqliteai%2Fsqlite-vector)
4
+ [![License](https://img.shields.io/badge/license-Elastic%202.0-blue.svg)](LICENSE.md)
5
5
 
6
- > SQLite Vector extension for Node.js - Cross-platform vector embeddings and similarity search
6
+ > SQLite Vector extension packaged for Node.js
7
7
 
8
- **SQLite Vector** brings powerful vector search capabilities to SQLite in Node.js. Perfect for Edge AI, semantic search, RAG applications, and similarity matching - all running locally without external dependencies.
8
+ **SQLite Vector** is a cross-platform, ultra-efficient SQLite extension that brings vector search capabilities to your embedded database. It works seamlessly on **iOS, Android, Windows, Linux, and macOS**, using just **30MB of memory** by default. With support for **Float32, Float16, BFloat16, Int8, and UInt8**, and **highly optimized distance functions**, it's the ideal solution for **Edge AI** applications.
9
9
 
10
10
  ## Features
11
11
 
@@ -13,7 +13,7 @@
13
13
  - ✅ **Zero configuration** - Automatically detects and loads the correct binary for your platform
14
14
  - ✅ **TypeScript native** - Full type definitions included
15
15
  - ✅ **Modern ESM + CJS** - Works with both ES modules and CommonJS
16
- - ✅ **Small footprint** - Only downloads binaries for your platform (~30MB)
16
+ - ✅ **Small footprint** - Only downloads binaries for your platform
17
17
  - ✅ **Offline-ready** - No external services required
18
18
 
19
19
  ## Installation
@@ -36,61 +36,16 @@ The package automatically downloads the correct native extension for your platfo
36
36
  | Linux | x86_64 (musl/Alpine) | `@sqliteai/sqlite-vector-linux-x86_64-musl` |
37
37
  | Windows | x86_64 | `@sqliteai/sqlite-vector-win32-x86_64` |
38
38
 
39
- ## Usage
39
+ ## sqlite-vector API
40
+
41
+ For detailed information on how to use the vector extension features, see the [main documentation](https://github.com/sqliteai/sqlite-vector/blob/main/README.md).
40
42
 
41
- ### Basic Usage
43
+ ## Usage
42
44
 
43
45
  ```typescript
44
46
  import { getExtensionPath } from '@sqliteai/sqlite-vector';
45
47
  import Database from 'better-sqlite3';
46
48
 
47
- // Get the path to the vector extension
48
- const extensionPath = getExtensionPath();
49
-
50
- // Load it into your SQLite database
51
- const db = new Database(':memory:');
52
- db.loadExtension(extensionPath);
53
-
54
- // Use vector functions
55
- db.exec(`
56
- CREATE TABLE embeddings (
57
- id INTEGER PRIMARY KEY,
58
- vector BLOB,
59
- text TEXT
60
- );
61
- `);
62
-
63
- // Initialize vector search
64
- db.prepare("SELECT vector_init('embeddings', 'vector', 'type=FLOAT32,dimension=384')").run();
65
-
66
- // Insert vectors (using your embedding model)
67
- const embedding = new Float32Array(384);
68
- // ... fill embedding with your model's output
69
-
70
- db.prepare('INSERT INTO embeddings (vector, text) VALUES (?, ?)').run(
71
- Buffer.from(embedding.buffer),
72
- 'Sample text'
73
- );
74
-
75
- // Perform similarity search
76
- const query = new Float32Array(384); // Your query embedding
77
- const results = db.prepare(`
78
- SELECT e.id, e.text, v.distance
79
- FROM embeddings AS e
80
- JOIN vector_quantize_scan('embeddings', 'vector', ?, 10) AS v
81
- ON e.id = v.rowid
82
- ORDER BY v.distance ASC
83
- `).all(Buffer.from(query.buffer));
84
-
85
- console.log(results);
86
- ```
87
-
88
- ### CommonJS
89
-
90
- ```javascript
91
- const { getExtensionPath } = require('@sqliteai/sqlite-vector');
92
- const Database = require('better-sqlite3');
93
-
94
49
  const db = new Database(':memory:');
95
50
  db.loadExtension(getExtensionPath());
96
51
 
@@ -99,28 +54,9 @@ const version = db.prepare('SELECT vector_version()').pluck().get();
99
54
  console.log('Vector extension version:', version);
100
55
  ```
101
56
 
102
- ### Get Extension Information
103
-
104
- ```typescript
105
- import { getExtensionInfo } from '@sqliteai/sqlite-vector';
106
-
107
- const info = getExtensionInfo();
108
- console.log(info);
109
- // {
110
- // platform: 'darwin-arm64',
111
- // packageName: '@sqliteai/sqlite-vector-darwin-arm64',
112
- // binaryName: 'vector.dylib',
113
- // path: '/path/to/node_modules/@sqliteai/sqlite-vector-darwin-arm64/vector.dylib'
114
- // }
115
- ```
116
-
117
57
  ## Examples
118
58
 
119
- For complete, runnable examples, see the [sqlite-extensions-guide](https://github.com/sqliteai/sqlite-extensions-guide/tree/main/examples/node):
120
-
121
- - **[basic-usage.js](https://github.com/sqliteai/sqlite-extensions-guide/blob/main/examples/node/basic-usage.js)** - Generic extension loading for any @sqliteai extension
122
- - **[semantic-search.js](https://github.com/sqliteai/sqlite-extensions-guide/blob/main/examples/node/semantic-search.js)** - Complete semantic search with OpenAI or on-device embeddings
123
- - **[with-multiple-extensions.js](https://github.com/sqliteai/sqlite-extensions-guide/blob/main/examples/node/with-multiple-extensions.js)** - Loading multiple extensions together (vector + sync + AI + js)
59
+ For complete, runnable examples, see the [sqlite-extensions-guide](https://github.com/sqliteai/sqlite-extensions-guide/tree/main/examples/node).
124
60
 
125
61
  These examples are generic and work with all SQLite extensions: `sqlite-vector`, `sqlite-sync`, `sqlite-js`, and `sqlite-ai`.
126
62
 
@@ -196,131 +132,23 @@ Detects if the system uses musl libc (Alpine Linux, etc.).
196
132
 
197
133
  Error thrown when the SQLite Vector extension cannot be found for the current platform.
198
134
 
199
- ## Vector Search Guide
200
-
201
- For detailed information on how to use the vector search features, see the [main documentation](https://github.com/sqliteai/sqlite-vector/blob/main/README.md).
202
-
203
- ### Quick Reference
204
-
205
- ```sql
206
- -- Initialize vector column
207
- SELECT vector_init('table', 'column', 'type=FLOAT32,dimension=384');
208
-
209
- -- Quantize vectors for faster search
210
- SELECT vector_quantize('table', 'column');
211
-
212
- -- Preload into memory for 4-5x speedup
213
- SELECT vector_quantize_preload('table', 'column');
214
-
215
- -- Search for similar vectors
216
- SELECT * FROM table AS t
217
- JOIN vector_quantize_scan('table', 'column', <query_vector>, <limit>) AS v
218
- ON t.rowid = v.rowid
219
- ORDER BY v.distance;
220
- ```
221
-
222
- ### Distance Metrics
223
-
224
- Specify the distance metric during initialization:
225
-
226
- ```sql
227
- -- L2 (Euclidean) - default
228
- SELECT vector_init('table', 'column', 'type=FLOAT32,dimension=384,distance=L2');
229
-
230
- -- Cosine similarity
231
- SELECT vector_init('table', 'column', 'type=FLOAT32,dimension=384,distance=COSINE');
232
-
233
- -- Dot product
234
- SELECT vector_init('table', 'column', 'type=FLOAT32,dimension=384,distance=DOT');
235
-
236
- -- L1 (Manhattan)
237
- SELECT vector_init('table', 'column', 'type=FLOAT32,dimension=384,distance=L1');
238
- ```
239
-
240
- ## Troubleshooting
241
-
242
- ### Extension Not Found
243
-
244
- If you get `ExtensionNotFoundError`, try:
245
-
246
- ```bash
247
- # Force reinstall dependencies
248
- npm install --force
249
-
250
- # Or manually install the platform package
251
- npm install @sqliteai/sqlite-vector-darwin-arm64 # Replace with your platform
252
- ```
253
-
254
- ### Platform Not Detected
255
-
256
- The package should automatically detect your platform. If detection fails, please [open an issue](https://github.com/sqliteai/sqlite-vector/issues) with:
257
- - Your OS and architecture
258
- - Node.js version
259
- - Output of `node -p "process.platform + '-' + process.arch"`
260
-
261
- ### Alpine Linux / musl
262
-
263
- On Alpine Linux or other musl-based systems, the package automatically detects musl and installs the correct variant. If you encounter issues:
264
-
265
- ```bash
266
- # Verify musl detection
267
- node -e "console.log(require('@sqliteai/sqlite-vector').isMusl())"
268
-
269
- # Should print: true
270
- ```
271
-
272
- ## Development
273
-
274
- ### Building from Source
275
-
276
- ```bash
277
- # Clone the repository
278
- git clone https://github.com/sqliteai/sqlite-vector.git
279
- cd sqlite-vector/packages/node
280
-
281
- # Install dependencies
282
- npm install
283
-
284
- # Build TypeScript
285
- npm run build
286
-
287
- # Run tests
288
- npm test
289
- ```
290
-
291
- ### Project Structure
292
-
293
- ```
294
- packages/node/
295
- ├── src/
296
- │ ├── index.ts # Main entry point
297
- │ ├── platform.ts # Platform detection logic
298
- │ └── index.test.ts # Test suite
299
- ├── dist/ # Compiled JavaScript (generated)
300
- ├── generate-platform-packages.js # Platform package generator
301
- ├── package.json
302
- ├── tsconfig.json
303
- └── README.md
304
- ```
305
-
306
135
  ## Related Projects
307
136
 
308
- - **[SQLite-AI](https://github.com/sqliteai/sqlite-ai)** - On-device AI inference and embedding generation
309
- - **[SQLite-Sync](https://github.com/sqliteai/sqlite-sync)** - Sync on-device databases with the cloud
310
- - **[SQLite-JS](https://github.com/sqliteai/sqlite-js)** - Define SQLite functions in JavaScript
137
+ - **[@sqliteai/sqlite-ai](https://www.npmjs.com/package/@sqliteai/sqlite-ai)** - On-device AI inference and embedding generation
138
+ - **[@sqliteai/sqlite-sync](https://www.npmjs.com/package/@sqliteai/sqlite-sync)** - Sync on-device databases with the cloud
139
+ - **[@sqliteai/sqlite-js](https://www.npmjs.com/package/@sqliteai/sqlite-js)** - Define SQLite functions in JavaScript
311
140
 
312
141
  ## License
313
142
 
314
- This project is licensed under the [Elastic License 2.0](../../../LICENSE.md).
143
+ This project is licensed under the [Elastic License 2.0](LICENSE.md).
315
144
 
316
145
  For production or managed service use, please [contact SQLite Cloud, Inc](mailto:info@sqlitecloud.io) for a commercial license.
317
146
 
318
147
  ## Contributing
319
148
 
320
- Contributions are welcome! Please see the [main repository](https://github.com/sqliteai/sqlite-vector) for contribution guidelines.
149
+ Contributions are welcome! Please see the [main repository](https://github.com/sqliteai/sqlite-vector) to open an issue.
321
150
 
322
151
  ## Support
323
152
 
324
153
  - 📖 [Documentation](https://github.com/sqliteai/sqlite-vector/blob/main/API.md)
325
154
  - 🐛 [Report Issues](https://github.com/sqliteai/sqlite-vector/issues)
326
- - 💬 [Discussions](https://github.com/sqliteai/sqlite-vector/discussions)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sqliteai/sqlite-vector",
3
- "version": "0.9.46",
3
+ "version": "0.9.49",
4
4
  "description": "SQLite vector search extension for Node.js - Cross-platform vector embeddings and similarity search",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -55,13 +55,13 @@
55
55
  "node": ">=16.0.0"
56
56
  },
57
57
  "optionalDependencies": {
58
- "@sqliteai/sqlite-vector-darwin-arm64": "0.9.46",
59
- "@sqliteai/sqlite-vector-darwin-x86_64": "0.9.46",
60
- "@sqliteai/sqlite-vector-linux-arm64": "0.9.46",
61
- "@sqliteai/sqlite-vector-linux-arm64-musl": "0.9.46",
62
- "@sqliteai/sqlite-vector-linux-x86_64": "0.9.46",
63
- "@sqliteai/sqlite-vector-linux-x86_64-musl": "0.9.46",
64
- "@sqliteai/sqlite-vector-win32-x86_64": "0.9.46"
58
+ "@sqliteai/sqlite-vector-darwin-arm64": "0.9.49",
59
+ "@sqliteai/sqlite-vector-darwin-x86_64": "0.9.49",
60
+ "@sqliteai/sqlite-vector-linux-arm64": "0.9.49",
61
+ "@sqliteai/sqlite-vector-linux-arm64-musl": "0.9.49",
62
+ "@sqliteai/sqlite-vector-linux-x86_64": "0.9.49",
63
+ "@sqliteai/sqlite-vector-linux-x86_64-musl": "0.9.49",
64
+ "@sqliteai/sqlite-vector-win32-x86_64": "0.9.49"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@types/node": "^20.0.0",