@soulcraft/brainy 2.7.2 → 2.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,22 @@ All notable changes to Brainy will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.7.4] - 2025-08-29
9
+
10
+ ### Fixed
11
+ - Use fp32 models consistently everywhere to ensure compatibility
12
+ - Changed default dtype from q8 to fp32 across all embedding implementations
13
+ - Ensures the exact same model (model.onnx) is used everywhere
14
+ - Prevents 404 errors when looking for quantized models that don't exist on CDN
15
+ - Maintains data compatibility across all Brainy instances
16
+
17
+ ## [2.7.3] - 2025-08-29
18
+
19
+ ### Fixed
20
+ - Allow automatic model downloads without requiring BRAINY_ALLOW_REMOTE_MODELS environment variable
21
+ - Models now download automatically when not present locally
22
+ - Fixed environment variable check to only block downloads when explicitly set to 'false'
23
+
8
24
  ## [2.0.0] - 2025-08-26
9
25
 
10
26
  ### 🎉 Major Release - Triple Intelligence™ Engine
@@ -97,7 +97,7 @@ export class LightweightEmbedder {
97
97
  console.log('⚠️ Loading ONNX model for complex text...');
98
98
  const { TransformerEmbedding } = await import('../utils/embedding.js');
99
99
  this.onnxEmbedder = new TransformerEmbedding({
100
- dtype: 'q8',
100
+ dtype: 'fp32',
101
101
  verbose: false
102
102
  });
103
103
  await this.onnxEmbedder.init();
@@ -107,7 +107,7 @@ export class UniversalMemoryManager {
107
107
  const { TransformerEmbedding } = await import('../utils/embedding.js');
108
108
  this.embeddingFunction = new TransformerEmbedding({
109
109
  verbose: false,
110
- dtype: 'q8',
110
+ dtype: 'fp32',
111
111
  localFilesOnly: process.env.BRAINY_ALLOW_REMOTE_MODELS !== 'true'
112
112
  });
113
113
  await this.embeddingFunction.init();
@@ -13,7 +13,7 @@ async function initModel() {
13
13
  if (!model) {
14
14
  model = new TransformerEmbedding({
15
15
  verbose: false,
16
- dtype: 'q8',
16
+ dtype: 'fp32',
17
17
  localFilesOnly: process.env.BRAINY_ALLOW_REMOTE_MODELS !== 'true'
18
18
  });
19
19
  await model.init();
@@ -76,9 +76,9 @@ export class TransformerEmbedding {
76
76
  // 1. Explicit option takes highest priority
77
77
  localFilesOnly = options.localFilesOnly;
78
78
  }
79
- else if (process.env.BRAINY_ALLOW_REMOTE_MODELS !== undefined) {
80
- // 2. Environment variable override
81
- localFilesOnly = process.env.BRAINY_ALLOW_REMOTE_MODELS !== 'true';
79
+ else if (process.env.BRAINY_ALLOW_REMOTE_MODELS === 'false') {
80
+ // 2. Environment variable explicitly disables remote models
81
+ localFilesOnly = true;
82
82
  }
83
83
  else if (process.env.NODE_ENV === 'development') {
84
84
  // 3. Development mode allows remote models
@@ -98,7 +98,7 @@ export class TransformerEmbedding {
98
98
  verbose: this.verbose,
99
99
  cacheDir: options.cacheDir || './models',
100
100
  localFilesOnly: localFilesOnly,
101
- dtype: options.dtype || 'q8', // Changed from fp32 to q8 for 75% memory reduction
101
+ dtype: options.dtype || 'fp32', // Use fp32 by default as quantized models aren't available on CDN
102
102
  device: options.device || 'auto'
103
103
  };
104
104
  if (this.verbose) {
@@ -216,7 +216,7 @@ export class TransformerEmbedding {
216
216
  const pipelineOptions = {
217
217
  cache_dir: cacheDir,
218
218
  local_files_only: isBrowser() ? false : this.options.localFilesOnly,
219
- dtype: this.options.dtype || 'q8', // Use quantized model for lower memory
219
+ dtype: this.options.dtype || 'fp32', // Use fp32 model as quantized models aren't available on CDN
220
220
  // CRITICAL: ONNX memory optimizations
221
221
  session_options: {
222
222
  enableCpuMemArena: false, // Disable pre-allocated memory arena
@@ -83,7 +83,7 @@ class HybridModelManager {
83
83
  // Smart configuration based on environment
84
84
  let options = {
85
85
  verbose: !isTest && !isServerless,
86
- dtype: 'q8',
86
+ dtype: 'fp32',
87
87
  device: 'cpu'
88
88
  };
89
89
  // Environment-specific optimizations
@@ -91,7 +91,7 @@ class HybridModelManager {
91
91
  options = {
92
92
  ...options,
93
93
  localFilesOnly: forceLocalOnly || false, // Respect environment variable
94
- dtype: 'q8',
94
+ dtype: 'fp32',
95
95
  device: 'cpu',
96
96
  verbose: false
97
97
  };
@@ -100,7 +100,7 @@ class HybridModelManager {
100
100
  options = {
101
101
  ...options,
102
102
  localFilesOnly: forceLocalOnly || true, // Default true for serverless, but respect env
103
- dtype: 'q8',
103
+ dtype: 'fp32',
104
104
  device: 'cpu',
105
105
  verbose: false
106
106
  };
@@ -119,7 +119,7 @@ class HybridModelManager {
119
119
  options = {
120
120
  ...options,
121
121
  localFilesOnly: forceLocalOnly || false, // Respect environment variable for tests
122
- dtype: 'q8',
122
+ dtype: 'fp32',
123
123
  device: 'cpu',
124
124
  verbose: false
125
125
  };
@@ -128,7 +128,7 @@ class HybridModelManager {
128
128
  options = {
129
129
  ...options,
130
130
  localFilesOnly: forceLocalOnly || false, // Respect environment variable for default node
131
- dtype: 'q8',
131
+ dtype: 'fp32',
132
132
  device: 'auto',
133
133
  verbose: true
134
134
  };
@@ -168,7 +168,7 @@ class HybridModelManager {
168
168
  // 2. If that fails, explicitly allow remote with verbose logging
169
169
  { ...options, localFilesOnly: false, verbose: true, source: 'fallback-verbose' },
170
170
  // 3. Last resort: basic configuration
171
- { verbose: false, dtype: 'q8', device: 'cpu', localFilesOnly: false, source: 'last-resort' }
171
+ { verbose: false, dtype: 'fp32', device: 'cpu', localFilesOnly: false, source: 'last-resort' }
172
172
  ];
173
173
  let lastError = null;
174
174
  for (const attemptOptions of attempts) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soulcraft/brainy",
3
- "version": "2.7.2",
3
+ "version": "2.7.4",
4
4
  "description": "Universal Knowledge Protocol™ - World's first Triple Intelligence database unifying vector, graph, and document search in one API. 31 nouns × 40 verbs for infinite expressiveness.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",