Skip to content

Commit 6147246

Browse files
committed
docs: Update README for v0.3.5 - Vector Convenience Methods
Documentation Updates ===================== - Add 'What's New in 0.3.5' section - Document new vector operations on Database class - Show simplified API compared to separate VectorIndex class - Add code examples for create_index(), insert_vectors(), search() - Document tokio-optional compatibility API Examples ============ Before (0.3.4): from toondb.vector import VectorIndex index = VectorIndex(dimension=384) After (0.3.5): db = Database.open('./mydb') db.create_index('embeddings', dimension=384) Benefits ======== - Simpler API - all operations on Database class - No need to manage separate VectorIndex instances - Index metadata stored in database - Backwards compatible with VectorIndex class
1 parent f357a98 commit 6147246

1 file changed

Lines changed: 45 additions & 1 deletion

File tree

README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,39 @@
1-
# ToonDB Python SDK v0.3.4
1+
# ToonDB Python SDK v0.3.5
22

33
**Dual-mode architecture: Embedded (FFI) + Server (gRPC/IPC)**
44
Choose the deployment mode that fits your needs.
55

6+
## What's New in 0.3.5
7+
8+
### 🔢 Vector Operations in Database Class
9+
No need for separate `VectorIndex` class anymore - vector operations are now directly available on the `Database` class:
10+
11+
```python
12+
from toondb import Database
13+
14+
db = Database.open('./mydb')
15+
16+
# Create vector index
17+
db.create_index('embeddings', dimension=384)
18+
19+
# Insert vectors
20+
db.insert_vectors('embeddings', [1, 2, 3], [
21+
[0.1, 0.2, ...], # vector 1
22+
[0.3, 0.4, ...], # vector 2
23+
[0.5, 0.6, ...], # vector 3
24+
])
25+
26+
# Search
27+
results = db.search('embeddings', [0.1, 0.2, ...], k=5)
28+
for id, distance in results:
29+
print(f'ID: {id}, Distance: {distance:.4f}')
30+
```
31+
32+
### 🏗️ Works with Tokio-Optional Architecture
33+
- Supports both sync and async Rust backend (v0.3.5)
34+
- No breaking changes to existing code
35+
- Smaller binaries (~500KB reduction)
36+
637
## Architecture: Flexible Deployment
738

839
```
@@ -72,6 +103,19 @@ with Database.open("./mydb") as db:
72103
db.put(b"key", b"value")
73104
value = db.get(b"key")
74105

106+
# Vector operations (NEW in 0.3.5)
107+
db.create_index('embeddings', dimension=384)
108+
db.insert_vectors('embeddings', [1, 2, 3], [
109+
[0.1, 0.2, ...], # vector 1
110+
[0.3, 0.4, ...], # vector 2
111+
[0.5, 0.6, ...], # vector 3
112+
])
113+
114+
# Search for similar vectors
115+
results = db.search('embeddings', [0.1, 0.2, ...], k=5)
116+
for id, distance in results:
117+
print(f'ID: {id}, Distance: {distance}')
118+
75119
# Namespaces
76120
ns = db.namespace("tenant_123")
77121
collection = ns.collection("documents", dimension=384)

0 commit comments

Comments
 (0)