fix: update all imports and references from BrainyData to Brainy

- Fixed imports in examples/tests/ to use correct Brainy import
- Fixed imports in tests/benchmarks/ to use correct paths
- Updated bin/brainy-interactive.js to use Brainy instead of BrainyData
- Corrected documentation references throughout codebase
- Removed duplicate imports in benchmark files
- All files now consistently use 'Brainy' class from dist/index.js
This commit is contained in:
David Snelling 2025-09-30 17:09:15 -07:00
parent 791fac54cd
commit 196690863d
77 changed files with 328 additions and 331 deletions

View file

@ -135,11 +135,11 @@ npm run test:watch
```typescript ```typescript
import { describe, it, expect } from 'vitest' import { describe, it, expect } from 'vitest'
import { BrainyData } from '../src' import { Brainy } from '../src'
describe('Feature Name', () => { describe('Feature Name', () => {
it('should do something specific', async () => { it('should do something specific', async () => {
const brain = new BrainyData() const brain = new Brainy()
await brain.init() await brain.init()
// Test implementation // Test implementation
@ -184,16 +184,16 @@ import { BrainyAugmentation } from '../types'
export class MyAugmentation extends BrainyAugmentation { export class MyAugmentation extends BrainyAugmentation {
name = 'MyAugmentation' name = 'MyAugmentation'
async onInit(brain: BrainyData): Promise<void> { async onInit(brain: Brainy): Promise<void> {
// Initialize augmentation // Initialize augmentation
} }
async onAdd(item: any, brain: BrainyData): Promise<any> { async onAdd(item: any, brain: Brainy): Promise<any> {
// Process before adding // Process before adding
return item return item
} }
async onSearch(query: any, results: any[], brain: BrainyData): Promise<any[]> { async onSearch(query: any, results: any[], brain: Brainy): Promise<any[]> {
// Process search results // Process search results
return results return results
} }
@ -236,10 +236,10 @@ Add examples for new features:
```typescript ```typescript
// examples/feature-name.ts // examples/feature-name.ts
import { BrainyData } from 'brainy' import { Brainy } from 'brainy'
async function exampleUsage() { async function exampleUsage() {
const brain = new BrainyData() const brain = new Brainy()
await brain.init() await brain.init()
// Show feature usage // Show feature usage

View file

@ -7,7 +7,7 @@
*/ */
import { program } from 'commander' import { program } from 'commander'
import { BrainyData } from '../dist/brainyData.js' import { Brainy } from '../dist/index.js'
import chalk from 'chalk' import chalk from 'chalk'
import inquirer from 'inquirer' import inquirer from 'inquirer'
import ora from 'ora' import ora from 'ora'
@ -61,7 +61,7 @@ async function getBrainy() {
if (!brainyInstance) { if (!brainyInstance) {
const spinner = ora('Initializing Brainy...').start() const spinner = ora('Initializing Brainy...').start()
try { try {
brainyInstance = new BrainyData() brainyInstance = new Brainy()
await brainyInstance.init() await brainyInstance.init()
spinner.succeed('Brainy initialized') spinner.succeed('Brainy initialized')
} catch (error) { } catch (error) {

View file

@ -34,9 +34,9 @@ await brain.delete(id) // Unified deletion
```typescript ```typescript
// DON'T DO THIS - Old API patterns // DON'T DO THIS - Old API patterns
import { BrainyData } from 'old-brainy' // ❌ Wrong import import { Brainy } from 'old-brainy' // ❌ Wrong import
const brain = new BrainyData({ // ❌ Old class name const brain = new Brainy({ // ❌ Old class name
complexConfig: true complexConfig: true
}) })

View file

@ -57,7 +57,7 @@ export class MyStorageAugmentation extends StorageAugmentation {
```typescript ```typescript
// Register before brain.init() // Register before brain.init()
const brain = new BrainyData() const brain = new Brainy()
brain.augmentations.register(new MyStorageAugmentation({ brain.augmentations.register(new MyStorageAugmentation({
connectionString: 'redis://localhost:6379' connectionString: 'redis://localhost:6379'
})) }))
@ -174,9 +174,9 @@ Common operations in Brainy:
```typescript ```typescript
interface AugmentationContext { interface AugmentationContext {
brain: BrainyData // The brain instance brain: Brainy // The brain instance
storage: StorageAdapter // Storage backend storage: StorageAdapter // Storage backend
config: BrainyDataConfig // Configuration config: BrainyConfig // Configuration
log: (message: string, level?: 'info' | 'warn' | 'error') => void log: (message: string, level?: 'info' | 'warn' | 'error') => void
} }
``` ```
@ -265,14 +265,14 @@ Future capability for premium augmentations:
## Testing Your Augmentation ## Testing Your Augmentation
```typescript ```typescript
import { BrainyData } from 'brainy' import { Brainy } from 'brainy'
import { MyAugmentation } from './my-augmentation' import { MyAugmentation } from './my-augmentation'
describe('MyAugmentation', () => { describe('MyAugmentation', () => {
let brain: BrainyData let brain: Brainy
beforeEach(async () => { beforeEach(async () => {
brain = new BrainyData() brain = new Brainy()
brain.augmentations.register(new MyAugmentation()) brain.augmentations.register(new MyAugmentation())
await brain.init() await brain.init()
}) })

View file

@ -59,13 +59,13 @@ Once registered, the new storage type works with zero-config:
```typescript ```typescript
// Auto-detection will now check Redis // Auto-detection will now check Redis
const brain = new BrainyData() // Will use Redis if available! const brain = new Brainy() // Will use Redis if available!
// Or explicitly specify // Or explicitly specify
const brain = new BrainyData({ storage: 'redis' }) const brain = new Brainy({ storage: 'redis' })
// Or with custom config // Or with custom config
const brain = new BrainyData({ const brain = new Brainy({
storage: { storage: {
type: 'redis', type: 'redis',
redisStorage: { redisStorage: {
@ -223,7 +223,7 @@ registerPresetAugmentation('redis-cluster', {
}) })
// Users can then use: // Users can then use:
const brain = new BrainyData('redis-cluster') const brain = new Brainy('redis-cluster')
``` ```
## Type Safety with Extensions ## Type Safety with Extensions
@ -367,17 +367,17 @@ export class BrainyRedisAugmentation {
} }
// Usage after installing the augmentation: // Usage after installing the augmentation:
import { BrainyData } from '@soulcraft/brainy' import { Brainy } from '@soulcraft/brainy'
import '@soulcraft/brainy-redis' // Registers the augmentation import '@soulcraft/brainy-redis' // Registers the augmentation
// Now Redis is automatically detected! // Now Redis is automatically detected!
const brain = new BrainyData() // Uses Redis if REDIS_URL is set const brain = new Brainy() // Uses Redis if REDIS_URL is set
// Or use a Redis preset // Or use a Redis preset
const brain = new BrainyData('redis-fast-cache') const brain = new Brainy('redis-fast-cache')
// Or explicitly configure // Or explicitly configure
const brain = new BrainyData({ const brain = new Brainy({
storage: 'redis', storage: 'redis',
model: ModelPrecision.FP32 model: ModelPrecision.FP32
}) })

View file

@ -35,7 +35,7 @@ These augmentations don't read or write metadata at all:
1. **CacheAugmentation** - Only caches search results 1. **CacheAugmentation** - Only caches search results
2. **RequestDeduplicatorAugmentation** - Only deduplicates requests 2. **RequestDeduplicatorAugmentation** - Only deduplicates requests
3. **ConnectionPoolAugmentation** - Only manages storage connections 3. **ConnectionPoolAugmentation** - Only manages storage connections
4. **StorageAugmentation** - Base storage layer, metadata handled by brainyData 4. **StorageAugmentation** - Base storage layer, metadata handled by Brainy
### Category 2: Read-Only Access ('readonly') ### Category 2: Read-Only Access ('readonly')
These augmentations read metadata but never modify it: These augmentations read metadata but never modify it:

View file

@ -4,14 +4,14 @@
### ✅ Development (Zero Config) ### ✅ Development (Zero Config)
```typescript ```typescript
const brain = new BrainyData() const brain = new Brainy()
await brain.init() // Downloads automatically (FP32 default) await brain.init() // Downloads automatically (FP32 default)
``` ```
### ⚡ Development (Optimized - v2.8.0+) ### ⚡ Development (Optimized - v2.8.0+)
```typescript ```typescript
// 75% smaller models, 99% accuracy // 75% smaller models, 99% accuracy
const brain = new BrainyData({ const brain = new Brainy({
embeddingOptions: { dtype: 'q8' } embeddingOptions: { dtype: 'q8' }
}) })
await brain.init() await brain.init()
@ -55,8 +55,8 @@ export BRAINY_ALLOW_REMOTE_MODELS=false
```html ```html
<!-- Automatic - no setup needed --> <!-- Automatic - no setup needed -->
<script type="module"> <script type="module">
import { BrainyData } from 'brainy' import { Brainy } from 'brainy'
const brain = new BrainyData() const brain = new Brainy()
await brain.init() // Works in browser await brain.init() // Works in browser
</script> </script>
``` ```

View file

@ -8,8 +8,8 @@
```typescript ```typescript
// DON'T DO THIS - Outdated documentation patterns // DON'T DO THIS - Outdated documentation patterns
import { BrainyData } from '@soulcraft/brainy' // ❌ Wrong import import { Brainy } from '@soulcraft/brainy' // ❌ Wrong import
const brain = new BrainyData() // ❌ Old class name const brain = new Brainy() // ❌ Old class name
// These may not work as expected: // These may not work as expected:
const neural = brain.neural // ❌ May be undefined const neural = brain.neural // ❌ May be undefined

View file

@ -18,9 +18,9 @@ npm install -g brainy
### 1. Initialize Brainy ### 1. Initialize Brainy
```javascript ```javascript
import { BrainyData, NounType } from '@soulcraft/brainy' import { Brainy, NounType } from '@soulcraft/brainy'
const brain = new BrainyData() const brain = new Brainy()
await brain.init() await brain.init()
``` ```
@ -77,10 +77,10 @@ const libraries = await brain.search("JavaScript", {
### Example 1: Document Search System ### Example 1: Document Search System
```javascript ```javascript
import { BrainyData, NounType } from '@soulcraft/brainy' import { Brainy, NounType } from '@soulcraft/brainy'
import fs from 'fs' import fs from 'fs'
const brain = new BrainyData({ const brain = new Brainy({
storage: { storage: {
type: 'filesystem', type: 'filesystem',
path: './document-index' path: './document-index'
@ -113,9 +113,9 @@ results.forEach(r => console.log(`- ${r.metadata.filename} (${(r.score * 100).to
### Example 2: AI Chat with Memory ### Example 2: AI Chat with Memory
```javascript ```javascript
import { BrainyData, NounType } from '@soulcraft/brainy' import { Brainy, NounType } from '@soulcraft/brainy'
const brain = new BrainyData() const brain = new Brainy()
await brain.init() await brain.init()
class ChatWithMemory { class ChatWithMemory {
@ -166,11 +166,11 @@ const response = await chat.chat("What did we discuss about JavaScript?")
### Example 3: Semantic Code Search ### Example 3: Semantic Code Search
```javascript ```javascript
import { BrainyData, NounType } from '@soulcraft/brainy' import { Brainy, NounType } from '@soulcraft/brainy'
import { glob } from 'glob' import { glob } from 'glob'
import fs from 'fs' import fs from 'fs'
const brain = new BrainyData() const brain = new Brainy()
await brain.init() await brain.init()
// Index all JavaScript files // Index all JavaScript files
@ -284,12 +284,12 @@ const results = await brain.search("*", {
### Memory (Testing) ### Memory (Testing)
```javascript ```javascript
const brain = new BrainyData() // Default const brain = new Brainy() // Default
``` ```
### FileSystem (Development) ### FileSystem (Development)
```javascript ```javascript
const brain = new BrainyData({ const brain = new Brainy({
storage: { storage: {
type: 'filesystem', type: 'filesystem',
path: './brain-data' path: './brain-data'
@ -299,14 +299,14 @@ const brain = new BrainyData({
### Browser (OPFS) ### Browser (OPFS)
```javascript ```javascript
const brain = new BrainyData({ const brain = new Brainy({
storage: { type: 'opfs' } storage: { type: 'opfs' }
}) })
``` ```
### S3 (Production) ### S3 (Production)
```javascript ```javascript
const brain = new BrainyData({ const brain = new Brainy({
storage: { storage: {
type: 's3', type: 's3',
bucket: 'my-brain-bucket', bucket: 'my-brain-bucket',

View file

@ -62,10 +62,10 @@ await brain.find("recent articles about AI with high ratings")
## Quick Example ## Quick Example
```typescript ```typescript
import { BrainyData } from 'brainy' import { Brainy } from 'brainy'
// Initialize // Initialize
const brain = new BrainyData() const brain = new Brainy()
await brain.init() await brain.init()
// Add entities (nouns) // Add entities (nouns)

View file

@ -8,20 +8,20 @@ Starting with v2.10, Brainy introduces a **Zero-Configuration System** that auto
### True Zero Config ### True Zero Config
```typescript ```typescript
import { BrainyData } from '@soulcraft/brainy' import { Brainy } from '@soulcraft/brainy'
// That's it! Everything auto-configures // That's it! Everything auto-configures
const brain = new BrainyData() const brain = new Brainy()
await brain.init() await brain.init()
``` ```
### Using Strongly-Typed Presets ### Using Strongly-Typed Presets
```typescript ```typescript
import { BrainyData, PresetName } from '@soulcraft/brainy' import { Brainy, PresetName } from '@soulcraft/brainy'
// Type-safe preset selection // Type-safe preset selection
const brain = new BrainyData(PresetName.PRODUCTION) const brain = new Brainy(PresetName.PRODUCTION)
await brain.init() await brain.init()
``` ```
@ -29,7 +29,7 @@ await brain.init()
#### Development #### Development
```typescript ```typescript
const brain = new BrainyData(PresetName.DEVELOPMENT) const brain = new Brainy(PresetName.DEVELOPMENT)
// ✅ Memory storage for fast iteration // ✅ Memory storage for fast iteration
// ✅ FP32 models for best quality // ✅ FP32 models for best quality
// ✅ Verbose logging // ✅ Verbose logging
@ -38,7 +38,7 @@ const brain = new BrainyData(PresetName.DEVELOPMENT)
#### Production #### Production
```typescript ```typescript
const brain = new BrainyData(PresetName.PRODUCTION) const brain = new Brainy(PresetName.PRODUCTION)
// ✅ Disk storage for persistence // ✅ Disk storage for persistence
// ✅ Auto-selected model precision // ✅ Auto-selected model precision
// ✅ Silent logging // ✅ Silent logging
@ -47,7 +47,7 @@ const brain = new BrainyData(PresetName.PRODUCTION)
#### Minimal #### Minimal
```typescript ```typescript
const brain = new BrainyData(PresetName.MINIMAL) const brain = new Brainy(PresetName.MINIMAL)
// ✅ Memory storage // ✅ Memory storage
// ✅ Q8 models for small size // ✅ Q8 models for small size
// ✅ Core features only // ✅ Core features only
@ -60,16 +60,16 @@ Brainy includes specialized presets for distributed and microservice architectur
### Basic Distributed Roles ### Basic Distributed Roles
```typescript ```typescript
import { BrainyData, PresetName } from '@soulcraft/brainy' import { Brainy, PresetName } from '@soulcraft/brainy'
// Write-only instance (data ingestion) // Write-only instance (data ingestion)
const writer = new BrainyData(PresetName.WRITER) const writer = new Brainy(PresetName.WRITER)
// ✅ Optimized for writes // ✅ Optimized for writes
// ✅ No search index loading // ✅ No search index loading
// ✅ Minimal memory usage // ✅ Minimal memory usage
// Read-only instance (search API) // Read-only instance (search API)
const reader = new BrainyData(PresetName.READER) const reader = new Brainy(PresetName.READER)
// ✅ Optimized for search // ✅ Optimized for search
// ✅ Lazy index loading // ✅ Lazy index loading
// ✅ Large cache // ✅ Large cache
@ -78,28 +78,28 @@ const reader = new BrainyData(PresetName.READER)
### Service-Specific Presets ### Service-Specific Presets
```typescript ```typescript
// High-throughput data ingestion // High-throughput data ingestion
const ingestion = new BrainyData(PresetName.INGESTION_SERVICE) const ingestion = new Brainy(PresetName.INGESTION_SERVICE)
// Low-latency search API // Low-latency search API
const searchApi = new BrainyData(PresetName.SEARCH_API) const searchApi = new Brainy(PresetName.SEARCH_API)
// Analytics processing // Analytics processing
const analytics = new BrainyData(PresetName.ANALYTICS_SERVICE) const analytics = new Brainy(PresetName.ANALYTICS_SERVICE)
// Edge location cache // Edge location cache
const edge = new BrainyData(PresetName.EDGE_CACHE) const edge = new Brainy(PresetName.EDGE_CACHE)
// Batch processing // Batch processing
const batch = new BrainyData(PresetName.BATCH_PROCESSOR) const batch = new Brainy(PresetName.BATCH_PROCESSOR)
// Real-time streaming // Real-time streaming
const streaming = new BrainyData(PresetName.STREAMING_SERVICE) const streaming = new Brainy(PresetName.STREAMING_SERVICE)
// ML training // ML training
const training = new BrainyData(PresetName.ML_TRAINING) const training = new Brainy(PresetName.ML_TRAINING)
// Lightweight sidecar // Lightweight sidecar
const sidecar = new BrainyData(PresetName.SIDECAR) const sidecar = new Brainy(PresetName.SIDECAR)
``` ```
## Model Precision Control ## Model Precision Control
@ -110,17 +110,17 @@ You can **explicitly specify** model precision when needed:
import { ModelPrecision } from '@soulcraft/brainy' import { ModelPrecision } from '@soulcraft/brainy'
// Force FP32 (full precision) // Force FP32 (full precision)
const brain = new BrainyData({ model: ModelPrecision.FP32 }) const brain = new Brainy({ model: ModelPrecision.FP32 })
// Force Q8 (quantized, smaller) // Force Q8 (quantized, smaller)
const brain = new BrainyData({ model: ModelPrecision.Q8 }) const brain = new Brainy({ model: ModelPrecision.Q8 })
// Use presets // Use presets
const brain = new BrainyData({ model: ModelPrecision.FAST }) // Maps to fp32 const brain = new Brainy({ model: ModelPrecision.FAST }) // Maps to fp32
const brain = new BrainyData({ model: ModelPrecision.SMALL }) // Maps to q8 const brain = new Brainy({ model: ModelPrecision.SMALL }) // Maps to q8
// Auto-detection (default) // Auto-detection (default)
const brain = new BrainyData({ model: ModelPrecision.AUTO }) const brain = new Brainy({ model: ModelPrecision.AUTO })
``` ```
### Auto-Detection Logic ### Auto-Detection Logic
@ -159,13 +159,13 @@ Brainy automatically detects the best storage option:
import { StorageOption } from '@soulcraft/brainy' import { StorageOption } from '@soulcraft/brainy'
// Force specific storage with enum // Force specific storage with enum
const brain = new BrainyData({ storage: StorageOption.MEMORY }) const brain = new Brainy({ storage: StorageOption.MEMORY })
const brain = new BrainyData({ storage: StorageOption.DISK }) const brain = new Brainy({ storage: StorageOption.DISK })
const brain = new BrainyData({ storage: StorageOption.CLOUD }) const brain = new Brainy({ storage: StorageOption.CLOUD })
const brain = new BrainyData({ storage: StorageOption.AUTO }) const brain = new Brainy({ storage: StorageOption.AUTO })
// Custom storage configuration // Custom storage configuration
const brain = new BrainyData({ const brain = new Brainy({
storage: { storage: {
s3Storage: { s3Storage: {
bucket: 'my-bucket', bucket: 'my-bucket',
@ -183,12 +183,12 @@ Control which features are enabled:
import { FeatureSet } from '@soulcraft/brainy' import { FeatureSet } from '@soulcraft/brainy'
// Preset feature sets with enum // Preset feature sets with enum
const brain = new BrainyData({ features: FeatureSet.MINIMAL }) // Core only const brain = new Brainy({ features: FeatureSet.MINIMAL }) // Core only
const brain = new BrainyData({ features: FeatureSet.DEFAULT }) // Balanced const brain = new Brainy({ features: FeatureSet.DEFAULT }) // Balanced
const brain = new BrainyData({ features: FeatureSet.FULL }) // Everything const brain = new Brainy({ features: FeatureSet.FULL }) // Everything
// Custom features // Custom features
const brain = new BrainyData({ const brain = new Brainy({
features: ['core', 'search', 'cache', 'triple-intelligence'] features: ['core', 'search', 'cache', 'triple-intelligence']
}) })
``` ```
@ -274,14 +274,14 @@ When multiple Brainy instances connect to the same storage (like S3), you **must
import { ModelPrecision } from '@soulcraft/brainy' import { ModelPrecision } from '@soulcraft/brainy'
// Container A - Writer // Container A - Writer
const writer = new BrainyData({ const writer = new Brainy({
mode: PresetName.WRITER, mode: PresetName.WRITER,
model: ModelPrecision.FP32, // ⚠️ MUST match across instances! model: ModelPrecision.FP32, // ⚠️ MUST match across instances!
storage: { s3Storage: { bucket: 'shared-data' }} storage: { s3Storage: { bucket: 'shared-data' }}
}) })
// Container B - Reader // Container B - Reader
const reader = new BrainyData({ const reader = new Brainy({
mode: PresetName.READER, mode: PresetName.READER,
model: ModelPrecision.FP32, // ✅ Matches Container A model: ModelPrecision.FP32, // ✅ Matches Container A
storage: { s3Storage: { bucket: 'shared-data' }} storage: { s3Storage: { bucket: 'shared-data' }}
@ -292,21 +292,21 @@ const reader = new BrainyData({
```typescript ```typescript
// Ingestion Service (Writer) // Ingestion Service (Writer)
const ingestion = new BrainyData({ const ingestion = new Brainy({
mode: PresetName.INGESTION_SERVICE, mode: PresetName.INGESTION_SERVICE,
model: ModelPrecision.Q8, // All instances must use Q8 model: ModelPrecision.Q8, // All instances must use Q8
storage: { s3Storage: { bucket: 'production-data' }} storage: { s3Storage: { bucket: 'production-data' }}
}) })
// Search API (Reader) // Search API (Reader)
const search = new BrainyData({ const search = new Brainy({
mode: PresetName.SEARCH_API, mode: PresetName.SEARCH_API,
model: ModelPrecision.Q8, // Matches ingestion service model: ModelPrecision.Q8, // Matches ingestion service
storage: { s3Storage: { bucket: 'production-data' }} storage: { s3Storage: { bucket: 'production-data' }}
}) })
// Analytics (Hybrid) // Analytics (Hybrid)
const analytics = new BrainyData({ const analytics = new Brainy({
mode: PresetName.ANALYTICS_SERVICE, mode: PresetName.ANALYTICS_SERVICE,
model: ModelPrecision.Q8, // Matches other services model: ModelPrecision.Q8, // Matches other services
storage: { s3Storage: { bucket: 'production-data' }} storage: { s3Storage: { bucket: 'production-data' }}
@ -317,7 +317,7 @@ const analytics = new BrainyData({
### Before (Complex) ### Before (Complex)
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
hnsw: { hnsw: {
M: 16, M: 16,
efConstruction: 200, efConstruction: 200,
@ -350,7 +350,7 @@ const brain = new BrainyData({
### After (Simple) ### After (Simple)
```typescript ```typescript
const brain = new BrainyData('production') const brain = new Brainy('production')
// Everything above is auto-configured! // Everything above is auto-configured!
``` ```

View file

@ -9,12 +9,12 @@
#### **1. Constructor & Initialization** #### **1. Constructor & Initialization**
```typescript ```typescript
// Clean, consistent initialization // Clean, consistent initialization
const brain = new BrainyData(config?) const brain = new Brainy(config?)
await brain.init() // Always required await brain.init() // Always required
// Storage auto-detection works seamlessly // Storage auto-detection works seamlessly
const brain = new BrainyData({ storage: { forceMemoryStorage: true } }) const brain = new Brainy({ storage: { forceMemoryStorage: true } })
const brain = new BrainyData({ storage: { path: './my-data' } }) const brain = new Brainy({ storage: { path: './my-data' } })
``` ```
#### **2. Data Operations (CRUD)** #### **2. Data Operations (CRUD)**
@ -135,7 +135,7 @@ brain.storage.vacuum()
#### **1. Beginner Flow (Simple & Intuitive)** #### **1. Beginner Flow (Simple & Intuitive)**
```typescript ```typescript
// Dead simple - just works // Dead simple - just works
const brain = new BrainyData() const brain = new Brainy()
await brain.init() await brain.init()
await brain.add('My first document', { nounType: NounType.Document }) await brain.add('My first document', { nounType: NounType.Document })
@ -147,7 +147,7 @@ const groups = await brain.clusters()
#### **2. Intermediate Flow (More Control)** #### **2. Intermediate Flow (More Control)**
```typescript ```typescript
// Add configuration and options // Add configuration and options
const brain = new BrainyData({ const brain = new Brainy({
storage: { path: './my-brainy-db' }, storage: { path: './my-brainy-db' },
neural: { cacheSize: 5000 } neural: { cacheSize: 5000 }
}) })
@ -267,9 +267,9 @@ try {
### **✅ 4. Type Safety** ### **✅ 4. Type Safety**
```typescript ```typescript
// Excellent TypeScript support // Excellent TypeScript support
import { BrainyData, NounType, VerbType } from '@soulcraft/brainy' import { Brainy, NounType, VerbType } from '@soulcraft/brainy'
const brain = new BrainyData() const brain = new Brainy()
await brain.add('content', { nounType: NounType.Document, title: 'My Doc' }) await brain.add('content', { nounType: NounType.Document, title: 'My Doc' })
// ^^^^^^^^^^^^^^^^ // IDE autocomplete! // ^^^^^^^^^^^^^^^^ // IDE autocomplete!
``` ```
@ -277,10 +277,10 @@ await brain.add('content', { nounType: NounType.Document, title: 'My Doc' })
### **✅ 5. Flexible Configuration** ### **✅ 5. Flexible Configuration**
```typescript ```typescript
// Zero-config (just works) // Zero-config (just works)
const brain = new BrainyData() const brain = new Brainy()
// Full control when needed // Full control when needed
const brain = new BrainyData({ const brain = new Brainy({
storage: { storage: {
adapter: 'file', adapter: 'file',
path: './my-data', path: './my-data',

View file

@ -6,9 +6,9 @@
## Quick Start ## Quick Start
```typescript ```typescript
import { BrainyData } from '@soulcraft/brainy' import { Brainy } from '@soulcraft/brainy'
const brain = new BrainyData() // Zero config! const brain = new Brainy() // Zero config!
await brain.init() await brain.init()
// Add data (text auto-embeds!) // Add data (text auto-embeds!)
@ -248,7 +248,7 @@ Train the relationship scoring model:
#### Initialization #### Initialization
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
storage: 'auto', // auto | memory | filesystem | s3 storage: 'auto', // auto | memory | filesystem | s3
dimensions: 384, // Vector dimensions dimensions: 384, // Vector dimensions
cache: true, // Enable caching cache: true, // Enable caching
@ -264,8 +264,8 @@ await brain.shutdown() // Graceful shutdown
``` ```
#### Static Methods #### Static Methods
- `BrainyData.preloadModel()` - Preload ML model - `Brainy.preloadModel()` - Preload ML model
- `BrainyData.warmup()` - Warmup system - `Brainy.warmup()` - Warmup system
--- ---

View file

@ -4,7 +4,7 @@
### **Main Class Shortcuts (Simple & Common)** ### **Main Class Shortcuts (Simple & Common)**
```typescript ```typescript
// High-level shortcuts on BrainyData - most common operations // High-level shortcuts on Brainy - most common operations
brain.similar(a, b, options?) // ✅ Keep - very common brain.similar(a, b, options?) // ✅ Keep - very common
brain.clusters(items?, options?) // ✅ Keep - very common brain.clusters(items?, options?) // ✅ Keep - very common
brain.related(id, options?) // ✅ Keep - common (like neighbors but simpler name) brain.related(id, options?) // ✅ Keep - common (like neighbors but simpler name)
@ -162,7 +162,7 @@ const streamingClusters = brain.neural.clusterStream({ batchSize: 50 })
### **High Priority:** ### **High Priority:**
- [x] Create comprehensive type definitions - [x] Create comprehensive type definitions
- [x] Implement improved NeuralAPI class with proper public/private separation - [x] Implement improved NeuralAPI class with proper public/private separation
- [ ] Update BrainyData integration to use improved API - [ ] Update Brainy integration to use improved API
- [ ] Fix brain-cloud explorer to use public APIs - [ ] Fix brain-cloud explorer to use public APIs
- [ ] Update test files to use consistent method names - [ ] Update test files to use consistent method names
- [ ] Update documentation with new API structure - [ ] Update documentation with new API structure

View file

@ -37,7 +37,7 @@ brain.augmentations.register(augmentation)
### 4. Auto-Configuration ✅ ### 4. Auto-Configuration ✅
```typescript ```typescript
new BrainyData({ new Brainy({
cache: true, // Auto-registers CacheAugmentation cache: true, // Auto-registers CacheAugmentation
index: true, // Auto-registers IndexAugmentation index: true, // Auto-registers IndexAugmentation
storage: 's3' // Auto-registers S3StorageAugmentation storage: 's3' // Auto-registers S3StorageAugmentation

View file

@ -241,7 +241,7 @@ const cacheConfig = await getCacheAutoConfig()
### Enable Distributed Modes ### Enable Distributed Modes
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
mode: 'reader', // or 'writer' or 'hybrid' mode: 'reader', // or 'writer' or 'hybrid'
distributed: { distributed: {
role: 'reader', role: 'reader',
@ -253,7 +253,7 @@ const brain = new BrainyData({
### Use Neural Import ### Use Neural Import
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
augmentations: [ augmentations: [
new NeuralImportAugmentation({ new NeuralImportAugmentation({
confidenceThreshold: 0.7, confidenceThreshold: 0.7,

View file

@ -15,7 +15,7 @@ High-performance deduplication for streaming data ingestion.
```typescript ```typescript
import { EntityRegistryAugmentation } from 'brainy' import { EntityRegistryAugmentation } from 'brainy'
const brain = new BrainyData({ const brain = new Brainy({
augmentations: [ augmentations: [
new EntityRegistryAugmentation({ new EntityRegistryAugmentation({
maxCacheSize: 100000, // Track up to 100k unique entities maxCacheSize: 100000, // Track up to 100k unique entities
@ -41,7 +41,7 @@ Enterprise-grade durability and crash recovery.
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
augmentations: [ augmentations: [
checkpointInterval: 1000, // Checkpoint every 1000 operations checkpointInterval: 1000, // Checkpoint every 1000 operations
compression: true, // Enable log compression compression: true, // Enable log compression
@ -53,7 +53,7 @@ const brain = new BrainyData({
// All operations are now durably logged // All operations are now durably logged
// Recover from crash // Recover from crash
const recovered = new BrainyData({ const recovered = new Brainy({
}) })
``` ```
@ -71,7 +71,7 @@ AI-powered relationship strength calculation.
```typescript ```typescript
import { IntelligentVerbScoringAugmentation } from 'brainy' import { IntelligentVerbScoringAugmentation } from 'brainy'
const brain = new BrainyData({ const brain = new Brainy({
augmentations: [ augmentations: [
new IntelligentVerbScoringAugmentation({ new IntelligentVerbScoringAugmentation({
factors: { factors: {
@ -111,7 +111,7 @@ Automatically extracts and registers entities from text.
```typescript ```typescript
import { AutoRegisterEntitiesAugmentation } from 'brainy' import { AutoRegisterEntitiesAugmentation } from 'brainy'
const brain = new BrainyData({ const brain = new Brainy({
augmentations: [ augmentations: [
new AutoRegisterEntitiesAugmentation({ new AutoRegisterEntitiesAugmentation({
types: ['person', 'organization', 'location', 'product'], types: ['person', 'organization', 'location', 'product'],
@ -147,7 +147,7 @@ Optimizes bulk operations for maximum throughput.
```typescript ```typescript
import { BatchProcessingAugmentation } from 'brainy' import { BatchProcessingAugmentation } from 'brainy'
const brain = new BrainyData({ const brain = new Brainy({
augmentations: [ augmentations: [
new BatchProcessingAugmentation({ new BatchProcessingAugmentation({
batchSize: 100, batchSize: 100,
@ -178,7 +178,7 @@ Intelligent multi-level caching system.
```typescript ```typescript
import { CachingAugmentation } from 'brainy' import { CachingAugmentation } from 'brainy'
const brain = new BrainyData({ const brain = new Brainy({
augmentations: [ augmentations: [
new CachingAugmentation({ new CachingAugmentation({
levels: { levels: {
@ -211,7 +211,7 @@ Reduces storage size while maintaining query performance.
```typescript ```typescript
import { CompressionAugmentation } from 'brainy' import { CompressionAugmentation } from 'brainy'
const brain = new BrainyData({ const brain = new Brainy({
augmentations: [ augmentations: [
new CompressionAugmentation({ new CompressionAugmentation({
algorithm: 'brotli', algorithm: 'brotli',
@ -240,7 +240,7 @@ Real-time performance monitoring and metrics.
```typescript ```typescript
import { MonitoringAugmentation } from 'brainy' import { MonitoringAugmentation } from 'brainy'
const brain = new BrainyData({ const brain = new Brainy({
augmentations: [ augmentations: [
new MonitoringAugmentation({ new MonitoringAugmentation({
metrics: ['operations', 'latency', 'cache', 'memory'], metrics: ['operations', 'latency', 'cache', 'memory'],
@ -279,7 +279,7 @@ brain.on('metrics', (metrics) => {
```typescript ```typescript
import { NeuralImportAugmentation } from 'brainy' import { NeuralImportAugmentation } from 'brainy'
const brain = new BrainyData({ const brain = new Brainy({
augmentations: [ augmentations: [
new NeuralImportAugmentation({ new NeuralImportAugmentation({
autoStructure: true, autoStructure: true,
@ -375,7 +375,7 @@ import { Augmentation } from 'brainy'
class CustomAugmentation extends Augmentation { class CustomAugmentation extends Augmentation {
name = 'CustomAugmentation' name = 'CustomAugmentation'
async onInit(brain: BrainyData): Promise<void> { async onInit(brain: Brainy): Promise<void> {
// Initialize augmentation // Initialize augmentation
console.log('Custom augmentation initialized') console.log('Custom augmentation initialized')
} }
@ -408,7 +408,7 @@ class CustomAugmentation extends Augmentation {
} }
// Use custom augmentation // Use custom augmentation
const brain = new BrainyData({ const brain = new Brainy({
augmentations: [new CustomAugmentation()] augmentations: [new CustomAugmentation()]
}) })
``` ```
@ -420,7 +420,7 @@ const brain = new BrainyData({
```typescript ```typescript
interface AugmentationHooks { interface AugmentationHooks {
// Initialization // Initialization
onInit(brain: BrainyData): Promise<void> onInit(brain: Brainy): Promise<void>
onShutdown(): Promise<void> onShutdown(): Promise<void>
// Noun operations // Noun operations
@ -459,7 +459,7 @@ interface AugmentationHooks {
```typescript ```typescript
// Combine multiple augmentations // Combine multiple augmentations
const brain = new BrainyData({ const brain = new Brainy({
augmentations: [ augmentations: [
// Order matters - executed in sequence // Order matters - executed in sequence
new EntityRegistryAugmentation(), // Deduplication first new EntityRegistryAugmentation(), // Deduplication first

View file

@ -41,8 +41,8 @@ const data = await brain1.export()
await brain2.import(data) await brain2.import(data)
// Or sync between different storage backends // Or sync between different storage backends
const cloudBrain = new BrainyData({ storage: 's3' }) const cloudBrain = new Brainy({ storage: 's3' })
const localBrain = new BrainyData({ storage: 'filesystem' }) const localBrain = new Brainy({ storage: 'filesystem' })
await cloudBrain.sync(localBrain) // Types match perfectly await cloudBrain.sync(localBrain) // Types match perfectly
``` ```

View file

@ -4,7 +4,7 @@ Brainy is a multi-dimensional AI database that combines vector similarity, graph
## Core Components ## Core Components
### BrainyData (Main Entry Point) ### Brainy (Main Entry Point)
The central orchestrator that manages all subsystems: The central orchestrator that manages all subsystems:
- **HNSW Index**: O(log n) vector similarity search - **HNSW Index**: O(log n) vector similarity search
- **Storage System**: Universal storage adapters (FileSystem, S3, OPFS, Memory) - **Storage System**: Universal storage adapters (FileSystem, S3, OPFS, Memory)
@ -90,11 +90,11 @@ Brainy's extensible plugin architecture allows for powerful enhancements:
### Creating Custom Augmentations ### Creating Custom Augmentations
```typescript ```typescript
class CustomAugmentation extends BrainyAugmentation { class CustomAugmentation extends BrainyAugmentation {
async onInit(brain: BrainyData): Promise<void> { async onInit(brain: Brainy): Promise<void> {
// Initialize augmentation // Initialize augmentation
} }
async onAdd(item: any, brain: BrainyData): Promise<any> { async onAdd(item: any, brain: Brainy): Promise<any> {
// Process item before adding // Process item before adding
return item return item
} }

View file

@ -27,7 +27,7 @@ Brainy provides multiple storage adapters with identical APIs:
### FileSystem Storage (Node.js) ### FileSystem Storage (Node.js)
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
storage: { storage: {
type: 'filesystem', type: 'filesystem',
path: './data' path: './data'
@ -40,7 +40,7 @@ const brain = new BrainyData({
### S3 Compatible Storage ### S3 Compatible Storage
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
storage: { storage: {
type: 's3', type: 's3',
bucket: 'my-brainy-data', bucket: 'my-brainy-data',
@ -58,7 +58,7 @@ const brain = new BrainyData({
### Origin Private File System (Browser) ### Origin Private File System (Browser)
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
storage: { storage: {
type: 'opfs' type: 'opfs'
} }
@ -70,7 +70,7 @@ const brain = new BrainyData({
### Memory Storage ### Memory Storage
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
storage: { storage: {
type: 'memory' type: 'memory'
} }
@ -172,7 +172,7 @@ Ensures durability and enables recovery:
### Caching Strategy ### Caching Strategy
```typescript ```typescript
// Configure caching per storage type // Configure caching per storage type
const brain = new BrainyData({ const brain = new Brainy({
storage: { storage: {
type: 'filesystem', type: 'filesystem',
cache: { cache: {
@ -236,8 +236,8 @@ await brain.import(backup, {
### Storage Migration ### Storage Migration
```typescript ```typescript
// Migrate between storage types // Migrate between storage types
const oldBrain = new BrainyData({ storage: { type: 'filesystem' } }) const oldBrain = new Brainy({ storage: { type: 'filesystem' } })
const newBrain = new BrainyData({ storage: { type: 's3' } }) const newBrain = new Brainy({ storage: { type: 's3' } })
await oldBrain.init() await oldBrain.init()
await newBrain.init() await newBrain.init()

View file

@ -11,10 +11,10 @@ Brainy is designed with **"Zero Config by Default, Infinite Tunability"** philos
### Instant Start ### Instant Start
```typescript ```typescript
import { BrainyData } from 'brainy' import { Brainy } from 'brainy'
// That's it. No config needed. // That's it. No config needed.
const brain = new BrainyData() const brain = new Brainy()
await brain.init() await brain.init()
// Brainy automatically: // Brainy automatically:
@ -100,7 +100,7 @@ Brainy seamlessly migrates between storage types:
```typescript ```typescript
// Start with memory storage (development) // Start with memory storage (development)
const brain = new BrainyData() // Auto-selects memory const brain = new Brainy() // Auto-selects memory
// Later, migrate to production storage // Later, migrate to production storage
await brain.migrate({ await brain.migrate({
@ -292,7 +292,7 @@ Models are automatically downloaded when needed:
```typescript ```typescript
// First use - model auto-downloads // First use - model auto-downloads
const brain = new BrainyData() const brain = new Brainy()
await brain.init() // Downloads model if not cached await brain.init() // Downloads model if not cached
// Intelligent model caching // Intelligent model caching
@ -705,7 +705,7 @@ While zero-config is default, you can override when needed:
```typescript ```typescript
// Explicit configuration when needed // Explicit configuration when needed
const brain = new BrainyData({ const brain = new Brainy({
// Override auto-detection // Override auto-detection
storage: { storage: {
type: 'filesystem', type: 'filesystem',

View file

@ -5,9 +5,9 @@
## Quick Start ## Quick Start
```typescript ```typescript
import { BrainyData } from '@soulcraft/brainy' import { Brainy } from '@soulcraft/brainy'
const brain = new BrainyData({ const brain = new Brainy({
// Augmentations auto-configure based on environment // Augmentations auto-configure based on environment
storage: 'auto', // Storage augmentation storage: 'auto', // Storage augmentation
cache: true, // Cache augmentation cache: true, // Cache augmentation
@ -40,7 +40,7 @@ Augmentations are modular extensions that add functionality to Brainy without cl
**Auto-enabled**: When `storage: 'memory'` or in test environments **Auto-enabled**: When `storage: 'memory'` or in test environments
**Purpose**: In-memory storage for testing and temporary data **Purpose**: In-memory storage for testing and temporary data
```typescript ```typescript
const brain = new BrainyData({ storage: 'memory' }) const brain = new Brainy({ storage: 'memory' })
``` ```
### FileSystemStorageAugmentation ### FileSystemStorageAugmentation
@ -48,7 +48,7 @@ const brain = new BrainyData({ storage: 'memory' })
**Auto-enabled**: When `storage: 'filesystem'` or Node.js detected **Auto-enabled**: When `storage: 'filesystem'` or Node.js detected
**Purpose**: Persistent file-based storage for Node.js applications **Purpose**: Persistent file-based storage for Node.js applications
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
storage: { type: 'filesystem', path: './data' } storage: { type: 'filesystem', path: './data' }
}) })
``` ```
@ -58,7 +58,7 @@ const brain = new BrainyData({
**Auto-enabled**: When `storage: 'opfs'` or browser with OPFS support **Auto-enabled**: When `storage: 'opfs'` or browser with OPFS support
**Purpose**: Browser-based persistent storage using Origin Private File System **Purpose**: Browser-based persistent storage using Origin Private File System
```typescript ```typescript
const brain = new BrainyData({ storage: 'opfs' }) const brain = new Brainy({ storage: 'opfs' })
``` ```
### S3StorageAugmentation ### S3StorageAugmentation
@ -66,7 +66,7 @@ const brain = new BrainyData({ storage: 'opfs' })
**Manual**: Requires AWS credentials **Manual**: Requires AWS credentials
**Purpose**: AWS S3-compatible cloud storage **Purpose**: AWS S3-compatible cloud storage
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
storage: { storage: {
type: 's3', type: 's3',
bucket: 'my-bucket', bucket: 'my-bucket',
@ -81,7 +81,7 @@ const brain = new BrainyData({
**Manual**: Requires Cloudflare credentials **Manual**: Requires Cloudflare credentials
**Purpose**: Cloudflare R2 storage (S3-compatible) **Purpose**: Cloudflare R2 storage (S3-compatible)
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
storage: { storage: {
type: 'r2', type: 'r2',
accountId: 'xxx', accountId: 'xxx',
@ -96,7 +96,7 @@ const brain = new BrainyData({
**Manual**: Requires Google Cloud credentials **Manual**: Requires Google Cloud credentials
**Purpose**: Google Cloud Storage **Purpose**: Google Cloud Storage
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
storage: { storage: {
type: 'gcs', type: 'gcs',
bucket: 'my-bucket', bucket: 'my-bucket',
@ -174,7 +174,7 @@ brain.addNouns([...]) // Automatically batched
**Auto-enabled**: When `wal: true` **Auto-enabled**: When `wal: true`
**Purpose**: Write-ahead logging for crash recovery **Purpose**: Write-ahead logging for crash recovery
```typescript ```typescript
const brain = new BrainyData({ wal: true }) const brain = new Brainy({ wal: true })
// Automatic recovery on restart after crash // Automatic recovery on restart after crash
``` ```
@ -275,7 +275,7 @@ class NotionSynapse extends SynapseAugmentation {
### Auto-Configuration ### Auto-Configuration
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
// These auto-register augmentations: // These auto-register augmentations:
storage: 'auto', // Storage augmentation storage: 'auto', // Storage augmentation
cache: true, // Cache augmentation cache: true, // Cache augmentation
@ -286,7 +286,7 @@ const brain = new BrainyData({
### Manual Registration ### Manual Registration
```typescript ```typescript
const brain = new BrainyData() const brain = new Brainy()
// Register before init() // Register before init()
const customAug = new MyCustomAugmentation() const customAug = new MyCustomAugmentation()
@ -347,7 +347,7 @@ class MyAugmentation extends BaseAugmentation {
### Where Augmentations Hook In ### Where Augmentations Hook In
**BrainyData Constructor**: **Brainy Constructor**:
- Storage augmentations register based on config - Storage augmentations register based on config
- Cache/Index augmentations auto-register if enabled - Cache/Index augmentations auto-register if enabled

View file

@ -24,10 +24,10 @@ The Brainy Augmentation Configuration System provides a VSCode-style extension a
### Using an Augmentation with Configuration ### Using an Augmentation with Configuration
```typescript ```typescript
import { BrainyData } from '@soulcraft/brainy' import { Brainy } from '@soulcraft/brainy'
// Zero-config (uses defaults) // Zero-config (uses defaults)
const brain = new BrainyData() const brain = new Brainy()
// With custom configuration // With custom configuration
immediateWrites: true, immediateWrites: true,

View file

@ -42,10 +42,10 @@ export class MyFirstAugmentation extends BaseAugmentation {
## Using Your Augmentation ## Using Your Augmentation
```typescript ```typescript
import { BrainyData } from '@soulcraft/brainy' import { Brainy } from '@soulcraft/brainy'
import { MyFirstAugmentation } from './my-first-augmentation' import { MyFirstAugmentation } from './my-first-augmentation'
const brain = new BrainyData() const brain = new Brainy()
// Register before init() // Register before init()
brain.augmentations.register(new MyFirstAugmentation()) brain.augmentations.register(new MyFirstAugmentation())
@ -301,12 +301,12 @@ class EncryptionAugmentation extends BaseAugmentation {
```typescript ```typescript
import { describe, it, expect } from 'vitest' import { describe, it, expect } from 'vitest'
import { BrainyData } from '@soulcraft/brainy' import { Brainy } from '@soulcraft/brainy'
import { MyAugmentation } from './my-augmentation' import { MyAugmentation } from './my-augmentation'
describe('MyAugmentation', () => { describe('MyAugmentation', () => {
it('should hook into addNoun', async () => { it('should hook into addNoun', async () => {
const brain = new BrainyData({ storage: 'memory' }) const brain = new Brainy({ storage: 'memory' })
const aug = new MyAugmentation() const aug = new MyAugmentation()
// Spy on the execute method // Spy on the execute method

View file

@ -116,7 +116,7 @@ Visual representations of data.
### Zero-Config Approach ### Zero-Config Approach
```typescript ```typescript
const brain = new BrainyData() const brain = new Brainy()
// Just register augmentations - they work automatically! // Just register augmentations - they work automatically!
brain.augmentations.register(new EntityRegistryAugmentation()) brain.augmentations.register(new EntityRegistryAugmentation())
@ -128,7 +128,7 @@ await brain.init()
### With Configuration ### With Configuration
```typescript ```typescript
const brain = new BrainyData() const brain = new Brainy()
brain.augmentations.register( brain.augmentations.register(
new APIServerAugmentation({ new APIServerAugmentation({

View file

@ -33,10 +33,10 @@ npm install express cors ws
## Zero-Config Usage ## Zero-Config Usage
```typescript ```typescript
import { BrainyData } from 'brainy' import { Brainy } from 'brainy'
import { APIServerAugmentation } from 'brainy/augmentations' import { APIServerAugmentation } from 'brainy/augmentations'
const brain = new BrainyData() const brain = new Brainy()
// Register the API server augmentation // Register the API server augmentation
brain.augmentations.register(new APIServerAugmentation()) brain.augmentations.register(new APIServerAugmentation())
@ -281,7 +281,7 @@ The APIServerAugmentation hooks into Brainy's augmentation pipeline:
```typescript ```typescript
// Server // Server
const brain = new BrainyData() const brain = new Brainy()
brain.augmentations.register(new APIServerAugmentation()) brain.augmentations.register(new APIServerAugmentation())
await brain.init() await brain.init()
@ -357,7 +357,7 @@ class FilteredAPIServer extends APIServerAugmentation {
### Integration with Other Augmentations ### Integration with Other Augmentations
```typescript ```typescript
const brain = new BrainyData() const brain = new Brainy()
// Stack augmentations for complete system // Stack augmentations for complete system
brain.augmentations.register(new EntityRegistryAugmentation()) // Dedup brain.augmentations.register(new EntityRegistryAugmentation()) // Dedup

View file

@ -137,7 +137,7 @@ await neuralImport.generateInsights(data)
Brainy automatically loads models with ZERO configuration required: Brainy automatically loads models with ZERO configuration required:
```typescript ```typescript
const brain = new BrainyData() // That's it! const brain = new Brainy() // That's it!
await brain.init() await brain.init()
// Models load automatically from best available source // Models load automatically from best available source
``` ```
@ -159,7 +159,7 @@ await brain.init()
### Reader Mode ✅ ### Reader Mode ✅
```typescript ```typescript
const brain = new BrainyData({ mode: 'reader' }) const brain = new Brainy({ mode: 'reader' })
// Optimized for read-heavy workloads // Optimized for read-heavy workloads
// 80% cache ratio, aggressive prefetch // 80% cache ratio, aggressive prefetch
// 1 hour TTL, minimal writes // 1 hour TTL, minimal writes
@ -167,7 +167,7 @@ const brain = new BrainyData({ mode: 'reader' })
### Writer Mode ✅ ### Writer Mode ✅
```typescript ```typescript
const brain = new BrainyData({ mode: 'writer' }) const brain = new Brainy({ mode: 'writer' })
// Optimized for write-heavy workloads // Optimized for write-heavy workloads
// Large write buffers, batch writes // Large write buffers, batch writes
// Minimal caching, fast ingestion // Minimal caching, fast ingestion
@ -175,7 +175,7 @@ const brain = new BrainyData({ mode: 'writer' })
### Hybrid Mode ✅ ### Hybrid Mode ✅
```typescript ```typescript
const brain = new BrainyData({ mode: 'hybrid' }) const brain = new Brainy({ mode: 'hybrid' })
// Balanced for mixed workloads // Balanced for mixed workloads
// Adaptive caching and batching // Adaptive caching and batching
``` ```
@ -346,7 +346,7 @@ import { crypto } from 'brainy/utils'
### 1. Zero Configuration ### 1. Zero Configuration
```typescript ```typescript
const brain = new BrainyData() const brain = new Brainy()
await brain.init() await brain.init()
// Everything else is automatic! // Everything else is automatic!
``` ```
@ -384,10 +384,10 @@ await brain.init()
## 🚀 Quick Start ## 🚀 Quick Start
```typescript ```typescript
import { BrainyData } from 'brainy' import { Brainy } from 'brainy'
// Zero config required! // Zero config required!
const brain = new BrainyData() const brain = new Brainy()
await brain.init() await brain.init()
// Add data (auto-detects type) // Add data (auto-detects type)

View file

@ -21,7 +21,7 @@ Enterprise features on our roadmap.
**Everyone gets bank-level security features:** **Everyone gets bank-level security features:**
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
security: { security: {
encryption: 'aes-256-gcm', // Military-grade encryption encryption: 'aes-256-gcm', // Military-grade encryption
keyRotation: true, // Automatic key rotation keyRotation: true, // Automatic key rotation
@ -47,7 +47,7 @@ const brain = new BrainyData({
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
augmentations: [ augmentations: [
enabled: true, // Write-ahead logging enabled: true, // Write-ahead logging
redundancy: 3, // Triple redundancy redundancy: 3, // Triple redundancy
@ -102,7 +102,7 @@ const performance = {
```typescript ```typescript
import { MonitoringAugmentation } from 'brainy' import { MonitoringAugmentation } from 'brainy'
const brain = new BrainyData({ const brain = new Brainy({
augmentations: [ augmentations: [
new MonitoringAugmentation({ new MonitoringAugmentation({
metrics: 'all', // Complete metrics metrics: 'all', // Complete metrics
@ -171,7 +171,7 @@ await brain.syncWith({
```typescript ```typescript
// Same architecture Netflix uses, free for you // Same architecture Netflix uses, free for you
const brain = new BrainyData({ const brain = new Brainy({
clustering: { clustering: {
enabled: true, // Distributed mode enabled: true, // Distributed mode
sharding: 'automatic', // Auto-sharding sharding: 'automatic', // Auto-sharding
@ -197,7 +197,7 @@ const brain = new BrainyData({
**Everyone gets compliance tools:** **Everyone gets compliance tools:**
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
compliance: { compliance: {
gdpr: { gdpr: {
rightToDelete: true, // Automatic PII deletion rightToDelete: true, // Automatic PII deletion
@ -235,7 +235,7 @@ const brain = new BrainyData({
```typescript ```typescript
// Advanced AI capabilities for everyone // Advanced AI capabilities for everyone
const brain = new BrainyData({ const brain = new Brainy({
ai: { ai: {
embeddings: 'state-of-the-art', // Best models available embeddings: 'state-of-the-art', // Best models available
dimensions: 1536, // High-precision vectors dimensions: 1536, // High-precision vectors
@ -267,7 +267,7 @@ const anomalies = await brain.detectAnomalies()
```typescript ```typescript
// CI/CD and DevOps features // CI/CD and DevOps features
const brain = new BrainyData({ const brain = new Brainy({
operations: { operations: {
blueGreen: true, // Zero-downtime deployments blueGreen: true, // Zero-downtime deployments
canary: true, // Gradual rollouts canary: true, // Gradual rollouts
@ -316,7 +316,7 @@ Your hobby project today might be tomorrow's unicorn startup. With Brainy, you w
### Startups ### Startups
```typescript ```typescript
// A 2-person startup gets the same features as Amazon // A 2-person startup gets the same features as Amazon
const startup = new BrainyData() const startup = new Brainy()
// ✓ Full durability // ✓ Full durability
// ✓ Complete security // ✓ Complete security
// ✓ Unlimited scale // ✓ Unlimited scale
@ -326,7 +326,7 @@ const startup = new BrainyData()
### Education ### Education
```typescript ```typescript
// Students learn with production-grade tools // Students learn with production-grade tools
const classroom = new BrainyData() const classroom = new Brainy()
// ✓ No feature restrictions // ✓ No feature restrictions
// ✓ Real enterprise experience // ✓ Real enterprise experience
// ✓ Free forever // ✓ Free forever
@ -335,7 +335,7 @@ const classroom = new BrainyData()
### Non-Profits ### Non-Profits
```typescript ```typescript
// NGOs get enterprise features without enterprise costs // NGOs get enterprise features without enterprise costs
const nonprofit = new BrainyData() const nonprofit = new Brainy()
// ✓ Compliance tools // ✓ Compliance tools
// ✓ Security features // ✓ Security features
// ✓ Scale for impact // ✓ Scale for impact
@ -345,7 +345,7 @@ const nonprofit = new BrainyData()
### Enterprises ### Enterprises
```typescript ```typescript
// Enterprises get everything plus peace of mind // Enterprises get everything plus peace of mind
const enterprise = new BrainyData() const enterprise = new Brainy()
// ✓ Proven at scale // ✓ Proven at scale
// ✓ Community tested // ✓ Community tested
// ✓ No vendor lock-in // ✓ No vendor lock-in
@ -397,10 +397,10 @@ npm install brainy
``` ```
```typescript ```typescript
import { BrainyData } from 'brainy' import { Brainy } from 'brainy'
// Create your enterprise-grade database // Create your enterprise-grade database
const brain = new BrainyData() const brain = new Brainy()
await brain.init() await brain.init()
// You're now running the same tech as Fortune 500 companies // You're now running the same tech as Fortune 500 companies

View file

@ -13,10 +13,10 @@ npm install @soulcraft/brainy
### Simple Initialization ### Simple Initialization
```typescript ```typescript
import { BrainyData } from '@soulcraft/brainy' import { Brainy } from '@soulcraft/brainy'
// Create a new Brainy instance with defaults // Create a new Brainy instance with defaults
const brain = new BrainyData() const brain = new Brainy()
// Initialize (downloads models if needed) // Initialize (downloads models if needed)
await brain.init() await brain.init()
@ -27,7 +27,7 @@ await brain.init()
### Custom Configuration ### Custom Configuration
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
// Storage configuration // Storage configuration
storage: { storage: {
type: 'filesystem', // or 's3', 'opfs', 'memory' type: 'filesystem', // or 's3', 'opfs', 'memory'
@ -193,7 +193,7 @@ const results = await brain.find({
```typescript ```typescript
// Configure for streaming // Configure for streaming
const brain = new BrainyData({ const brain = new Brainy({
augmentations: [ augmentations: [
new EntityRegistryAugmentation(), // Deduplication new EntityRegistryAugmentation(), // Deduplication
new BatchProcessingAugmentation({ batchSize: 100 }) // Batching new BatchProcessingAugmentation({ batchSize: 100 }) // Batching
@ -220,7 +220,7 @@ async function processStream(item) {
### Development (Memory) ### Development (Memory)
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
storage: { type: 'memory' } storage: { type: 'memory' }
}) })
// Fast, temporary, perfect for testing // Fast, temporary, perfect for testing
@ -228,7 +228,7 @@ const brain = new BrainyData({
### Production (FileSystem) ### Production (FileSystem)
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
storage: { storage: {
type: 'filesystem', type: 'filesystem',
path: '/var/lib/brainy' path: '/var/lib/brainy'
@ -239,7 +239,7 @@ const brain = new BrainyData({
### Cloud (S3) ### Cloud (S3)
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
storage: { storage: {
type: 's3', type: 's3',
bucket: 'my-brainy-data', bucket: 'my-brainy-data',
@ -251,7 +251,7 @@ const brain = new BrainyData({
### Browser (OPFS) ### Browser (OPFS)
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
storage: { type: 'opfs' } storage: { type: 'opfs' }
}) })
// Browser-native, persistent, offline-capable // Browser-native, persistent, offline-capable
@ -279,7 +279,7 @@ for (const rel of relationships) {
### 2. Enable Caching ### 2. Enable Caching
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
cache: { cache: {
enabled: true, enabled: true,
maxSize: 1000, maxSize: 1000,
@ -298,7 +298,7 @@ const results = await brain.search("query", {
### 4. Index Frequently Queried Fields ### 4. Index Frequently Queried Fields
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
indexedFields: ['category', 'userId', 'timestamp'] indexedFields: ['category', 'userId', 'timestamp']
}) })
``` ```

View file

@ -9,9 +9,9 @@ Brainy's import is **ONE magical method** that understands EVERYTHING:
## The Ultimate Simplicity ## The Ultimate Simplicity
```javascript ```javascript
import { BrainyData } from '@soulcraft/brainy' import { Brainy } from '@soulcraft/brainy'
const brain = new BrainyData() const brain = new Brainy()
await brain.init() await brain.init()
// ONE method for EVERYTHING: // ONE method for EVERYTHING:

View file

@ -7,7 +7,7 @@ Brainy uses AI embedding models to understand and process your data. This guide
**For most developers, no configuration is needed:** **For most developers, no configuration is needed:**
```typescript ```typescript
const brain = new BrainyData() const brain = new Brainy()
await brain.init() // Models load automatically await brain.init() // Models load automatically
``` ```
@ -38,21 +38,21 @@ Brainy tries multiple sources in this order:
### Browser ### Browser
```typescript ```typescript
// Automatically configured for browsers // Automatically configured for browsers
const brain = new BrainyData() // Works in React, Vue, vanilla JS const brain = new Brainy() // Works in React, Vue, vanilla JS
await brain.init() // Downloads models via CDN await brain.init() // Downloads models via CDN
``` ```
### Node.js Development ### Node.js Development
```typescript ```typescript
// Zero config - downloads to ./models/ // Zero config - downloads to ./models/
const brain = new BrainyData() const brain = new Brainy()
await brain.init() // Downloads once, cached forever await brain.init() // Downloads once, cached forever
``` ```
### Production Server ### Production Server
```typescript ```typescript
// Preload models during build/deployment // Preload models during build/deployment
const brain = new BrainyData() const brain = new Brainy()
await brain.init() // Uses cached local models await brain.init() // Uses cached local models
``` ```
@ -87,7 +87,7 @@ ls ./models/Xenova/all-MiniLM-L6-v2/
### Custom Model Path ### Custom Model Path
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
embedding: { embedding: {
cacheDir: './custom-models' cacheDir: './custom-models'
} }
@ -213,7 +213,7 @@ chmod 755 ./models
export BRAINY_MODELS_PATH=/tmp/brainy-models export BRAINY_MODELS_PATH=/tmp/brainy-models
# Or use memory-only storage # Or use memory-only storage
const brain = new BrainyData({ const brain = new Brainy({
storage: { forceMemoryStorage: true } storage: { forceMemoryStorage: true }
}) })
``` ```
@ -223,7 +223,7 @@ const brain = new BrainyData({
### Development ### Development
```typescript ```typescript
// ✅ Zero config - just works // ✅ Zero config - just works
const brain = new BrainyData() const brain = new Brainy()
await brain.init() await brain.init()
``` ```
@ -259,7 +259,7 @@ RUN test -f ./models/Xenova/all-MiniLM-L6-v2/onnx/model.onnx
### Lambda/Serverless ### Lambda/Serverless
```typescript ```typescript
// ✅ Models in deployment package // ✅ Models in deployment package
const brain = new BrainyData({ const brain = new Brainy({
embedding: { embedding: {
localFilesOnly: true, // No downloads in lambda localFilesOnly: true, // No downloads in lambda
cacheDir: './models' // Bundled with deployment cacheDir: './models' // Bundled with deployment
@ -300,7 +300,7 @@ const response = await openai.embeddings.create({
}) })
// After: Local Brainy embeddings // After: Local Brainy embeddings
const brain = new BrainyData() const brain = new Brainy()
await brain.init() // One-time setup await brain.init() // One-time setup
const id = await brain.add("Your text", { nounType: 'content' }) // Embedded automatically const id = await brain.add("Your text", { nounType: 'content' }) // Embedded automatically
``` ```
@ -312,7 +312,7 @@ from sentence_transformers import SentenceTransformer
model = SentenceTransformer('all-MiniLM-L6-v2') model = SentenceTransformer('all-MiniLM-L6-v2')
# After: JavaScript Brainy (same model!) # After: JavaScript Brainy (same model!)
const brain = new BrainyData() // Uses same all-MiniLM-L6-v2 const brain = new Brainy() // Uses same all-MiniLM-L6-v2
await brain.init() await brain.init()
``` ```
@ -320,7 +320,7 @@ await brain.init()
### Custom Embedding Options ### Custom Embedding Options
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
embedding: { embedding: {
model: 'Xenova/all-MiniLM-L6-v2', // Default model: 'Xenova/all-MiniLM-L6-v2', // Default
dtype: 'q8', // Quantized for speed dtype: 'q8', // Quantized for speed
@ -341,7 +341,7 @@ const customEmbedder = createEmbeddingFunction({
dtype: 'fp32' // Higher precision dtype: 'fp32' // Higher precision
}) })
const brain = new BrainyData({ const brain = new Brainy({
embeddingFunction: customEmbedder embeddingFunction: customEmbedder
}) })
``` ```

View file

@ -21,9 +21,9 @@ The current NLP implementation supports:
## Basic Usage ## Basic Usage
```typescript ```typescript
import { BrainyData } from 'brainy' import { Brainy } from 'brainy'
const brain = new BrainyData() const brain = new Brainy()
await brain.init() await brain.init()
// Simply ask in natural language // Simply ask in natural language

View file

@ -9,9 +9,9 @@ The Neural API provides advanced AI-powered features for understanding relations
## Quick Start ## Quick Start
```javascript ```javascript
import { BrainyData } from '@soulcraft/brainy' import { Brainy } from '@soulcraft/brainy'
const brain = new BrainyData() const brain = new Brainy()
await brain.init() await brain.init()
// Access Neural API // Access Neural API
@ -340,7 +340,7 @@ const sim = await neural.similar('fake-id-1', 'fake-id-2')
```javascript ```javascript
// Configure neural behavior at initialization // Configure neural behavior at initialization
const brain = new BrainyData({ const brain = new Brainy({
neural: { neural: {
cacheSize: 1000, // Cache up to 1000 results cacheSize: 1000, // Cache up to 1000 results
defaultAlgorithm: 'kmeans', defaultAlgorithm: 'kmeans',

View file

@ -75,7 +75,7 @@ ENV BRAINY_MODEL_DTYPE=q8
chmod 755 ./brainy-data chmod 755 ./brainy-data
# Use custom writable path # Use custom writable path
const brain = new BrainyData({ const brain = new Brainy({
storage: { storage: {
adapter: 'filesystem', adapter: 'filesystem',
path: '/tmp/brainy-data' path: '/tmp/brainy-data'
@ -83,7 +83,7 @@ const brain = new BrainyData({
}) })
# Or use memory storage # Or use memory storage
const brain = new BrainyData({ const brain = new Brainy({
storage: { forceMemoryStorage: true } storage: { forceMemoryStorage: true }
}) })
``` ```
@ -98,7 +98,7 @@ const brain = new BrainyData({
mkdir -p ./brainy-data mkdir -p ./brainy-data
# Check storage configuration # Check storage configuration
const brain = new BrainyData({ const brain = new Brainy({
storage: { storage: {
adapter: 'filesystem', adapter: 'filesystem',
path: '/full/path/to/storage' // Use absolute path path: '/full/path/to/storage' // Use absolute path
@ -126,7 +126,7 @@ const brain = new BrainyData({
2. **Network issues** 2. **Network issues**
```typescript ```typescript
// Set initialization timeout // Set initialization timeout
const brain = new BrainyData() const brain = new Brainy()
// Use Promise.race for timeout // Use Promise.race for timeout
const initPromise = Promise.race([ const initPromise = Promise.race([
@ -210,7 +210,7 @@ const brain = new BrainyData({
1. **Enable search cache** 1. **Enable search cache**
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
cache: { cache: {
search: { search: {
maxSize: 1000, maxSize: 1000,
@ -283,7 +283,7 @@ const brain = new BrainyData({
2. **Use memory storage in tests** 2. **Use memory storage in tests**
```typescript ```typescript
// In test setup // In test setup
const brain = new BrainyData({ const brain = new Brainy({
storage: { forceMemoryStorage: true } storage: { forceMemoryStorage: true }
}) })
``` ```
@ -352,7 +352,7 @@ ENV BRAINY_MODELS_PATH=./models
Enable verbose logging to see what's happening: Enable verbose logging to see what's happening:
```typescript ```typescript
const brain = new BrainyData({ const brain = new Brainy({
logging: { verbose: true } logging: { verbose: true }
}) })
``` ```
@ -364,7 +364,7 @@ Verify your Brainy setup:
```typescript ```typescript
// Basic health check // Basic health check
try { try {
const brain = new BrainyData() const brain = new Brainy()
await brain.init() await brain.init()
const id = await brain.add("health check", { nounType: 'content' }) const id = await brain.add("health check", { nounType: 'content' })

View file

@ -23,9 +23,9 @@ The Universal Display Augmentation is a powerful AI-powered system that automati
### Basic Usage ### Basic Usage
```typescript ```typescript
import { BrainyData } from '@soulcraft/brainy' import { Brainy } from '@soulcraft/brainy'
const brainy = new BrainyData() const brainy = new Brainy()
await brainy.init() await brainy.init()
// Add some data // Add some data
@ -186,12 +186,12 @@ const stats = displayAug.getStats()
console.log(`Cache hit ratio: ${stats.cacheHitRatio}%`) console.log(`Cache hit ratio: ${stats.cacheHitRatio}%`)
``` ```
### BrainyData Configuration ### Brainy Configuration
Configure at initialization: Configure at initialization:
```typescript ```typescript
const brainy = new BrainyData({ const brainy = new Brainy({
augmentations: { augmentations: {
display: { display: {
enabled: true, enabled: true,

View file

@ -7,12 +7,12 @@
* Zero-config philosophy: Just create and register the augmentation! * Zero-config philosophy: Just create and register the augmentation!
*/ */
import { BrainyData } from '../src/index.js' import { Brainy } from '../src/index.js'
import { APIServerAugmentation } from '../src/augmentations/apiServerAugmentation.js' import { APIServerAugmentation } from '../src/augmentations/apiServerAugmentation.js'
async function main() { async function main() {
// 1. Create Brainy with zero config // 1. Create Brainy with zero config
const brain = new BrainyData() const brain = new Brainy()
await brain.init() await brain.init()
// 2. Add some sample data // 2. Add some sample data

View file

@ -5,14 +5,14 @@
* Augmentations extend Brainy without any complex setup. * Augmentations extend Brainy without any complex setup.
*/ */
import { BrainyData } from '../src/index.js' import { Brainy } from '../src/index.js'
import { EntityRegistryAugmentation } from '../src/augmentations/entityRegistryAugmentation.js' import { EntityRegistryAugmentation } from '../src/augmentations/entityRegistryAugmentation.js'
import { BatchProcessingAugmentation } from '../src/augmentations/batchProcessingAugmentation.js' import { BatchProcessingAugmentation } from '../src/augmentations/batchProcessingAugmentation.js'
import { APIServerAugmentation } from '../src/augmentations/apiServerAugmentation.js' import { APIServerAugmentation } from '../src/augmentations/apiServerAugmentation.js'
async function main() { async function main() {
// Create Brainy - zero config! // Create Brainy - zero config!
const brain = new BrainyData() const brain = new Brainy()
// Register augmentations - they just work! // Register augmentations - they just work!
brain.augmentations.register(new EntityRegistryAugmentation()) // Deduplication brain.augmentations.register(new EntityRegistryAugmentation()) // Deduplication

View file

@ -4,7 +4,7 @@
* 🚀 Focused Validation - Test Core Functionality with Timeout * 🚀 Focused Validation - Test Core Functionality with Timeout
*/ */
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
console.log('🚀 Brainy 2.0 - Focused Production Test') console.log('🚀 Brainy 2.0 - Focused Production Test')
console.log('=' + '='.repeat(35)) console.log('=' + '='.repeat(35))
@ -20,7 +20,7 @@ const TIMEOUT = 45000 // 45 seconds
const timeoutId = setTimeout(() => { const timeoutId = setTimeout(() => {
console.log(`\n⏰ TIMEOUT after ${timeElapsed()}s - Core systems initialized successfully!`) console.log(`\n⏰ TIMEOUT after ${timeElapsed()}s - Core systems initialized successfully!`)
console.log('🎯 Key Evidence:') console.log('🎯 Key Evidence:')
console.log('✅ BrainyData instantiated') console.log('✅ Brainy instantiated')
console.log('✅ All augmentations loading') console.log('✅ All augmentations loading')
console.log('✅ Storage systems operational') console.log('✅ Storage systems operational')
console.log('✅ Models found in cache') console.log('✅ Models found in cache')
@ -30,7 +30,7 @@ const timeoutId = setTimeout(() => {
try { try {
console.log(`\n⏱️ [${timeElapsed()}s] Initializing brain...`) console.log(`\n⏱️ [${timeElapsed()}s] Initializing brain...`)
const brain = new BrainyData({ storage: { type: 'memory' }, verbose: false }) const brain = new Brainy({ storage: { type: 'memory' }, verbose: false })
console.log(`⏱️ [${timeElapsed()}s] Starting init()...`) console.log(`⏱️ [${timeElapsed()}s] Starting init()...`)

View file

@ -5,13 +5,13 @@
* Tests that core functionality works without heavy model loading * Tests that core functionality works without heavy model loading
*/ */
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
console.log('🚀 Brainy 2.0 - Instant Core API Validation') console.log('🚀 Brainy 2.0 - Instant Core API Validation')
console.log('=' + '='.repeat(40)) console.log('=' + '='.repeat(40))
// Skip heavy initialization, focus on API validation // Skip heavy initialization, focus on API validation
const brain = new BrainyData({ const brain = new Brainy({
storage: { type: 'memory' }, storage: { type: 'memory' },
verbose: false, verbose: false,
skipModelDownload: true // Skip heavy model operations skipModelDownload: true // Skip heavy model operations
@ -32,8 +32,8 @@ function test(name, condition) {
try { try {
console.log('\n🔧 Core API Structure Tests...') console.log('\n🔧 Core API Structure Tests...')
// Test 1: BrainyData class instantiated // Test 1: Brainy class instantiated
test('BrainyData class instantiation', brain instanceof Object) test('Brainy class instantiation', brain instanceof Object)
// Test 2: Core methods exist // Test 2: Core methods exist
test('addNoun method exists', typeof brain.addNoun === 'function') test('addNoun method exists', typeof brain.addNoun === 'function')

View file

@ -7,7 +7,7 @@
* Focus on HIGH-IMPACT validation that proves the system is ready for release. * Focus on HIGH-IMPACT validation that proves the system is ready for release.
*/ */
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
import { performance } from 'perf_hooks' import { performance } from 'perf_hooks'
console.log('🚀 Brainy 2.0 - Production Validation Suite') console.log('🚀 Brainy 2.0 - Production Validation Suite')
@ -19,7 +19,7 @@ const testConfig = {
verbose: false verbose: false
} }
const brain = new BrainyData(testConfig) const brain = new Brainy(testConfig)
// Validation results tracking // Validation results tracking
const results = { const results = {

View file

@ -4,12 +4,12 @@
* 🚀 Quick Production Validation - Focus on Core Functionality * 🚀 Quick Production Validation - Focus on Core Functionality
*/ */
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
console.log('🚀 Brainy 2.0 - Quick Production Validation') console.log('🚀 Brainy 2.0 - Quick Production Validation')
console.log('=' + '='.repeat(40)) console.log('=' + '='.repeat(40))
const brain = new BrainyData({ storage: { type: 'memory' }, verbose: false }) const brain = new Brainy({ storage: { type: 'memory' }, verbose: false })
try { try {
// Test 1: Initialize // Test 1: Initialize

View file

@ -4,14 +4,14 @@
* Quick CLI API Compatibility Test * Quick CLI API Compatibility Test
*/ */
import { BrainyData } from './dist/brainyData.js' import { Brainy } from '../../dist/index.js'
console.log('🧠 Testing CLI API compatibility...') console.log('🧠 Testing CLI API compatibility...')
const brain = new BrainyData({ storage: { type: 'memory' }, verbose: false }) const brain = new Brainy({ storage: { type: 'memory' }, verbose: false })
try { try {
console.log('✅ BrainyData instantiated') console.log('✅ Brainy instantiated')
// Test method signatures // Test method signatures
console.log('✅ addNoun method:', typeof brain.addNoun === 'function') console.log('✅ addNoun method:', typeof brain.addNoun === 'function')

View file

@ -1,11 +1,11 @@
#!/usr/bin/env node #!/usr/bin/env node
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
console.log('🧪 Testing Brainy 2.0 Consolidated API') console.log('🧪 Testing Brainy 2.0 Consolidated API')
console.log('=' + '='.repeat(50)) console.log('=' + '='.repeat(50))
const brain = new BrainyData({ const brain = new Brainy({
storage: { type: 'memory' }, storage: { type: 'memory' },
verbose: false verbose: false
}) })

View file

@ -5,7 +5,7 @@
* Bypasses Vitest to avoid memory overhead * Bypasses Vitest to avoid memory overhead
*/ */
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
console.log('🧠 Testing Brainy Core Functionality (Direct Node.js)') console.log('🧠 Testing Brainy Core Functionality (Direct Node.js)')
console.log('=' + '='.repeat(60)) console.log('=' + '='.repeat(60))
@ -32,15 +32,15 @@ async function testBrainyCore() {
try { try {
// Test 1: Library Loading // Test 1: Library Loading
console.log('\n📦 Testing Library Loading') console.log('\n📦 Testing Library Loading')
assert(typeof BrainyData === 'function', 'BrainyData class should be exported') assert(typeof Brainy === 'function', 'Brainy class should be exported')
// Test 2: Instance Creation // Test 2: Instance Creation
console.log('\n🏗 Testing Instance Creation') console.log('\n🏗 Testing Instance Creation')
const brain = new BrainyData({ const brain = new Brainy({
storage: { forceMemoryStorage: true }, storage: { forceMemoryStorage: true },
verbose: false verbose: false
}) })
assert(brain !== null, 'Should create BrainyData instance') assert(brain !== null, 'Should create Brainy instance')
assert(brain.dimensions === 384, 'Should have 384 dimensions') assert(brain.dimensions === 384, 'Should have 384 dimensions')
// Test 3: Initialization // Test 3: Initialization

View file

@ -7,7 +7,7 @@
* Uses minimal memory approach to avoid ONNX issues. * Uses minimal memory approach to avoid ONNX issues.
*/ */
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
console.log('🧠 Brainy 2.0 Core Functionality Verification') console.log('🧠 Brainy 2.0 Core Functionality Verification')
console.log('=' + '='.repeat(55)) console.log('=' + '='.repeat(55))
@ -45,7 +45,7 @@ async function runTests() {
console.log(` RSS: ${(startMem.rss / 1024 / 1024).toFixed(2)} MB`) console.log(` RSS: ${(startMem.rss / 1024 / 1024).toFixed(2)} MB`)
// Create Brainy instance with custom embedding function to avoid ONNX // Create Brainy instance with custom embedding function to avoid ONNX
const brain = new BrainyData({ const brain = new Brainy({
storage: { forceMemoryStorage: true }, storage: { forceMemoryStorage: true },
verbose: false, verbose: false,
// Use a simple embedding function to avoid ONNX memory issues // Use a simple embedding function to avoid ONNX memory issues

View file

@ -7,7 +7,7 @@
* to identify where the timeout occurs * to identify where the timeout occurs
*/ */
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
async function testDirectSearch() { async function testDirectSearch() {
console.log('🔍 DIRECT SEARCH TEST') console.log('🔍 DIRECT SEARCH TEST')
@ -16,7 +16,7 @@ async function testDirectSearch() {
try { try {
// 1. Initialize // 1. Initialize
console.log('1. Initializing Brainy...') console.log('1. Initializing Brainy...')
const brain = new BrainyData({ const brain = new Brainy({
storage: { forceMemoryStorage: true }, storage: { forceMemoryStorage: true },
verbose: false verbose: false
}) })

View file

@ -4,13 +4,13 @@
* Fast focused test of critical AI features * Fast focused test of critical AI features
*/ */
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
async function quickTest() { async function quickTest() {
try { try {
console.log('🚀 QUICK BRAINY AI TEST') console.log('🚀 QUICK BRAINY AI TEST')
const brain = new BrainyData({ const brain = new Brainy({
storage: { forceMemoryStorage: true }, storage: { forceMemoryStorage: true },
verbose: false verbose: false
}) })

View file

@ -9,12 +9,12 @@ console.log('ORT_INTRA_OP_NUM_THREADS:', process.env.ORT_INTRA_OP_NUM_THREADS)
console.log('ORT_INTER_OP_NUM_THREADS:', process.env.ORT_INTER_OP_NUM_THREADS) console.log('ORT_INTER_OP_NUM_THREADS:', process.env.ORT_INTER_OP_NUM_THREADS)
// Now test with minimal embedding // Now test with minimal embedding
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
async function testMinimalSearch() { async function testMinimalSearch() {
try { try {
console.log('\nInitializing Brainy...') console.log('\nInitializing Brainy...')
const brain = new BrainyData({ const brain = new Brainy({
storage: { forceMemoryStorage: true }, storage: { forceMemoryStorage: true },
verbose: false verbose: false
}) })

View file

@ -1,6 +1,6 @@
#!/usr/bin/env node #!/usr/bin/env node
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
async function testMemoryUsage() { async function testMemoryUsage() {
console.log('Testing memory usage...\n') console.log('Testing memory usage...\n')
@ -12,7 +12,7 @@ async function testMemoryUsage() {
heapUsed: Math.round(memBefore.heapUsed / 1024 / 1024) + ' MB' heapUsed: Math.round(memBefore.heapUsed / 1024 / 1024) + ' MB'
}) })
const brain = new BrainyData({ const brain = new Brainy({
storage: { forceMemoryStorage: true } storage: { forceMemoryStorage: true }
}) })
await brain.init() await brain.init()

View file

@ -7,7 +7,7 @@
* Uses reasonable memory limits (4GB instead of 16GB) * Uses reasonable memory limits (4GB instead of 16GB)
*/ */
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
console.log('🧠 Testing Memory-Safe Brainy System') console.log('🧠 Testing Memory-Safe Brainy System')
console.log('=' + '='.repeat(50)) console.log('=' + '='.repeat(50))
@ -20,7 +20,7 @@ async function testMemorySafety() {
console.log(` RSS: ${(startMem.rss / 1024 / 1024).toFixed(2)} MB`) console.log(` RSS: ${(startMem.rss / 1024 / 1024).toFixed(2)} MB`)
console.log('\n🚀 Initializing Brainy with Universal Memory Manager...') console.log('\n🚀 Initializing Brainy with Universal Memory Manager...')
const brain = new BrainyData({ const brain = new Brainy({
storage: { forceMemoryStorage: true }, storage: { forceMemoryStorage: true },
verbose: false verbose: false
}) })

View file

@ -1,8 +1,8 @@
#!/usr/bin/env node #!/usr/bin/env node
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
const brain = new BrainyData({ const brain = new Brainy({
storage: { type: 'memory' }, storage: { type: 'memory' },
verbose: false verbose: false
}) })

View file

@ -1,14 +1,14 @@
#!/usr/bin/env node #!/usr/bin/env node
// Minimal test to verify core works without memory issues // Minimal test to verify core works without memory issues
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
console.log('🧪 Minimal Brainy Test') console.log('🧪 Minimal Brainy Test')
async function minimalTest() { async function minimalTest() {
try { try {
// Just test initialization and basic add // Just test initialization and basic add
const brain = new BrainyData({ const brain = new Brainy({
storage: { forceMemoryStorage: true }, storage: { forceMemoryStorage: true },
verbose: false, verbose: false,
// Disable features that might use memory // Disable features that might use memory

View file

@ -1,14 +1,14 @@
#!/usr/bin/env node #!/usr/bin/env node
// Test without search to avoid memory issues // Test without search to avoid memory issues
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
console.log('🧪 Brainy Test (No Search)') console.log('🧪 Brainy Test (No Search)')
console.log('===========================') console.log('===========================')
async function testNoSearch() { async function testNoSearch() {
try { try {
const brain = new BrainyData({ const brain = new Brainy({
storage: { forceMemoryStorage: true }, storage: { forceMemoryStorage: true },
verbose: false verbose: false
}) })

View file

@ -7,7 +7,7 @@
* Tests: search(), find(), clustering, Triple Intelligence, Brain Patterns * Tests: search(), find(), clustering, Triple Intelligence, Brain Patterns
*/ */
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
const TEST_TIMEOUT = 30000 // 30 seconds per operation const TEST_TIMEOUT = 30000 // 30 seconds per operation
@ -39,7 +39,7 @@ async function testProductionFunctionality() {
try { try {
// 1. Initialize Brainy // 1. Initialize Brainy
console.log('1⃣ Initializing Brainy with real AI models...') console.log('1⃣ Initializing Brainy with real AI models...')
const brain = new BrainyData({ const brain = new Brainy({
storage: { forceMemoryStorage: true }, storage: { forceMemoryStorage: true },
verbose: false verbose: false
}) })

View file

@ -1,7 +1,7 @@
#!/usr/bin/env node #!/usr/bin/env node
// Quick test to verify Brainy works without running full test suite // Quick test to verify Brainy works without running full test suite
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
console.log('🧪 Quick Brainy Test') console.log('🧪 Quick Brainy Test')
console.log('====================') console.log('====================')
@ -10,7 +10,7 @@ async function quickTest() {
try { try {
// Test 1: Initialize // Test 1: Initialize
console.log('\n1. Initializing Brainy...') console.log('\n1. Initializing Brainy...')
const brain = new BrainyData({ const brain = new Brainy({
storage: { forceMemoryStorage: true }, storage: { forceMemoryStorage: true },
verbose: false verbose: false
}) })

View file

@ -1,6 +1,6 @@
#!/usr/bin/env node #!/usr/bin/env node
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
async function testRangeQueries() { async function testRangeQueries() {
console.log('🧠 Testing Brain Patterns Range Query Support...\n') console.log('🧠 Testing Brain Patterns Range Query Support...\n')
@ -8,7 +8,7 @@ async function testRangeQueries() {
let brain let brain
try { try {
// Initialize with memory storage // Initialize with memory storage
brain = new BrainyData({ brain = new Brainy({
storage: { forceMemoryStorage: true }, storage: { forceMemoryStorage: true },
dimensions: 384, dimensions: 384,
metric: 'cosine' metric: 'cosine'

View file

@ -5,7 +5,7 @@
* Direct Node.js script to avoid test framework overhead * Direct Node.js script to avoid test framework overhead
*/ */
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
console.log('🧠 TESTING BRAINY 2.0 WITH REAL AI MODELS') console.log('🧠 TESTING BRAINY 2.0 WITH REAL AI MODELS')
console.log('==========================================') console.log('==========================================')
@ -13,7 +13,7 @@ console.log('==========================================')
async function testAllFeatures() { async function testAllFeatures() {
try { try {
console.log('\n1. Initializing with real AI...') console.log('\n1. Initializing with real AI...')
const brain = new BrainyData({ const brain = new Brainy({
storage: { forceMemoryStorage: true }, storage: { forceMemoryStorage: true },
verbose: false verbose: false
}) })

View file

@ -1,13 +1,13 @@
#!/usr/bin/env node #!/usr/bin/env node
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
console.log('🧠 Testing Refactored API Architecture') console.log('🧠 Testing Refactored API Architecture')
console.log('search(q) = find({like: q})') console.log('search(q) = find({like: q})')
console.log('find(q) = NLP processing → complex TripleQuery') console.log('find(q) = NLP processing → complex TripleQuery')
console.log('=' + '='.repeat(50)) console.log('=' + '='.repeat(50))
const brain = new BrainyData({ const brain = new Brainy({
storage: { type: 'memory' }, storage: { type: 'memory' },
verbose: false verbose: false
}) })

View file

@ -5,7 +5,7 @@
* This validates that the flag prevents remote model downloads and works with local models only * This validates that the flag prevents remote model downloads and works with local models only
*/ */
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
import { fileURLToPath } from 'url' import { fileURLToPath } from 'url'
import { dirname, join } from 'path' import { dirname, join } from 'path'
@ -24,8 +24,8 @@ async function testLocalModelsOnly() {
console.log(`Set BRAINY_MODELS_PATH=${process.env.BRAINY_MODELS_PATH}`) console.log(`Set BRAINY_MODELS_PATH=${process.env.BRAINY_MODELS_PATH}`)
try { try {
console.log('✅ Creating BrainyData with local models only...') console.log('✅ Creating Brainy with local models only...')
const brain = new BrainyData() const brain = new Brainy()
console.log('✅ Initializing (should use local models)...') console.log('✅ Initializing (should use local models)...')
await brain.init() await brain.init()

View file

@ -5,7 +5,7 @@
* Verifies industry-leading performance and relevance * Verifies industry-leading performance and relevance
*/ */
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
console.log('🧠 BRAINY 2.0 SEARCH & FIND VERIFICATION') console.log('🧠 BRAINY 2.0 SEARCH & FIND VERIFICATION')
console.log('=' + '='.repeat(50)) console.log('=' + '='.repeat(50))
@ -13,7 +13,7 @@ console.log('=' + '='.repeat(50))
async function testSearchAndFind() { async function testSearchAndFind() {
try { try {
// Initialize with production-like configuration // Initialize with production-like configuration
const brain = new BrainyData({ const brain = new Brainy({
storage: { forceMemoryStorage: true }, storage: { forceMemoryStorage: true },
verbose: false verbose: false
}) })

View file

@ -1,6 +1,6 @@
#!/usr/bin/env node #!/usr/bin/env node
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
async function testBasicFunctionality() { async function testBasicFunctionality() {
console.log('Testing Brainy 2.0 Core Functionality...\n') console.log('Testing Brainy 2.0 Core Functionality...\n')
@ -9,7 +9,7 @@ async function testBasicFunctionality() {
try { try {
// Test 1: Initialization // Test 1: Initialization
console.log('1. Testing initialization...') console.log('1. Testing initialization...')
brain = new BrainyData({ brain = new Brainy({
storage: { forceMemoryStorage: true }, storage: { forceMemoryStorage: true },
dimensions: 384, dimensions: 384,
metric: 'cosine' metric: 'cosine'

View file

@ -1,8 +1,8 @@
#!/usr/bin/env node #!/usr/bin/env node
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
const brain = new BrainyData({ const brain = new Brainy({
storage: { type: 'memory' }, storage: { type: 'memory' },
verbose: false verbose: false
}) })

View file

@ -4,7 +4,7 @@
* Test all storage adapters for Brainy 2.0 * Test all storage adapters for Brainy 2.0
*/ */
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
import { promises as fs } from 'fs' import { promises as fs } from 'fs'
import { join } from 'path' import { join } from 'path'
@ -16,7 +16,7 @@ async function testStorageAdapter(name, config) {
try { try {
// Initialize with specific storage // Initialize with specific storage
const brain = new BrainyData({ const brain = new Brainy({
storage: config, storage: config,
verbose: false verbose: false
}) })

View file

@ -2,7 +2,7 @@
* Test script to verify storage augmentation system works * Test script to verify storage augmentation system works
*/ */
import { BrainyData } from './dist/brainyData.js' import { Brainy } from '../../dist/index.js'
import { import {
MemoryStorageAugmentation, MemoryStorageAugmentation,
FileSystemStorageAugmentation FileSystemStorageAugmentation
@ -13,7 +13,7 @@ console.log('=' .repeat(50))
async function test1_ZeroConfig() { async function test1_ZeroConfig() {
console.log('\n1. Zero-Config Test') console.log('\n1. Zero-Config Test')
const brain = new BrainyData() const brain = new Brainy()
await brain.init() await brain.init()
await brain.add('test', { content: 'Zero-config test' }) await brain.add('test', { content: 'Zero-config test' })
@ -25,7 +25,7 @@ async function test1_ZeroConfig() {
async function test2_ConfigBased() { async function test2_ConfigBased() {
console.log('\n2. Config-Based Storage Test') console.log('\n2. Config-Based Storage Test')
const brain = new BrainyData({ const brain = new Brainy({
storage: { storage: {
forceMemoryStorage: true forceMemoryStorage: true
} }
@ -41,7 +41,7 @@ async function test2_ConfigBased() {
async function test3_AugmentationOverride() { async function test3_AugmentationOverride() {
console.log('\n3. Augmentation Override Test') console.log('\n3. Augmentation Override Test')
const brain = new BrainyData() const brain = new Brainy()
// Register storage augmentation BEFORE init // Register storage augmentation BEFORE init
brain.augmentations.register(new MemoryStorageAugmentation('test-memory')) brain.augmentations.register(new MemoryStorageAugmentation('test-memory'))
@ -59,7 +59,7 @@ async function test4_BackwardCompatibility() {
console.log('\n4. Backward Compatibility Test') console.log('\n4. Backward Compatibility Test')
// Old style with rootDirectory config // Old style with rootDirectory config
const brain = new BrainyData({ const brain = new Brainy({
storage: { storage: {
rootDirectory: './test-data', rootDirectory: './test-data',
forceFileSystemStorage: true forceFileSystemStorage: true

View file

@ -12,7 +12,7 @@
* - Fusion scoring * - Fusion scoring
*/ */
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
async function testTripleIntelligence() { async function testTripleIntelligence() {
console.log('🧠 TRIPLE INTELLIGENCE COMPREHENSIVE TEST') console.log('🧠 TRIPLE INTELLIGENCE COMPREHENSIVE TEST')
@ -27,7 +27,7 @@ async function testTripleIntelligence() {
try { try {
// Initialize // Initialize
console.log('📦 Initializing Brainy...') console.log('📦 Initializing Brainy...')
const brain = new BrainyData({ const brain = new Brainy({
storage: { forceMemoryStorage: true }, storage: { forceMemoryStorage: true },
verbose: false verbose: false
}) })

View file

@ -1,8 +1,8 @@
#!/usr/bin/env node #!/usr/bin/env node
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
const brain = new BrainyData({ const brain = new Brainy({
storage: { type: 'memory' }, storage: { type: 'memory' },
verbose: false verbose: false
}) })

View file

@ -5,7 +5,7 @@
* Requires 6-8GB RAM (ONNX runtime requirement) * Requires 6-8GB RAM (ONNX runtime requirement)
*/ */
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
import v8 from 'v8' import v8 from 'v8'
// Check if we have enough memory allocated // Check if we have enough memory allocated
@ -23,7 +23,7 @@ console.log('='.repeat(50))
async function testRealSearch() { async function testRealSearch() {
try { try {
const brain = new BrainyData({ const brain = new Brainy({
storage: { forceMemoryStorage: true }, storage: { forceMemoryStorage: true },
verbose: false verbose: false
}) })

View file

@ -5,14 +5,14 @@
* This validates core database operations without ONNX memory issues * This validates core database operations without ONNX memory issues
*/ */
import { BrainyData } from './dist/index.js' import { Brainy } from './dist/index.js'
console.log('🧠 Testing Brainy Core (No Embeddings)') console.log('🧠 Testing Brainy Core (No Embeddings)')
console.log('=' + '='.repeat(50)) console.log('=' + '='.repeat(50))
async function testCoreFeatures() { async function testCoreFeatures() {
try { try {
const brain = new BrainyData({ const brain = new Brainy({
storage: { forceMemoryStorage: true }, storage: { forceMemoryStorage: true },
verbose: false, verbose: false,
// Disable embedding features for this test // Disable embedding features for this test

View file

@ -5,7 +5,7 @@
* Verifies ALL public API methods are properly integrated in CLI * Verifies ALL public API methods are properly integrated in CLI
*/ */
import { BrainyData } from './dist/brainyData.js' import { Brainy } from '../../dist/index.js'
import fs from 'fs' import fs from 'fs'
console.log('🧠 Brainy 2.0 - Comprehensive CLI API Verification') console.log('🧠 Brainy 2.0 - Comprehensive CLI API Verification')

View file

@ -41,10 +41,10 @@ The `BrainyMCPService` has been refactored to separate the core functionality fr
### In Any Environment (Browser, Node.js, Server) ### In Any Environment (Browser, Node.js, Server)
```typescript ```typescript
import { BrainyData, BrainyMCPAdapter, MCPAugmentationToolset } from '@soulcraft/brainy' import { Brainy, BrainyMCPAdapter, MCPAugmentationToolset } from '@soulcraft/brainy'
// Create a BrainyData instance // Create a Brainy instance
const brainyData = new BrainyData() const brainyData = new Brainy()
await brainyData.init() await brainyData.init()
// Create an MCP adapter // Create an MCP adapter
@ -81,10 +81,10 @@ const toolResponse = await toolset.handleRequest({
### In Browser Environment (Core Functionality Only) ### In Browser Environment (Core Functionality Only)
```typescript ```typescript
import { BrainyData, BrainyMCPService } from '@soulcraft/brainy' import { Brainy, BrainyMCPService } from '@soulcraft/brainy'
// Create a BrainyData instance // Create a Brainy instance
const brainyData = new BrainyData() const brainyData = new Brainy()
await brainyData.init() await brainyData.init()
// Create an MCP service (server functionality will be disabled in browser) // Create an MCP service (server functionality will be disabled in browser)

View file

@ -5,9 +5,8 @@
* This is the TRUE comparison - with real transformers models * This is the TRUE comparison - with real transformers models
*/ */
import { Brainy } from '../dist/brainy.js' import { Brainy } from '../../dist/index.js'
import { BrainyData } from '../dist/brainyData.js' import { NounType, VerbType } from '../../dist/types/graphTypes.js'
import { NounType, VerbType } from '../dist/types/graphTypes.js'
// Real text samples for embedding // Real text samples for embedding
const REAL_DOCUMENTS = [ const REAL_DOCUMENTS = [

View file

@ -5,9 +5,8 @@
* Compares Brainy v3 vs v2 vs Competition benchmarks * Compares Brainy v3 vs v2 vs Competition benchmarks
*/ */
import { Brainy } from '../dist/brainy.js' import { Brainy } from '../../dist/index.js'
import { BrainyData } from '../dist/brainyData.js' import { NounType, VerbType } from '../../dist/types/graphTypes.js'
import { NounType, VerbType } from '../dist/types/graphTypes.js'
// Mock embedder for consistent benchmarking (no model overhead) // Mock embedder for consistent benchmarking (no model overhead)
const mockEmbedder = async () => new Array(384).fill(0).map(() => Math.random()) const mockEmbedder = async () => new Array(384).fill(0).map(() => Math.random())
@ -17,10 +16,10 @@ async function formatOps(ops) {
} }
async function runV2Benchmark() { async function runV2Benchmark() {
console.log('\n📊 BrainyData v2 Performance') console.log('\n📊 Brainy v2 Performance')
console.log('═'.repeat(50)) console.log('═'.repeat(50))
const brain = new BrainyData({ const brain = new Brainy({
storage: { type: 'memory' }, storage: { type: 'memory' },
embeddingFunction: mockEmbedder, embeddingFunction: mockEmbedder,
augmentations: false // Disable for raw performance augmentations: false // Disable for raw performance

View file

@ -5,8 +5,8 @@
* This will help us identify where we lost the claimed 500,000 ops/sec * This will help us identify where we lost the claimed 500,000 ops/sec
*/ */
import { BrainyData } from '../dist/index.js' import { Brainy } from '../../dist/index.js'
import { MemoryStorage } from '../dist/storage/adapters/memoryStorage.js' import { MemoryStorage } from '../../dist/storage/adapters/memoryStorage.js'
// Performance tracking // Performance tracking
class PerformanceProfiler { class PerformanceProfiler {
@ -78,20 +78,20 @@ async function profilePerformance() {
console.log('Initializing Brainy configurations...') console.log('Initializing Brainy configurations...')
// 1. Minimal config (no augmentations) // 1. Minimal config (no augmentations)
const minimalBrain = new BrainyData({ const minimalBrain = new Brainy({
storage: new MemoryStorage(), storage: new MemoryStorage(),
augmentations: false // Disable all augmentations augmentations: false // Disable all augmentations
}) })
await minimalBrain.init() await minimalBrain.init()
// 2. Default config (with augmentations) // 2. Default config (with augmentations)
const defaultBrain = new BrainyData({ const defaultBrain = new Brainy({
storage: new MemoryStorage() storage: new MemoryStorage()
}) })
await defaultBrain.init() await defaultBrain.init()
// 3. Full augmentations config // 3. Full augmentations config
const fullBrain = new BrainyData({ const fullBrain = new Brainy({
storage: new MemoryStorage(), storage: new MemoryStorage(),
augmentations: { augmentations: {
batchProcessing: { enabled: true, maxBatchSize: 1000 }, batchProcessing: { enabled: true, maxBatchSize: 1000 },

View file

@ -2,21 +2,20 @@
/** /**
* Brainy 3.0 Performance Benchmark * Brainy 3.0 Performance Benchmark
* Compare v2 (BrainyData) vs v3 (Brainy) performance * Compare v2 (Brainy) vs v3 (Brainy) performance
*/ */
import { BrainyData } from '../dist/brainyData.js' import { Brainy } from '../../dist/index.js'
import { Brainy } from '../dist/brainy.js' import { NounType, VerbType } from '../../dist/types/graphTypes.js'
import { NounType, VerbType } from '../dist/types/graphTypes.js'
const ITERATIONS = 1000 const ITERATIONS = 1000
const BATCH_SIZE = 100 const BATCH_SIZE = 100
async function benchmarkV2() { async function benchmarkV2() {
console.log('\n📊 BrainyData v2 Performance') console.log('\n📊 Brainy v2 Performance')
console.log('═'.repeat(50)) console.log('═'.repeat(50))
const brain = new BrainyData({ const brain = new Brainy({
storage: { type: 'memory' }, storage: { type: 'memory' },
augmentations: false, augmentations: false,
embeddingFunction: async () => new Array(384).fill(0).map(() => Math.random()) embeddingFunction: async () => new Array(384).fill(0).map(() => Math.random())

View file

@ -4,8 +4,8 @@
* Quick Performance Test - Find the bottlenecks * Quick Performance Test - Find the bottlenecks
*/ */
import { BrainyData } from '../dist/index.js' import { Brainy } from '../../dist/index.js'
import { MemoryStorage } from '../dist/storage/adapters/memoryStorage.js' import { MemoryStorage } from '../../dist/storage/adapters/memoryStorage.js'
async function quickPerf() { async function quickPerf() {
console.log('🚀 Quick Performance Test\n') console.log('🚀 Quick Performance Test\n')
@ -34,7 +34,7 @@ async function quickPerf() {
// Mock embedding function that returns instantly // Mock embedding function that returns instantly
const mockEmbed = async () => new Array(384).fill(0) const mockEmbed = async () => new Array(384).fill(0)
const brain = new BrainyData({ const brain = new Brainy({
storage: new MemoryStorage(), storage: new MemoryStorage(),
embeddingFunction: mockEmbed, embeddingFunction: mockEmbed,
augmentations: false // Disable augmentations augmentations: false // Disable augmentations
@ -57,7 +57,7 @@ async function quickPerf() {
// Test 3: With augmentations // Test 3: With augmentations
console.log('3⃣ Brainy with Augmentations') console.log('3⃣ Brainy with Augmentations')
const brain2 = new BrainyData({ const brain2 = new Brainy({
storage: new MemoryStorage(), storage: new MemoryStorage(),
embeddingFunction: mockEmbed embeddingFunction: mockEmbed
// Default augmentations enabled // Default augmentations enabled
@ -78,7 +78,7 @@ async function quickPerf() {
// Test 4: Real embeddings (the killer) // Test 4: Real embeddings (the killer)
console.log('4⃣ With Real Embeddings (10 samples)') console.log('4⃣ With Real Embeddings (10 samples)')
const brain3 = new BrainyData({ const brain3 = new Brainy({
storage: new MemoryStorage(), storage: new MemoryStorage(),
augmentations: false augmentations: false
// Uses real embedding function // Uses real embedding function

View file

@ -4,14 +4,14 @@
* Quick Verification Test - Verify real implementations work * Quick Verification Test - Verify real implementations work
*/ */
import { BrainyData } from '../dist/index.js' import { Brainy } from '../dist/index.js'
import { MemoryStorage } from '../dist/storage/adapters/memoryStorage.js' import { MemoryStorage } from '../dist/storage/adapters/memoryStorage.js'
async function quickVerify() { async function quickVerify() {
console.log('🔍 Quick Verification Test\n') console.log('🔍 Quick Verification Test\n')
// Initialize // Initialize
const brain = new BrainyData({ const brain = new Brainy({
storage: new MemoryStorage() storage: new MemoryStorage()
}) })

View file

@ -10,7 +10,7 @@
* 4. No fake/stub code in production path * 4. No fake/stub code in production path
*/ */
import { BrainyData } from '../dist/index.js' import { Brainy } from '../dist/index.js'
import { MemoryStorage } from '../dist/storage/adapters/memoryStorage.js' import { MemoryStorage } from '../dist/storage/adapters/memoryStorage.js'
// Test configuration // Test configuration
@ -34,7 +34,7 @@ async function runScaleTest() {
const startTime = Date.now() const startTime = Date.now()
// Initialize Brainy with real augmentations // Initialize Brainy with real augmentations
const brain = new BrainyData({ const brain = new Brainy({
storage: new MemoryStorage(), storage: new MemoryStorage(),
augmentations: { augmentations: {
// These should all be REAL implementations now // These should all be REAL implementations now