usearch 2.20.5 → 2.20.7
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.
- package/README.md +14 -13
- package/c/README.md +5 -8
- package/c/usearch.h +1 -2
- package/include/usearch/index.hpp +1 -1
- package/javascript/README.md +2 -0
- package/javascript/dist/cjs/usearch.js +19 -9
- package/package.json +8 -8
- package/prebuilds/darwin-arm64+x64/usearch.node +0 -0
- package/prebuilds/linux-arm64/usearch.node +0 -0
- package/prebuilds/linux-x64/usearch.node +0 -0
package/README.md
CHANGED
|
@@ -20,28 +20,28 @@ Similarity Search & Clustering Engine for <a href="https://github.com/ashvardani
|
|
|
20
20
|
<p align="center">
|
|
21
21
|
Spatial • Binary • Probabilistic • User-Defined Metrics
|
|
22
22
|
<br/>
|
|
23
|
-
<a href="https://unum-cloud.github.io/usearch/cpp">C++
|
|
23
|
+
<a href="https://unum-cloud.github.io/usearch/cpp">C++11</a> •
|
|
24
24
|
<a href="https://unum-cloud.github.io/usearch/python">Python 3</a> •
|
|
25
25
|
<a href="https://unum-cloud.github.io/usearch/javascript">JavaScript</a> •
|
|
26
26
|
<a href="https://unum-cloud.github.io/usearch/java">Java</a> •
|
|
27
27
|
<a href="https://unum-cloud.github.io/usearch/rust">Rust</a> •
|
|
28
|
-
<a href="https://unum-cloud.github.io/usearch/c">
|
|
28
|
+
<a href="https://unum-cloud.github.io/usearch/c">C99</a> •
|
|
29
29
|
<a href="https://unum-cloud.github.io/usearch/objective-c">Objective-C</a> •
|
|
30
30
|
<a href="https://unum-cloud.github.io/usearch/swift">Swift</a> •
|
|
31
31
|
<a href="https://unum-cloud.github.io/usearch/csharp">C#</a> •
|
|
32
|
-
<a href="https://unum-cloud.github.io/usearch/golang">
|
|
32
|
+
<a href="https://unum-cloud.github.io/usearch/golang">Go</a> •
|
|
33
33
|
<a href="https://unum-cloud.github.io/usearch/wolfram">Wolfram</a>
|
|
34
34
|
<br/>
|
|
35
|
-
Linux •
|
|
36
|
-
<a href="https://unum-cloud.github.io/usearch/sqlite">
|
|
35
|
+
Linux • macOS • Windows • iOS • Android • WebAssembly •
|
|
36
|
+
<a href="https://unum-cloud.github.io/usearch/sqlite">SQLite</a>
|
|
37
37
|
</p>
|
|
38
38
|
|
|
39
39
|
<div align="center">
|
|
40
|
-
<a href="https://pepy.tech/project/usearch"> <img alt="PyPI" src="https://static.pepy.tech/personalized-badge/usearch?period=total&units=abbreviation&left_color=black&right_color=blue&left_text=Python%
|
|
40
|
+
<a href="https://pepy.tech/project/usearch"> <img alt="PyPI" src="https://static.pepy.tech/personalized-badge/usearch?period=total&units=abbreviation&left_color=black&right_color=blue&left_text=Python%20PyPI%20installs"> </a>
|
|
41
41
|
<a href="https://www.npmjs.com/package/usearch"> <img alt="NPM" src="https://img.shields.io/npm/dy/usearch?label=JavaScript%20NPM%20installs"> </a>
|
|
42
42
|
<a href="https://crates.io/crates/usearch"> <img alt="Crate" src="https://img.shields.io/crates/d/usearch?label=Rust%20Crate%20installs"> </a>
|
|
43
43
|
<a href="https://www.nuget.org/packages/Cloud.Unum.USearch"> <img alt="NuGet" src="https://img.shields.io/nuget/dt/Cloud.Unum.USearch?label=CSharp%20NuGet%20installs"> </a>
|
|
44
|
-
|
|
44
|
+
<!-- Maven Central publishing is deprecated for now; fat-JAR download is the supported path. -->
|
|
45
45
|
<img alt="GitHub code size in bytes" src="https://img.shields.io/github/languages/code-size/unum-cloud/usearch?label=Repo%20size">
|
|
46
46
|
</div>
|
|
47
47
|
|
|
@@ -160,7 +160,7 @@ This can result in __20x cost reduction__ on AWS and other public clouds.
|
|
|
160
160
|
```py
|
|
161
161
|
index.save("index.usearch")
|
|
162
162
|
|
|
163
|
-
|
|
163
|
+
index.load("index.usearch")
|
|
164
164
|
view = Index.restore("index.usearch", view=True, ...)
|
|
165
165
|
|
|
166
166
|
other_view = Index(ndim=..., metric=...)
|
|
@@ -201,6 +201,8 @@ You can use [Numba][numba], [Cppyy][cppyy], or [PeachPy][peachpy] to define your
|
|
|
201
201
|
from numba import cfunc, types, carray
|
|
202
202
|
from usearch.index import Index, MetricKind, MetricSignature, CompiledMetric
|
|
203
203
|
|
|
204
|
+
ndim = 256
|
|
205
|
+
|
|
204
206
|
@cfunc(types.float32(types.CPointer(types.float32), types.CPointer(types.float32)))
|
|
205
207
|
def python_inner_product(a, b):
|
|
206
208
|
a_array = carray(a, ndim)
|
|
@@ -352,7 +354,7 @@ By now, the core functionality is supported across all bindings.
|
|
|
352
354
|
Broader functionality is ported per request.
|
|
353
355
|
In some cases, like Batch operations, feature parity is meaningless, as the host language has full multi-threading capabilities and the USearch index structure is concurrent by design, so the users can implement batching/scheduling/load-balancing in the most optimal way for their applications.
|
|
354
356
|
|
|
355
|
-
| | C++ 11 | Python 3 | C 99 | Java | JavaScript | Rust |
|
|
357
|
+
| | C++ 11 | Python 3 | C 99 | Java | JavaScript | Rust | Go | Swift |
|
|
356
358
|
| :---------------------- | :----: | :------: | :---: | :---: | :--------: | :---: | :----: | :---: |
|
|
357
359
|
| Add, search, remove | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
358
360
|
| Save, load, view | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
@@ -532,15 +534,14 @@ index = Index(ndim=ndim, metric=CompiledMetric(
|
|
|
532
534
|
- [x] TiDB & TiFlash: [C++](https://github.com/pingcap/tiflash), [announcement](https://www.pingcap.com/article/introduce-vector-search-indexes-in-tidb/).
|
|
533
535
|
- [x] YugaByte: [C++](https://github.com/yugabyte/yugabyte-db/blob/366b9f5e3c4df3a1a17d553db41d6dc50146f488/src/yb/vector_index/usearch_wrapper.cc).
|
|
534
536
|
- [x] Google: [UniSim](https://github.com/google/unisim), [RetSim](https://arxiv.org/abs/2311.17264) paper.
|
|
535
|
-
- [x]
|
|
537
|
+
- [x] Memgraph: [C++](https://github.com/memgraph/memgraph/blob/784dd8520f65050d033aea8b29446e84e487d091/src/storage/v2/indices/vector_index.cpp), [announcement](https://memgraph.com/blog/simplify-data-retrieval-memgraph-vector-search).
|
|
536
538
|
- [x] LanternDB: [C++](https://github.com/lanterndata/lantern), [Rust](https://github.com/lanterndata/lantern_extras), [docs](https://lantern.dev/blog/hnsw-index-creation).
|
|
537
539
|
- [x] LangChain: [Python](https://github.com/langchain-ai/langchain/releases/tag/v0.0.257) and [JavaScript](https://github.com/hwchase17/langchainjs/releases/tag/0.0.125).
|
|
538
540
|
- [x] Microsoft Semantic Kernel: [Python](https://github.com/microsoft/semantic-kernel/releases/tag/python-0.3.9.dev) and C#.
|
|
539
541
|
- [x] GPTCache: [Python](https://github.com/zilliztech/GPTCache/releases/tag/0.1.29).
|
|
540
542
|
- [x] Sentence-Transformers: Python [docs](https://www.sbert.net/docs/package_reference/quantization.html#sentence_transformers.quantization.semantic_search_usearch).
|
|
541
543
|
- [x] Pathway: [Rust](https://github.com/pathwaycom/pathway).
|
|
542
|
-
|
|
543
|
-
- [x] TiDB: [C++](https://github.com/pingcap/tiflash/pull/9486), [docs](https://docs.pingcap.com/tidb/stable/vector-search-index#vector-search-index)
|
|
544
|
+
|
|
544
545
|
|
|
545
546
|
## Citations
|
|
546
547
|
|
|
@@ -550,7 +551,7 @@ doi = {10.5281/zenodo.7949416},
|
|
|
550
551
|
author = {Vardanian, Ash},
|
|
551
552
|
title = {{USearch by Unum Cloud}},
|
|
552
553
|
url = {https://github.com/unum-cloud/usearch},
|
|
553
|
-
version = {2.20.
|
|
554
|
+
version = {2.20.7},
|
|
554
555
|
year = {2023},
|
|
555
556
|
month = oct,
|
|
556
557
|
}
|
package/c/README.md
CHANGED
|
@@ -36,7 +36,7 @@ int main() {
|
|
|
36
36
|
if (error) goto cleanup;
|
|
37
37
|
|
|
38
38
|
// Check up:
|
|
39
|
-
assert(usearch_size(index, &error) ==
|
|
39
|
+
assert(usearch_size(index, &error) == 1);
|
|
40
40
|
assert(usearch_capacity(index, &error) == vectors_count);
|
|
41
41
|
assert(usearch_contains(index, 42, &error));
|
|
42
42
|
|
|
@@ -47,8 +47,6 @@ int main() {
|
|
|
47
47
|
index, &vector[0], usearch_scalar_f32_k, 10,
|
|
48
48
|
&found_keys[0], &found_distances[0], &error);
|
|
49
49
|
|
|
50
|
-
usearch_free(index, &error);
|
|
51
|
-
|
|
52
50
|
cleanup:
|
|
53
51
|
if (error) fprintf(stderr, "Error: %s\n", error);
|
|
54
52
|
if (index) usearch_free(index, &error);
|
|
@@ -66,13 +64,13 @@ usearch_load(index, "index.usearch", &error);
|
|
|
66
64
|
usearch_view(index, "index.usearch", &error);
|
|
67
65
|
```
|
|
68
66
|
|
|
69
|
-
Before saving
|
|
67
|
+
Before saving to disk, you can determine exactly how much disk space the index will take:
|
|
70
68
|
|
|
71
69
|
```c
|
|
72
70
|
size_t bytes = usearch_serialized_length(index, &error);
|
|
73
71
|
```
|
|
74
72
|
|
|
75
|
-
With a known size, you can serialize the index into an in-memory
|
|
73
|
+
With a known size, you can serialize the index into an in-memory buffer:
|
|
76
74
|
|
|
77
75
|
```c
|
|
78
76
|
void* buffer = malloc(bytes);
|
|
@@ -158,7 +156,7 @@ size_t count_removed = usearch_remove(index, 43, &error);
|
|
|
158
156
|
assert(count_renamed == count_removed);
|
|
159
157
|
```
|
|
160
158
|
|
|
161
|
-
USearch can also be used for multi-
|
|
159
|
+
USearch can also be used for multi-indices, where each key may map to multiple vectors.
|
|
162
160
|
That's a common case when implementing semantic search for long documents, where the entire documents can't fit into one input sequence in a transformer-model, and you have to split them into chunks.
|
|
163
161
|
|
|
164
162
|
```c
|
|
@@ -179,7 +177,7 @@ usearch_distance_t distance = usearch_distance(
|
|
|
179
177
|
&vector_a[0], &vector_b[0], usearch_scalar_f32_k, dimensions, usearch_metric_cos_k, &error);
|
|
180
178
|
```
|
|
181
179
|
|
|
182
|
-
Alternatively, you can
|
|
180
|
+
Alternatively, you can benefit from faster thread-pools and priority queues for parallel exact batch-search.
|
|
183
181
|
|
|
184
182
|
```c
|
|
185
183
|
size_t threads = 0;
|
|
@@ -247,4 +245,3 @@ The second will print the memory usage of the index in bytes.
|
|
|
247
245
|
printf("Hardware acceleration: %s\n", usearch_hardware_acceleration(index, &error));
|
|
248
246
|
printf("Memory usage: %zu\n", usearch_memory_usage(index, &error));
|
|
249
247
|
```
|
|
250
|
-
|
package/c/usearch.h
CHANGED
|
@@ -478,8 +478,7 @@ USEARCH_EXPORT void usearch_exact_search( //
|
|
|
478
478
|
* @param[inout] index The handle to the USearch index to be modified.
|
|
479
479
|
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
480
480
|
*/
|
|
481
|
-
USEARCH_EXPORT void usearch_clear(usearch_index_t index,
|
|
482
|
-
usearch_error_t* error);
|
|
481
|
+
USEARCH_EXPORT void usearch_clear(usearch_index_t index, usearch_error_t* error);
|
|
483
482
|
|
|
484
483
|
#ifdef __cplusplus
|
|
485
484
|
}
|
package/javascript/README.md
CHANGED
|
@@ -28,6 +28,8 @@ assert.deepEqual(results.distances, new Float32Array([0]));
|
|
|
28
28
|
index.remove(42n);
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
+
Note: keys are 64-bit integers represented as JavaScript `BigInt` (e.g., `42n`).
|
|
32
|
+
|
|
31
33
|
## Serialization
|
|
32
34
|
|
|
33
35
|
Persist and restore your index with serialization methods:
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
26
36
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
27
37
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
@@ -38,7 +48,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
48
|
};
|
|
39
49
|
var _Index_compiledIndex;
|
|
40
50
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.
|
|
51
|
+
exports.Index = exports.BatchMatches = exports.Matches = exports.ScalarKind = exports.MetricKind = void 0;
|
|
52
|
+
exports.exactSearch = exactSearch;
|
|
42
53
|
const node_gyp_build_1 = __importDefault(require("node-gyp-build"));
|
|
43
54
|
const path = __importStar(require("path"));
|
|
44
55
|
const fs_1 = require("fs");
|
|
@@ -512,7 +523,6 @@ function exactSearch(dataset, queries, dimensions, count, metric, threads = 0) {
|
|
|
512
523
|
return new BatchMatches(...result, count);
|
|
513
524
|
}
|
|
514
525
|
}
|
|
515
|
-
exports.exactSearch = exactSearch;
|
|
516
526
|
const usearch = {
|
|
517
527
|
Index,
|
|
518
528
|
MetricKind,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "usearch",
|
|
3
|
-
"version": "2.20.
|
|
3
|
+
"version": "2.20.7",
|
|
4
4
|
"description": "Smaller & Faster Single-File Vector Search Engine from Unum",
|
|
5
5
|
"author": "Ash Vardanian (https://ashvardanian.com/)",
|
|
6
6
|
"license": "Apache 2.0",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"bindings": "^1.5.0",
|
|
32
|
-
"node-addon-api": "^8.
|
|
33
|
-
"node-gyp-build": "^4.8.
|
|
32
|
+
"node-addon-api": "^8.5.0",
|
|
33
|
+
"node-gyp-build": "^4.8.4"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"test": "node --test ./javascript/usearch.test.js",
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/bindings": "^1.5.5",
|
|
45
|
-
"@types/node": "^
|
|
46
|
-
"node-gyp": "^
|
|
47
|
-
"prebuildify": "^6.0.
|
|
48
|
-
"typescript": "^5.
|
|
45
|
+
"@types/node": "^24.3.0",
|
|
46
|
+
"node-gyp": "^11.4.2",
|
|
47
|
+
"prebuildify": "^6.0.1",
|
|
48
|
+
"typescript": "^5.9.2"
|
|
49
49
|
},
|
|
50
50
|
"main": "javascript/dist/cjs/usearch.js",
|
|
51
51
|
"module": "javascript/dist/esm/usearch.js",
|
|
@@ -55,4 +55,4 @@
|
|
|
55
55
|
"require": "./javascript/dist/cjs/usearch.js"
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
}
|
|
58
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|