Commit graph

128 commits

Author SHA1 Message Date
5f0d9f4b0a **refactor: rename directories and variables for semantic clarity in OPFS storage**
### Changes:
- Renamed `nodes` to `nouns` and `edges` to `verbs` across `opfsStorage.ts`, improving code semantics:
  - Directory constants (e.g., `NODES_DIR` → `NOUNS_DIR`).
  - Class properties, method names, and variables updated accordingly.
- Introduced global type augmentation for `FileSystemDirectoryHandle` to support `entries()` method, improving compatibility.
- Updated directory management logic:
  - Adjusted initialization, recreation, and metadata retrieval methods to reflect new nomenclature.
  - Enhanced handling for directory entries in both `nouns` and `verbs` contexts.
- Refined comments, formatting, and TypeScript annotations for consistency.

### Purpose:
Improved the code's readability and semantic clarity by aligning directory and variable names with their conceptual purpose (`nouns` for entities, `verbs` for relationships). Enhanced maintainability and developer understanding of the storage implementation.
2025-06-19 15:03:06 -07:00
126fe08379 **refactor: streamline initializeBrainy embedding configuration and cleanup code style**
### Changes:
- Removed conditional configuration for `USE_SIMPLE_EMBEDDING` as Universal Sentence Encoder is now the sole embedding option.
- Updated comments to reflect the exclusive use of TensorFlow.js for embedding functionality.
- Cleaned up unnecessary blank lines and whitespace for improved code readability.

### Purpose:
Simplified the `initializeBrainy` function by consolidating embedding configuration and eliminating outdated options. This refinement aligns with the project's transition to TensorFlow-based embeddings and improves code clarity.
2025-06-19 15:02:53 -07:00
71b5e09462 **refactor: remove simple embedding model and enhance UniversalSentenceEncoder implementation**
### Changes:
- Removed `SimpleEmbedding` class, including its character-based embedding functionality and associated utility methods.
- Refined the Universal Sentence Encoder (USE) implementation:
  - Added support for handling edge cases such as empty strings and arrays by returning zero vectors.
  - Filtered out invalid input, improving robustness.
  - Addressed `EPSILON` flag initialization and TensorFlow.js environment setup to prevent runtime errors.
- Updated error handling for embedding failures to provide more detailed traceability.
- Simplified `createEmbeddingFunction` and `defaultEmbeddingFunction` to focus solely on TensorFlow-based embeddings.

### Purpose:
Streamlined the embedding API by removing the outdated `SimpleEmbedding` class and fully transitioning to TensorFlow's Universal Sentence Encoder. These changes improve input validation, error resilience, and compatibility with TensorFlow.js, ensuring a more consistent and reliable embedding experience.
2025-06-19 15:02:39 -07:00
5703c4a69a **feat: integrate optimized index functionality into BrainyData**
### Changes:
- Enhanced `BrainyData` class to support `HNSWIndexOptimized` alongside the standard HNSW index.
- Added a new configuration parameter `hnswOptimized` for enabling optimized indexing.
- Created utility methods for handling optimized index-specific functionalities such as memory usage tracking and disk-based index management.
- Updated vector addition, retrieval, and management methods to accommodate both standard and optimized indices.
- Introduced support for using pre-defined IDs during vector and relationship creation.
- Standardized metadata handling for error resilience and embedding integrations.
- Implemented a `getAllNouns` method to retrieve all indexed data.
- Added validation for vector dimensions during relationship creation to ensure consistency.
- Refactored method signatures to improve readability and alignment.

### Purpose:
Improved the BrainyData API to support optimized indexing functionality powered by `HNSWIndexOptimized`, enhancing scalability for large datasets while maintaining backward compatibility. Elevated overall code structure and usability.
2025-06-19 15:02:25 -07:00
6f6f787bf1 **feat: introduce Optimized HNSW Index with product quantization and disk-based storage support**
### Changes:
- Added `HNSWIndexOptimized` class in `src/hnsw/hnswIndexOptimized.ts`:
  - Supports large datasets with product quantization for dimensionality reduction.
  - Enables disk-based index storage via a configurable storage adapter.
  - Introduces `HNSWOptimizedConfig` interface for advanced configuration:
    - Includes memory thresholds, product quantization (subvectors, centroids), and disk-based indexing options.
  - Implements methods for adding, searching, and managing indexed vectors with enhanced scalability.
