@soulcraft/brainy 0.51.1 → 0.51.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +162 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -129,6 +129,26 @@ const results = await brainy.search("wireless headphones", 10, {
|
|
|
129
129
|
- ✅ **5x Fewer Dependencies**: Clean tree, no peer dependency issues
|
|
130
130
|
- ✅ **Same API**: Drop-in replacement, existing code works unchanged
|
|
131
131
|
|
|
132
|
+
### 🚀 Why Developers Love Brainy
|
|
133
|
+
|
|
134
|
+
- **🧠 Zero-to-Smart™** - No config files, no tuning parameters, no DevOps headaches. Brainy auto-detects your environment and optimizes itself
|
|
135
|
+
- **🌍 True Write-Once, Run-Anywhere** - Same code runs in Angular, React, Vue, Node.js, Deno, Bun, serverless, edge workers, and web workers with automatic environment detection
|
|
136
|
+
- **⚡ Scary Fast** - Handles millions of vectors with sub-millisecond search. GPU acceleration for embeddings, optimized CPU for distance calculations
|
|
137
|
+
- **🎯 Self-Learning** - Like having a database that goes to the gym. Gets faster and smarter the more you use it
|
|
138
|
+
- **🔮 AI-First Design** - Built for the age of embeddings, RAG, and semantic search. Your LLMs will thank you
|
|
139
|
+
- **🎮 Actually Fun to Use** - Clean API, great DX, and it does the heavy lifting so you can build cool stuff
|
|
140
|
+
|
|
141
|
+
### 🚀 NEW: Ultra-Fast Search Performance + Auto-Configuration
|
|
142
|
+
|
|
143
|
+
**Your searches just got 100x faster AND Brainy now configures itself!** Advanced performance with zero setup:
|
|
144
|
+
|
|
145
|
+
- **🤖 Intelligent Auto-Configuration** - Detects environment and usage patterns, optimizes automatically
|
|
146
|
+
- **⚡ Smart Result Caching** - Repeated queries return in <1ms with automatic cache invalidation
|
|
147
|
+
- **📄 Cursor-Based Pagination** - Navigate millions of results with constant O(k) performance
|
|
148
|
+
- **🔄 Real-Time Data Sync** - Cache automatically updates when data changes, even in distributed scenarios
|
|
149
|
+
- **📊 Performance Monitoring** - Built-in hit rate and memory usage tracking with adaptive optimization
|
|
150
|
+
- **🎯 Zero Breaking Changes** - All existing code works unchanged, just faster and smarter
|
|
151
|
+
|
|
132
152
|
## 🏆 Why Brainy Wins
|
|
133
153
|
|
|
134
154
|
- 🧠 **Triple Search Power** - Vector + Graph + Faceted filtering in one query
|
|
@@ -349,6 +369,62 @@ const health = reader.getHealthStatus()
|
|
|
349
369
|
console.log(`Instance ${health.instanceId}: ${health.status}`)
|
|
350
370
|
```
|
|
351
371
|
|
|
372
|
+
### 🐳 NEW: Zero-Config Docker Deployment
|
|
373
|
+
|
|
374
|
+
**Deploy to any cloud with embedded models - no runtime downloads needed!**
|
|
375
|
+
|
|
376
|
+
```dockerfile
|
|
377
|
+
# One line extracts models automatically during build
|
|
378
|
+
RUN npm run download-models
|
|
379
|
+
|
|
380
|
+
# Deploy anywhere: Google Cloud, AWS, Azure, Cloudflare, etc.
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
- **⚡ 7x Faster Cold Starts** - Models embedded in container, no downloads
|
|
384
|
+
- **🌐 Universal Cloud Support** - Same Dockerfile works everywhere
|
|
385
|
+
- **🔒 Offline Ready** - No external dependencies at runtime
|
|
386
|
+
- **📦 Zero Configuration** - Automatic model detection and loading
|
|
387
|
+
|
|
388
|
+
```javascript
|
|
389
|
+
// Zero configuration - everything optimized automatically!
|
|
390
|
+
const brainy = new BrainyData() // Auto-detects environment & optimizes
|
|
391
|
+
await brainy.init()
|
|
392
|
+
|
|
393
|
+
// Caching happens automatically - no setup needed!
|
|
394
|
+
const results1 = await brainy.search('query', 10) // ~50ms first time
|
|
395
|
+
const results2 = await brainy.search('query', 10) // <1ms cached hit!
|
|
396
|
+
|
|
397
|
+
// Advanced pagination works instantly
|
|
398
|
+
const page1 = await brainy.searchWithCursor('query', 100)
|
|
399
|
+
const page2 = await brainy.searchWithCursor('query', 100, {
|
|
400
|
+
cursor: page1.cursor // Constant time, no matter how deep!
|
|
401
|
+
})
|
|
402
|
+
|
|
403
|
+
// Monitor auto-optimized performance
|
|
404
|
+
const stats = brainy.getCacheStats()
|
|
405
|
+
console.log(`Auto-tuned cache hit rate: ${(stats.search.hitRate * 100).toFixed(1)}%`)
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
## 🎭 Key Features
|
|
409
|
+
|
|
410
|
+
### Core Capabilities
|
|
411
|
+
|
|
412
|
+
- **Vector Search** - Find semantically similar content using embeddings
|
|
413
|
+
- **MongoDB-Style Metadata Filtering** 🆕 - Advanced filtering with `$gt`, `$in`, `$regex`, `$and`, `$or` operators
|
|
414
|
+
- **Graph Relationships** - Connect data with meaningful relationships
|
|
415
|
+
- **JSON Document Search** - Search within specific fields with prioritization
|
|
416
|
+
- **Distributed Mode** - Scale horizontally with automatic coordination between instances
|
|
417
|
+
- **Real-Time Syncing** - WebSocket and WebRTC for distributed instances
|
|
418
|
+
- **Streaming Pipeline** - Process data in real-time as it flows through
|
|
419
|
+
- **Model Control Protocol** - Let AI models access your data
|
|
420
|
+
|
|
421
|
+
### Developer Experience
|
|
422
|
+
|
|
423
|
+
- **TypeScript Support** - Fully typed API with generics
|
|
424
|
+
- **Extensible Augmentations** - Customize and extend functionality
|
|
425
|
+
- **REST API** - Web service wrapper for HTTP endpoints
|
|
426
|
+
- **Auto-Complete** - IntelliSense for all APIs and types
|
|
427
|
+
|
|
352
428
|
## 🆚 Why Not Just Use...?
|
|
353
429
|
|
|
354
430
|
### vs. Multiple Databases
|
|
@@ -488,6 +564,92 @@ Deploy to: Google Cloud Run, AWS Lambda/ECS, Azure Container Instances, Cloudfla
|
|
|
488
564
|
|
|
489
565
|
</details>
|
|
490
566
|
|
|
567
|
+
## 🚀 Getting Started in 30 Seconds
|
|
568
|
+
|
|
569
|
+
**The same Brainy code works everywhere - React, Vue, Angular, Node.js, Serverless, Edge Workers.**
|
|
570
|
+
|
|
571
|
+
```javascript
|
|
572
|
+
// This EXACT code works in ALL environments
|
|
573
|
+
import { BrainyData } from '@soulcraft/brainy'
|
|
574
|
+
|
|
575
|
+
const brainy = new BrainyData()
|
|
576
|
+
await brainy.init()
|
|
577
|
+
|
|
578
|
+
// Add nouns (entities)
|
|
579
|
+
const openai = await brainy.add("OpenAI", { type: "company" })
|
|
580
|
+
const gpt4 = await brainy.add("GPT-4", { type: "product" })
|
|
581
|
+
|
|
582
|
+
// Add verbs (relationships)
|
|
583
|
+
await brainy.relate(openai, gpt4, "develops")
|
|
584
|
+
|
|
585
|
+
// Vector search + Graph traversal
|
|
586
|
+
const similar = await brainy.search("AI companies", 5)
|
|
587
|
+
const products = await brainy.getVerbsBySource(openai)
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
<details>
|
|
591
|
+
<summary>🔍 <strong>See Framework Examples</strong></summary>
|
|
592
|
+
|
|
593
|
+
### React
|
|
594
|
+
|
|
595
|
+
```jsx
|
|
596
|
+
function App() {
|
|
597
|
+
const [brainy] = useState(() => new BrainyData())
|
|
598
|
+
useEffect(() => brainy.init(), [])
|
|
599
|
+
|
|
600
|
+
const search = async (query) => {
|
|
601
|
+
return await brainy.search(query, 10)
|
|
602
|
+
}
|
|
603
|
+
// Same API as above
|
|
604
|
+
}
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
### Vue 3
|
|
608
|
+
|
|
609
|
+
```vue
|
|
610
|
+
<script setup>
|
|
611
|
+
const brainy = new BrainyData()
|
|
612
|
+
await brainy.init()
|
|
613
|
+
// Same API as above
|
|
614
|
+
</script>
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
### Angular
|
|
618
|
+
|
|
619
|
+
```typescript
|
|
620
|
+
@Component({})
|
|
621
|
+
export class AppComponent {
|
|
622
|
+
brainy = new BrainyData()
|
|
623
|
+
|
|
624
|
+
async ngOnInit() {
|
|
625
|
+
await this.brainy.init()
|
|
626
|
+
// Same API as above
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
### Node.js / Deno / Bun
|
|
632
|
+
|
|
633
|
+
```javascript
|
|
634
|
+
const brainy = new BrainyData()
|
|
635
|
+
await brainy.init()
|
|
636
|
+
// Same API as above
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
</details>
|
|
640
|
+
|
|
641
|
+
### 🌍 Framework-First, Runs Everywhere
|
|
642
|
+
|
|
643
|
+
**Brainy automatically detects your environment and optimizes everything:**
|
|
644
|
+
|
|
645
|
+
| Environment | Storage | Optimization |
|
|
646
|
+
|-----------------|-----------------|----------------------------|
|
|
647
|
+
| 🌐 Browser | OPFS | Web Workers, Memory Cache |
|
|
648
|
+
| 🟢 Node.js | FileSystem / S3 | Worker Threads, Clustering |
|
|
649
|
+
| ⚡ Serverless | S3 / Memory | Cold Start Optimization |
|
|
650
|
+
| 🔥 Edge Workers | Memory / KV | Minimal Footprint |
|
|
651
|
+
| 🦕 Deno/Bun | FileSystem / S3 | Native Performance |
|
|
652
|
+
|
|
491
653
|
## 📚 Documentation & Resources
|
|
492
654
|
|
|
493
655
|
- **[🚀 Quick Start Guide](docs/getting-started/)** - Get up and running in minutes
|