usearch 2.20.8 → 2.21.1

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 CHANGED
@@ -354,16 +354,16 @@ By now, the core functionality is supported across all bindings.
354
354
  Broader functionality is ported per request.
355
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.
356
356
 
357
- | | C++ 11 | Python 3 | C 99 | Java | JavaScript | Rust | Go | Swift |
358
- | :---------------------- | :----: | :------: | :---: | :---: | :--------: | :---: | :----: | :---: |
359
- | Add, search, remove | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
360
- | Save, load, view | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
361
- | User-defined metrics | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
362
- | Batch operations | ❌ | ✅ | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ |
363
- | Filter predicates | ✅ | ❌ | ✅ | ❌ | ❌ | ✅ | ❌ | ❌ |
364
- | Joins | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
365
- | Variable-length vectors | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
366
- | 4B+ capacities | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
357
+ | | C++ 11 | Python 3 | C 99 | Java | JavaScript | Rust | Go | Swift |
358
+ | :---------------------- | :----: | :------: | :---: | :---: | :--------: | :---: | :---: | :---: |
359
+ | Add, search, remove | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
360
+ | Save, load, view | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
361
+ | User-defined metrics | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | ❌ | ❌ |
362
+ | Batch operations | ❌ | ✅ | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ |
363
+ | Filter predicates | ✅ | ❌ | ✅ | ❌ | ❌ | ✅ | ❌ | ✅ |
364
+ | Joins | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
365
+ | Variable-length vectors | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
366
+ | 4B+ capacities | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
367
367
 
368
368
  ## Application Examples
369
369
 
