feat: implement comprehensive type safety system with BrainyTypes API
Major enhancements for type safety and developer experience: - Add BrainyTypes static API for type management and AI-powered suggestions - Implement strict type validation for all 31 NounType categories - Remove dangerous generic add() method that bypassed type safety - Add intelligent type inference with confidence scoring - Provide helpful error messages with typo suggestions using Levenshtein distance - Update all internal code, examples, and documentation to use typed methods - Enhance CLI with new type management commands (types, suggest, validate) Breaking changes: - Remove deprecated add() method - use addNoun() with explicit type parameter - All addNoun() calls now require explicit type as second parameter This release significantly improves type safety across the entire system while maintaining backward compatibility for properly typed method calls. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
d7d2d749b6
commit
6c62bc4e9d
40 changed files with 1704 additions and 497 deletions
|
|
@ -12,7 +12,7 @@ const brain = new BrainyData() // Zero config!
|
|||
await brain.init()
|
||||
|
||||
// Add data (text auto-embeds!)
|
||||
await brain.addNoun('The future of AI is here')
|
||||
await brain.addNoun('The future of AI is here', 'content')
|
||||
|
||||
// Search with Triple Intelligence
|
||||
const results = await brain.find({
|
||||
|
|
@ -322,9 +322,9 @@ const articles = await brain.find({
|
|||
### Creating Knowledge Graphs
|
||||
```typescript
|
||||
// Add entities
|
||||
const ai = await brain.addNoun('Artificial Intelligence')
|
||||
const ml = await brain.addNoun('Machine Learning')
|
||||
const dl = await brain.addNoun('Deep Learning')
|
||||
const ai = await brain.addNoun('Artificial Intelligence', 'concept')
|
||||
const ml = await brain.addNoun('Machine Learning', 'concept')
|
||||
const dl = await brain.addNoun('Deep Learning', 'concept')
|
||||
|
||||
// Create relationships
|
||||
await brain.addVerb(ml, ai, 'subset_of')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue