zeusdb-vector-database 0.0.2__tar.gz → 0.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of zeusdb-vector-database might be problematic. Click here for more details.
- {zeusdb_vector_database-0.0.2 → zeusdb_vector_database-0.0.3}/PKG-INFO +78 -13
- {zeusdb_vector_database-0.0.2 → zeusdb_vector_database-0.0.3}/README.md +77 -12
- {zeusdb_vector_database-0.0.2 → zeusdb_vector_database-0.0.3}/pyproject.toml +1 -1
- {zeusdb_vector_database-0.0.2 → zeusdb_vector_database-0.0.3}/src/zeusdb_vector_database/__init__.py +1 -1
- {zeusdb_vector_database-0.0.2 → zeusdb_vector_database-0.0.3}/vdb-core/Cargo.lock +73 -1
- {zeusdb_vector_database-0.0.2 → zeusdb_vector_database-0.0.3}/vdb-core/Cargo.toml +2 -1
- zeusdb_vector_database-0.0.3/vdb-core/src/hnsw_index.rs +723 -0
- {zeusdb_vector_database-0.0.2 → zeusdb_vector_database-0.0.3}/vdb-core/src/lib.rs +1 -0
- zeusdb_vector_database-0.0.2/vdb-core/src/hnsw_index.rs +0 -344
- {zeusdb_vector_database-0.0.2 → zeusdb_vector_database-0.0.3}/LICENSE +0 -0
- {zeusdb_vector_database-0.0.2 → zeusdb_vector_database-0.0.3}/NOTICE +0 -0
- {zeusdb_vector_database-0.0.2 → zeusdb_vector_database-0.0.3}/src/zeusdb_vector_database/py.typed +0 -0
- {zeusdb_vector_database-0.0.2 → zeusdb_vector_database-0.0.3}/src/zeusdb_vector_database/vector_database.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: zeusdb-vector-database
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
6
|
Requires-Dist: numpy>=2.2.6,<3.0.0
|
|
@@ -17,14 +17,17 @@ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
|
17
17
|
Project-URL: Repository, https://github.com/zeusdb/zeusdb-vector-database
|
|
18
18
|
Project-URL: Bug Tracker, https://github.com/zeusdb/zeusdb-vector-database/issues
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
<p align="center" width="100%">
|
|
21
|
+
<img src="https://github.com/user-attachments/assets/ad21baec-6f4c-445c-b423-88a081ca2b97" alt="zeusdb-vector-database-logo-cropped" />
|
|
22
|
+
<h1 align="center">ZeusDB Vector Database</h1>
|
|
23
|
+
</p>
|
|
21
24
|
|
|
22
25
|
<!-- <h2 align="center">Fast, Rust-powered vector database for similarity search</h2> -->
|
|
23
26
|
<!--**Fast, Rust-powered vector database for similarity search** -->
|
|
24
27
|
|
|
25
28
|
<!-- badges: start -->
|
|
26
29
|
|
|
27
|
-
<div align="
|
|
30
|
+
<div align="center">
|
|
28
31
|
<table>
|
|
29
32
|
<tr>
|
|
30
33
|
<td><strong>Meta</strong></td>
|
|
@@ -57,6 +60,8 @@ ZeusDB leverages the HNSW (Hierarchical Navigable Small World) algorithm for spe
|
|
|
57
60
|
|
|
58
61
|
🔥 High-performance Rust backend
|
|
59
62
|
|
|
63
|
+
📥 Supports multiple input formats using a single, easy-to-use Python method
|
|
64
|
+
|
|
60
65
|
🗂️ Metadata-aware filtering at query time
|
|
61
66
|
|
|
62
67
|
🐍 Simple and intuitive Python API
|
|
@@ -123,17 +128,16 @@ vdb = VectorDatabase()
|
|
|
123
128
|
# Initialize and set up the database resources
|
|
124
129
|
index = vdb.create_index_hnsw(dim = 8, space = "cosine", M = 16, ef_construction = 200, expected_size=5)
|
|
125
130
|
|
|
126
|
-
# Upload vector records
|
|
127
|
-
|
|
128
|
-
"doc_001":
|
|
129
|
-
"doc_002":
|
|
130
|
-
"doc_003":
|
|
131
|
-
"doc_004":
|
|
132
|
-
"doc_005":
|
|
133
|
-
|
|
131
|
+
# Upload vector records using the unified `add()` method
|
|
132
|
+
records = [
|
|
133
|
+
{"id": "doc_001", "values": [0.1, 0.2, 0.3, 0.1, 0.4, 0.2, 0.6, 0.7], "metadata": {"author": "Alice"}},
|
|
134
|
+
{"id": "doc_002", "values": [0.9, 0.1, 0.4, 0.2, 0.8, 0.5, 0.3, 0.9], "metadata": {"author": "Bob"}},
|
|
135
|
+
{"id": "doc_003", "values": [0.11, 0.21, 0.31, 0.15, 0.41, 0.22, 0.61, 0.72], "metadata": {"author": "Alice"}},
|
|
136
|
+
{"id": "doc_004", "values": [0.85, 0.15, 0.42, 0.27, 0.83, 0.52, 0.33, 0.95], "metadata": {"author": "Bob"}},
|
|
137
|
+
{"id": "doc_005", "values": [0.12, 0.22, 0.33, 0.13, 0.45, 0.23, 0.65, 0.71], "metadata": {"author": "Alice"}},
|
|
138
|
+
]
|
|
134
139
|
|
|
135
|
-
|
|
136
|
-
index.add_point(doc_id, vec, metadata=meta)
|
|
140
|
+
result = index.add(records)
|
|
137
141
|
|
|
138
142
|
# Perform a similarity search and print the top 2 results
|
|
139
143
|
# Query Vector
|
|
@@ -148,6 +152,67 @@ for doc_id, score in results:
|
|
|
148
152
|
|
|
149
153
|
<br/>
|
|
150
154
|
|
|
155
|
+
### ➕ Adding Vectors – Multiple Formats Supported
|
|
156
|
+
|
|
157
|
+
ZeusDB Vector Database supports multiple intuitive ways to insert data using index.add(...). All formats accept optional metadata per record.
|
|
158
|
+
|
|
159
|
+
#### ✅ Format 1 – Single Object
|
|
160
|
+
|
|
161
|
+
```python
|
|
162
|
+
index.add({
|
|
163
|
+
"id": "doc1",
|
|
164
|
+
"values": [0.1, 0.2],
|
|
165
|
+
"metadata": {"text": "hello"}
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
print(result.summary()) # ✅ 1 inserted, ❌ 0 errors
|
|
169
|
+
print(result.is_success()) # True
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
#### ✅ Format 2 – List of Objects
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
index.add([
|
|
176
|
+
{"id": "doc1", "values": [0.1, 0.2], "metadata": {"text": "hello"}},
|
|
177
|
+
{"id": "doc2", "values": [0.3, 0.4], "metadata": {"text": "world"}}
|
|
178
|
+
])
|
|
179
|
+
|
|
180
|
+
print(result.summary()) # ✅ 2 inserted, ❌ 0 errors
|
|
181
|
+
print(result.vector_shape) # (2, 2)
|
|
182
|
+
print(result.errors) # []
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
#### ✅ Format 3 – Separate Arrays
|
|
186
|
+
|
|
187
|
+
```python
|
|
188
|
+
index.add({
|
|
189
|
+
"ids": ["doc1", "doc2"],
|
|
190
|
+
"embeddings": [[0.1, 0.2], [0.3, 0.4]],
|
|
191
|
+
"metadatas": [{"text": "hello"}, {"text": "world"}]
|
|
192
|
+
})
|
|
193
|
+
print(result) # BatchResult(inserted=2, errors=0, shape=(2, 2))
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
#### ✅ Format 4 – Using NumPy Arrays
|
|
197
|
+
|
|
198
|
+
ZeusDB also supports NumPy arrays as input for seamless integration with scientific and ML workflows.
|
|
199
|
+
|
|
200
|
+
```python
|
|
201
|
+
import numpy as np
|
|
202
|
+
|
|
203
|
+
data = [
|
|
204
|
+
{"id": "doc2", "values": np.array([0.1, 0.2, 0.3, 0.4], dtype=np.float32), "metadata": {"type": "blog"}},
|
|
205
|
+
{"id": "doc3", "values": np.array([0.5, 0.6, 0.7, 0.8], dtype=np.float32), "metadata": {"type": "news"}},
|
|
206
|
+
]
|
|
207
|
+
|
|
208
|
+
result = index.add(data)
|
|
209
|
+
|
|
210
|
+
print(result.summary()) # ✅ 2 inserted, ❌ 0 errors
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Each format is automatically parsed and validated internally, including support for NumPy arrays (np.ndarray). Errors and successes are returned in a structured BatchResult object for easy debugging and logging.
|
|
214
|
+
|
|
215
|
+
<br/>
|
|
151
216
|
|
|
152
217
|
### 🧰 Additional functionality
|
|
153
218
|
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center" width="100%">
|
|
2
|
+
<img src="https://github.com/user-attachments/assets/ad21baec-6f4c-445c-b423-88a081ca2b97" alt="zeusdb-vector-database-logo-cropped" />
|
|
3
|
+
<h1 align="center">ZeusDB Vector Database</h1>
|
|
4
|
+
</p>
|
|
2
5
|
|
|
3
6
|
<!-- <h2 align="center">Fast, Rust-powered vector database for similarity search</h2> -->
|
|
4
7
|
<!--**Fast, Rust-powered vector database for similarity search** -->
|
|
5
8
|
|
|
6
9
|
<!-- badges: start -->
|
|
7
10
|
|
|
8
|
-
<div align="
|
|
11
|
+
<div align="center">
|
|
9
12
|
<table>
|
|
10
13
|
<tr>
|
|
11
14
|
<td><strong>Meta</strong></td>
|
|
@@ -38,6 +41,8 @@ ZeusDB leverages the HNSW (Hierarchical Navigable Small World) algorithm for spe
|
|
|
38
41
|
|
|
39
42
|
🔥 High-performance Rust backend
|
|
40
43
|
|
|
44
|
+
📥 Supports multiple input formats using a single, easy-to-use Python method
|
|
45
|
+
|
|
41
46
|
🗂️ Metadata-aware filtering at query time
|
|
42
47
|
|
|
43
48
|
🐍 Simple and intuitive Python API
|
|
@@ -104,17 +109,16 @@ vdb = VectorDatabase()
|
|
|
104
109
|
# Initialize and set up the database resources
|
|
105
110
|
index = vdb.create_index_hnsw(dim = 8, space = "cosine", M = 16, ef_construction = 200, expected_size=5)
|
|
106
111
|
|
|
107
|
-
# Upload vector records
|
|
108
|
-
|
|
109
|
-
"doc_001":
|
|
110
|
-
"doc_002":
|
|
111
|
-
"doc_003":
|
|
112
|
-
"doc_004":
|
|
113
|
-
"doc_005":
|
|
114
|
-
|
|
112
|
+
# Upload vector records using the unified `add()` method
|
|
113
|
+
records = [
|
|
114
|
+
{"id": "doc_001", "values": [0.1, 0.2, 0.3, 0.1, 0.4, 0.2, 0.6, 0.7], "metadata": {"author": "Alice"}},
|
|
115
|
+
{"id": "doc_002", "values": [0.9, 0.1, 0.4, 0.2, 0.8, 0.5, 0.3, 0.9], "metadata": {"author": "Bob"}},
|
|
116
|
+
{"id": "doc_003", "values": [0.11, 0.21, 0.31, 0.15, 0.41, 0.22, 0.61, 0.72], "metadata": {"author": "Alice"}},
|
|
117
|
+
{"id": "doc_004", "values": [0.85, 0.15, 0.42, 0.27, 0.83, 0.52, 0.33, 0.95], "metadata": {"author": "Bob"}},
|
|
118
|
+
{"id": "doc_005", "values": [0.12, 0.22, 0.33, 0.13, 0.45, 0.23, 0.65, 0.71], "metadata": {"author": "Alice"}},
|
|
119
|
+
]
|
|
115
120
|
|
|
116
|
-
|
|
117
|
-
index.add_point(doc_id, vec, metadata=meta)
|
|
121
|
+
result = index.add(records)
|
|
118
122
|
|
|
119
123
|
# Perform a similarity search and print the top 2 results
|
|
120
124
|
# Query Vector
|
|
@@ -129,6 +133,67 @@ for doc_id, score in results:
|
|
|
129
133
|
|
|
130
134
|
<br/>
|
|
131
135
|
|
|
136
|
+
### ➕ Adding Vectors – Multiple Formats Supported
|
|
137
|
+
|
|
138
|
+
ZeusDB Vector Database supports multiple intuitive ways to insert data using index.add(...). All formats accept optional metadata per record.
|
|
139
|
+
|
|
140
|
+
#### ✅ Format 1 – Single Object
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
index.add({
|
|
144
|
+
"id": "doc1",
|
|
145
|
+
"values": [0.1, 0.2],
|
|
146
|
+
"metadata": {"text": "hello"}
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
print(result.summary()) # ✅ 1 inserted, ❌ 0 errors
|
|
150
|
+
print(result.is_success()) # True
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
#### ✅ Format 2 – List of Objects
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
index.add([
|
|
157
|
+
{"id": "doc1", "values": [0.1, 0.2], "metadata": {"text": "hello"}},
|
|
158
|
+
{"id": "doc2", "values": [0.3, 0.4], "metadata": {"text": "world"}}
|
|
159
|
+
])
|
|
160
|
+
|
|
161
|
+
print(result.summary()) # ✅ 2 inserted, ❌ 0 errors
|
|
162
|
+
print(result.vector_shape) # (2, 2)
|
|
163
|
+
print(result.errors) # []
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
#### ✅ Format 3 – Separate Arrays
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
index.add({
|
|
170
|
+
"ids": ["doc1", "doc2"],
|
|
171
|
+
"embeddings": [[0.1, 0.2], [0.3, 0.4]],
|
|
172
|
+
"metadatas": [{"text": "hello"}, {"text": "world"}]
|
|
173
|
+
})
|
|
174
|
+
print(result) # BatchResult(inserted=2, errors=0, shape=(2, 2))
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### ✅ Format 4 – Using NumPy Arrays
|
|
178
|
+
|
|
179
|
+
ZeusDB also supports NumPy arrays as input for seamless integration with scientific and ML workflows.
|
|
180
|
+
|
|
181
|
+
```python
|
|
182
|
+
import numpy as np
|
|
183
|
+
|
|
184
|
+
data = [
|
|
185
|
+
{"id": "doc2", "values": np.array([0.1, 0.2, 0.3, 0.4], dtype=np.float32), "metadata": {"type": "blog"}},
|
|
186
|
+
{"id": "doc3", "values": np.array([0.5, 0.6, 0.7, 0.8], dtype=np.float32), "metadata": {"type": "news"}},
|
|
187
|
+
]
|
|
188
|
+
|
|
189
|
+
result = index.add(data)
|
|
190
|
+
|
|
191
|
+
print(result.summary()) # ✅ 2 inserted, ❌ 0 errors
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Each format is automatically parsed and validated internally, including support for NumPy arrays (np.ndarray). Errors and successes are returned in a structured BatchResult object for easy debugging and logging.
|
|
195
|
+
|
|
196
|
+
<br/>
|
|
132
197
|
|
|
133
198
|
### 🧰 Additional functionality
|
|
134
199
|
|
|
@@ -382,6 +382,16 @@ dependencies = [
|
|
|
382
382
|
"libc",
|
|
383
383
|
]
|
|
384
384
|
|
|
385
|
+
[[package]]
|
|
386
|
+
name = "matrixmultiply"
|
|
387
|
+
version = "0.3.10"
|
|
388
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
389
|
+
checksum = "a06de3016e9fae57a36fd14dba131fccf49f74b40b7fbdb472f96e361ec71a08"
|
|
390
|
+
dependencies = [
|
|
391
|
+
"autocfg",
|
|
392
|
+
"rawpointer",
|
|
393
|
+
]
|
|
394
|
+
|
|
385
395
|
[[package]]
|
|
386
396
|
name = "memchr"
|
|
387
397
|
version = "2.7.5"
|
|
@@ -423,6 +433,21 @@ dependencies = [
|
|
|
423
433
|
"windows",
|
|
424
434
|
]
|
|
425
435
|
|
|
436
|
+
[[package]]
|
|
437
|
+
name = "ndarray"
|
|
438
|
+
version = "0.16.1"
|
|
439
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
440
|
+
checksum = "882ed72dce9365842bf196bdeedf5055305f11fc8c03dee7bb0194a6cad34841"
|
|
441
|
+
dependencies = [
|
|
442
|
+
"matrixmultiply",
|
|
443
|
+
"num-complex",
|
|
444
|
+
"num-integer",
|
|
445
|
+
"num-traits",
|
|
446
|
+
"portable-atomic",
|
|
447
|
+
"portable-atomic-util",
|
|
448
|
+
"rawpointer",
|
|
449
|
+
]
|
|
450
|
+
|
|
426
451
|
[[package]]
|
|
427
452
|
name = "nix"
|
|
428
453
|
version = "0.26.4"
|
|
@@ -436,6 +461,24 @@ dependencies = [
|
|
|
436
461
|
"pin-utils",
|
|
437
462
|
]
|
|
438
463
|
|
|
464
|
+
[[package]]
|
|
465
|
+
name = "num-complex"
|
|
466
|
+
version = "0.4.6"
|
|
467
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
468
|
+
checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
|
|
469
|
+
dependencies = [
|
|
470
|
+
"num-traits",
|
|
471
|
+
]
|
|
472
|
+
|
|
473
|
+
[[package]]
|
|
474
|
+
name = "num-integer"
|
|
475
|
+
version = "0.1.46"
|
|
476
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
477
|
+
checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
|
|
478
|
+
dependencies = [
|
|
479
|
+
"num-traits",
|
|
480
|
+
]
|
|
481
|
+
|
|
439
482
|
[[package]]
|
|
440
483
|
name = "num-traits"
|
|
441
484
|
version = "0.2.19"
|
|
@@ -455,6 +498,22 @@ dependencies = [
|
|
|
455
498
|
"libc",
|
|
456
499
|
]
|
|
457
500
|
|
|
501
|
+
[[package]]
|
|
502
|
+
name = "numpy"
|
|
503
|
+
version = "0.25.0"
|
|
504
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
505
|
+
checksum = "29f1dee9aa8d3f6f8e8b9af3803006101bb3653866ef056d530d53ae68587191"
|
|
506
|
+
dependencies = [
|
|
507
|
+
"libc",
|
|
508
|
+
"ndarray",
|
|
509
|
+
"num-complex",
|
|
510
|
+
"num-integer",
|
|
511
|
+
"num-traits",
|
|
512
|
+
"pyo3",
|
|
513
|
+
"pyo3-build-config",
|
|
514
|
+
"rustc-hash",
|
|
515
|
+
]
|
|
516
|
+
|
|
458
517
|
[[package]]
|
|
459
518
|
name = "once_cell"
|
|
460
519
|
version = "1.21.3"
|
|
@@ -635,6 +694,12 @@ dependencies = [
|
|
|
635
694
|
"getrandom",
|
|
636
695
|
]
|
|
637
696
|
|
|
697
|
+
[[package]]
|
|
698
|
+
name = "rawpointer"
|
|
699
|
+
version = "0.2.1"
|
|
700
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
701
|
+
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
|
|
702
|
+
|
|
638
703
|
[[package]]
|
|
639
704
|
name = "rayon"
|
|
640
705
|
version = "1.10.0"
|
|
@@ -693,6 +758,12 @@ version = "0.8.5"
|
|
|
693
758
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
694
759
|
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
|
695
760
|
|
|
761
|
+
[[package]]
|
|
762
|
+
name = "rustc-hash"
|
|
763
|
+
version = "2.1.1"
|
|
764
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
765
|
+
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
|
|
766
|
+
|
|
696
767
|
[[package]]
|
|
697
768
|
name = "same-file"
|
|
698
769
|
version = "1.0.6"
|
|
@@ -1029,8 +1100,9 @@ dependencies = [
|
|
|
1029
1100
|
|
|
1030
1101
|
[[package]]
|
|
1031
1102
|
name = "zeusdb-vector-database"
|
|
1032
|
-
version = "0.0.
|
|
1103
|
+
version = "0.0.3"
|
|
1033
1104
|
dependencies = [
|
|
1034
1105
|
"hnsw_rs",
|
|
1106
|
+
"numpy",
|
|
1035
1107
|
"pyo3",
|
|
1036
1108
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "zeusdb-vector-database"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.3"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
resolver = "2" # <-- Avoid compiling unnecessary features from dependencies.
|
|
6
6
|
|
|
@@ -12,6 +12,7 @@ crate-type = ["cdylib"]
|
|
|
12
12
|
[dependencies]
|
|
13
13
|
pyo3 = { version = "0.25.1", features = ["extension-module"] }
|
|
14
14
|
hnsw_rs = "0.3.2"
|
|
15
|
+
numpy = "0.25.0"
|
|
15
16
|
|
|
16
17
|
[profile.release]
|
|
17
18
|
lto = true # <-- Enable Link-Time Optimization
|