npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vectore_db

v0.1.2

Published

Embedding Rust library in WebAssembly for use in web apps.

Downloads

11

Readme

vectore-db

Rust

vectore-db is a Rust library leveraging WebAssembly to efficiently process and store string embeddings. It provides functionality to transform strings or string arrays into embeddings (arrays of floating-point numbers), which are then stored in a k-d tree data structure. Once stored, the library allows you to input a string and retrieve similar strings based on the embeddings.

Demo

Check out this demo video to see vectore-db in action:

Demo Video

Features

  • Store and query embeddings generated from strings
  • Utilizes k-d tree data structure for efficient similarity searches
  • Easy installation via npm
  • Simple usage in JavaScript/TypeScript projects
  • Add single or multiple words/texts to the vector database
  • Retrieve all words/texts inserted in the vector database -Find similar words/texts based on input string

Installation

You can install vectore-db using npm:

npm i vectore_db

Usage

Here's a simple example of how to use vectore-db in a react project:

import init, { VectorStore } from "vectore_node";
import { useEffect, useState } from "react";

export default function useVectoreStore() {
  const [vector_store, setVector_store] = useState();
  const [first, setfirst] = useState(false);
  
  useEffect(() => {
    async function initg() {
      await init();
      setVector_store(VectorStore.new());
    }
    
    if (!first) {
      setfirst(true);
      initg();
    }
  }, [first, vector_store]);
  
  return { vector_store };
}

In any client component, you can use the hook useVectoreStore() to access the vector store:

vector_store.get_words(); // Get all words or text inserted in the vectore database

await vector_store.add_vectore_by_word("hello world"); // Add a single word or text to the vectore database

await vector_store.add_vectore_by_text("sky\ncolor"); // Add multiple texts separated by \n to the vectore database

await vector_store.similar_words("color", 1); // Get similar words to the input string and specify the number of related strings desired

Setting up an Embedding Server

To transform text into embeddings, you can set up an embedding server. The default server provided by our library has limited resources. Please note that the first request to the server may incur a wait time of 50 seconds due to rendering policy. However, if you prefer to use your own server, you can follow the example provided at the following URL:

Example Embedding Server Configuration

After configuring your own server, initialize the library with the server URL and the length of the embedding vector. For example:

const vectore = VectoreStore.new(url, vectore_length);

Troubleshooting

If you encounter any issues or have questions about using vectore-db, please check out our FAQ or open an issue on GitHub.

License

vectore-db is licensed under the MIT License.