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.
Files changed (2) hide show
  1. package/README.md +68 -20
  2. 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 Separate
719
+ ### ⚠️ Important: Embeddings Are SEPARATE from HyperMind
696
720
 
697
- **HyperMind agents do NOT use embeddings for query generation.** Embeddings are a separate feature for semantic similarity search:
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
- // Embeddings: For semantic similarity search (SEPARATE from HyperMind)
703
- const embeddings = new EmbeddingService({ provider: 'mock', dimensions: 384 })
704
- embeddings.addText('professor', 'A teacher at a university')
705
- embeddings.addText('student', 'Someone who studies at a university')
706
- const similar = embeddings.findSimilar('teacher', 5) // Finds "professor"
707
-
708
- // HyperMind: For natural language to SPARQL (NO embeddings used)
709
- const agent = await HyperMindAgent.spawn({ model: 'mock', ... })
710
- const result = await agent.call('Find professors') // Generates SPARQL query
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 | HyperMind Agent | Embedding Service |
714
- |---------|-----------------|-------------------|
715
- | **Purpose** | NL → SPARQL queries | Semantic similarity |
716
- | **Input** | Natural language question | Text to embed |
717
- | **Output** | SPARQL query + results | Similar items |
718
- | **Uses embeddings?** | No | Yes |
719
- | **Requires API key?** | Only for LLM mode | No (mock available) |
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.10",
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",