- Introduced `ProductQuantizer` utility:
  - Handles vector quantization with training and reconstruction capabilities.
  - Reduces vector dimensions, improving memory and performance efficiency.
- Added accessor methods in `src/hnsw/hnswIndex.ts` for configuration and index metadata (e.g., dimension, max level, entry point).

### Purpose:
Enhanced the HNSW implementation to support optimized indexing and search for large datasets, addressing scalability challenges via product quantization and optional disk-based storage. This update elevates the library's performance and applicability for memory-constrained environments.
2025-06-19 15:02:05 -07:00
57880cfd06 **chore: bump version to 0.8.11**
### Changes:
- Updated `VERSION` constant in `src/utils/version.ts` from `0.8.0` to `0.8.11`.

### Purpose:
Incremented the project version to reflect new changes, updates, or bug fixes, ensuring proper version tracking and release management.
2025-06-19 15:01:10 -07:00
518a422da0 **feat: add backup and restore commands for database operations**
### Changes:
- Added `backup` command to export database content into a JSON file.
  - Includes noun and verb data with metadata.
  - Allows specifying a custom output filename (`brainy-backup.json` by default).
- Added `restore` command to import data from a JSON file into the database.
  - Supports clearing existing data with `--clear` option before restoration.
  - Displays success information for imported nouns and verbs.
- Integrated help text examples for the new commands.
- Enhanced CLI interface with additional indentation for better readability.
- Adjusted `completion-setup` to include autocomplete for backup and restore operations.

### Purpose:
Introduced backup and restore functionality to improve database management and data portability, enabling users to save and load datasets seamlessly for better flexibility in usage and recovery.
2025-06-19 15:00:58 -07:00
755b1a6fc1 **feat: add browser-compatible exports and define BrainyData interface**
### Changes:
- Created `examples/browser_compatible_exports.ts`:
  - Introduced browser-friendly exports with polyfill for `Buffer` in browser environments.
  - Implemented shims for Node.js modules (`fs`, `util`, and `path`) to avoid compatibility issues.
  - Exported browser-compatible types and utilities: `BrainyData`, `NounType`, `VerbType`, graph types, core types, distance functions, embedding utilities, and storage adapters.
  - Explicitly excluded Node.js/CLI-specific parts to focus on browser compatibility.
- Added `src/types/brainyDataInterface.ts`:
  - Defined `BrainyDataInterface` to break the circular dependency between `brainyData.ts` and `serverSearchAugmentations.ts`.
  - Provided methods for managing nodes, relationships, initialization, search, and adding vector data with metadata.

### Purpose:
- Enhanced the codebase to support browser environments by introducing browser-specific exports and avoiding Node.js dependencies.
- Established clearer separation of concerns and modularity by introducing the `BrainyDataInterface` for dependency management, improving maintainability and flexibility.
2025-06-19 15:00:41 -07:00
cbc007b6cf **remove: delete LLM augmentations implementation**
### Changes:
- Removed the `src/augmentations/llmAugmentations.ts` file:
  - Contained cognition augmentations for creating, testing, exporting, and deploying LLM models.
  - Included TensorFlow.js-based model configuration, training, testing, and deployment functionalities.
  - Implemented various presets (`tiny`, `small`, `medium`, `large`) for simplified LLM model creation.

