UNPKG

universal-ai-brain

Version:

🧠 UNIVERSAL AI BRAIN 3.3 - The world's most advanced cognitive architecture with 24 specialized systems, MongoDB 8.1 $rankFusion hybrid search, latest Voyage 3.5 embeddings, and framework-agnostic design. Works with Mastra, Vercel AI, LangChain, OpenAI A

215 lines (168 loc) β€’ 8.77 kB
# 🧠 Universal AI Brain 3.3 **The world's most comprehensive cognitive architecture for AI agents with 24 cognitive systems, MongoDB 8.1 hybrid search, and latest Voyage 3.5 embeddings.** Transform ANY AI framework into a truly intelligent system with semantic memory, emotional intelligence, goal hierarchy, and 21 other cognitive systems. ## πŸš€ Quick Start (2 Minutes) ```bash # Install Universal AI Brain npm install universal-ai-brain # Run interactive setup wizard npx universal-ai-brain setup ``` **The setup wizard will:** - βœ… Create a complete project structure - βœ… Configure your API keys (Voyage AI or OpenAI) - βœ… Set up MongoDB connection - βœ… Generate working example code - βœ… Create tests and documentation ### Manual Setup ### Simple Setup with Latest Voyage 3.5 (Recommended) ```typescript import { UniversalAIBrain } from 'universal-ai-brain'; // 🎯 Latest Voyage 3.5 model (strongest embeddings) const brain = UniversalAIBrain.forVoyage({ mongoUri: process.env.MONGODB_URI, apiKey: process.env.VOYAGE_API_KEY, }); await brain.initialize(); console.log('🧠 Universal AI Brain ready with 24 cognitive systems!'); ``` ### Framework Integration Examples ```typescript // 🎯 Mastra Framework const brain = UniversalAIBrain.forMastra({ mongoUri: process.env.MONGODB_URI, apiKey: process.env.VOYAGE_API_KEY }); // ⚑ Vercel AI SDK const brain = UniversalAIBrain.forVercelAI({ mongoUri: process.env.MONGODB_URI, apiKey: process.env.OPENAI_API_KEY }); // 🦜 LangChain.js const brain = UniversalAIBrain.forLangChain({ mongoUri: process.env.MONGODB_URI, apiKey: process.env.OPENAI_API_KEY }); // πŸ€– OpenAI Agents const brain = UniversalAIBrain.forOpenAI({ mongoUri: process.env.MONGODB_URI, apiKey: process.env.OPENAI_API_KEY }); ``` ## 🧠 The 24 Cognitive Systems ### 🧠 **Core Memory** (4 Systems) - **Semantic Memory** - Knowledge storage and retrieval - **Working Memory** - Short-term context management - **Episodic Memory** - Experience-based learning - **Memory Decay** - Intelligent forgetting ### 🎯 **Intelligence** (6 Systems) - **Emotional Intelligence** - Emotion recognition and response - **Cultural Knowledge** - Cultural awareness and adaptation - **Confidence Tracking** - Uncertainty quantification - **Self Improvement** - Continuous learning and optimization - **Causal Reasoning** - Cause-and-effect understanding - **Analogical Mapping** - Pattern recognition across domains ### ⚑ **Management** (6 Systems) - **Attention Management** - Focus and priority handling - **Goal Hierarchy** - Multi-level objective management - **Temporal Planning** - Time-aware decision making - **Social Intelligence** - Social context understanding - **Skill Capability** - Ability assessment and development - **Change Stream** - Real-time data monitoring ### πŸ”§ **Advanced Tools** (8 Systems) - **Advanced Tool Interface** - External tool integration - **Workflow Orchestration** - Complex task coordination - **Communication Protocol** - Multi-agent coordination - **Multi-Modal Processing** - Multi-format data handling - **Human Feedback Integration** - Learning from human input - **Notification Manager** - Event-driven notifications - **Vector Search** - Semantic similarity matching - **Context Injection** - Relevant information retrieval ## πŸ”₯ **MongoDB 8.1 Hybrid Search - World's First $rankFusion** βœ… **Latest MongoDB 8.1** - Cutting-edge database features βœ… **$rankFusion Aggregation** - Combines vector + text search βœ… **Atlas Vector Search** - Semantic similarity at scale βœ… **Hybrid Search by Default** - Best of both worlds βœ… **Production Tested** - Real MongoDB Atlas 8.1 cluster βœ… **Performance Optimized** - Automatic query optimization ## 🎯 **Framework Support** βœ… **Mastra** - `UniversalAIBrain.forMastra()` βœ… **Vercel AI SDK** - `UniversalAIBrain.forVercelAI()` βœ… **LangChain.js** - `UniversalAIBrain.forLangChain()` βœ… **OpenAI Agents** - `UniversalAIBrain.forOpenAI()` βœ… **Framework Agnostic** - Works with ANY TypeScript AI framework ## ⚑ **Latest Features in 3.3** πŸ†• **Voyage 3.5 Embeddings** - Latest and strongest embedding model πŸ†• **Smart Provider Selection** - Respects user choice (forOpenAI vs forVoyage) πŸ†• **5-Minute Integration Guide** - Complete setup documentation πŸ†• **Error Classification** - Clear distinction between critical vs non-critical errors πŸ†• **Enhanced Documentation** - Framework-specific examples and troubleshooting ## πŸ“– **Documentation** πŸ“– **[Complete Integration Guide β†’](https://github.com/romiluz13/ai_brain_js/blob/main/INTEGRATION_GUIDE.md)** 🎯 **[Framework Examples β†’](https://github.com/romiluz13/ai_brain_js/tree/main/examples/)** πŸ“š **[Full Documentation β†’](https://github.com/romiluz13/ai_brain_js#readme)** ## πŸ—οΈ **Architecture** ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Your AI Framework β”‚ β”‚ (Mastra, Vercel AI, LangChain, etc.) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Universal AI Brain 3.3 β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Memory β”‚ β”‚Intelligence β”‚ β”‚ MongoDB 8.1 β”‚ β”‚ β”‚ β”‚ Systems β”‚ β”‚ Systems β”‚ β”‚ Hybrid Search β”‚ β”‚ β”‚ β”‚ (4) β”‚ β”‚ (14) β”‚ β”‚ $rankFusion β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ MongoDB Atlas 8.1 β”‚ β”‚ Vector Search + Text Search + $rankFusion β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ## πŸ§ͺ **Testing All 24 Cognitive Systems** ```bash # Test all cognitive systems with real MongoDB data npm test # Test specific cognitive systems npm run test:cognitive:memory npm run test:cognitive:benchmark # Setup cognitive system tests npm run setup:cognitive ``` ## πŸ“¦ **Requirements** - **Node.js 18+** - Modern JavaScript runtime - **MongoDB Atlas** - For vector search and hybrid search - **API Keys** - Voyage AI (recommended) or OpenAI - **TypeScript** - For best development experience ## 🚨 **Error Handling Guide** ### βœ… **Safe to Ignore (Non-Critical)** ``` ⚠️ NON-CRITICAL: can't $divide by zero ⚠️ NON-CRITICAL: Atlas Vector Search failed ⚠️ NON-CRITICAL: Dashboard refresh failed ``` ### ❌ **Requires Attention (Critical)** ``` ❌ CRITICAL: MongoDB connection failed ❌ CRITICAL: API key invalid ❌ CRITICAL: Brain initialization failed ``` ## πŸ” **Environment Setup** ```bash # Required Environment Variables MONGODB_URI=mongodb+srv://your-connection-string VOYAGE_API_KEY=pa-your-voyage-api-key OPENAI_API_KEY=sk-your-openai-key # Optional fallback ``` ## πŸ“„ **License** MIT License - see [LICENSE](https://github.com/romiluz13/ai_brain_js/blob/main/LICENSE) file for details. ## πŸ”— **Links** - **[GitHub Repository](https://github.com/romiluz13/ai_brain_js)** - Source code and issues - **[Integration Guide](https://github.com/romiluz13/ai_brain_js/blob/main/INTEGRATION_GUIDE.md)** - Complete setup guide - **[Examples](https://github.com/romiluz13/ai_brain_js/tree/main/examples/)** - Framework examples - **[npm Package](https://www.npmjs.com/package/universal-ai-brain)** - Install via npm --- **🧠 Universal AI Brain 3.3 - Making AI agents truly intelligent with 24 cognitive systems.** ⚑