rust-kgdb 0.3.10 → 0.3.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/README.md +68 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -574,6 +574,30 @@ console.log('Bipartite(3,4):', bp34.vertexCount(), 'vertices,', bp34.edgeCount()
|
|
|
574
574
|
|
|
575
575
|
## 7. HyperMind Agentic Framework (Neuro-Symbolic AI)
|
|
576
576
|
|
|
577
|
+
### ⚡ TL;DR: What is HyperMind?
|
|
578
|
+
|
|
579
|
+
**HyperMind converts natural language questions into SPARQL queries.**
|
|
580
|
+
|
|
581
|
+
```typescript
|
|
582
|
+
// Input: "Find all professors"
|
|
583
|
+
// Output: "SELECT ?x WHERE { ?x a ub:Professor }"
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
**NOT to be confused with:**
|
|
587
|
+
- ❌ **EmbeddingService** - That's for semantic similarity search (different feature)
|
|
588
|
+
- ❌ **GraphDB** - That's for direct SPARQL queries (no natural language)
|
|
589
|
+
|
|
590
|
+
### Quick Start: Create an Agent in 3 Lines
|
|
591
|
+
|
|
592
|
+
```typescript
|
|
593
|
+
const { HyperMindAgent } = require('rust-kgdb')
|
|
594
|
+
|
|
595
|
+
const agent = await HyperMindAgent.spawn({ model: 'mock', endpoint: 'http://localhost:30080' })
|
|
596
|
+
const result = await agent.call('Find all professors') // → SPARQL query + results
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
---
|
|
600
|
+
|
|
577
601
|
HyperMind is a **production-grade neuro-symbolic agentic framework** built on rust-kgdb that combines:
|
|
578
602
|
|
|
579
603
|
- **Type Theory**: Compile-time safety with typed tool contracts
|
|
@@ -692,31 +716,55 @@ console.log(`Success: ${stats.syntaxSuccess}/${stats.totalTests}`) // 12/12
|
|
|
692
716
|
console.log(`Latency: ${stats.avgLatencyMs.toFixed(1)}ms`) // ~6.58ms
|
|
693
717
|
```
|
|
694
718
|
|
|
695
|
-
### Important: Embeddings Are
|
|
719
|
+
### ⚠️ Important: Embeddings Are SEPARATE from HyperMind
|
|
696
720
|
|
|
697
|
-
|
|
721
|
+
```
|
|
722
|
+
┌───────────────────────────────────────────────────────────────────────────────┐
|
|
723
|
+
│ COMMON CONFUSION: These are TWO DIFFERENT FEATURES │
|
|
724
|
+
├───────────────────────────────────────────────────────────────────────────────┤
|
|
725
|
+
│ │
|
|
726
|
+
│ HyperMindAgent EmbeddingService │
|
|
727
|
+
│ ───────────────── ───────────────── │
|
|
728
|
+
│ • Natural Language → SPARQL • Text → Vector embeddings │
|
|
729
|
+
│ • "Find professors" → SQL-like query • "professor" → [0.1, 0.2, ...] │
|
|
730
|
+
│ • Returns database results • Returns similar items │
|
|
731
|
+
│ • NO embeddings used internally • ALL about embeddings │
|
|
732
|
+
│ │
|
|
733
|
+
│ Use HyperMind when: Use Embeddings when: │
|
|
734
|
+
│ "I want to query my database "I want to find semantically │
|
|
735
|
+
│ using natural language" similar items" │
|
|
736
|
+
│ │
|
|
737
|
+
└───────────────────────────────────────────────────────────────────────────────┘
|
|
738
|
+
```
|
|
698
739
|
|
|
699
740
|
```typescript
|
|
700
|
-
const { EmbeddingService, GraphDB } = require('rust-kgdb')
|
|
701
|
-
|
|
702
|
-
//
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
const
|
|
707
|
-
|
|
708
|
-
//
|
|
709
|
-
|
|
710
|
-
|
|
741
|
+
const { HyperMindAgent, EmbeddingService, GraphDB } = require('rust-kgdb')
|
|
742
|
+
|
|
743
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
744
|
+
// HYPERMIND: Natural language → SPARQL queries (NO embeddings)
|
|
745
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
746
|
+
const agent = await HyperMindAgent.spawn({ model: 'mock', endpoint: 'http://localhost:30080' })
|
|
747
|
+
const result = await agent.call('Find all professors')
|
|
748
|
+
// result.sparql = "SELECT ?x WHERE { ?x a ub:Professor }"
|
|
749
|
+
// result.results = [{ x: "http://university.edu/prof1" }, ...]
|
|
750
|
+
|
|
751
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
752
|
+
// EMBEDDINGS: Semantic similarity search (COMPLETELY SEPARATE)
|
|
753
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
754
|
+
const embeddings = new EmbeddingService()
|
|
755
|
+
embeddings.storeVector('professor', [0.1, 0.2, 0.3, ...]) // 384-dim vector
|
|
756
|
+
embeddings.storeVector('teacher', [0.11, 0.21, 0.31, ...])
|
|
757
|
+
const similar = embeddings.findSimilar('professor', 5) // Finds "teacher" by cosine similarity
|
|
711
758
|
```
|
|
712
759
|
|
|
713
|
-
| Feature |
|
|
714
|
-
|
|
715
|
-
| **
|
|
716
|
-
| **Input** |
|
|
717
|
-
| **Output** | SPARQL query + results | Similar items |
|
|
718
|
-
| **Uses embeddings?** |
|
|
719
|
-
| **
|
|
760
|
+
| Feature | HyperMindAgent | EmbeddingService |
|
|
761
|
+
|---------|----------------|------------------|
|
|
762
|
+
| **What it does** | NL → SPARQL queries | Semantic similarity search |
|
|
763
|
+
| **Input** | "Find all professors" | Text or vectors |
|
|
764
|
+
| **Output** | SPARQL query + results | Similar items list |
|
|
765
|
+
| **Uses embeddings?** | ❌ **NO** | ✅ Yes |
|
|
766
|
+
| **Uses LLM?** | ✅ Yes (or mock) | ❌ No |
|
|
767
|
+
| **Requires API key?** | Only for LLM mode | No |
|
|
720
768
|
|
|
721
769
|
### Architecture Overview
|
|
722
770
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rust-kgdb",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"description": "High-performance RDF/SPARQL database with GraphFrames analytics, vector embeddings, Datalog reasoning, Pregel BSP processing, and HyperMind neuro-symbolic agentic framework",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|