Skip to content

Commit 4c656aa

Browse files
Release v0.1.0
* Bump version to 0.1.0 for development * feat(api): introduce unified `create()` method for extensible vector index creation * Refactor internal tests to use new generic `.create()` API * Refactor internal tests to use new generic `.create()` API * test: Update test suite for new .create() API * 📄 docs(readme): updated the content information * Add: latest uv.lock file for reproducible Python dependency management * 📄 docs(readme): updated the content information * 📄 docs(readme): updated the content information * 📄 docs(changelog): update for v0.1.0 release
1 parent da241fa commit 4c656aa

28 files changed

Lines changed: 258 additions & 112 deletions

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
---
99

10+
## [0.1.0] - 2025-07-13
11+
12+
### Added
13+
- **Generic `create()` method** for extensible vector index creation
14+
- Registry-based architecture supporting multiple index types
15+
- Case-insensitive index type matching: `create("HNSW")` or `create("hnsw")`
16+
- Comprehensive parameter defaults with Rust backend validation
17+
- Self-updating error messages showing all available index types
18+
- Supports case-insensitive index types (e.g. "HNSW" and "hnsw")
19+
- **`available_index_types()`** class method for programmatic type discovery
20+
- Future-ready architecture for IVF, LSH, Annoy, and Flat index types
21+
22+
### Changed
23+
- ⚠️ **Breaking Change**: Replaced index-specific factory methods with generic `create()`
24+
- Migration: `VectorDatabase().create_index_hnsw(dim=768)``VectorDatabase().create("hnsw", dim=768)`
25+
- All HNSW parameters now default to best-practice values; dim is the only commonly customized field. Most of the settings like `m`, `ef_construction`, `expected_size`, and `space` already have good defaults, so users typically don't change them. The only one they usually set themselves is `dim`, since it must match the shape of their data.
26+
- Improved error messages with dynamic type listing
27+
28+
### Fixed
29+
- Updated all internal testing files to use the new .create()` API
30+
31+
### Removed
32+
- Index-specific factory methods (replaced by unified `create()` interface)
33+
34+
---
35+
1036
## [0.0.9] - 2025-07-10
1137

1238
### Added

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ from zeusdb_vector_database import VectorDatabase
105105
vdb = VectorDatabase()
106106

107107
# Initialize and set up the database resources
108-
index = vdb.create_index_hnsw(dim = 8)
108+
index = vdb.create(index_type="hnsw", dim=8)
109109

110110
# Vector embeddings with accompanying ID's and Metadata
111111
records = [
@@ -156,11 +156,11 @@ ZeusDB Vector Database makes it easy to work with high-dimensional vector data u
156156

157157
**Three simple steps**
158158

159-
1. **Create an index**
160-
2. **Add data to the index**
161-
3. **Conduct a similarity search**
159+
1. **Create an index** using `.create()`
160+
2. **Add data** using `.add(...)`
161+
3. **Conduct a similarity search** using `.search(...)`
162162

163-
Each step is covered below.
163+
Each step is covered below.
164164

165165
<br/>
166166

@@ -176,22 +176,24 @@ from zeusdb_vector_database import VectorDatabase
176176
vdb = VectorDatabase()
177177

178178
# Initialize and set up the database resources
179-
index = vdb.create_index_hnsw(
179+
index = vdb.create(
180+
index_type = "hnsw",
180181
dim = 8,
181182
space = "cosine",
182-
M = 16,
183+
m = 16,
183184
ef_construction = 200,
184-
expected_size=5
185+
expected_size = 5
185186
)
186187
```
187188

188-
#### 📘 `create_index_hnsw()` Parameters
189+
#### 📘 `create()` Parameters
189190

190191
| Parameter | Type | Default | Description |
191192
|------------------|--------|-----------|-----------------------------------------------------------------------------|
193+
| `index_type` | `str` | `"hnsw"` | The type of vector index to create. Currently supports `"hnsw"`. Future options include `"ivf"`, `"flat"`, etc. Case-insensitive. |
192194
| `dim` | `int` | `1536` | Dimensionality of the vectors to be indexed. Each vector must have this length. The default dim=1536 is chosen to match the output dimensionality of OpenAI’s text-embedding-ada-002 model. |
193195
| `space` | `str` | `"cosine"`| Distance metric used for similarity search. Options include `"cosine"`. Additional metrics such as `"l2"`, and `"dot"` will be added in future versions. |
194-
| `M` | `int` | `16` | Number of bi-directional connections created for each new node. Higher `M` improves recall but increases index size and build time. |
196+
| `m` | `int` | `16` | Number of bi-directional connections created for each new node. Higher `m` improves recall but increases index size and build time. |
195197
| `ef_construction`| `int` | `200` | Size of the dynamic list used during index construction. Larger values increase indexing time and memory, but improve quality. |
196198
| `expected_size` | `int` | `10000` | Estimated number of elements to be inserted. Used for preallocating internal data structures. Not a hard limit. |
197199

