idb-vector

0.2.0 • Public • Published

Vector IDB

A simple IDB vector store.

<script type="module">
  import { VectorDB } from "idb-vector";

  const db = new VectorDB({
    vectorPath: "embedding"
  });

  await db.insert({ embedding: [1, 2, 3], "text": "ASDASINDASDASZd" });
  await db.insert({ embedding: [2, 3, 4], "text": "GTFSDGRG" });
  await db.insert({ embedding: [73, -213, 3], "text": "hYTRTERFR" });

  // Query returns a list ordered by the entries closest to the vector (cosine similarity)
  console.log(await db.query([1, 2, 3], { limit: 20 }));
</script>

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i idb-vector

    Weekly Downloads

    3

    Version

    0.2.0

    License

    Apache-2.0

    Unpacked Size

    20.7 kB

    Total Files

    7

    Last publish

    Collaborators

    • kinlan