Skip to content

Commit 5cc701a

Browse files
committed
docs: Update all READMEs with new FFI/Python methods
1 parent cd6da06 commit 5cc701a

3 files changed

Lines changed: 66 additions & 8 deletions

File tree

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ pip install .
8484
from valori import Valori
8585

8686
client = Valori()
87-
client.insert([0.1] * 16) # Insert vector
88-
results = client.search([0.1] * 16, k=5) # Search (returns exact match)
87+
# Atomic Batch Insert
88+
client.insert_batch([[0.1]*16, [0.2]*16])
89+
# Search
90+
results = client.search([0.1] * 16, k=5)
8991
```
9092

9193
**That's it.** Simple embedded mode. No Docker. No Kubernetes.

ffi/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,26 @@ Creates a relationship between two nodes.
6161
### `save() -> str`
6262
Saves a snapshot of the current in-memory state to disk.
6363
* **Returns**: Path to the saved snapshot file.
64+
65+
### `insert_batch(vectors: list[list[float]]) -> list[int]`
66+
Atomically insert multiple vectors.
67+
* **vectors**: List of float lists.
68+
* **Returns**: List of assigned Record IDs.
69+
70+
### `get_metadata(record_id: int) -> bytes | None`
71+
Get metadata for a record.
72+
73+
### `set_metadata(record_id: int, metadata: bytes)`
74+
Set metadata for a record.
75+
76+
### `get_state_hash() -> str`
77+
Get the cryptographic state hash (BLAKE3) of the kernel. Used for verifiable crash recovery.
78+
79+
### `record_count() -> int`
80+
Get the total number of records.
81+
82+
### `restore(data: bytes)`
83+
Restore kernel state from snapshot bytes.
84+
85+
### `soft_delete(record_id: int)`
86+
Mark a record as deleted (tombstone). Excludes it from search results.

python/README.md

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,56 @@ client = Valori(remote="https://your-node.koyeb.app")
8181

8282
### Methods
8383

84-
#### `insert(vector)`
85-
Raw insert. Returns integer Record ID.
84+
#### `insert(vector)` / `insert_batch(vectors)`
85+
Insert single or multiple vectors atomically.
8686
```python
87-
rid = client.insert([0.1, 0.2, ...])
87+
# Single
88+
rid = client.insert([0.1, ...])
89+
90+
# Batch (Atomic)
91+
vectors = [[0.1]*16, [0.2]*16, [0.3]*16]
92+
ids = client.insert_batch(vectors) # [0, 1, 2]
8893
```
8994

9095
#### `search(query, k)`
9196
Raw search. Returns IDs and scores.
9297
```python
93-
hits = client.search([0.1, 0.2, ...], k=5)
98+
hits = client.search([0.1, ...], k=5)
9499
# [{'id': 10, 'score': 12345}, ...]
95100
```
96101

102+
#### `get_metadata(id)` / `set_metadata(id, data)`
103+
Read/Write metadata (for both HTTP and Local modes).
104+
```python
105+
client.set_metadata(10, b"user:123")
106+
meta = client.get_metadata(10)
107+
```
108+
109+
#### `get_state_hash()`
110+
**Verifiable AI**: Get cryptographic proof of current database state.
111+
```python
112+
hash1 = client.get_state_hash()
113+
# 1a2b3c... (BLAKE3 hash)
114+
```
115+
116+
#### `record_count()`
117+
Get total number of records.
118+
```python
119+
count = client.record_count()
120+
```
121+
122+
#### `soft_delete(id)`
123+
Mark record as deleted (excluded from search).
124+
```python
125+
client.soft_delete(10)
126+
```
127+
97128
#### `snapshot()` / `restore(data)`
98129
Backup and recovery.
99130
```python
131+
# Save to bytes
100132
data = client.snapshot()
101-
with open("backup.snap", "wb") as f:
102-
f.write(data)
133+
134+
# Restore (Local mode only)
135+
client.restore(data)
103136
```

0 commit comments

Comments
 (0)