@@ -534,13 +534,14 @@ index = Index(ndim=ndim, metric=CompiledMetric(
534
534
  - [x] TiDB & TiFlash: [C++](https://github.com/pingcap/tiflash), [announcement](https://www.pingcap.com/article/introduce-vector-search-indexes-in-tidb/).
535
535
  - [x] YugaByte: [C++](https://github.com/yugabyte/yugabyte-db/blob/366b9f5e3c4df3a1a17d553db41d6dc50146f488/src/yb/vector_index/usearch_wrapper.cc).
536
536
  - [x] Google: [UniSim](https://github.com/google/unisim), [RetSim](https://arxiv.org/abs/2311.17264) paper.
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).
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).
538
538
  - [x] LanternDB: [C++](https://github.com/lanterndata/lantern), [Rust](https://github.com/lanterndata/lantern_extras), [docs](https://lantern.dev/blog/hnsw-index-creation).
539
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).
540
540
  - [x] Microsoft Semantic Kernel: [Python](https://github.com/microsoft/semantic-kernel/releases/tag/python-0.3.9.dev) and C#.
541
541
  - [x] GPTCache: [Python](https://github.com/zilliztech/GPTCache/releases/tag/0.1.29).
542
542
  - [x] Sentence-Transformers: Python [docs](https://www.sbert.net/docs/package_reference/quantization.html#sentence_transformers.quantization.semantic_search_usearch).
543
543
  - [x] Pathway: [Rust](https://github.com/pathwaycom/pathway).
544
+ - [x] Vald: [GoLang](https://github.com/vdaas/vald).
544
545
 
545
546
 
546
547
  ## Citations
@@ -551,7 +552,7 @@ doi = {10.5281/zenodo.7949416},
551
552
  author = {Vardanian, Ash},
552
553
  title = {{USearch by Unum Cloud}},
553
554
  url = {https://github.com/unum-cloud/usearch},
554
- version = {2.20.8},
555
+ version = {2.21.1},
555
556
  year = {2023},
556
557
  month = oct,
557
558
  }
@@ -8,8 +8,8 @@
8
8
  #define UNUM_USEARCH_HPP
9
9
 
10
10
  #define USEARCH_VERSION_MAJOR 2
11
- #define USEARCH_VERSION_MINOR 20
12
- #define USEARCH_VERSION_PATCH 8
11
+ #define USEARCH_VERSION_MINOR 21
12
+ #define USEARCH_VERSION_PATCH 1
13
13
 
14
14
  // Inferring C++ version
15
15
  // https://stackoverflow.com/a/61552074
@@ -120,7 +120,7 @@ export declare class Index {
120
120
  * @throws Will throw an error if the length of keys doesn't match the number of vectors
121
121
  * or if it's not a single key.
122
122
  */
123
- add(keys: bigint | bigint[] | BigUint64Array, vectors: Vector, threads?: number): void;
123
+ add(keys: bigint | bigint[] | BigUint64Array, vectors: VectorOrMatrix, threads?: number): void;
124
124
  /**
125
125
  * Perform a k-nearest neighbor search on the index.
126
126
  *
@@ -143,7 +143,8 @@ export declare class Index {
143
143
  * @throws Will throw an error if `k` is not a positive integer or if the size of the vectors is not a multiple of dimensions.
144
144
  * @throws Will throw an error if `vectors` is not a valid input type (TypedArray or an array of TypedArray) or if its flattened size is not a multiple of dimensions.
145
145
  */
146
- search(vectors: VectorOrMatrix, k: number, threads?: number): Matches | BatchMatches;
146
+ search(vectors: Vector, k: number, threads: number): Matches;
147
+ search(vectors: Matrix, k: number, threads: number): BatchMatches;
147
148
  /**
148
149
  * Verifies the presence of one or more keys in the index.
149
150
  *
@@ -300,28 +300,6 @@ class Index {
300
300
  // Call the compiled method
301
301
  __classPrivateFieldGet(this, _Index_compiledIndex, "f").add(normalizedKeys, normalizedVectors, threads);
302
302
  }
303
- /**
304
- * Perform a k-nearest neighbor search on the index.
305
- *
306
- * This method accepts a matrix of query vectors and returns the closest vectors
307
- * from the index for each query. The method returns an object containing the keys,
308
- * distances, and counts of the matches found.
309
- *
310
- * Vectors should be provided as a flat typed array representing a matrix where
311
- * each row is a vector. The matrix should be of size n * d, where n is the
312
- * number of query vectors, and d is their dimensionality.
313
- *
314
- * The parameter `k` specifies the number of nearest neighbors to return for each
315
- * query vector. If there are not enough results for a query, the result array is
316
- * padded with -1s.
317
- *
318
- * @param {Float32Array|Float64Array|Int8Array|Array<Array<number>>} vectors - Input matrix representing query vectors, can be a TypedArray or an array of TypedArray.
319
- * @param {number} k - The number of nearest neighbors to search for each query vector.
320
- * @param {number} [threads=0] - Optional, default is 0. Number of threads to use for searching. If set to 0, the number of threads is determined automatically.
321
- * @return {Matches|BatchMatches} - Search results for one or more queries, containing keys, distances, and counts of the matches found.
322
- * @throws Will throw an error if `k` is not a positive integer or if the size of the vectors is not a multiple of dimensions.
323
- * @throws Will throw an error if `vectors` is not a valid input type (TypedArray or an array of TypedArray) or if its flattened size is not a multiple of dimensions.
324
- */
325
303
  search(vectors, k, threads = 0) {
326
304
  if ((!Number.isNaN(k) && typeof k !== "number") || k <= 0) {
327
305
  throw new Error("`k` must be a positive integer representing the number of nearest neighbors to search for.");
@@ -120,7 +120,7 @@ export declare class Index {
120
120
  * @throws Will throw an error if the length of keys doesn't match the number of vectors
121
121
  * or if it's not a single key.
122
122
  */
123
- add(keys: bigint | bigint[] | BigUint64Array, vectors: Vector, threads?: number): void;
123
+ add(keys: bigint | bigint[] | BigUint64Array, vectors: VectorOrMatrix, threads?: number): void;
124
124
  /**
125
125
  * Perform a k-nearest neighbor search on the index.
126
126
  *
@@ -143,7 +143,8 @@ export declare class Index {
143
143
  * @throws Will throw an error if `k` is not a positive integer or if the size of the vectors is not a multiple of dimensions.
144
144
  * @throws Will throw an error if `vectors` is not a valid input type (TypedArray or an array of TypedArray) or if its flattened size is not a multiple of dimensions.
145
145
  */
146
- search(vectors: VectorOrMatrix, k: number, threads?: number): Matches | BatchMatches;
146
+ search(vectors: Vector, k: number, threads: number): Matches;
147
+ search(vectors: Matrix, k: number, threads: number): BatchMatches;
147
148
  /**
148
149
  * Verifies the presence of one or more keys in the index.
149
150
  *
@@ -252,28 +252,6 @@ export class Index {
252
252
  // Call the compiled method
253
253
  this.#compiledIndex.add(normalizedKeys, normalizedVectors, threads);
254
254
  }
255
- /**
256
- * Perform a k-nearest neighbor search on the index.
257
- *
258
- * This method accepts a matrix of query vectors and returns the closest vectors
259
- * from the index for each query. The method returns an object containing the keys,
260
- * distances, and counts of the matches found.
261
- *
262
- * Vectors should be provided as a flat typed array representing a matrix where
263
- * each row is a vector. The matrix should be of size n * d, where n is the
264
- * number of query vectors, and d is their dimensionality.
265
- *
266
- * The parameter `k` specifies the number of nearest neighbors to return for each
267
- * query vector. If there are not enough results for a query, the result array is
268
- * padded with -1s.
269
- *
270
- * @param {Float32Array|Float64Array|Int8Array|Array<Array<number>>} vectors - Input matrix representing query vectors, can be a TypedArray or an array of TypedArray.
271
- * @param {number} k - The number of nearest neighbors to search for each query vector.
272
- * @param {number} [threads=0] - Optional, default is 0. Number of threads to use for searching. If set to 0, the number of threads is determined automatically.
273
- * @return {Matches|BatchMatches} - Search results for one or more queries, containing keys, distances, and counts of the matches found.
274
- * @throws Will throw an error if `k` is not a positive integer or if the size of the vectors is not a multiple of dimensions.
275
- * @throws Will throw an error if `vectors` is not a valid input type (TypedArray or an array of TypedArray) or if its flattened size is not a multiple of dimensions.
276
- */
277
255
  search(vectors, k, threads = 0) {
278
256
  if ((!Number.isNaN(k) && typeof k !== "number") || k <= 0) {
279
257
  throw new Error("`k` must be a positive integer representing the number of nearest neighbors to search for.");
@@ -332,7 +332,7 @@ export class Index {
332
332
  * @throws Will throw an error if the length of keys doesn't match the number of vectors
333
333
  * or if it's not a single key.
334
334
  */
335
- add(keys: bigint | bigint[] | BigUint64Array, vectors: Vector, threads: number = 0): void {
335
+ add(keys: bigint | bigint[] | BigUint64Array, vectors: VectorOrMatrix, threads: number = 0): void {
336
336
  let normalizedKeys = normalizeKeys(keys);
337
337
  let normalizedVectors = normalizeVectors(
338
338
  vectors,
@@ -386,6 +386,8 @@ export class Index {
386
386
  * @throws Will throw an error if `k` is not a positive integer or if the size of the vectors is not a multiple of dimensions.
387
387
  * @throws Will throw an error if `vectors` is not a valid input type (TypedArray or an array of TypedArray) or if its flattened size is not a multiple of dimensions.
388
388
  */
389
+ search(vectors: Vector, k: number, threads: number): Matches;
390
+ search(vectors: Matrix, k: number, threads: number): BatchMatches;
389
391
  search(vectors: VectorOrMatrix, k: number, threads: number = 0): Matches | BatchMatches {
390
392
  if ((!Number.isNaN(k) && typeof k !== "number") || k <= 0) {
391
393
  throw new Error(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "usearch",
3
- "version": "2.20.8",
3
+ "version": "2.21.1",
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",
Binary file
Binary file