@soulcraft/brainy 0.24.0 → 0.26.0
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/README.md +22 -16
- package/dist/brainy.js +4553 -2264
- package/dist/brainy.min.js +750 -750
- package/dist/brainyData.d.ts +141 -0
- package/dist/coreTypes.d.ts +31 -0
- package/dist/errors/brainyError.d.ts +45 -0
- package/dist/hnsw/hnswIndexOptimized.d.ts +13 -1
- package/dist/hnsw/hnswIndexOptimized.d.ts.map +1 -1
- package/dist/statistics/statisticsManager.d.ts +121 -0
- package/dist/storage/adapters/fileSystemStorage.d.ts +99 -30
- package/dist/storage/adapters/fileSystemStorage.d.ts.map +1 -1
- package/dist/storage/adapters/memoryStorage.d.ts.map +1 -1
- package/dist/storage/adapters/opfsStorage.d.ts +21 -1
- package/dist/storage/adapters/opfsStorage.d.ts.map +1 -1
- package/dist/storage/adapters/s3CompatibleStorage.d.ts +58 -1
- package/dist/storage/adapters/s3CompatibleStorage.d.ts.map +1 -1
- package/dist/storage/fileSystemStorage.d.ts +2 -15
- package/dist/storage/fileSystemStorage.d.ts.map +1 -1
- package/dist/storage/opfsStorage.d.ts +3 -66
- package/dist/storage/opfsStorage.d.ts.map +1 -1
- package/dist/storage/s3CompatibleStorage.d.ts +2 -14
- package/dist/storage/s3CompatibleStorage.d.ts.map +1 -1
- package/dist/storage/storageFactory.d.ts +6 -1
- package/dist/storage/storageFactory.d.ts.map +1 -1
- package/dist/testing/prettyReporter.d.ts +23 -0
- package/dist/testing/prettySummaryReporter.d.ts +22 -0
- package/dist/types/tensorflowTypes.d.ts +0 -8
- package/dist/types/tensorflowTypes.d.ts.map +1 -1
- package/dist/unified.d.ts +4 -0
- package/dist/unified.js +3170 -1464
- package/dist/unified.min.js +750 -750
- package/dist/utils/embedding.d.ts +7 -0
- package/dist/utils/embedding.d.ts.map +1 -1
- package/dist/utils/environmentDetection.d.ts +47 -0
- package/dist/utils/environmentDetection.d.ts.map +1 -0
- package/dist/utils/logger.d.ts +99 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/operationUtils.d.ts +58 -0
- package/dist/utils/operationUtils.d.ts.map +1 -0
- package/dist/utils/textEncoding.d.ts +0 -7
- package/dist/utils/textEncoding.d.ts.map +1 -1
- package/dist/utils/version.d.ts +1 -1
- package/package.json +14 -3
- package/dist/augmentations/conduitAugmentations.js +0 -1158
- package/dist/augmentations/conduitAugmentations.js.map +0 -1
- package/dist/augmentations/memoryAugmentations.js +0 -255
- package/dist/augmentations/memoryAugmentations.js.map +0 -1
- package/dist/augmentations/serverSearchAugmentations.js +0 -531
- package/dist/augmentations/serverSearchAugmentations.js.map +0 -1
- package/dist/examples/basicUsage.js +0 -128
- package/dist/examples/basicUsage.js.map +0 -1
- package/dist/hnsw/hnswIndex.js +0 -550
- package/dist/hnsw/hnswIndex.js.map +0 -1
- package/dist/hnsw/hnswIndexOptimized.js +0 -441
- package/dist/hnsw/hnswIndexOptimized.js.map +0 -1
- package/dist/mcp/brainyMCPAdapter.js +0 -142
- package/dist/mcp/brainyMCPAdapter.js.map +0 -1
- package/dist/mcp/brainyMCPService.js +0 -248
- package/dist/mcp/brainyMCPService.js.map +0 -1
- package/dist/mcp/index.js +0 -17
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/mcpAugmentationToolset.js +0 -180
- package/dist/mcp/mcpAugmentationToolset.js.map +0 -1
- package/dist/storage/adapters/baseStorageAdapter.js +0 -233
- package/dist/storage/adapters/baseStorageAdapter.js.map +0 -1
- package/dist/storage/adapters/fileSystemStorage.js +0 -568
- package/dist/storage/adapters/fileSystemStorage.js.map +0 -1
- package/dist/storage/adapters/memoryStorage.js +0 -300
- package/dist/storage/adapters/memoryStorage.js.map +0 -1
- package/dist/storage/adapters/opfsStorage.js +0 -778
- package/dist/storage/adapters/opfsStorage.js.map +0 -1
- package/dist/storage/adapters/s3CompatibleStorage.js +0 -1021
- package/dist/storage/adapters/s3CompatibleStorage.js.map +0 -1
- package/dist/storage/baseStorage.js +0 -126
- package/dist/storage/baseStorage.js.map +0 -1
- package/dist/storage/storageFactory.js +0 -183
- package/dist/storage/storageFactory.js.map +0 -1
- package/dist/types/augmentations.js +0 -16
- package/dist/types/augmentations.js.map +0 -1
- package/dist/types/brainyDataInterface.js +0 -8
- package/dist/types/brainyDataInterface.js.map +0 -1
- package/dist/types/fileSystemTypes.js +0 -8
- package/dist/types/fileSystemTypes.js.map +0 -1
- package/dist/types/graphTypes.js +0 -36
- package/dist/types/graphTypes.js.map +0 -1
- package/dist/types/mcpTypes.js +0 -22
- package/dist/types/mcpTypes.js.map +0 -1
- package/dist/types/pipelineTypes.js +0 -7
- package/dist/types/pipelineTypes.js.map +0 -1
- package/dist/types/tensorflowTypes.js +0 -6
- package/dist/types/tensorflowTypes.js.map +0 -1
- package/dist/utils/distance.js +0 -239
- package/dist/utils/distance.js.map +0 -1
- package/dist/utils/embedding.js +0 -622
- package/dist/utils/embedding.js.map +0 -1
- package/dist/utils/environment.js +0 -75
- package/dist/utils/environment.js.map +0 -1
- package/dist/utils/index.js +0 -5
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/statistics.js +0 -25
- package/dist/utils/statistics.js.map +0 -1
- package/dist/utils/tensorflowUtils.js +0 -25
- package/dist/utils/tensorflowUtils.js.map +0 -1
- package/dist/utils/textEncoding.js +0 -281
- package/dist/utils/textEncoding.js.map +0 -1
- package/dist/utils/workerUtils.js +0 -458
- package/dist/utils/workerUtils.js.map +0 -1
package/dist/utils/embedding.js
DELETED
|
@@ -1,622 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Embedding functions for converting data to vectors
|
|
3
|
-
*/
|
|
4
|
-
import { executeInThread } from './workerUtils.js';
|
|
5
|
-
/**
|
|
6
|
-
* TensorFlow Universal Sentence Encoder embedding model
|
|
7
|
-
* This model provides high-quality text embeddings using TensorFlow.js
|
|
8
|
-
* The required TensorFlow.js dependencies are automatically installed with this package
|
|
9
|
-
*
|
|
10
|
-
* This implementation attempts to use GPU processing when available for better performance,
|
|
11
|
-
* falling back to CPU processing for compatibility across all environments.
|
|
12
|
-
*/
|
|
13
|
-
export class UniversalSentenceEncoder {
|
|
14
|
-
/**
|
|
15
|
-
* Create a new UniversalSentenceEncoder instance
|
|
16
|
-
* @param options Configuration options
|
|
17
|
-
*/
|
|
18
|
-
constructor(options = {}) {
|
|
19
|
-
this.model = null;
|
|
20
|
-
this.initialized = false;
|
|
21
|
-
this.tf = null;
|
|
22
|
-
this.use = null;
|
|
23
|
-
this.backend = 'cpu'; // Default to CPU
|
|
24
|
-
this.verbose = true; // Whether to log non-essential messages
|
|
25
|
-
this.verbose = options.verbose !== undefined ? options.verbose : true;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Add polyfills and patches for TensorFlow.js compatibility
|
|
29
|
-
* This addresses issues with TensorFlow.js across all server environments
|
|
30
|
-
* (Node.js, serverless, and other server environments)
|
|
31
|
-
*
|
|
32
|
-
* Note: The main TensorFlow.js patching is now centralized in textEncoding.ts
|
|
33
|
-
* and applied through setup.ts. This method only adds additional utility functions
|
|
34
|
-
* that might be needed by TensorFlow.js.
|
|
35
|
-
*/
|
|
36
|
-
addServerCompatibilityPolyfills() {
|
|
37
|
-
// Apply in all non-browser environments (Node.js, serverless, server environments)
|
|
38
|
-
const isBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
39
|
-
if (isBrowserEnv) {
|
|
40
|
-
return; // Browser environments don't need these polyfills
|
|
41
|
-
}
|
|
42
|
-
// Get the appropriate global object for the current environment
|
|
43
|
-
const globalObj = (() => {
|
|
44
|
-
if (typeof globalThis !== 'undefined')
|
|
45
|
-
return globalThis;
|
|
46
|
-
if (typeof global !== 'undefined')
|
|
47
|
-
return global;
|
|
48
|
-
if (typeof self !== 'undefined')
|
|
49
|
-
return self;
|
|
50
|
-
return {}; // Fallback for unknown environments
|
|
51
|
-
})();
|
|
52
|
-
// Add polyfill for utility functions across all server environments
|
|
53
|
-
// This fixes issues like "Cannot read properties of undefined (reading 'isFloat32Array')"
|
|
54
|
-
try {
|
|
55
|
-
// Ensure the util object exists
|
|
56
|
-
if (!globalObj.util) {
|
|
57
|
-
globalObj.util = {};
|
|
58
|
-
}
|
|
59
|
-
// Add isFloat32Array method if it doesn't exist
|
|
60
|
-
if (!globalObj.util.isFloat32Array) {
|
|
61
|
-
globalObj.util.isFloat32Array = (obj) => {
|
|
62
|
-
return !!(obj instanceof Float32Array ||
|
|
63
|
-
(obj &&
|
|
64
|
-
Object.prototype.toString.call(obj) === '[object Float32Array]'));
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
// Add isTypedArray method if it doesn't exist
|
|
68
|
-
if (!globalObj.util.isTypedArray) {
|
|
69
|
-
globalObj.util.isTypedArray = (obj) => {
|
|
70
|
-
return !!(ArrayBuffer.isView(obj) && !(obj instanceof DataView));
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
console.warn('Failed to add utility polyfills:', error);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Check if we're running in a test environment
|
|
80
|
-
*/
|
|
81
|
-
isTestEnvironment() {
|
|
82
|
-
// Safely check for Node.js environment first
|
|
83
|
-
if (typeof process === 'undefined') {
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
return (process.env.NODE_ENV === 'test' ||
|
|
87
|
-
process.env.VITEST === 'true' ||
|
|
88
|
-
(typeof global !== 'undefined' && global.__vitest__) ||
|
|
89
|
-
process.argv.some((arg) => arg.includes('vitest')));
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Log message only if verbose mode is enabled or if it's an error
|
|
93
|
-
* This helps suppress non-essential log messages
|
|
94
|
-
*/
|
|
95
|
-
logger(level, message, ...args) {
|
|
96
|
-
// Always log errors, but only log other messages if verbose mode is enabled
|
|
97
|
-
if (level === 'error' || this.verbose) {
|
|
98
|
-
console[level](message, ...args);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Load the Universal Sentence Encoder model with retry logic
|
|
103
|
-
* This helps handle network failures and JSON parsing errors from TensorFlow Hub
|
|
104
|
-
* @param loadFunction The function to load the model
|
|
105
|
-
* @param maxRetries Maximum number of retry attempts
|
|
106
|
-
* @param baseDelay Base delay in milliseconds for exponential backoff
|
|
107
|
-
*/
|
|
108
|
-
async loadModelWithRetry(loadFunction, maxRetries = 3, baseDelay = 1000) {
|
|
109
|
-
let lastError = null;
|
|
110
|
-
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
111
|
-
try {
|
|
112
|
-
this.logger('log', attempt === 0
|
|
113
|
-
? 'Loading Universal Sentence Encoder model...'
|
|
114
|
-
: `Retrying Universal Sentence Encoder model loading (attempt ${attempt + 1}/${maxRetries + 1})...`);
|
|
115
|
-
const model = await loadFunction();
|
|
116
|
-
if (attempt > 0) {
|
|
117
|
-
this.logger('log', 'Universal Sentence Encoder model loaded successfully after retry');
|
|
118
|
-
}
|
|
119
|
-
return model;
|
|
120
|
-
}
|
|
121
|
-
catch (error) {
|
|
122
|
-
lastError = error;
|
|
123
|
-
const errorMessage = lastError.message || String(lastError);
|
|
124
|
-
// Check if this is a network-related error that might benefit from retry
|
|
125
|
-
const isRetryableError = errorMessage.includes('Failed to parse model JSON') ||
|
|
126
|
-
errorMessage.includes('Failed to fetch') ||
|
|
127
|
-
errorMessage.includes('Network error') ||
|
|
128
|
-
errorMessage.includes('ENOTFOUND') ||
|
|
129
|
-
errorMessage.includes('ECONNRESET') ||
|
|
130
|
-
errorMessage.includes('ETIMEDOUT') ||
|
|
131
|
-
errorMessage.includes('JSON') ||
|
|
132
|
-
errorMessage.includes('model.json');
|
|
133
|
-
if (attempt < maxRetries && isRetryableError) {
|
|
134
|
-
const delay = baseDelay * Math.pow(2, attempt); // Exponential backoff
|
|
135
|
-
this.logger('warn', `Universal Sentence Encoder model loading failed (attempt ${attempt + 1}): ${errorMessage}. Retrying in ${delay}ms...`);
|
|
136
|
-
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
// Either we've exhausted retries or this is not a retryable error
|
|
140
|
-
if (attempt >= maxRetries) {
|
|
141
|
-
this.logger('error', `Universal Sentence Encoder model loading failed after ${maxRetries + 1} attempts. Last error: ${errorMessage}`);
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
this.logger('error', `Universal Sentence Encoder model loading failed with non-retryable error: ${errorMessage}`);
|
|
145
|
-
}
|
|
146
|
-
throw lastError;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
// This should never be reached, but just in case
|
|
151
|
-
throw lastError || new Error('Unknown error during model loading');
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Initialize the embedding model
|
|
155
|
-
*/
|
|
156
|
-
async init() {
|
|
157
|
-
try {
|
|
158
|
-
// Save original console.warn
|
|
159
|
-
const originalWarn = console.warn;
|
|
160
|
-
// Override console.warn to suppress TensorFlow.js Node.js backend message
|
|
161
|
-
console.warn = function (message, ...optionalParams) {
|
|
162
|
-
if (message &&
|
|
163
|
-
typeof message === 'string' &&
|
|
164
|
-
message.includes('Hi, looks like you are running TensorFlow.js in Node.js')) {
|
|
165
|
-
return; // Suppress the specific warning
|
|
166
|
-
}
|
|
167
|
-
originalWarn(message, ...optionalParams);
|
|
168
|
-
};
|
|
169
|
-
// Add polyfills for TensorFlow.js compatibility
|
|
170
|
-
this.addServerCompatibilityPolyfills();
|
|
171
|
-
// TensorFlow.js will use its default EPSILON value
|
|
172
|
-
// CRITICAL: Ensure TextEncoder/TextDecoder are available before TensorFlow.js loads
|
|
173
|
-
try {
|
|
174
|
-
// Get the appropriate global object for the current environment
|
|
175
|
-
const globalObj = (() => {
|
|
176
|
-
if (typeof globalThis !== 'undefined')
|
|
177
|
-
return globalThis;
|
|
178
|
-
if (typeof global !== 'undefined')
|
|
179
|
-
return global;
|
|
180
|
-
if (typeof self !== 'undefined')
|
|
181
|
-
return self;
|
|
182
|
-
return null;
|
|
183
|
-
})();
|
|
184
|
-
// Ensure TextEncoder/TextDecoder are globally available in server environments
|
|
185
|
-
if (globalObj) {
|
|
186
|
-
// Try to use Node.js util module if available (Node.js environments)
|
|
187
|
-
try {
|
|
188
|
-
if (typeof process !== 'undefined' &&
|
|
189
|
-
process.versions &&
|
|
190
|
-
process.versions.node) {
|
|
191
|
-
const util = await import('util');
|
|
192
|
-
if (!globalObj.TextEncoder) {
|
|
193
|
-
globalObj.TextEncoder = util.TextEncoder;
|
|
194
|
-
}
|
|
195
|
-
if (!globalObj.TextDecoder) {
|
|
196
|
-
globalObj.TextDecoder = util.TextDecoder;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
catch (utilError) {
|
|
201
|
-
// Fallback to standard TextEncoder/TextDecoder for non-Node.js server environments
|
|
202
|
-
if (!globalObj.TextEncoder) {
|
|
203
|
-
globalObj.TextEncoder = TextEncoder;
|
|
204
|
-
}
|
|
205
|
-
if (!globalObj.TextDecoder) {
|
|
206
|
-
globalObj.TextDecoder = TextDecoder;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
// Apply the TensorFlow.js patch
|
|
211
|
-
const { applyTensorFlowPatch } = await import('./textEncoding.js');
|
|
212
|
-
await applyTensorFlowPatch();
|
|
213
|
-
// Now load TensorFlow.js core module using dynamic imports
|
|
214
|
-
this.tf = await import('@tensorflow/tfjs-core');
|
|
215
|
-
// Import CPU backend (always needed as fallback)
|
|
216
|
-
await import('@tensorflow/tfjs-backend-cpu');
|
|
217
|
-
// Try to import WebGL backend for GPU acceleration in browser environments
|
|
218
|
-
try {
|
|
219
|
-
if (typeof window !== 'undefined') {
|
|
220
|
-
await import('@tensorflow/tfjs-backend-webgl');
|
|
221
|
-
// Check if WebGL is available
|
|
222
|
-
try {
|
|
223
|
-
if (this.tf.setBackend) {
|
|
224
|
-
await this.tf.setBackend('webgl');
|
|
225
|
-
this.backend = 'webgl';
|
|
226
|
-
console.log('Using WebGL backend for TensorFlow.js');
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
console.warn('tf.setBackend is not available, falling back to CPU');
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
catch (e) {
|
|
233
|
-
console.warn('WebGL backend not available, falling back to CPU:', e);
|
|
234
|
-
this.backend = 'cpu';
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
catch (error) {
|
|
239
|
-
console.warn('WebGL backend not available, falling back to CPU:', error);
|
|
240
|
-
this.backend = 'cpu';
|
|
241
|
-
}
|
|
242
|
-
// Load Universal Sentence Encoder using dynamic import
|
|
243
|
-
this.use = await import('@tensorflow-models/universal-sentence-encoder');
|
|
244
|
-
}
|
|
245
|
-
catch (error) {
|
|
246
|
-
this.logger('error', 'Failed to initialize TensorFlow.js:', error);
|
|
247
|
-
throw error;
|
|
248
|
-
}
|
|
249
|
-
// Set the backend
|
|
250
|
-
if (this.tf.setBackend) {
|
|
251
|
-
await this.tf.setBackend(this.backend);
|
|
252
|
-
}
|
|
253
|
-
// Module structure available for debugging if needed
|
|
254
|
-
// Try to find the load function in different possible module structures
|
|
255
|
-
const loadFunction = findUSELoadFunction(this.use);
|
|
256
|
-
if (!loadFunction) {
|
|
257
|
-
throw new Error('Could not find Universal Sentence Encoder load function');
|
|
258
|
-
}
|
|
259
|
-
// Load the model with retry logic for network failures
|
|
260
|
-
this.model = await this.loadModelWithRetry(loadFunction);
|
|
261
|
-
this.initialized = true;
|
|
262
|
-
// Restore original console.warn
|
|
263
|
-
console.warn = originalWarn;
|
|
264
|
-
}
|
|
265
|
-
catch (error) {
|
|
266
|
-
this.logger('error', 'Failed to initialize Universal Sentence Encoder:', error);
|
|
267
|
-
throw new Error(`Failed to initialize Universal Sentence Encoder: ${error}`);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Embed text into a vector using Universal Sentence Encoder
|
|
272
|
-
* @param data Text to embed
|
|
273
|
-
*/
|
|
274
|
-
async embed(data) {
|
|
275
|
-
if (!this.initialized) {
|
|
276
|
-
await this.init();
|
|
277
|
-
}
|
|
278
|
-
try {
|
|
279
|
-
// Handle different input types
|
|
280
|
-
let textToEmbed;
|
|
281
|
-
if (typeof data === 'string') {
|
|
282
|
-
// Handle empty string case
|
|
283
|
-
if (data.trim() === '') {
|
|
284
|
-
// Return a zero vector of appropriate dimension (512 is the default for USE)
|
|
285
|
-
return new Array(512).fill(0);
|
|
286
|
-
}
|
|
287
|
-
textToEmbed = [data];
|
|
288
|
-
}
|
|
289
|
-
else if (Array.isArray(data) &&
|
|
290
|
-
data.every((item) => typeof item === 'string')) {
|
|
291
|
-
// Handle empty array or array with empty strings
|
|
292
|
-
if (data.length === 0 || data.every((item) => item.trim() === '')) {
|
|
293
|
-
return new Array(512).fill(0);
|
|
294
|
-
}
|
|
295
|
-
// Filter out empty strings
|
|
296
|
-
textToEmbed = data.filter((item) => item.trim() !== '');
|
|
297
|
-
if (textToEmbed.length === 0) {
|
|
298
|
-
return new Array(512).fill(0);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
else {
|
|
302
|
-
throw new Error('UniversalSentenceEncoder only supports string or string[] data');
|
|
303
|
-
}
|
|
304
|
-
// Get embeddings
|
|
305
|
-
const embeddings = await this.model.embed(textToEmbed);
|
|
306
|
-
// Convert to array and return the first embedding
|
|
307
|
-
const embeddingArray = await embeddings.array();
|
|
308
|
-
// Dispose of the tensor to free memory
|
|
309
|
-
embeddings.dispose();
|
|
310
|
-
return embeddingArray[0];
|
|
311
|
-
}
|
|
312
|
-
catch (error) {
|
|
313
|
-
this.logger('error', 'Failed to embed text with Universal Sentence Encoder:', error);
|
|
314
|
-
throw new Error(`Failed to embed text with Universal Sentence Encoder: ${error}`);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Embed multiple texts into vectors using Universal Sentence Encoder
|
|
319
|
-
* This is more efficient than calling embed() multiple times
|
|
320
|
-
* @param dataArray Array of texts to embed
|
|
321
|
-
* @returns Array of embedding vectors
|
|
322
|
-
*/
|
|
323
|
-
async embedBatch(dataArray) {
|
|
324
|
-
if (!this.initialized) {
|
|
325
|
-
await this.init();
|
|
326
|
-
}
|
|
327
|
-
try {
|
|
328
|
-
// Handle empty array case
|
|
329
|
-
if (dataArray.length === 0) {
|
|
330
|
-
return [];
|
|
331
|
-
}
|
|
332
|
-
// Filter out empty strings and handle edge cases
|
|
333
|
-
const textToEmbed = dataArray.filter((text) => typeof text === 'string' && text.trim() !== '');
|
|
334
|
-
// If all strings were empty, return appropriate zero vectors
|
|
335
|
-
if (textToEmbed.length === 0) {
|
|
336
|
-
return dataArray.map(() => new Array(512).fill(0));
|
|
337
|
-
}
|
|
338
|
-
// Get embeddings for all texts in a single batch operation
|
|
339
|
-
const embeddings = await this.model.embed(textToEmbed);
|
|
340
|
-
// Convert to array
|
|
341
|
-
const embeddingArray = await embeddings.array();
|
|
342
|
-
// Dispose of the tensor to free memory
|
|
343
|
-
embeddings.dispose();
|
|
344
|
-
// Map the results back to the original array order
|
|
345
|
-
const results = [];
|
|
346
|
-
let embeddingIndex = 0;
|
|
347
|
-
for (let i = 0; i < dataArray.length; i++) {
|
|
348
|
-
const text = dataArray[i];
|
|
349
|
-
if (typeof text === 'string' && text.trim() !== '') {
|
|
350
|
-
// Use the embedding for non-empty strings
|
|
351
|
-
results.push(embeddingArray[embeddingIndex]);
|
|
352
|
-
embeddingIndex++;
|
|
353
|
-
}
|
|
354
|
-
else {
|
|
355
|
-
// Use a zero vector for empty strings
|
|
356
|
-
results.push(new Array(512).fill(0));
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
return results;
|
|
360
|
-
}
|
|
361
|
-
catch (error) {
|
|
362
|
-
this.logger('error', 'Failed to batch embed text with Universal Sentence Encoder:', error);
|
|
363
|
-
throw new Error(`Failed to batch embed text with Universal Sentence Encoder: ${error}`);
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
/**
|
|
367
|
-
* Dispose of the model resources
|
|
368
|
-
*/
|
|
369
|
-
async dispose() {
|
|
370
|
-
if (this.model && this.tf) {
|
|
371
|
-
try {
|
|
372
|
-
// Dispose of the model and tensors
|
|
373
|
-
this.model.dispose();
|
|
374
|
-
this.tf.disposeVariables();
|
|
375
|
-
this.initialized = false;
|
|
376
|
-
}
|
|
377
|
-
catch (error) {
|
|
378
|
-
this.logger('error', 'Failed to dispose Universal Sentence Encoder:', error);
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
return Promise.resolve();
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
/**
|
|
385
|
-
* Helper function to load the Universal Sentence Encoder model
|
|
386
|
-
* This tries multiple approaches to find the correct load function
|
|
387
|
-
* @param sentenceEncoderModule The imported module
|
|
388
|
-
* @returns The load function or null if not found
|
|
389
|
-
*/
|
|
390
|
-
function findUSELoadFunction(sentenceEncoderModule) {
|
|
391
|
-
// Module structure available for debugging if needed
|
|
392
|
-
let loadFunction = null;
|
|
393
|
-
// Try sentenceEncoderModule.load first (direct export)
|
|
394
|
-
if (sentenceEncoderModule.load &&
|
|
395
|
-
typeof sentenceEncoderModule.load === 'function') {
|
|
396
|
-
loadFunction = sentenceEncoderModule.load;
|
|
397
|
-
}
|
|
398
|
-
// Then try sentenceEncoderModule.default.load (default export)
|
|
399
|
-
else if (sentenceEncoderModule.default &&
|
|
400
|
-
sentenceEncoderModule.default.load &&
|
|
401
|
-
typeof sentenceEncoderModule.default.load === 'function') {
|
|
402
|
-
loadFunction = sentenceEncoderModule.default.load;
|
|
403
|
-
}
|
|
404
|
-
// Try sentenceEncoderModule.default directly if it's a function
|
|
405
|
-
else if (sentenceEncoderModule.default &&
|
|
406
|
-
typeof sentenceEncoderModule.default === 'function') {
|
|
407
|
-
loadFunction = sentenceEncoderModule.default;
|
|
408
|
-
}
|
|
409
|
-
// Try sentenceEncoderModule directly if it's a function
|
|
410
|
-
else if (typeof sentenceEncoderModule === 'function') {
|
|
411
|
-
loadFunction = sentenceEncoderModule;
|
|
412
|
-
}
|
|
413
|
-
// Try additional common patterns
|
|
414
|
-
else if (sentenceEncoderModule.UniversalSentenceEncoder &&
|
|
415
|
-
typeof sentenceEncoderModule.UniversalSentenceEncoder.load === 'function') {
|
|
416
|
-
loadFunction = sentenceEncoderModule.UniversalSentenceEncoder.load;
|
|
417
|
-
}
|
|
418
|
-
else if (sentenceEncoderModule.default &&
|
|
419
|
-
sentenceEncoderModule.default.UniversalSentenceEncoder &&
|
|
420
|
-
typeof sentenceEncoderModule.default.UniversalSentenceEncoder.load ===
|
|
421
|
-
'function') {
|
|
422
|
-
loadFunction = sentenceEncoderModule.default.UniversalSentenceEncoder.load;
|
|
423
|
-
}
|
|
424
|
-
// Try to find the load function in the module's properties
|
|
425
|
-
else {
|
|
426
|
-
// Look for any property that might be a load function
|
|
427
|
-
for (const key in sentenceEncoderModule) {
|
|
428
|
-
if (typeof sentenceEncoderModule[key] === 'function') {
|
|
429
|
-
// Check if the function name or key contains 'load'
|
|
430
|
-
const fnName = sentenceEncoderModule[key].name || key;
|
|
431
|
-
if (fnName.toLowerCase().includes('load')) {
|
|
432
|
-
loadFunction = sentenceEncoderModule[key];
|
|
433
|
-
break;
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
// Also check nested objects
|
|
437
|
-
else if (typeof sentenceEncoderModule[key] === 'object' &&
|
|
438
|
-
sentenceEncoderModule[key] !== null) {
|
|
439
|
-
for (const nestedKey in sentenceEncoderModule[key]) {
|
|
440
|
-
if (typeof sentenceEncoderModule[key][nestedKey] === 'function') {
|
|
441
|
-
const fnName = sentenceEncoderModule[key][nestedKey].name || nestedKey;
|
|
442
|
-
if (fnName.toLowerCase().includes('load')) {
|
|
443
|
-
loadFunction = sentenceEncoderModule[key][nestedKey];
|
|
444
|
-
break;
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
if (loadFunction)
|
|
449
|
-
break;
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
return loadFunction;
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* Check if we're running in a test environment (standalone version)
|
|
457
|
-
*/
|
|
458
|
-
function isTestEnvironment() {
|
|
459
|
-
// Safely check for Node.js environment first
|
|
460
|
-
if (typeof process === 'undefined') {
|
|
461
|
-
return false;
|
|
462
|
-
}
|
|
463
|
-
return (process.env.NODE_ENV === 'test' ||
|
|
464
|
-
process.env.VITEST === 'true' ||
|
|
465
|
-
(typeof global !== 'undefined' && global.__vitest__) ||
|
|
466
|
-
process.argv.some((arg) => arg.includes('vitest')));
|
|
467
|
-
}
|
|
468
|
-
/**
|
|
469
|
-
* Log message only if not in test environment and verbose mode is enabled (standalone version)
|
|
470
|
-
* @param level Log level ('log', 'warn', 'error')
|
|
471
|
-
* @param message Message to log
|
|
472
|
-
* @param args Additional arguments to log
|
|
473
|
-
* @param verbose Whether to log non-essential messages (default: true)
|
|
474
|
-
*/
|
|
475
|
-
function logIfNotTest(level, message, args = [], verbose = true) {
|
|
476
|
-
// Always log errors, but only log other messages if verbose mode is enabled
|
|
477
|
-
if ((level === 'error' || verbose) && !isTestEnvironment()) {
|
|
478
|
-
console[level](message, ...args);
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
/**
|
|
482
|
-
* Create an embedding function from an embedding model
|
|
483
|
-
* @param model Embedding model to use (optional, defaults to UniversalSentenceEncoder)
|
|
484
|
-
*/
|
|
485
|
-
export function createEmbeddingFunction(model) {
|
|
486
|
-
// If no model is provided, use the default TensorFlow embedding function
|
|
487
|
-
if (!model) {
|
|
488
|
-
return createTensorFlowEmbeddingFunction();
|
|
489
|
-
}
|
|
490
|
-
return async (data) => {
|
|
491
|
-
return await model.embed(data);
|
|
492
|
-
};
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* Creates a TensorFlow-based Universal Sentence Encoder embedding function
|
|
496
|
-
* This is the required embedding function for all text embeddings
|
|
497
|
-
* Uses a shared model instance for better performance across multiple calls
|
|
498
|
-
* @param options Configuration options
|
|
499
|
-
* @param options.verbose Whether to log non-essential messages (default: true)
|
|
500
|
-
*/
|
|
501
|
-
// Create a single shared instance of the model that persists across all embedding calls
|
|
502
|
-
let sharedModel = null;
|
|
503
|
-
let sharedModelInitialized = false;
|
|
504
|
-
let sharedModelVerbose = true;
|
|
505
|
-
export function createTensorFlowEmbeddingFunction(options = {}) {
|
|
506
|
-
// Update verbose setting if provided
|
|
507
|
-
if (options.verbose !== undefined) {
|
|
508
|
-
sharedModelVerbose = options.verbose;
|
|
509
|
-
}
|
|
510
|
-
// Create the shared model if it doesn't exist yet
|
|
511
|
-
if (!sharedModel) {
|
|
512
|
-
sharedModel = new UniversalSentenceEncoder({ verbose: sharedModelVerbose });
|
|
513
|
-
}
|
|
514
|
-
return async (data) => {
|
|
515
|
-
try {
|
|
516
|
-
// Initialize the model if it hasn't been initialized yet
|
|
517
|
-
if (!sharedModelInitialized) {
|
|
518
|
-
try {
|
|
519
|
-
await sharedModel.init();
|
|
520
|
-
sharedModelInitialized = true;
|
|
521
|
-
}
|
|
522
|
-
catch (initError) {
|
|
523
|
-
// Reset the flag so we can retry initialization on the next call
|
|
524
|
-
sharedModelInitialized = false;
|
|
525
|
-
throw initError;
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
return await sharedModel.embed(data);
|
|
529
|
-
}
|
|
530
|
-
catch (error) {
|
|
531
|
-
logIfNotTest('error', 'Failed to use TensorFlow embedding:', [error], sharedModelVerbose);
|
|
532
|
-
throw new Error(`Universal Sentence Encoder is required but failed: ${error}`);
|
|
533
|
-
}
|
|
534
|
-
};
|
|
535
|
-
}
|
|
536
|
-
/**
|
|
537
|
-
* Default embedding function
|
|
538
|
-
* Uses UniversalSentenceEncoder for all text embeddings
|
|
539
|
-
* TensorFlow.js is required for this to work
|
|
540
|
-
* Uses CPU for compatibility
|
|
541
|
-
* @param options Configuration options
|
|
542
|
-
* @param options.verbose Whether to log non-essential messages (default: true)
|
|
543
|
-
*/
|
|
544
|
-
export function getDefaultEmbeddingFunction(options = {}) {
|
|
545
|
-
return createTensorFlowEmbeddingFunction(options);
|
|
546
|
-
}
|
|
547
|
-
/**
|
|
548
|
-
* Default embedding function with default options
|
|
549
|
-
* Uses UniversalSentenceEncoder for all text embeddings
|
|
550
|
-
* TensorFlow.js is required for this to work
|
|
551
|
-
* Uses CPU for compatibility
|
|
552
|
-
*/
|
|
553
|
-
export const defaultEmbeddingFunction = getDefaultEmbeddingFunction();
|
|
554
|
-
/**
|
|
555
|
-
* Creates a batch embedding function that uses UniversalSentenceEncoder
|
|
556
|
-
* TensorFlow.js is required for this to work
|
|
557
|
-
* Processes all items in a single batch operation
|
|
558
|
-
* Uses a shared model instance for better performance across multiple calls
|
|
559
|
-
* @param options Configuration options
|
|
560
|
-
* @param options.verbose Whether to log non-essential messages (default: true)
|
|
561
|
-
*/
|
|
562
|
-
// Create a single shared instance of the model that persists across function calls
|
|
563
|
-
let sharedBatchModel = null;
|
|
564
|
-
let sharedBatchModelInitialized = false;
|
|
565
|
-
let sharedBatchModelVerbose = true;
|
|
566
|
-
export function createBatchEmbeddingFunction(options = {}) {
|
|
567
|
-
// Update verbose setting if provided
|
|
568
|
-
if (options.verbose !== undefined) {
|
|
569
|
-
sharedBatchModelVerbose = options.verbose;
|
|
570
|
-
}
|
|
571
|
-
// Create the shared model if it doesn't exist yet
|
|
572
|
-
if (!sharedBatchModel) {
|
|
573
|
-
sharedBatchModel = new UniversalSentenceEncoder({ verbose: sharedBatchModelVerbose });
|
|
574
|
-
}
|
|
575
|
-
return async (dataArray) => {
|
|
576
|
-
try {
|
|
577
|
-
// Initialize the model if it hasn't been initialized yet
|
|
578
|
-
if (!sharedBatchModelInitialized) {
|
|
579
|
-
await sharedBatchModel.init();
|
|
580
|
-
sharedBatchModelInitialized = true;
|
|
581
|
-
}
|
|
582
|
-
return await sharedBatchModel.embedBatch(dataArray);
|
|
583
|
-
}
|
|
584
|
-
catch (error) {
|
|
585
|
-
logIfNotTest('error', 'Failed to use TensorFlow batch embedding:', [error], sharedBatchModelVerbose);
|
|
586
|
-
throw new Error(`Universal Sentence Encoder batch embedding failed: ${error}`);
|
|
587
|
-
}
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
|
-
/**
|
|
591
|
-
* Get a batch embedding function with custom options
|
|
592
|
-
* Uses UniversalSentenceEncoder for all text embeddings
|
|
593
|
-
* TensorFlow.js is required for this to work
|
|
594
|
-
* Processes all items in a single batch operation
|
|
595
|
-
* @param options Configuration options
|
|
596
|
-
* @param options.verbose Whether to log non-essential messages (default: true)
|
|
597
|
-
*/
|
|
598
|
-
export function getDefaultBatchEmbeddingFunction(options = {}) {
|
|
599
|
-
return createBatchEmbeddingFunction(options);
|
|
600
|
-
}
|
|
601
|
-
/**
|
|
602
|
-
* Default batch embedding function with default options
|
|
603
|
-
* Uses UniversalSentenceEncoder for all text embeddings
|
|
604
|
-
* TensorFlow.js is required for this to work
|
|
605
|
-
* Processes all items in a single batch operation
|
|
606
|
-
*/
|
|
607
|
-
export const defaultBatchEmbeddingFunction = getDefaultBatchEmbeddingFunction();
|
|
608
|
-
/**
|
|
609
|
-
* Creates an embedding function that runs in a separate thread
|
|
610
|
-
* This is a wrapper around createEmbeddingFunction that uses executeInThread
|
|
611
|
-
* @param model Embedding model to use
|
|
612
|
-
*/
|
|
613
|
-
export function createThreadedEmbeddingFunction(model) {
|
|
614
|
-
const embeddingFunction = createEmbeddingFunction(model);
|
|
615
|
-
return async (data) => {
|
|
616
|
-
// Convert the embedding function to a string
|
|
617
|
-
const fnString = embeddingFunction.toString();
|
|
618
|
-
// Execute the embedding function in a "thread" (main thread in this implementation)
|
|
619
|
-
return await executeInThread(fnString, data);
|
|
620
|
-
};
|
|
621
|
-
}
|
|
622
|
-
//# sourceMappingURL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