Commit graph

20 commits

Author SHA1 Message Date
5e0c02e363 chore: Update repository references from soulcraft-research to soulcraftlabs
- Updated GitHub URLs to github.com/soulcraftlabs/brainy
- Updated git remote origin URL
- Updated all documentation references
2025-08-10 16:42:02 -07:00
f898f0ce7b feat\!: migrate from TensorFlow.js to Transformers.js with ONNX Runtime
BREAKING CHANGE: Complete migration from TensorFlow.js to Transformers.js for embedding generation

This is a major architectural change that replaces TensorFlow.js (USE model) with Transformers.js (all-MiniLM-L6-v2) for significantly improved performance and reduced complexity.

Key Changes:
- Replace TensorFlow.js Universal Sentence Encoder with Transformers.js all-MiniLM-L6-v2
- Reduce model size from 525MB to 87MB (83% reduction)
- Reduce embedding dimensions from 512 to 384 (faster distance calculations)
- Remove TensorFlow.js Float32Array patching (caused ONNX conflicts)
- Implement smart bundled model detection for offline operation
- Add explicit model download script for Docker deployments
- Remove complex environment variables in favor of simple configuration
- Update all distance functions to use optimized pure JavaScript
- Remove TensorFlow-specific utilities and type definitions

Performance Improvements:
- Model loading: 5x faster (87MB vs 525MB)
- Memory usage: 75% reduction (~200-400MB vs ~1.5GB)
- Distance calculations: Faster pure JS vs GPU overhead for small vectors
- Cold start performance: Significantly improved

Files Changed:
- Updated package.json: New dependencies, simplified scripts
- Rewrote src/utils/embedding.ts: Complete Transformers.js implementation
- Updated src/utils/distance.ts: Optimized JavaScript distance functions
- Simplified src/setup.ts: Removed TensorFlow-specific patching
- Simplified src/utils/textEncoding.ts: Only Node.js TextEncoder/Decoder patches
- Deleted src/utils/robustModelLoader.ts: TensorFlow-specific loader
- Deleted src/types/tensorflowTypes.ts: TensorFlow type definitions
- Added scripts/download-models.cjs: Docker-compatible model downloader
- Added comprehensive documentation: README.md, OFFLINE_MODELS.md, analysis docs

Testing:
- All 19 tests passing
- Removed test mocking in favor of real implementation testing
- Updated test environment for Transformers.js compatibility
- Performance tests validate improved efficiency

This migration resolves production issues with Docker egress limitations and provides a more robust, performant foundation for vector operations.
2025-08-05 19:29:59 -07:00
e868060057 feat: add brainy-models-package v0.8.0 with USE-lite model
- Add complete Universal Sentence Encoder Lite model (27MB)
- Include vocab.json for tokenization support
- Update package to work with @tensorflow-models/universal-sentence-encoder
- Ensure offline model loading capability for Docker deployments
- Published to npm as @soulcraft/brainy-models@0.8.0
2025-08-05 18:09:12 -07:00
838a998b6a chore: clean up project for release
Remove development artifacts, test files, and redundant directories:
- Delete debug/reproduction scripts and temporary test files
- Remove brainy-models-package/ (redundant with main models/ directory)
- Remove test-consumer/ development testing directory
- Remove build artifacts (coverage/, test-results.json)
- Remove large brainy-data/ test artifact directory

This cleanup reduces repository size significantly and prepares the project for a clean release.
2025-08-05 09:44:59 -07:00
ce4b531fc0 chore(release): 1.0.0 2025-08-05 09:18:26 -07:00
672be32bea **feat: add scripts to reproduce and test race conditions, write-only mode, and indexing issues**
- **New Scripts**:
  - Created `reproduce_race_condition.cjs` to demonstrate and debug race condition issues in `Brainy`. This includes:
    - Scenarios where verbs arrive before nouns.
    - Testing indexing delays and streaming simulations.
    - Evaluation of the `autoCreateMissingNouns` feature.
  - Added `reproduce_writeonly_issue.js` to reproduce and verify issues with write-only mode:
    - Ensures add operations succeed while search operations give appropriate errors.
    - Handles placeholder nouns and validates their replacement with real data.
  - Developed `test_race_condition_fixes.cjs` to verify the implemented fixes:
    - Covers scenarios for `writeOnlyMode`, fallback storage lookups, and missing noun auto-creation.