### Purpose:
This change removes legacy LLM-related augmentations and functionalities no longer relevant to the project's current focus, in alignment with the recent transition to TensorFlow-based embedding workflows. Cleaning up eliminates unused code and maintains a streamlined, up-to-date codebase.
2025-06-19 15:00:26 -07:00
cfe1fd9e22 **feat: refine README and enhance embedding workflows**
### Changes:
- Updated README.md:
  - Refined the project description to highlight its lightweight and powerful nature.
  - Enhanced feature list, replacing outdated entries with modern updates (e.g., TensorFlow integration replacing LLM creation).
  - Included detailed installation and usage instructions for TensorFlow.js support and embedding workflows.
  - Added "Usage Options" section to define different import methods and supported environments.
  - Expanded "Backup and Restore" details, showcasing CLI and scripting examples.
  - Introduced optimized HNSW indexing for large datasets.
  - Replaced examples with a unified and simplified demonstration approach.
  - Embedded advanced build and environment-specific configurations for better clarity.
- Removed outdated content related to language model generation, including LLM-related commands and examples.
- Added README.demo.md with full instructions for running the interactive demo.

### Purpose:
This update modernizes the documentation and focuses on Brainy’s current capabilities, simplifying onboarding for new users while removing deprecated features. It also streamlines project understanding, enabling developers to better utilize its features in diverse environments.
2025-06-19 15:00:08 -07:00
8eaf9f67cb **feat: add browser-compatible build configuration and environment detection**
### Changes:
- Added `rollup.unified.js` for building a unified bundle with environment detection (Node.js, Browser, Serverless).
- Added `rollup_config.js` for browser-specific bundle configurations.
- Created `tsconfig.browser.json` for browser builds and `tsconfig.unified.json` for unified builds.
- Implemented custom Rollup plugins:
  - **`fixThisReferences`**: Resolves `this` reference issues in TensorFlow files.
  - **`nodeModuleShims`**: Provides empty shims for Node.js built-in modules in browser environments.
- Updated dependencies in `package-lock.json` to include Rollup plugins and updated `buffer` dependency for polyfills.
- Created `src/unified.ts` as the unified library entry point with dynamic environment detection.

### Purpose:
- Introduced a unified and browser-compatible build pipeline to ensure `Brainy` can seamlessly operate across multiple environments (Node.js, Browser, Serverless).
- Resolved compatibility issues with Node.js modules and specific library builds.
- Enhanced flexibility and usability for developers working in diverse runtime environments.
2025-06-19 14:59:42 -07:00
6cedde94b0 remove: outdated examples from the examples directory
### Changes:
- Deleted the following outdated example files from the `examples` directory:
  - `buildTimeRegistration.js`
  - `conduitAugmentationExample.js`
  - `configurationTest.js`
  - `dataInspectionExample.js`
  - `import-graphTypes.js`
  - `browser-server-search/index.html`

### Purpose:
These example files were removed as they were no longer relevant or up-to-date with the current state of the project. This cleanup ensures that users referencing examples have access to accurate and relevant documentation and code, reducing potential confusion.
2025-06-18 11:20:47 -07:00
f6059d9484 update: refine project description in README.md
### Changes:
- Adjusted the main project description in `README.md` for a more engaging tone by adding "A fun" to emphasize the platform's appeal.

