A high-performance vector database for AI applications
Project description
VelesDB Python
Python bindings for VelesDB - a high-performance vector database for AI applications.
Installation
pip install velesdb
Quick Start
import velesdb
# Open or create a database
db = velesdb.Database("./my_vectors")
# Create a collection for 768-dimensional vectors (e.g., BERT embeddings)
collection = db.create_collection(
name="documents",
dimension=768,
metric="cosine" # Options: "cosine", "euclidean", "dot"
)
# Insert vectors with metadata
collection.upsert([
{
"id": 1,
"vector": [0.1, 0.2, ...], # 768-dim vector
"payload": {"title": "Introduction to AI", "category": "tech"}
},
{
"id": 2,
"vector": [0.3, 0.4, ...],
"payload": {"title": "Machine Learning Basics", "category": "tech"}
}
])
# Search for similar vectors
results = collection.search(
vector=[0.15, 0.25, ...], # Query vector
top_k=5
)
for result in results:
print(f"ID: {result['id']}, Score: {result['score']:.4f}")
print(f" Payload: {result['payload']}")
API Reference
Database
# Create/open database
db = velesdb.Database("./path/to/data")
# List collections
names = db.list_collections()
# Create collection
collection = db.create_collection("name", dimension=768, metric="cosine")
# Get existing collection
collection = db.get_collection("name")
# Delete collection
db.delete_collection("name")
Collection
# Get collection info
info = collection.info()
# {"name": "documents", "dimension": 768, "metric": "cosine", "point_count": 100}
# Insert/update vectors
collection.upsert([
{"id": 1, "vector": [...], "payload": {"key": "value"}}
])
# Search
results = collection.search(vector=[...], top_k=10)
# Get specific points
points = collection.get([1, 2, 3])
# Delete points
collection.delete([1, 2, 3])
# Check if empty
is_empty = collection.is_empty()
# Flush to disk
collection.flush()
Distance Metrics
| Metric | Description | Use Case |
|---|---|---|
cosine |
Cosine similarity (default) | Text embeddings, normalized vectors |
euclidean |
Euclidean (L2) distance | Image features, spatial data |
dot |
Dot product | When vectors are pre-normalized |
hamming |
Hamming distance | Binary vectors, fingerprints, hashes |
jaccard |
Jaccard similarity | Set similarity, tags, recommendations |
Performance
VelesDB is built in Rust with explicit SIMD optimizations:
| Operation | Time (768d) | Throughput |
|---|---|---|
| Cosine | ~76 ns | 13M ops/sec |
| Euclidean | ~47 ns | 21M ops/sec |
| Hamming | ~6 ns | 164M ops/sec |
- Sub-millisecond search latency
- 4x memory reduction with SQ8 quantization
- Millions of vectors per collection
Requirements
- Python 3.9+
- No external dependencies (pure Rust engine)
License
Elastic License 2.0 (ELv2)
See LICENSE for details.
Links
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 Distribution
velesdb-0.4.0.tar.gz
(165.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file velesdb-0.4.0.tar.gz.
File metadata
- Download URL: velesdb-0.4.0.tar.gz
- Upload date:
- Size: 165.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ea76e7521c0d0e78a3708ef5d797af5673c788550daa80e73643dc415281989
|
|
| MD5 |
5fa9ab8ffb1aad03f1b1f0c5da4ed291
|
|
| BLAKE2b-256 |
6f30aec836f383770f30c35e6cbfe3b780d28ea5dcaabb9e2348f503be428f83
|
File details
Details for the file velesdb-0.4.0-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: velesdb-0.4.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cfac1f6558266fdb0259a7d4728f00019ad1f1093a2208275ea1e5f7013c374
|
|
| MD5 |
92c9b6f4a0865b13a8bfab553d634902
|
|
| BLAKE2b-256 |
4c151d593b5c69b00582ae527157a7acf5476ad83022b26f2dd3a1d1f785ccf5
|