docs: update documentation for accurate v3.9.0 API examples and technical claims

- Fix all API examples to use proper enum syntax (NounType.Concept vs "concept")
- Correct noun/verb type counts (31 noun types × 40 verb types = 1,240 combinations)
- Update package references from 'brainy' to '@soulcraft/brainy'
- Standardize version references to be version-agnostic
- Ensure all examples match actual v3.9.0 implementation
- Add proper TypeScript imports throughout documentation
This commit is contained in:
David Snelling 2025-09-22 16:19:27 -07:00
parent 6113b39109
commit 8508cfc97d
5 changed files with 43 additions and 42 deletions

View file

@ -5,7 +5,7 @@ Get up and running with Brainy in 5 minutes!
## Installation
```bash
npm install brainy
npm install @soulcraft/brainy
```
Or install globally for CLI access:
@ -18,7 +18,7 @@ npm install -g brainy
### 1. Initialize Brainy
```javascript
import { BrainyData } from 'brainy'
import { BrainyData, NounType } from '@soulcraft/brainy'
const brain = new BrainyData()
await brain.init()
@ -34,11 +34,11 @@ That's it! No configuration needed. Brainy automatically:
```javascript
// Add a simple string
await brain.add("JavaScript is a versatile programming language", { nounType: 'concept' })
await brain.add("JavaScript is a versatile programming language", { nounType: NounType.Concept })
// Add with metadata
await brain.add("React is a JavaScript library", {
nounType: 'concept',
nounType: NounType.Concept,
type: "library",
category: "frontend",
popularity: "high"
@ -50,7 +50,7 @@ await brain.add({
content: "TypeScript adds static typing to JavaScript",
author: "John Doe"
}, {
nounType: 'document',
nounType: NounType.Document,
type: "article",
date: "2024-01-15"
})
@ -77,11 +77,11 @@ const libraries = await brain.search("JavaScript", {
### Example 1: Document Search System
```javascript
import { BrainyData } from 'brainy'
import { BrainyData, NounType } from '@soulcraft/brainy'
import fs from 'fs'
const brain = new BrainyData({
storage: {
storage: {
type: 'filesystem',
path: './document-index'
}
@ -97,6 +97,7 @@ const documents = [
for (const doc of documents) {
await brain.add(doc.content, {
nounType: NounType.Document,
filename: doc.file,
type: 'documentation',
indexed: new Date().toISOString()
@ -112,7 +113,7 @@ results.forEach(r => console.log(`- ${r.metadata.filename} (${(r.score * 100).to
### Example 2: AI Chat with Memory
```javascript
import { BrainyData } from 'brainy'
import { BrainyData, NounType } from '@soulcraft/brainy'
const brain = new BrainyData()
await brain.init()
@ -125,6 +126,7 @@ class ChatWithMemory {
async addMessage(role, content) {
await this.brain.add(content, {
nounType: NounType.Message,
role,
sessionId: this.sessionId,
timestamp: Date.now()
@ -164,7 +166,7 @@ const response = await chat.chat("What did we discuss about JavaScript?")
### Example 3: Semantic Code Search
```javascript
import { BrainyData } from 'brainy'
import { BrainyData, NounType } from '@soulcraft/brainy'
import { glob } from 'glob'
import fs from 'fs'
@ -180,6 +182,7 @@ for (const file of files) {
const functions = content.match(/function\s+(\w+)|const\s+(\w+)\s*=/g) || []
await brain.add(content, {
nounType: NounType.File,
file,
type: 'code',
language: 'javascript',