️ A WASM vector similarity search written in Rust
** Work in Progress**
Voy is under active development. As a result, the API is not stable. Please be aware that there might be breaking changes before the upcoming 1.0 release.
A sneak peek of what we are working on:
- Built-in text transformation in WebAssembly: As of now, voy relies on JavaScript libraries like
transformers.jsto generate text embeddings. See Usage for more detail.- Index update: Currently it's required to re-build the index when a resource update occurs.
- TypeScript support: Due to the limitation of WASM tooling, complex data types are not auto-generated.
# with npm
npm i voy-search
# with Yarn
yarn add voy-search
# with pnpm
pnpm add voy-search
class VoyThe Voy class encapsulates an index and exposes all the public methods Voy has to offer.
…
Besides the Voy class, Voy also exports all the instance methods as individual functions.
index(resource: Resource): SerializedIndexIt indexes the given resource and returns a serialized index.
Parameters
interface Resource {
embeddings: Array;
}
Return
type SerializedIndex = string;
search(index: SerializedIndex, query: Query, k: NumberOfResult): SearchResultIt deserializes the given index and search for the k nearest neighbors of the query.
Parameter
type SerializedIndex = string;
type Query = Float32Array; // embeddings of the search query
type NumberOfResult = number; // K top results to return
Return
interface SearchResult {
neighbors: Array;
}
add(index: SerializedIndex, resource: Resource): SerializedIndexIt adds resources to the index and returns an updated serialized index.
Parameter
type SerializedIndex = string;
interface Resource {
embeddings: Array;
}
Return
type SerializedIndex = string;
remove(index: SerializedIndex, resource: Resource): SerializedIndexIt removes resources from the index and returns an updated serialized index.
Parameter
type SerializedIndex = string;
interface Resource {
embeddings: Array;
}
Return
type SerializedIndex = string;
clear(index: SerializedIndex): SerializedIndexIt removes all items from the index and returns an empty serialized index.
Parameter
type SerializedIndex = string;
Return
type SerializedIndex = string;
size(index: SerializedIndex): number;It returns the size of the index.
Parameter
type SerializedIndex = string;
As of now, voy relies on libraries like transformers.js and web-ai to generate embeddings for text:
…
…
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
No open issues yet, or sync has not completed.