### Purpose:
This update aims to make the project description more approachable and engaging for potential users while maintaining clarity about its capabilities.
2025-06-12 17:05:14 -07:00
faada22323 update: highlight "Run Everywhere" feature in README.md and fix whitespace in related projects section 2025-06-12 16:55:48 -07:00
1f9910cf17 remove: brainy.png and brainy-large.png from package files and repository 2025-06-12 16:52:08 -07:00
a61553fb22 update: refine README.md examples, remove sensitive placeholders, and simplify branding in documentation 2025-06-12 16:42:15 -07:00
43827134ec chore: remove IDE configuration XML files from repository 2025-06-12 16:41:26 -07:00
9d631386dd update: change logo path to relative URL and refine project description in README.md 2025-06-12 16:27:36 -07:00
b3240f39cb 0.8.11 2025-06-12 08:44:59 -07:00
9dc846abf6 fix: update logo URL in README.md to use absolute GitHub path 2025-06-12 08:44:48 -07:00
38dfed9636 0.8.10 2025-06-11 10:00:34 -07:00
214865af08 remove: embedded image data from README.md to reduce file size 2025-06-11 10:00:16 -07:00
caa399003c 0.8.9 2025-06-11 09:58:41 -07:00
bbb7639b8e 0.8.8 2025-06-11 09:57:17 -07:00
90ce85fecc Embed brainy.png image directly in README.md for better visibility 2025-06-11 09:52:25 -07:00
af5fae9195 0.8.7 2025-06-11 09:37:14 -07:00
04daa9ff0d fix: update logo URL in README.md to use absolute GitHub path 2025-06-11 09:36:46 -07:00
4551bbab96 0.8.6 2025-06-11 09:32:23 -07:00
a71ca50815 fix: add extra line breaks in README.md for better spacing 2025-06-11 09:31:59 -07:00
6de25d85eb fix: update logo source path in README.md 2025-06-11 09:31:23 -07:00
f28eef6df9 fix: update image source path in README.md 2025-06-11 09:23:48 -07:00
b6a33be76d fix: update image source path in README.md 2025-06-11 09:22:00 -07:00
61e4172aab 0.8.5 2025-06-11 09:17:36 -07:00
3c16ea34c6 feat: add script for encoding images to Base64 and generating HTML output
Introduced `encode-image.js` to convert images to Base64 and create corresponding HTML `<img>` tags. Outputs a sample encoded result to `encoded-image.html`.
2025-06-11 09:17:17 -07:00
4e15237a17 0.8.4 2025-06-11 09:03:16 -07:00
c2ff5d335b chore: add repository information to package.json 2025-06-11 09:03:04 -07:00
3b706e48de 0.8.3 2025-06-11 08:58:29 -07:00
9b4ac287e6 chore: update README.md with logo alignment and define package file inclusions
Added spacing adjustment for Brainy logo in README. Specified files to be included in package publication to streamline distribution.
2025-06-11 08:58:19 -07:00
ef41ec07f6 0.8.2 2025-06-11 08:49:54 -07:00
0b7b3f947b chore: update README.md and docs with Brainy logo and enhanced formatting
Standardized documentation by adding a centered Brainy logo across README files, examples, and guides. Adjusted text formatting for consistency, improved alignment, and readability of feature descriptions and examples.
2025-06-11 08:49:30 -07:00
21ae491913 0.8.1 2025-06-10 11:47:15 -07:00
f0537a3fc4 feat: add simplified LLM commands and presets with detailed CLI support
Implemented new simplified commands (`create-simple`, `train-simple`, `generate-simple`) for easier LLM model management. Added pre-configured model presets (`tiny`, `small`, `medium`, `large`) and enhanced options to streamline usage for beginners. Updated CLI and API documentation with detailed examples. Incremented version to 0.8.0.
2025-06-10 11:47:05 -07:00
cb43391ee2 0.8.0 2025-06-10 11:15:47 -07:00
7f95844434 docs: add comprehensive documentation and examples for LLM augmentation
Introduced `llm-augmentation.md`, detailing the creation, training, testing, exporting, and deployment of language models using Brainy's graph database. Added examples showcasing practical usage and pipeline integration. Included class implementations in `llmAugmentations.ts`.
2025-06-10 11:15:22 -07:00
dbea051572 0.7.7 2025-06-06 10:49:36 -07:00
099b192071 feat: update server search augmentations and increment version to 0.7.6 2025-06-06 10:49:29 -07:00
a206b9926d feat: add browser-server search example with server search augmentations 2025-06-06 10:48:10 -07:00
bf3d9a055b feat: implement remote server search capabilities with WebSocket support 2025-06-06 10:48:01 -07:00
6ccbd01654 docs: enhance README.md with new badges, iConduit details, and related projects
Added several badges for TypeScript, TensorFlow, and Cartographer. Expanded on iConduit augmentations with WebSocket and WebRTC details, revised feature descriptions, and introduced a related projects section. Updated examples for improved clarity.
2025-06-06 09:33:39 -07:00
0d12f68f32 0.7.6 2025-06-06 09:09:32 -07:00