A vector similarity search engine for humans🥳
Project description
VSSLite
A vector similarity search engine for humans🥳
🎁 Install
$ pip install vsslite
✨ Features
VSSLite provides a user-friendly interface for langchain and sqlite-vss.
🧩 Start API server
$ export OPENAI_APIKEY="YOUR_API_KEY"
$ python -m vsslite
Or
import uvicorn
from server import LangChainVSSLiteServer
app = LangChainVSSLiteServer(YOUR_API_KEY).app
uvicorn.run(app, host="127.0.0.1", port=8000)
Go http://127.0.0.1:8000/docs to know the details and try it out.
🔍 Search
from vsslite import LangChainVSSLiteClient
# Initialize
vss = LangChainVSSLiteClient()
# Add data with embeddings
vss.add("The difference between eel and conger eel is that eel is more expensive.")
vss.add("Red pandas are smaller than pandas, but when it comes to cuteness, there is no \"lesser\" about them.")
vss.add("There is no difference between \"Ohagi\" and \"Botamochi\" themselves; they are used interchangeably depending on the season.")
# Search
print(vss.search("fish", count=1))
print(vss.search("animal", count=1))
print(vss.search("food", count=1))
Now you can get these search results.
$ python run.py
[{'page_content': 'The difference between eel and conger eel is that eel is more expensive.', 'metadata': {'source': 'inline'}}]
[{'page_content': 'Red pandas are smaller than pandas, but when it comes to cuteness, there is no "lesser" about them.', 'metadata': {'source': 'inline'}}]
[{'page_content': 'There is no difference between "Ohagi" and "Botamochi" themselves; they are used interchangeably depending on the season.', 'metadata': {'source': 'inline'}}]
🔧 Data management (Add, Get, Update, Delete)
Helps CRUD.
# Add
id = vss.add("The difference between eel and conger eel is that eel is more expensive.")[0]
# Get
vss.get(id)
# Update
vss.update(id, "The difference between eel and conger eel is that eel is more expensive. Una-jiro is cheaper than both of them.")
# Delete
vss.delete(id)
# Delete all
vss.delete_all()
Upload data. Accept Text, PDF, CSV and JSON for now.
vss.upload("path/to/data.json")
🍻 Asynchronous
Use async methods when you use VSSLite in server apps.
await vss.aadd("~~~")
await vss.aupdate(id, "~~~")
await vss.aget(id)
await vss.adelete(id)
await vss.aupdate_all()
await vss.asearch("~~~")
await vss.aupload("~~~")
🧇 Namespace
VSSLite supports namespaces for dividing the set of documents to search or update.
vss = LangChainVSSLiteClient()
# Search product documents
vss.search("What is the difference between super size and ultra size?", namespace="product")
# Search company documents
vss.search("Who is the CTO of Unagiken?", namespace="company")
🍪 Classic version (based on SQLite)
See v0.3.0 README
🥰 Special thanks
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
vsslite-0.4.0-py3-none-any.whl
(13.4 kB
view hashes)