VecSim - A unified interface for similarity servers
A standard, light-weight interface to all popular similarity servers.
The problems we are trying to solve:
- Standard API - Different vector similarity servers have different APIs - so switching is not trivial.
- Identifiers - Some vector similarity servers support string IDs, some do not - we keep track of the mapping.
- Partitions - In most cases, pre-filtering is needed prior to querying, we abstract this concept away.
- Aggregations - In some cases, one item is being indexed to multiple vectors.
Supported engines:
- Scikit-learn, via NearestNeighbors
- RediSearch
- Faiss
- ElasticSearch
- Pinecone
QuickStart example
import numpy as np
# Import a similarity server of your choice:
# SKlearn (best for small datasets or testing)
from vecsim import SciKitIndex
sim = SciKitIndex(metric='cosine', dim=32)
user_ids = ["user_"+str(1+i) for i in range(100)]
user_data = np.random.random((100,32))
item_ids=["item_"+str(101+i) for i in range(100)]
item_data = np.random.random((100,32))
sim.add_items(user_data, user_ids, partition="users")
sim.add_items(item_data, item_ids, partition="items")
# Index the data
sim.init()
# Run nearest neighbor vector search
query = np.random.random(32)
dists, items = sim.search(query, k=10) # returns a list of users and items
dists, items = sim.search(query, k=10, partition="users") # returns a list of users only
For more examples, please read our documentation
Release files for vecsim 0.0.62
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| vecsim-0.0.62.tar.gz | 10.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vecsim-0.0.62-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.9 kB
Release files / vecsim-0.0.62.tar.gz
| Download URL | vecsim-0.0.62.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
067f5ca5e573abcf423e1f10b8682c9e8081eb5a0ba533c27cbabfdc8454212f
|
|
BLAKE2b-256 checksum How to use checksums |
de14d37e75e0f05caa74fea3c15270cca699f1ac1c10c199453c2f0009f4f90e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / vecsim-0.0.62-py3-none-any.whl
| Download URL | vecsim-0.0.62-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0864cd2cc3e1483d117e00858a2c00b8ab37f9ad4ebd4693d39215be67d60cb6
|
|
BLAKE2b-256 checksum How to use checksums |
b26b64cb7ae88a1abcefda84f4bfbd340926b35c42f86c367b29d087a3cf7b16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|