@soulcraft/brainy 0.51.2 → 0.53.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 +154 -0
- package/dist/augmentations/intelligentVerbScoring.d.ts +158 -0
- package/dist/augmentations/intelligentVerbScoring.js +377 -0
- package/dist/augmentations/intelligentVerbScoring.js.map +1 -0
- package/dist/brainyData.d.ts +115 -0
- package/dist/brainyData.js +188 -4
- package/dist/brainyData.js.map +1 -1
- package/dist/storage/adapters/s3CompatibleStorage.d.ts +24 -0
- package/dist/storage/adapters/s3CompatibleStorage.js +125 -3
- package/dist/storage/adapters/s3CompatibleStorage.js.map +1 -1
- package/package.json +2 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intelligentVerbScoring.js","sourceRoot":"","sources":["../../src/augmentations/intelligentVerbScoring.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAwBrD;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAuB;IAC7D,qBAAqB,EAAE,IAAI;IAC3B,4BAA4B,EAAE,IAAI;IAClC,mBAAmB,EAAE,IAAI;IACzB,iBAAiB,EAAE,IAAI,EAAE,mBAAmB;IAC5C,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,cAAc,EAAE,GAAG;IACnB,YAAY,EAAE,GAAG;CAClB,CAAA;AAcD;;;;;GAKG;AACH,MAAM,OAAO,sBAAsB;IAUjC,YAAY,SAAsC,EAAE;QAT3C,SAAI,GAAG,0BAA0B,CAAA;QACjC,gBAAW,GAAG,yFAAyF,CAAA;QAChH,YAAO,GAAG,KAAK,CAAA,CAAC,8BAA8B;QAGtC,sBAAiB,GAAmC,IAAI,GAAG,EAAE,CAAA;QAE7D,kBAAa,GAAG,KAAK,CAAA;QAG3B,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,2BAA2B,EAAE,GAAG,MAAM,EAAE,C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AC,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAA;YAClD,CAAC;YAED,iCAAiC;YACjC,IAAI,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC5C,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;oBAC9B,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;wBACtB,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE;4BAC5C,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC;4BACtB,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,aAAa,IAAI,GAAG;4BAC1D,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,GAAG;4BACxC,SAAS,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;4BACjD,QAAQ,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;4BAC/C,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;yBAC5C,CAAC,CAAA;oBACJ,CAAC;gBACH,CAAC;YACH,CAAC;YAED,OAAO,CAAC,GAAG,CAAC,2BAA2B,IAAI,CAAC,iBAAiB,CAAC,IAAI,gBAAgB,CAAC,CAAA;QACrF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAA;YACvD,MAAM,IAAI,KAAK,CAAC,mCAAmC,KAAK,EAAE,CAAC,CAAA;QAC7D,CAAC;IACH,CAAC;CACF"}
|
package/dist/brainyData.d.ts
CHANGED
|
@@ -105,6 +105,13 @@ export interface BrainyDataConfig {
|
|
|
105
105
|
* This is useful for data ingestion scenarios where only write operations are needed
|
|
106
106
|
*/
|
|
107
107
|
writeOnly?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Allow direct storage reads in write-only mode
|
|
110
|
+
* When true and writeOnly is also true, enables direct ID-based lookups (get, has, exists, getMetadata, getBatch, getVerb)
|
|
111
|
+
* that don't require search indexes. Search operations (search, similar, query, findRelated) remain disabled.
|
|
112
|
+
* This is useful for writer services that need deduplication without loading expensive search indexes.
|
|
113
|
+
*/
|
|
114
|
+
allowDirectReads?: boolean;
|
|
108
115
|
/**
|
|
109
116
|
* Remote server configuration for search operations
|
|
110
117
|
*/
|
|
@@ -288,6 +295,58 @@ export interface BrainyDataConfig {
|
|
|
288
295
|
prefetchStrategy?: 'conservative' | 'moderate' | 'aggressive';
|
|
289
296
|
};
|
|
290
297
|
};
|
|
298
|
+
/**
|
|
299
|
+
* Intelligent verb scoring configuration
|
|
300
|
+
* Automatically generates weight and confidence scores for verb relationships
|
|
301
|
+
* Off by default - enable by setting enabled: true
|
|
302
|
+
*/
|
|
303
|
+
intelligentVerbScoring?: {
|
|
304
|
+
/**
|
|
305
|
+
* Whether to enable intelligent verb scoring
|
|
306
|
+
* Default: false (off by default)
|
|
307
|
+
*/
|
|
308
|
+
enabled?: boolean;
|
|
309
|
+
/**
|
|
310
|
+
* Enable semantic proximity scoring based on entity embeddings
|
|
311
|
+
* Default: true
|
|
312
|
+
*/
|
|
313
|
+
enableSemanticScoring?: boolean;
|
|
314
|
+
/**
|
|
315
|
+
* Enable frequency-based weight amplification
|
|
316
|
+
* Default: true
|
|
317
|
+
*/
|
|
318
|
+
enableFrequencyAmplification?: boolean;
|
|
319
|
+
/**
|
|
320
|
+
* Enable temporal decay for weights
|
|
321
|
+
* Default: true
|
|
322
|
+
*/
|
|
323
|
+
enableTemporalDecay?: boolean;
|
|
324
|
+
/**
|
|
325
|
+
* Decay rate per day for temporal scoring (0-1)
|
|
326
|
+
* Default: 0.01 (1% decay per day)
|
|
327
|
+
*/
|
|
328
|
+
temporalDecayRate?: number;
|
|
329
|
+
/**
|
|
330
|
+
* Minimum weight threshold
|
|
331
|
+
* Default: 0.1
|
|
332
|
+
*/
|
|
333
|
+
minWeight?: number;
|
|
334
|
+
/**
|
|
335
|
+
* Maximum weight threshold
|
|
336
|
+
* Default: 1.0
|
|
337
|
+
*/
|
|
338
|
+
maxWeight?: number;
|
|
339
|
+
/**
|
|
340
|
+
* Base confidence score for new relationships
|
|
341
|
+
* Default: 0.5
|
|
342
|
+
*/
|
|
343
|
+
baseConfidence?: number;
|
|
344
|
+
/**
|
|
345
|
+
* Learning rate for adaptive scoring (0-1)
|
|
346
|
+
* Default: 0.1
|
|
347
|
+
*/
|
|
348
|
+
learningRate?: number;
|
|
349
|
+
};
|
|
291
350
|
}
|
|
292
351
|
export declare class BrainyData<T = any> implements BrainyDataInterface<T> {
|
|
293
352
|
index: HNSWIndex | HNSWIndexOptimized;
|
|
@@ -302,6 +361,7 @@ export declare class BrainyData<T = any> implements BrainyDataInterface<T> {
|
|
|
302
361
|
private frozen;
|
|
303
362
|
private lazyLoadInReadOnlyMode;
|
|
304
363
|
private writeOnly;
|
|
364
|
+
private allowDirectReads;
|
|
305
365
|
private storageConfig;
|
|
306
366
|
private config;
|
|
307
367
|
private useOptimizedIndex;
|
|
@@ -321,6 +381,7 @@ export declare class BrainyData<T = any> implements BrainyDataInterface<T> {
|
|
|
321
381
|
private remoteServerConfig;
|
|
322
382
|
private serverSearchConduit;
|
|
323
383
|
private serverConnection;
|
|
384
|
+
private intelligentVerbScoring;
|
|
324
385
|
private distributedConfig;
|
|
325
386
|
private configManager;
|
|
326
387
|
private partitioner;
|
|
@@ -357,6 +418,7 @@ export declare class BrainyData<T = any> implements BrainyDataInterface<T> {
|
|
|
357
418
|
/**
|
|
358
419
|
* Check if the database is in write-only mode and throw an error if it is
|
|
359
420
|
* @param allowExistenceChecks If true, allows existence checks (get operations) in write-only mode
|
|
421
|
+
* @param isDirectStorageOperation If true, allows the operation when allowDirectReads is enabled
|
|
360
422
|
* @throws Error if the database is in write-only mode and operation is not allowed
|
|
361
423
|
*/
|
|
362
424
|
private checkWriteOnly;
|
|
@@ -406,6 +468,30 @@ export declare class BrainyData<T = any> implements BrainyDataInterface<T> {
|
|
|
406
468
|
* Apply changes using full scan method (fallback for storage adapters without change log support)
|
|
407
469
|
*/
|
|
408
470
|
private applyChangesFromFullScan;
|
|
471
|
+
/**
|
|
472
|
+
* Provide feedback to the intelligent verb scoring system for learning
|
|
473
|
+
* This allows the system to learn from user corrections or validation
|
|
474
|
+
*
|
|
475
|
+
* @param sourceId - Source entity ID
|
|
476
|
+
* @param targetId - Target entity ID
|
|
477
|
+
* @param verbType - Relationship type
|
|
478
|
+
* @param feedbackWeight - The corrected/validated weight (0-1)
|
|
479
|
+
* @param feedbackConfidence - The corrected/validated confidence (0-1)
|
|
480
|
+
* @param feedbackType - Type of feedback ('correction', 'validation', 'enhancement')
|
|
481
|
+
*/
|
|
482
|
+
provideFeedbackForVerbScoring(sourceId: string, targetId: string, verbType: string, feedbackWeight: number, feedbackConfidence?: number, feedbackType?: 'correction' | 'validation' | 'enhancement'): Promise<void>;
|
|
483
|
+
/**
|
|
484
|
+
* Get learning statistics from the intelligent verb scoring system
|
|
485
|
+
*/
|
|
486
|
+
getVerbScoringStats(): any;
|
|
487
|
+
/**
|
|
488
|
+
* Export learning data from the intelligent verb scoring system
|
|
489
|
+
*/
|
|
490
|
+
exportVerbScoringLearningData(): string | null;
|
|
491
|
+
/**
|
|
492
|
+
* Import learning data into the intelligent verb scoring system
|
|
493
|
+
*/
|
|
494
|
+
importVerbScoringLearningData(jsonData: string): void;
|
|
409
495
|
/**
|
|
410
496
|
* Get the current augmentation name if available
|
|
411
497
|
* This is used to auto-detect the service performing data operations
|
|
@@ -622,6 +708,34 @@ export declare class BrainyData<T = any> implements BrainyDataInterface<T> {
|
|
|
622
708
|
* Get a vector by ID
|
|
623
709
|
*/
|
|
624
710
|
get(id: string): Promise<VectorDocument<T> | null>;
|
|
711
|
+
/**
|
|
712
|
+
* Check if a document with the given ID exists
|
|
713
|
+
* This is a direct storage operation that works in write-only mode when allowDirectReads is enabled
|
|
714
|
+
* @param id The ID to check for existence
|
|
715
|
+
* @returns Promise<boolean> True if the document exists, false otherwise
|
|
716
|
+
*/
|
|
717
|
+
has(id: string): Promise<boolean>;
|
|
718
|
+
/**
|
|
719
|
+
* Check if a document with the given ID exists (alias for has)
|
|
720
|
+
* This is a direct storage operation that works in write-only mode when allowDirectReads is enabled
|
|
721
|
+
* @param id The ID to check for existence
|
|
722
|
+
* @returns Promise<boolean> True if the document exists, false otherwise
|
|
723
|
+
*/
|
|
724
|
+
exists(id: string): Promise<boolean>;
|
|
725
|
+
/**
|
|
726
|
+
* Get metadata for a document by ID
|
|
727
|
+
* This is a direct storage operation that works in write-only mode when allowDirectReads is enabled
|
|
728
|
+
* @param id The ID of the document
|
|
729
|
+
* @returns Promise<T | null> The metadata object or null if not found
|
|
730
|
+
*/
|
|
731
|
+
getMetadata(id: string): Promise<T | null>;
|
|
732
|
+
/**
|
|
733
|
+
* Get multiple documents by their IDs
|
|
734
|
+
* This is a direct storage operation that works in write-only mode when allowDirectReads is enabled
|
|
735
|
+
* @param ids Array of IDs to retrieve
|
|
736
|
+
* @returns Promise<Array<VectorDocument<T> | null>> Array of documents (null for missing IDs)
|
|
737
|
+
*/
|
|
738
|
+
getBatch(ids: string[]): Promise<Array<VectorDocument<T> | null>>;
|
|
625
739
|
/**
|
|
626
740
|
* Get all nouns in the database
|
|
627
741
|
* @returns Array of vector documents
|
|
@@ -712,6 +826,7 @@ export declare class BrainyData<T = any> implements BrainyDataInterface<T> {
|
|
|
712
826
|
}): Promise<string>;
|
|
713
827
|
/**
|
|
714
828
|
* Get a verb by ID
|
|
829
|
+
* This is a direct storage operation that works in write-only mode when allowDirectReads is enabled
|
|
715
830
|
*/
|
|
716
831
|
getVerb(id: string): Promise<GraphVerb | null>;
|
|
717
832
|
/**
|
package/dist/brainyData.js
CHANGED
|
@@ -12,6 +12,7 @@ import { matchesMetadataFilter } from './utils/metadataFilter.js';
|
|
|
12
12
|
import { MetadataIndexManager } from './utils/metadataIndex.js';
|
|
13
13
|
import { NounType, VerbType } from './types/graphTypes.js';
|
|
14
14
|
import { createServerSearchAugmentations } from './augmentations/serverSearchAugmentations.js';
|
|
15
|
+
import { IntelligentVerbScoring } from './augmentations/intelligentVerbScoring.js';
|
|
15
16
|
import { augmentationPipeline } from './augmentationPipeline.js';
|
|
16
17
|
import { prepareJsonForVectorization, extractFieldFromJson } from './utils/jsonProcessing.js';
|
|
17
18
|
import { DistributedConfigManager, HashPartitioner, OperationalModeFactory, DomainDetector, HealthMonitor } from './distributed/index.js';
|
|
@@ -69,6 +70,7 @@ export class BrainyData {
|
|
|
69
70
|
this.remoteServerConfig = null;
|
|
70
71
|
this.serverSearchConduit = null;
|
|
71
72
|
this.serverConnection = null;
|
|
73
|
+
this.intelligentVerbScoring = null;
|
|
72
74
|
// Distributed mode properties
|
|
73
75
|
this.distributedConfig = null;
|
|
74
76
|
this.configManager = null;
|
|
@@ -120,6 +122,8 @@ export class BrainyData {
|
|
|
120
122
|
this.lazyLoadInReadOnlyMode = config.lazyLoadInReadOnlyMode || false;
|
|
121
123
|
// Set write-only flag
|
|
122
124
|
this.writeOnly = config.writeOnly || false;
|
|
125
|
+
// Set allowDirectReads flag
|
|
126
|
+
this.allowDirectReads = config.allowDirectReads || false;
|
|
123
127
|
// Validate that readOnly and writeOnly are not both true
|
|
124
128
|
if (this.readOnly && this.writeOnly) {
|
|
125
129
|
throw new Error('Database cannot be both read-only and write-only');
|
|
@@ -198,6 +202,11 @@ export class BrainyData {
|
|
|
198
202
|
}
|
|
199
203
|
// Initialize search cache with final configuration
|
|
200
204
|
this.searchCache = new SearchCache(finalSearchCacheConfig);
|
|
205
|
+
// Initialize intelligent verb scoring if enabled
|
|
206
|
+
if (config.intelligentVerbScoring?.enabled) {
|
|
207
|
+
this.intelligentVerbScoring = new IntelligentVerbScoring(config.intelligentVerbScoring);
|
|
208
|
+
this.intelligentVerbScoring.enabled = true;
|
|
209
|
+
}
|
|
201
210
|
}
|
|
202
211
|
/**
|
|
203
212
|
* Check if the database is in read-only mode and throw an error if it is
|
|
@@ -220,11 +229,15 @@ export class BrainyData {
|
|
|
220
229
|
/**
|
|
221
230
|
* Check if the database is in write-only mode and throw an error if it is
|
|
222
231
|
* @param allowExistenceChecks If true, allows existence checks (get operations) in write-only mode
|
|
232
|
+
* @param isDirectStorageOperation If true, allows the operation when allowDirectReads is enabled
|
|
223
233
|
* @throws Error if the database is in write-only mode and operation is not allowed
|
|
224
234
|
*/
|
|
225
|
-
checkWriteOnly(allowExistenceChecks = false) {
|
|
226
|
-
if (this.writeOnly && !allowExistenceChecks) {
|
|
227
|
-
throw new Error('Cannot perform search operation: database is in write-only mode.
|
|
235
|
+
checkWriteOnly(allowExistenceChecks = false, isDirectStorageOperation = false) {
|
|
236
|
+
if (this.writeOnly && !allowExistenceChecks && !(isDirectStorageOperation && this.allowDirectReads)) {
|
|
237
|
+
throw new Error('Cannot perform search operation: database is in write-only mode. ' +
|
|
238
|
+
(this.allowDirectReads
|
|
239
|
+
? 'Direct storage operations (get, has, exists, getMetadata, getBatch, getVerb) are allowed.'
|
|
240
|
+
: 'Use get() for existence checks or enable allowDirectReads for direct storage operations.'));
|
|
228
241
|
}
|
|
229
242
|
}
|
|
230
243
|
/**
|
|
@@ -542,6 +555,48 @@ export class BrainyData {
|
|
|
542
555
|
throw error;
|
|
543
556
|
}
|
|
544
557
|
}
|
|
558
|
+
/**
|
|
559
|
+
* Provide feedback to the intelligent verb scoring system for learning
|
|
560
|
+
* This allows the system to learn from user corrections or validation
|
|
561
|
+
*
|
|
562
|
+
* @param sourceId - Source entity ID
|
|
563
|
+
* @param targetId - Target entity ID
|
|
564
|
+
* @param verbType - Relationship type
|
|
565
|
+
* @param feedbackWeight - The corrected/validated weight (0-1)
|
|
566
|
+
* @param feedbackConfidence - The corrected/validated confidence (0-1)
|
|
567
|
+
* @param feedbackType - Type of feedback ('correction', 'validation', 'enhancement')
|
|
568
|
+
*/
|
|
569
|
+
async provideFeedbackForVerbScoring(sourceId, targetId, verbType, feedbackWeight, feedbackConfidence, feedbackType = 'correction') {
|
|
570
|
+
if (this.intelligentVerbScoring?.enabled) {
|
|
571
|
+
await this.intelligentVerbScoring.provideFeedback(sourceId, targetId, verbType, feedbackWeight, feedbackConfidence, feedbackType);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Get learning statistics from the intelligent verb scoring system
|
|
576
|
+
*/
|
|
577
|
+
getVerbScoringStats() {
|
|
578
|
+
if (this.intelligentVerbScoring?.enabled) {
|
|
579
|
+
return this.intelligentVerbScoring.getLearningStats();
|
|
580
|
+
}
|
|
581
|
+
return null;
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Export learning data from the intelligent verb scoring system
|
|
585
|
+
*/
|
|
586
|
+
exportVerbScoringLearningData() {
|
|
587
|
+
if (this.intelligentVerbScoring?.enabled) {
|
|
588
|
+
return this.intelligentVerbScoring.exportLearningData();
|
|
589
|
+
}
|
|
590
|
+
return null;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Import learning data into the intelligent verb scoring system
|
|
594
|
+
*/
|
|
595
|
+
importVerbScoringLearningData(jsonData) {
|
|
596
|
+
if (this.intelligentVerbScoring?.enabled) {
|
|
597
|
+
this.intelligentVerbScoring.importLearningData(jsonData);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
545
600
|
/**
|
|
546
601
|
* Get the current augmentation name if available
|
|
547
602
|
* This is used to auto-detect the service performing data operations
|
|
@@ -765,6 +820,13 @@ export class BrainyData {
|
|
|
765
820
|
}
|
|
766
821
|
}
|
|
767
822
|
}
|
|
823
|
+
// Initialize intelligent verb scoring augmentation if enabled
|
|
824
|
+
if (this.intelligentVerbScoring) {
|
|
825
|
+
await this.intelligentVerbScoring.initialize();
|
|
826
|
+
this.intelligentVerbScoring.setBrainyInstance(this);
|
|
827
|
+
// Register with augmentation pipeline
|
|
828
|
+
augmentationPipeline.register(this.intelligentVerbScoring);
|
|
829
|
+
}
|
|
768
830
|
this.isInitialized = true;
|
|
769
831
|
this.isInitializing = false;
|
|
770
832
|
// Start real-time updates if enabled
|
|
@@ -1970,6 +2032,96 @@ export class BrainyData {
|
|
|
1970
2032
|
throw new Error(`Failed to get vector ${id}: ${error}`);
|
|
1971
2033
|
}
|
|
1972
2034
|
}
|
|
2035
|
+
/**
|
|
2036
|
+
* Check if a document with the given ID exists
|
|
2037
|
+
* This is a direct storage operation that works in write-only mode when allowDirectReads is enabled
|
|
2038
|
+
* @param id The ID to check for existence
|
|
2039
|
+
* @returns Promise<boolean> True if the document exists, false otherwise
|
|
2040
|
+
*/
|
|
2041
|
+
async has(id) {
|
|
2042
|
+
if (id === null || id === undefined) {
|
|
2043
|
+
throw new Error('ID cannot be null or undefined');
|
|
2044
|
+
}
|
|
2045
|
+
await this.ensureInitialized();
|
|
2046
|
+
// This is a direct storage operation - check if allowed in write-only mode
|
|
2047
|
+
if (this.writeOnly && !this.allowDirectReads) {
|
|
2048
|
+
throw new Error('Cannot perform has() operation: database is in write-only mode. Enable allowDirectReads for direct storage operations.');
|
|
2049
|
+
}
|
|
2050
|
+
try {
|
|
2051
|
+
// Always query storage directly for existence check
|
|
2052
|
+
const noun = await this.storage.getNoun(id);
|
|
2053
|
+
return noun !== null;
|
|
2054
|
+
}
|
|
2055
|
+
catch (error) {
|
|
2056
|
+
// If storage lookup fails, the item doesn't exist
|
|
2057
|
+
return false;
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
/**
|
|
2061
|
+
* Check if a document with the given ID exists (alias for has)
|
|
2062
|
+
* This is a direct storage operation that works in write-only mode when allowDirectReads is enabled
|
|
2063
|
+
* @param id The ID to check for existence
|
|
2064
|
+
* @returns Promise<boolean> True if the document exists, false otherwise
|
|
2065
|
+
*/
|
|
2066
|
+
async exists(id) {
|
|
2067
|
+
return this.has(id);
|
|
2068
|
+
}
|
|
2069
|
+
/**
|
|
2070
|
+
* Get metadata for a document by ID
|
|
2071
|
+
* This is a direct storage operation that works in write-only mode when allowDirectReads is enabled
|
|
2072
|
+
* @param id The ID of the document
|
|
2073
|
+
* @returns Promise<T | null> The metadata object or null if not found
|
|
2074
|
+
*/
|
|
2075
|
+
async getMetadata(id) {
|
|
2076
|
+
if (id === null || id === undefined) {
|
|
2077
|
+
throw new Error('ID cannot be null or undefined');
|
|
2078
|
+
}
|
|
2079
|
+
await this.ensureInitialized();
|
|
2080
|
+
// This is a direct storage operation - check if allowed in write-only mode
|
|
2081
|
+
if (this.writeOnly && !this.allowDirectReads) {
|
|
2082
|
+
throw new Error('Cannot perform getMetadata() operation: database is in write-only mode. Enable allowDirectReads for direct storage operations.');
|
|
2083
|
+
}
|
|
2084
|
+
try {
|
|
2085
|
+
const metadata = await this.storage.getMetadata(id);
|
|
2086
|
+
return metadata;
|
|
2087
|
+
}
|
|
2088
|
+
catch (error) {
|
|
2089
|
+
console.error(`Failed to get metadata for ${id}:`, error);
|
|
2090
|
+
return null;
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
/**
|
|
2094
|
+
* Get multiple documents by their IDs
|
|
2095
|
+
* This is a direct storage operation that works in write-only mode when allowDirectReads is enabled
|
|
2096
|
+
* @param ids Array of IDs to retrieve
|
|
2097
|
+
* @returns Promise<Array<VectorDocument<T> | null>> Array of documents (null for missing IDs)
|
|
2098
|
+
*/
|
|
2099
|
+
async getBatch(ids) {
|
|
2100
|
+
if (!Array.isArray(ids)) {
|
|
2101
|
+
throw new Error('IDs must be provided as an array');
|
|
2102
|
+
}
|
|
2103
|
+
await this.ensureInitialized();
|
|
2104
|
+
// This is a direct storage operation - check if allowed in write-only mode
|
|
2105
|
+
if (this.writeOnly && !this.allowDirectReads) {
|
|
2106
|
+
throw new Error('Cannot perform getBatch() operation: database is in write-only mode. Enable allowDirectReads for direct storage operations.');
|
|
2107
|
+
}
|
|
2108
|
+
const results = [];
|
|
2109
|
+
for (const id of ids) {
|
|
2110
|
+
if (id === null || id === undefined) {
|
|
2111
|
+
results.push(null);
|
|
2112
|
+
continue;
|
|
2113
|
+
}
|
|
2114
|
+
try {
|
|
2115
|
+
const result = await this.get(id);
|
|
2116
|
+
results.push(result);
|
|
2117
|
+
}
|
|
2118
|
+
catch (error) {
|
|
2119
|
+
console.error(`Failed to get document ${id} in batch:`, error);
|
|
2120
|
+
results.push(null);
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
return results;
|
|
2124
|
+
}
|
|
1973
2125
|
/**
|
|
1974
2126
|
* Get all nouns in the database
|
|
1975
2127
|
* @returns Array of vector documents
|
|
@@ -2540,6 +2692,28 @@ export class BrainyData {
|
|
|
2540
2692
|
vector: verbVector,
|
|
2541
2693
|
connections: new Map()
|
|
2542
2694
|
};
|
|
2695
|
+
// Apply intelligent verb scoring if enabled and weight/confidence not provided
|
|
2696
|
+
let finalWeight = options.weight;
|
|
2697
|
+
let finalConfidence;
|
|
2698
|
+
let scoringReasoning = [];
|
|
2699
|
+
if (this.intelligentVerbScoring?.enabled && (!options.weight || options.weight === 0.5)) {
|
|
2700
|
+
try {
|
|
2701
|
+
const scores = await this.intelligentVerbScoring.computeVerbScores(sourceId, targetId, verbType, options.weight, options.metadata);
|
|
2702
|
+
finalWeight = scores.weight;
|
|
2703
|
+
finalConfidence = scores.confidence;
|
|
2704
|
+
scoringReasoning = scores.reasoning;
|
|
2705
|
+
if (this.loggingConfig?.verbose && scoringReasoning.length > 0) {
|
|
2706
|
+
console.log(`Intelligent verb scoring for ${sourceId}-${verbType}-${targetId}:`, scoringReasoning);
|
|
2707
|
+
}
|
|
2708
|
+
}
|
|
2709
|
+
catch (error) {
|
|
2710
|
+
if (this.loggingConfig?.verbose) {
|
|
2711
|
+
console.warn('Error in intelligent verb scoring:', error);
|
|
2712
|
+
}
|
|
2713
|
+
// Fall back to original weight
|
|
2714
|
+
finalWeight = options.weight;
|
|
2715
|
+
}
|
|
2716
|
+
}
|
|
2543
2717
|
// Create complete verb metadata separately
|
|
2544
2718
|
const verbMetadata = {
|
|
2545
2719
|
sourceId: sourceId,
|
|
@@ -2548,7 +2722,12 @@ export class BrainyData {
|
|
|
2548
2722
|
target: targetId,
|
|
2549
2723
|
verb: verbType,
|
|
2550
2724
|
type: verbType, // Set the type property to match the verb type
|
|
2551
|
-
weight:
|
|
2725
|
+
weight: finalWeight,
|
|
2726
|
+
confidence: finalConfidence, // Add confidence to metadata
|
|
2727
|
+
intelligentScoring: scoringReasoning.length > 0 ? {
|
|
2728
|
+
reasoning: scoringReasoning,
|
|
2729
|
+
computedAt: new Date().toISOString()
|
|
2730
|
+
} : undefined,
|
|
2552
2731
|
createdAt: timestamp,
|
|
2553
2732
|
updatedAt: timestamp,
|
|
2554
2733
|
createdBy: getAugmentationVersion(service),
|
|
@@ -2607,9 +2786,14 @@ export class BrainyData {
|
|
|
2607
2786
|
}
|
|
2608
2787
|
/**
|
|
2609
2788
|
* Get a verb by ID
|
|
2789
|
+
* This is a direct storage operation that works in write-only mode when allowDirectReads is enabled
|
|
2610
2790
|
*/
|
|
2611
2791
|
async getVerb(id) {
|
|
2612
2792
|
await this.ensureInitialized();
|
|
2793
|
+
// This is a direct storage operation - check if allowed in write-only mode
|
|
2794
|
+
if (this.writeOnly && !this.allowDirectReads) {
|
|
2795
|
+
throw new Error('Cannot perform getVerb() operation: database is in write-only mode. Enable allowDirectReads for direct storage operations.');
|
|
2796
|
+
}
|
|
2613
2797
|
try {
|
|
2614
2798
|
// Get the lightweight verb from storage
|
|
2615
2799
|
const hnswVerb = await this.storage.getVerb(id);
|