Skip to content

Latest commit

 

History

176 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vlite

a simple and blazing fast vector database

there is no database you need to set up, no server to run, and no complex configuration. just install vlite and start using it. take the CTX file with you wherever you go. its like a browser cookie but with embeddings.

1a3e85a6-2a3f-4092-beea-8b9d69433e80

Features

  • 🔥 Fastest vector db retrieval with binary embeddings, less than 1.1s to search 500k documents
  • 🔋 Made for RAG -- embeddings from mixedbread embed-xsmall baked in, run in plain numpy. numpy is the only dependency
  • 🍪 CTX (context) file format, a novel abstraction for storing user context similar to browser cookies
  • Long texts are chunked to the model's 512-token window automatically, metadata filtering built in
  • >77.95% faster than Chroma on indexing, >422% faster on retrieval, and >3.6x smaller on disk

Installation

pip install vlite

Usage

from vlite import VLite

db = VLite("borges")
db.add(["a library of hexagonal rooms that holds every possible book",
        "a man who remembers every leaf of every tree he has ever seen",
        "a garden where time forks into every possible future"])

for _, text, _, distance in db.retrieve("parallel timelines", top_k=2):
    print(distance, text)

db.save()
148 a garden where time forks into every possible future
167 a man who remembers every leaf of every tree he has ever seen

each line is a borges story. each result is (id, text, metadata, distance), and lower distance means closer. save() writes everything to contexts/borges.ctx, and VLite("borges") picks it back up next time. the first run downloads the model (48 MB) to ~/.cache/vlite.

tag things with metadata, then filter on it:

db.add(["a point in a cellar that contains every other point in the universe",
        "a coin that, once seen, can never be put out of mind"],
       metadata={"book": "the aleph"})

db.retrieve("perfect memory", top_k=1)                               # the man who remembers everything
db.retrieve("perfect memory", top_k=1, where={"book": "the aleph"})  # the coin you can't forget

long texts get chunked for you. vlite only takes strings, so bring your own pdf reader.

About

vlite is a vector database built for agents, ChatGPT Plugins, and other AI apps that need a fast and simple database to store vectors. It was developed to support the billions of embeddings generated, indexed, and sorted with ChatWith+ ChatGPT Plugins, which run for millions of users. Most vector databases either repeatedly crashed on a daily basis or were too expensive for the high throughput required.

vlite introduces the CTX file format, which acts like a browser cookie for user embeddings, providing efficient storage, retrieval of embeddings, composability, portability, and user context.

converted copy

License

AGPL-3.0 License

Contributing

Thanks to Claude and Ray for their contributions to vlite. If you'd like to contribute, please open an issue or a pull request.

About

fastest vector database made in numpy

Resources

Stars

764 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages