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.
Files changed (3) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +37 -22
  3. 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: Before & After
191
+ ## The Difference: Manual vs Integrated
192
192
 
193
- ### Before: Vanilla LLM (Unreliable)
193
+ ### Manual Approach (Works, But Tedious)
194
194
 
195
195
  ```javascript
196
- // Ask LLM to query your database
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: [{ role: 'user', content: 'Find suspicious providers in my database' }]
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
- console.log(answer.choices[0].message.content);
203
- // "Based on my analysis, Provider P001 appears suspicious because..."
204
- //
205
- // PROBLEMS:
206
- // Did it actually query your database? No - it's guessing
207
- // Where's the evidence? None - it made up "Provider P001"
208
- // Will this answer be the same tomorrow? No - probabilistic
209
- // Can you audit this for regulators? No - black box
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
- ### After: HyperMind (Verifiable)
225
+ ### HyperMind Approach (Integrated)
213
226
 
214
227
  ```javascript
215
- // Ask HyperMind to query your database
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); // Your real data
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
- // VERIFIED:
228
- // ✅ Queried your actual database (SPARQL executed)
229
- // ✅ Evidence included (47 real claims found)
230
- // ✅ Reproducible (same hash every time)
231
- // ✅ Full audit trail for regulators
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
- **The key insight**: The LLM plans WHAT to look for. The database finds EXACTLY that. Every answer traces back to your actual data.
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.45",
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",