vlite
VLite is a simple and blazing fast vector database that allows you to store and retrieve data semantically using embeddings. Made with numpy, vlite is a lightweight batteries-included database to implement RAG, similarity search, and embeddings into your projects.
You'll need to install langchain-community
with pip install -qU langchain-community
to use this integration
Installationโ
To use the VLite in LangChain, you need to install the vlite
package:
!pip install vlite
Importing VLiteโ
from langchain_community.vectorstores import VLite
Basic Exampleโ
In this basic example, we load a text document, and store them in the VLite vector database. Then, we perform a similarity search to retrieve relevant documents based on a query.
VLite handles chunking and embedding of the text for you, and you can change these parameters by pre-chunking the text and/or embeddings those chunks into the VLite database.
from langchain.document_loaders import TextLoader
from langchain.text_splitter import CharacterTextSplitter
# Load the document and split it into chunks
loader = TextLoader("path/to/document.txt")
documents = loader.load()
# Create a VLite instance
vlite = VLite(collection="my_collection")
# Add documents to the VLite vector database
vlite.add_documents(documents)
# Perform a similarity search
query = "What is the main topic of the document?"
docs = vlite.similarity_search(query)
# Print the most relevant document
print(docs[0].page_content)