@@ -374,7 +376,7 @@ print(index.info())
374376
```
375377
*Output*
376378
```
377-
HNSWIndex(dim=8, space=cosine, M=16, ef_construction=200, expected_size=5, vectors=5)
379+
HNSWIndex(dim=8, space=cosine, m=16, ef_construction=200, expected_size=5, vectors=5)
378380
```
379381

380382
<br/>
Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,33 @@
1+
# Import the vector database module
12
from zeusdb_vector_database import VectorDatabase
23

34
# Instantiate the VectorDatabase class
45
vdb = VectorDatabase()
56

6-
# Initialize and set up the database resources
7-
index = vdb.create_index_hnsw(dim = 1536, space = "cosine", M = 16, ef_construction = 200, expected_size=5)
7+
# Absolute minimal - uses all defaults
8+
index1 = vdb.create() # index_type="hnsw", dim=1536, space="cosine", m=16, etc.
9+
print("\n✅ Absolute minimal index creation (all defaults):")
10+
print(index1.info())
811

9-
# Outputs the details of the HNSW index
10-
print(index.info())
11-
12+
# Specify just the index type
13+
# This will use default values for all other parameters
14+
index2 = vdb.create("hnsw") # dim=1536, space="cosine", m=16, etc.
15+
print("\n✅ Absolute minimal index creation (all defaults):")
16+
print(index1.info())
17+
18+
# Specify just the arguments you need
19+
index3 = vdb.create("hnsw", dim=768, m=32)
20+
print("\n✅ Specify 'dim' and 'm' in index creation:")
21+
print(index2.info())
22+
23+
# Specify all arguments explicitly
24+
index4 = vdb.create(
25+
"hnsw",
26+
dim=128,
27+
space="cosine",
28+
m=32,
29+
ef_construction=100,
30+
expected_size=5
31+
)
32+
print("\n✅ Specify all arguments explicitly:")
33+
print(index4.info())

benchmarks/10.new_query_data_with_metadata.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import numpy as np
2+
3+
# Import the vector database module
24
from zeusdb_vector_database import VectorDatabase
35

46
# Instantiate the VectorDatabase class
57
vdb = VectorDatabase()
68

79
# Create index
8-
index = vdb.create_index_hnsw(dim=384, expected_size=10000)
10+
index = vdb.create(index_type="hnsw", dim=384, expected_size=10000)
911

1012
# Outputs the details of the HNSW index
1113
print("\n--- Shows Initial Index Information ---")

benchmarks/11.new_query_data_return_vector.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import numpy as np
2+
3+
# Import the vector database module
24
from zeusdb_vector_database import VectorDatabase
35

46
# Instantiate the VectorDatabase class
57
vdb = VectorDatabase()
68

79
# Create index with dim=4
8-
index = vdb.create_index_hnsw(dim=4, expected_size=100)
10+
index = vdb.create(index_type="hnsw", dim=4, expected_size=100)
911

1012
# Show index info
1113
print("\n--- Shows Initial Index Information ---")

benchmarks/12.readme_code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Initialize and set up the database resources
88
#index = vdb.create_index_hnsw(dim = 8, space = "cosine", M = 16, ef_construction = 200, expected_size=5)
9-
index = vdb.create_index_hnsw(dim = 8)
9+
index = vdb.create(index_type="hnsw", dim=8)
1010

1111
# Upload vector records using the unified `add()` method
1212
records = [

benchmarks/13.new_add_data_with_errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
vdb = VectorDatabase()
66

77
# Step 1: Set up index with dim=8
8-
index = vdb.create_index_hnsw(dim=8, space="cosine", M=16, ef_construction=200, expected_size=5)
8+
index = vdb.create(index_type="hnsw", dim=8, space="cosine", m=16, ef_construction=200, expected_size=5)
99

1010
# Step 2: Add initial valid records
1111
records = [

benchmarks/14.new_benchmark_overwrite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
vdb = VectorDatabase()
1010

1111
# Create index with large capacity
12-
index = vdb.create_index_hnsw(dim=8, expected_size=100000)
12+
index = vdb.create(index_type="hnsw", dim=8, expected_size=100000)
1313

1414
# Insert 10,000 random records
1515
data = [{"id": f"doc_{i}", "values": [random.random() for _ in range(8)]} for i in range(10000)]

benchmarks/15.get_records.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
vdb = VectorDatabase()
66

77
# Initialize and set up the database resources
8-
index = vdb.create_index_hnsw(dim = 2, space = "cosine", M = 16, ef_construction = 200, expected_size=5)
8+
index = vdb.create(index_type="hnsw", dim=2, space="cosine", m=16, ef_construction=200, expected_size=5)
99

1010
# Upload vector records using the unified `add()` method
1111
index.add([

benchmarks/16.new_test_cosine_L1_L2.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
print("\n==================== Testing space = 'cosine' ====================\n")
1515

1616
vdb_cos = VectorDatabase()
17-
index_cos = vdb_cos.create_index_hnsw(dim=8, space="cosine", M=16, ef_construction=200, expected_size=5)
17+
index_cos = vdb_cos.create(index_type="hnsw", dim=8, space="cosine", m=16, ef_construction=200, expected_size=5)
1818

1919
add_result_cos = index_cos.add(records)
2020
print("--- Add Results Summary ---")
@@ -34,7 +34,8 @@
3434
print("\n==================== Testing space = 'L2' ====================\n")
3535

3636
vdb_l2 = VectorDatabase()
37-
index_l2 = vdb_l2.create_index_hnsw(dim=8, space="L2", M=16, ef_construction=200, expected_size=5)
37+
index_l2 = vdb_l2.create(index_type="hnsw", dim=8, space="L2", m=16, ef_construction=200, expected_size=5)
38+
3839

3940
add_result_l2 = index_l2.add(records)
4041
print("--- Add Results Summary ---")
@@ -54,7 +55,7 @@
5455
print("\n==================== Testing space = 'L1' ====================\n")
5556

5657
vdb_l1 = VectorDatabase()
57-
index_l1 = vdb_l1.create_index_hnsw(dim=8, space="L1", M=16, ef_construction=200, expected_size=5)
58+
index_l1 = vdb_l1.create(index_type="hnsw", dim=8, space="L1", m=16, ef_construction=200, expected_size=5)
5859

5960
add_result_l1 = index_l1.add(records)
6061
print("--- Add Results Summary ---")

0 commit comments

Comments
 (0)