rust-kgdb 0.6.45 → 0.6.46
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 +26 -0
- package/README.md +37 -22
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to the rust-kgdb TypeScript SDK will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.6.46] - 2025-12-17
|
|
6
|
+
|
|
7
|
+
### Honest Comparison Fix
|
|
8
|
+
|
|
9
|
+
#### Fixed Misleading "Before & After" Section
|
|
10
|
+
- **Old (misleading)**: Implied vanilla LLMs CAN'T use schema/context
|
|
11
|
+
- **New (honest)**: Shows both approaches work, difference is integration effort
|
|
12
|
+
|
|
13
|
+
The "Before & After" section now honestly shows:
|
|
14
|
+
- **Manual Approach**: Works (~71% accuracy), but requires 5-8 manual integration steps
|
|
15
|
+
- Write schema manually
|
|
16
|
+
- Pass to LLM
|
|
17
|
+
- Parse SPARQL from response
|
|
18
|
+
- Find external database
|
|
19
|
+
- Connect, execute, parse results
|
|
20
|
+
- Build audit trail yourself
|
|
21
|
+
|
|
22
|
+
- **HyperMind Approach**: Same accuracy (~71%), but integrated
|
|
23
|
+
- Schema auto-extracted from your data
|
|
24
|
+
- Built-in database executes queries
|
|
25
|
+
- Audit trail included automatically
|
|
26
|
+
|
|
27
|
+
**Key insight**: We don't claim better accuracy than manual approach with schema. We provide integration convenience.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
5
31
|
## [0.6.45] - 2025-12-17
|
|
6
32
|
|
|
7
33
|
### ARCADE Pipeline Documentation & Benchmark Methodology
|
package/README.md
CHANGED
|
@@ -188,47 +188,60 @@ db.loadTtl(':Provider123 :hasRiskScore "0.87" .', null)
|
|
|
188
188
|
|
|
189
189
|
---
|
|
190
190
|
|
|
191
|
-
## The Difference:
|
|
191
|
+
## The Difference: Manual vs Integrated
|
|
192
192
|
|
|
193
|
-
###
|
|
193
|
+
### Manual Approach (Works, But Tedious)
|
|
194
194
|
|
|
195
195
|
```javascript
|
|
196
|
-
//
|
|
196
|
+
// STEP 1: Manually write your schema (takes hours for large ontologies)
|
|
197
|
+
const LUBM_SCHEMA = `
|
|
198
|
+
PREFIX ub: <http://swat.cse.lehigh.edu/onto/univ-bench.owl#>
|
|
199
|
+
Classes: University, Department, Professor, Student, Course, Publication
|
|
200
|
+
Properties: teacherOf(Faculty→Course), worksFor(Faculty→Department)
|
|
201
|
+
`;
|
|
202
|
+
|
|
203
|
+
// STEP 2: Pass schema to LLM
|
|
197
204
|
const answer = await openai.chat.completions.create({
|
|
198
205
|
model: 'gpt-4o',
|
|
199
|
-
messages: [
|
|
206
|
+
messages: [
|
|
207
|
+
{ role: 'system', content: `${LUBM_SCHEMA}\nOutput raw SPARQL only.` },
|
|
208
|
+
{ role: 'user', content: 'Find suspicious providers' }
|
|
209
|
+
]
|
|
200
210
|
});
|
|
201
211
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
//
|
|
206
|
-
//
|
|
207
|
-
//
|
|
208
|
-
//
|
|
209
|
-
//
|
|
212
|
+
// STEP 3: Parse out the SPARQL (handle markdown, explanations, etc.)
|
|
213
|
+
const sparql = extractSPARQL(answer.choices[0].message.content);
|
|
214
|
+
|
|
215
|
+
// STEP 4: Find a SPARQL database (Jena? RDFox? Virtuoso?)
|
|
216
|
+
// STEP 5: Connect to database
|
|
217
|
+
// STEP 6: Execute query
|
|
218
|
+
// STEP 7: Parse results
|
|
219
|
+
// STEP 8: No audit trail - you'd have to build that yourself
|
|
220
|
+
|
|
221
|
+
// RESULT: ~71% accuracy (same as HyperMind with schema)
|
|
222
|
+
// BUT: 5-8 manual integration steps
|
|
210
223
|
```
|
|
211
224
|
|
|
212
|
-
###
|
|
225
|
+
### HyperMind Approach (Integrated)
|
|
213
226
|
|
|
214
227
|
```javascript
|
|
215
|
-
//
|
|
228
|
+
// ONE-TIME SETUP: Load your data
|
|
216
229
|
const { HyperMindAgent, GraphDB } = require('rust-kgdb');
|
|
217
230
|
|
|
218
231
|
const db = new GraphDB('http://insurance.org/');
|
|
219
|
-
db.loadTtl(yourActualData, null); //
|
|
232
|
+
db.loadTtl(yourActualData, null); // Schema auto-extracted from data
|
|
220
233
|
|
|
221
234
|
const agent = new HyperMindAgent({ kg: db, model: 'gpt-4o' });
|
|
222
235
|
const result = await agent.call('Find suspicious providers');
|
|
223
236
|
|
|
224
237
|
console.log(result.answer);
|
|
225
238
|
// "Provider PROV001 has risk score 0.87 with 47 claims over $50,000"
|
|
226
|
-
|
|
227
|
-
//
|
|
228
|
-
// ✅
|
|
229
|
-
// ✅
|
|
230
|
-
// ✅
|
|
231
|
-
// ✅
|
|
239
|
+
|
|
240
|
+
// WHAT YOU GET (ALL AUTOMATIC):
|
|
241
|
+
// ✅ Schema auto-extracted (no manual prompt engineering)
|
|
242
|
+
// ✅ Query executed on built-in database (no external DB needed)
|
|
243
|
+
// ✅ Full audit trail included
|
|
244
|
+
// ✅ Reproducible hash for compliance
|
|
232
245
|
|
|
233
246
|
console.log(result.reasoningTrace);
|
|
234
247
|
// [
|
|
@@ -240,7 +253,9 @@ console.log(result.hash);
|
|
|
240
253
|
// "sha256:8f3a2b1c..." - Same question = Same answer = Same hash
|
|
241
254
|
```
|
|
242
255
|
|
|
243
|
-
**
|
|
256
|
+
**Honest comparison**: Both approaches achieve ~71% accuracy on LUBM benchmark. The difference is integration effort:
|
|
257
|
+
- **Manual**: Write schema, integrate database, build audit trail yourself
|
|
258
|
+
- **HyperMind**: Database + schema extraction + audit trail built-in
|
|
244
259
|
|
|
245
260
|
---
|
|
246
261
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rust-kgdb",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.46",
|
|
4
4
|
"description": "High-performance RDF/SPARQL database with AI agent framework. GraphDB (449ns lookups, 35x faster than RDFox), GraphFrames analytics (PageRank, motifs), Datalog reasoning, HNSW vector embeddings. HyperMindAgent for schema-aware query generation with audit trails. W3C SPARQL 1.1 compliant. Native performance via Rust + NAPI-RS.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|