rust-kgdb 0.5.9 → 0.5.11
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.
- package/CHANGELOG.md +15 -0
- package/README.md +42 -20
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to the rust-kgdb TypeScript SDK will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.5.11] - 2025-12-15
|
|
6
|
+
|
|
7
|
+
### Documentation Clarification
|
|
8
|
+
|
|
9
|
+
- Clarified that embedding providers (OpenAI, Voyage AI) are third-party libraries, not built into rust-kgdb
|
|
10
|
+
- Updated examples to show `fetch` API for Voyage AI instead of non-existent SDK
|
|
11
|
+
- Added "bring your own embeddings" messaging to make provider abstraction clear
|
|
12
|
+
- rust-kgdb's EmbeddingService stores/searches vectors; users provide embeddings from their preferred provider
|
|
13
|
+
|
|
14
|
+
## [0.5.10] - 2025-12-15
|
|
15
|
+
|
|
16
|
+
### Documentation Cleanup
|
|
17
|
+
|
|
18
|
+
- Removed naming disclaimer note from README header
|
|
19
|
+
|
|
5
20
|
## [0.5.9] - 2025-12-15
|
|
6
21
|
|
|
7
22
|
### Expert-Level Documentation - Complete Neuro-Symbolic AI Framework
|
package/README.md
CHANGED
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
> **Two-Layer Architecture**: High-performance Rust knowledge graph database + HyperMind neuro-symbolic agent framework with mathematical foundations.
|
|
8
8
|
|
|
9
|
-
**Naming Note**: The `GraphDB` class in this SDK is not affiliated with [Ontotext GraphDB](https://www.ontotext.com/products/graphdb/). The `GraphFrame` API is inspired by [Apache Spark GraphFrames](https://graphframes.github.io/graphframes/docs/_site/index.html).
|
|
10
|
-
|
|
11
9
|
---
|
|
12
10
|
|
|
13
11
|
## Architecture: What Powers rust-kgdb
|
|
@@ -311,11 +309,13 @@ const voteResults = service.findSimilarComposite('CLM001', 10, 0.7, 'voting') //
|
|
|
311
309
|
|
|
312
310
|
### Provider Configuration
|
|
313
311
|
|
|
314
|
-
|
|
312
|
+
rust-kgdb's `EmbeddingService` stores and searches vectors - you bring your own embeddings from any provider. Here are examples using popular third-party libraries:
|
|
315
313
|
|
|
316
314
|
```javascript
|
|
317
|
-
//
|
|
318
|
-
|
|
315
|
+
// ============================================================
|
|
316
|
+
// EXAMPLE: Using OpenAI embeddings (requires: npm install openai)
|
|
317
|
+
// ============================================================
|
|
318
|
+
const { OpenAI } = require('openai') // Third-party library
|
|
319
319
|
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY })
|
|
320
320
|
|
|
321
321
|
async function getOpenAIEmbedding(text) {
|
|
@@ -327,17 +327,31 @@ async function getOpenAIEmbedding(text) {
|
|
|
327
327
|
return response.data[0].embedding
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
//
|
|
331
|
-
//
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
330
|
+
// ============================================================
|
|
331
|
+
// EXAMPLE: Using Voyage AI (requires: npm install voyageai)
|
|
332
|
+
// Note: Anthropic recommends Voyage AI for embeddings
|
|
333
|
+
// ============================================================
|
|
335
334
|
async function getVoyageEmbedding(text) {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
335
|
+
// Using fetch directly (no SDK required)
|
|
336
|
+
const response = await fetch('https://api.voyageai.com/v1/embeddings', {
|
|
337
|
+
method: 'POST',
|
|
338
|
+
headers: {
|
|
339
|
+
'Authorization': `Bearer ${process.env.VOYAGE_API_KEY}`,
|
|
340
|
+
'Content-Type': 'application/json'
|
|
341
|
+
},
|
|
342
|
+
body: JSON.stringify({ input: text, model: 'voyage-2' })
|
|
339
343
|
})
|
|
340
|
-
|
|
344
|
+
const data = await response.json()
|
|
345
|
+
return data.data[0].embedding.slice(0, 384) // Truncate to 384-dim
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// ============================================================
|
|
349
|
+
// EXAMPLE: Mock embeddings for testing (no external deps)
|
|
350
|
+
// ============================================================
|
|
351
|
+
function getMockEmbedding(text) {
|
|
352
|
+
return new Array(384).fill(0).map((_, i) =>
|
|
353
|
+
Math.sin(text.charCodeAt(i % text.length) * 0.1) * 0.5 + 0.5
|
|
354
|
+
)
|
|
341
355
|
}
|
|
342
356
|
```
|
|
343
357
|
|
|
@@ -1226,11 +1240,12 @@ const db = new GraphDB('http://insurance.org/fraud-kb')
|
|
|
1226
1240
|
const embeddings = new EmbeddingService()
|
|
1227
1241
|
|
|
1228
1242
|
// ============================================================
|
|
1229
|
-
// STEP 3: Configure Embedding Provider
|
|
1243
|
+
// STEP 3: Configure Embedding Provider (bring your own)
|
|
1230
1244
|
// ============================================================
|
|
1231
1245
|
async function getEmbedding(text) {
|
|
1232
1246
|
switch (EMBEDDING_PROVIDER) {
|
|
1233
1247
|
case 'openai':
|
|
1248
|
+
// Requires: npm install openai
|
|
1234
1249
|
const { OpenAI } = require('openai')
|
|
1235
1250
|
const openai = new OpenAI({ apiKey: OPENAI_API_KEY })
|
|
1236
1251
|
const resp = await openai.embeddings.create({
|
|
@@ -1241,12 +1256,19 @@ async function getEmbedding(text) {
|
|
|
1241
1256
|
return resp.data[0].embedding
|
|
1242
1257
|
|
|
1243
1258
|
case 'voyage':
|
|
1244
|
-
|
|
1245
|
-
const
|
|
1246
|
-
|
|
1247
|
-
|
|
1259
|
+
// Using fetch directly (no SDK required)
|
|
1260
|
+
const vResp = await fetch('https://api.voyageai.com/v1/embeddings', {
|
|
1261
|
+
method: 'POST',
|
|
1262
|
+
headers: {
|
|
1263
|
+
'Authorization': `Bearer ${VOYAGE_API_KEY}`,
|
|
1264
|
+
'Content-Type': 'application/json'
|
|
1265
|
+
},
|
|
1266
|
+
body: JSON.stringify({ input: text, model: 'voyage-2' })
|
|
1267
|
+
})
|
|
1268
|
+
const vData = await vResp.json()
|
|
1269
|
+
return vData.data[0].embedding.slice(0, EMBEDDING_DIM)
|
|
1248
1270
|
|
|
1249
|
-
default: // Mock embeddings for testing
|
|
1271
|
+
default: // Mock embeddings for testing (no external deps)
|
|
1250
1272
|
return new Array(EMBEDDING_DIM).fill(0).map((_, i) =>
|
|
1251
1273
|
Math.sin(text.charCodeAt(i % text.length) * 0.1) * 0.5 + 0.5
|
|
1252
1274
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rust-kgdb",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.11",
|
|
4
4
|
"description": "Production-grade Neuro-Symbolic AI Framework: +86.4% accuracy improvement over vanilla LLMs. High-performance knowledge graph (2.78µs lookups, 35x faster than RDFox). Features fraud detection, underwriting agents, WASM sandbox, type/category/proof theory, and W3C SPARQL 1.1 compliance.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|