- **Documentation Updates**:
  - Added `
2025-08-02 15:09:14 -07:00
25dd68e9e7 **feat(brainy-models): implement robust format field validation and update workflow scripts**
- **Documentation**:
  - Added a detailed explanation in `model-management.md` for resolving `"format"` field compatibility issues in TensorFlow.js.
  - Introduced a dual-layer protection approach to mitigate errors like `RangeError: byte length of Float32Array should be a multiple of 4`.

- **Scripts**:
  - Removed the redundant `release:minor` script entry from `package.json`.
  - Enhanced `_deploy` script consistency.

- **Protection Mechanisms**:
  - Updated `download-full-models.js` to inject a missing `"format"` field during downloads.
  - Enhanced `RobustModelLoader` to validate and restore the `"format"` field automatically at runtime, ensuring persistence and compatibility
2025-08-01 18:00:36 -07:00
699dc4f4a5 **feat(brainy-models): enhance workflows, update README, and improve model compatibility**
- **Scripts**:
  - Refactored logging within `release-workflow.js` for improved readability and maintainability.
  - Added a fallback mechanism in `download-full-models.js` to inject the "format" field into `model.json` for TensorFlow.js compatibility.

- **Documentation**:
  - Updated `README.md` with a redesigned structure:
    - Enhanced readability using emojis and a cleaner presentation.
    - Expanded `Overview`, `Features`, and `Quick Start` sections.
    - Refined "Use Cases" and added better explanations for bundled model benefits.

- **Models**:
  - Adjusted `model.json` to include the "format" field for compatibility with TensorFlow.js.
  - Updated `metadata.json` with a recent download timestamp.

**Purpose
2025-08-01 17:33:13 -07:00
4254deceac chore(release): 0.7.0 2025-08-01 17:28:46 -07:00
c677b561d7 **docs(brainy-models): add Code of Conduct and Contributing Guide**
- Added `CODE_OF_CONDUCT.md` to establish community standards for behavior and inclusivity.
- Added `CONTRIBUTING.md` with detailed guidelines for contributing to the `brainy-models-package`:
  - Model quality, testing, and optimization requirements.
  - Development setup instructions, including build and test scripts.
  - Pull request and commit message conventions.
  - Package-specific utility scripts and file structure overview.

**Purpose**: Provide clear contribution and community guidelines to foster collaboration and maintain project quality standards.
2025-08-01 17:15:50 -07:00
1bc1f08c4e **chore(brainy-models): add version configuration and MIT license**
- Added `.versionrc.json` to define conventional release configurations for `brainy-models-package`:
  - Configured tag prefix as `brainy-models-v`.
  - Defined custom commit message format and section mapping for release notes.
- Added `LICENSE` file with MIT license for legal clarity.
- Updated `README.md`:
  - Adjusted internal NPM script names to use underscore prefix for consistency (`_release:patch`, `_github-release`).

**Purpose**: Establish standardized versioning, licensing, and script conventions for the `brainy-models-package` to improve maintainability and alignment with project standards.
2025-08-01 16:59:31 -07:00
b8be0b109c chore(release): 0.6.0 2025-08-01 16:50:04 -07:00
b9b286821b chore(release): 0.5.0 2025-08-01 16:48:18 -07:00
c1add0e7bb chore(release): 0.4.0 [skip ci] 2025-08-01 16:42:55 -07:00
742fad39b8 chore(release): 0.3.0 [skip ci] 2025-08-01 16:42:45 -07:00
d1a6284cf4 chore(release): 0.2.0 [skip ci] 2025-08-01 16:42:35 -07:00
5d3651b058 chore(release): 0.1.0 [skip ci] 2025-08-01 16:37:29 -07:00
e476d45fac **feat(models): add pre-bundled Universal Sentence Encoder for offline use**
- Introduced `@soulcraft/brainy-models` package with pre-bundled TensorFlow models for enhanced offline reliability.
- Added `index.d.ts` and `index.js` allowing offline embedding workflows with the Universal Sentence Encoder model.
- Included utility scripts for model compression, size retrieval, and availability checks.
- Added `metadata.json` and `model.json` defining the Universal Sentence Encoder configuration with offline bundling.
- Ensured comprehensive model documentation, error handling, and robust logging for seamless integration.
- Supported optional model quantization placeholders for future TensorFlow.js enhancements.

**Purpose**: Enable fully offline-ready embedding workflows via pre-bundled Universal Sentence Encoder models, ensuring maximum reliability and air-gapped environment compatibility.
2025-08-01 16:22:58 -07:00
4e5d747a8a **refactor(models): remove demo script and replace with GitHub release creation script**
- Removed `demo-optional-model-bundling.js`:
  - Obsolete demonstration of model bundling and offline loading.
  - Replaced by comprehensive documentation and tools in `@soulcraft/brainy-models`.
- Added `create-github-release.js`:
  - Automates GitHub release creation for `@soulcraft/brainy-models-package`.
  - Includes features for generating release notes, tagging, and uploading with GitHub CLI.
- Updated `package-lock.json`:
  - Reflects new dependencies and updates for GitHub release automation.

**Purpose**: Streamline repository by removing redundant scripts and introducing automated GitHub release workflows for efficient version management.
2025-08-01 16:08:22 -07:00
563b983fcc **feat(models): add scripts for model compression, bundling, and optimization**
- Added new scripts under `brainy-models-package/scripts`:
  - **`compress-models.js`**: Implements model compression with float16 and int8 precision to create optimized variants of Universal Sentence Encoder models.
  - **`download-full-models.js`**: Downloads the complete Universal Sentence Encoder model for offline usage.
  - **`download-model.js`**: Downloads reference files for TensorFlow Hub-based Universal Sentence Encoder.

- Introduced a demonstration script:
  - **`demo-optional-model-bundling.js`**: Highlights the solution of bundling models to eliminate network dependency, ensuring reliability and offline capability.

- Key Features:
  - **Compression**:
    - Reduced model size with float16 (balanced precision and size) and int8 (low-memory environments) options.
    - Generated compression summaries for quick insights into model variants and saved space.
  - **Offline Reliability**:
    - Bundled versions eliminate first-load delays, network dependencies, and failures.
    - Ensures rapid initialization in offline and memory-constrained scenarios.
  - **Dynamic Optimization**:
    - Tailored optimization profiles for various use cases: general, low-memory, and high-performance.
  - **Demonstration and Documentation**:
    - Comprehensive demo showcasing benefits of bundled models over online loading.
    - Examples for usage, testing, and integration with Brainy.

**Purpose**: Introduce essential scripts and tools to enable efficient, offline-ready model usage, streamlining the embedding workflow while ensuring reliability in production and resource-constrained environments.
2025-08-01 15:35:08 -07:00