開發體驗
安裝,開啟,寫入記憶。
TriviumDB 是嵌入式的,本機開發從一個套件與一個資料庫路徑開始,而不是一整套服務叢集。
v0.9.4
- Python
pip install triviumdb - Node.js
npm install triviumdb - Rust
cargo add triviumdb
import triviumdb
with triviumdb.TriviumDB("agent-memory.tdb", dim=3) as db:
alice = db.insert([0.12, -0.45, 0.78], {
"type": "memory",
"text": "Alice works on embedded databases",
})
cafe = db.insert([0.08, -0.52, 0.81], {
"type": "place",
"name": "Blue Bottle",
})
db.link(alice, cafe, label="visited", weight=0.8)
hits = db.search([0.10, -0.48, 0.80], top_k=5, expand_depth=2, min_score=0.1)
for hit in hits:
print(hit.id, hit.score, hit.payload)