• v7.1.0 61100bdc9d

    dpsifr released this 2026-01-06 23:53:13 +01:00 | 478 commits to main since this release

    New APIs

    6 New Public APIs leveraging the Candle WASM embedding engine and optimized indexes:

    API Description Performance
    embedBatch(texts) Batch embed multiple texts Batch WASM processing - avoids N separate JS↔WASM calls
    similarity(textA, textB) Semantic similarity score (0-1) Single call vs manual embed + embed + cosine
    indexStats() Comprehensive index statistics O(1) - aggregates pre-computed stats
    neighbors(entityId, options) Graph traversal with filters O(log n) - LSM-tree with bloom filters, sub-5ms
    findDuplicates(options) Find semantic duplicates O(k log n) - uses HNSW for ANN search
    cluster(options) Cluster by similarity O(k log n) - greedy algorithm with HNSW

    Performance Stack (v7.0.0+)

    The new APIs leverage the optimized infrastructure introduced in v7.0.0:

    Component Technology Benefit
    Embeddings Candle WASM (Rust) 93MB binary with embedded MiniLM-L6-v2, zero downloads
    Vector Search HNSW Index O(log n) approximate nearest neighbor
    Graph Traversal LSM-tree + Bloom Filters 90% of queries skip disk I/O, sub-5ms lookups
    Metadata Filtering RoaringBitmap32 Compressed bitmaps for fast AND/OR operations

    Examples

    // Batch embedding
    const embeddings = await brain.embedBatch([
      'Machine learning',
      'Deep neural networks',
      'Natural language processing'
    ])
    
    // Semantic similarity
    const score = await brain.similarity(
      'The cat sat on the mat',
      'A feline was resting on the rug'
    ) // ~0.85
    
    // Find duplicates
    const duplicates = await brain.findDuplicates({
      threshold: 0.9,
      type: NounType.Document
    })
    
    // Clustering
    const clusters = await brain.cluster({
      threshold: 0.8,
      minClusterSize: 3,
      includeCentroid: true
    })
    
    // Graph neighbors
    const neighbors = await brain.neighbors(entityId, {
      direction: 'outgoing',
      depth: 2
    })
    
    // Index statistics
    const stats = await brain.indexStats()
    console.log(`${stats.entities} entities, ${stats.vectors} vectors`)
    

    Migration from v6.x

    v7.0.0 introduced breaking changes to the embedding system:

    • Removed: onnxruntime-node dependency (was 200MB+ with external model downloads)
    • Added: Candle WASM with embedded model weights (93MB, zero-config)
    • Removed: Semantic type inference (NLP-based type detection)
    • Works in: Node.js, Bun, Bun --compile, browsers

    Full Changelog: https://github.com/soulcraftlabs/brainy/compare/v7.0.1...v7.1.0

    Downloads