@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.
Files changed (107) hide show
  1. package/README.md +22 -16
  2. package/dist/brainy.js +4553 -2264
  3. package/dist/brainy.min.js +750 -750
  4. package/dist/brainyData.d.ts +141 -0
  5. package/dist/coreTypes.d.ts +31 -0
  6. package/dist/errors/brainyError.d.ts +45 -0
  7. package/dist/hnsw/hnswIndexOptimized.d.ts +13 -1
  8. package/dist/hnsw/hnswIndexOptimized.d.ts.map +1 -1
  9. package/dist/statistics/statisticsManager.d.ts +121 -0
  10. package/dist/storage/adapters/fileSystemStorage.d.ts +99 -30
  11. package/dist/storage/adapters/fileSystemStorage.d.ts.map +1 -1
  12. package/dist/storage/adapters/memoryStorage.d.ts.map +1 -1
  13. package/dist/storage/adapters/opfsStorage.d.ts +21 -1
  14. package/dist/storage/adapters/opfsStorage.d.ts.map +1 -1
  15. package/dist/storage/adapters/s3CompatibleStorage.d.ts +58 -1
  16. package/dist/storage/adapters/s3CompatibleStorage.d.ts.map +1 -1
  17. package/dist/storage/fileSystemStorage.d.ts +2 -15
  18. package/dist/storage/fileSystemStorage.d.ts.map +1 -1
  19. package/dist/storage/opfsStorage.d.ts +3 -66
  20. package/dist/storage/opfsStorage.d.ts.map +1 -1
  21. package/dist/storage/s3CompatibleStorage.d.ts +2 -14
  22. package/dist/storage/s3CompatibleStorage.d.ts.map +1 -1
  23. package/dist/storage/storageFactory.d.ts +6 -1
  24. package/dist/storage/storageFactory.d.ts.map +1 -1
  25. package/dist/testing/prettyReporter.d.ts +23 -0
  26. package/dist/testing/prettySummaryReporter.d.ts +22 -0
  27. package/dist/types/tensorflowTypes.d.ts +0 -8
  28. package/dist/types/tensorflowTypes.d.ts.map +1 -1
  29. package/dist/unified.d.ts +4 -0
  30. package/dist/unified.js +3170 -1464
  31. package/dist/unified.min.js +750 -750
  32. package/dist/utils/embedding.d.ts +7 -0
  33. package/dist/utils/embedding.d.ts.map +1 -1
  34. package/dist/utils/environmentDetection.d.ts +47 -0
  35. package/dist/utils/environmentDetection.d.ts.map +1 -0
  36. package/dist/utils/logger.d.ts +99 -0
  37. package/dist/utils/logger.d.ts.map +1 -0
  38. package/dist/utils/operationUtils.d.ts +58 -0
  39. package/dist/utils/operationUtils.d.ts.map +1 -0
  40. package/dist/utils/textEncoding.d.ts +0 -7
  41. package/dist/utils/textEncoding.d.ts.map +1 -1
  42. package/dist/utils/version.d.ts +1 -1
  43. package/package.json +14 -3
  44. package/dist/augmentations/conduitAugmentations.js +0 -1158
  45. package/dist/augmentations/conduitAugmentations.js.map +0 -1
  46. package/dist/augmentations/memoryAugmentations.js +0 -255
  47. package/dist/augmentations/memoryAugmentations.js.map +0 -1
  48. package/dist/augmentations/serverSearchAugmentations.js +0 -531
  49. package/dist/augmentations/serverSearchAugmentations.js.map +0 -1
  50. package/dist/examples/basicUsage.js +0 -128
  51. package/dist/examples/basicUsage.js.map +0 -1
  52. package/dist/hnsw/hnswIndex.js +0 -550
  53. package/dist/hnsw/hnswIndex.js.map +0 -1
  54. package/dist/hnsw/hnswIndexOptimized.js +0 -441
  55. package/dist/hnsw/hnswIndexOptimized.js.map +0 -1
  56. package/dist/mcp/brainyMCPAdapter.js +0 -142
  57. package/dist/mcp/brainyMCPAdapter.js.map +0 -1
  58. package/dist/mcp/brainyMCPService.js +0 -248
  59. package/dist/mcp/brainyMCPService.js.map +0 -1
  60. package/dist/mcp/index.js +0 -17
  61. package/dist/mcp/index.js.map +0 -1
  62. package/dist/mcp/mcpAugmentationToolset.js +0 -180
  63. package/dist/mcp/mcpAugmentationToolset.js.map +0 -1
  64. package/dist/storage/adapters/baseStorageAdapter.js +0 -233
  65. package/dist/storage/adapters/baseStorageAdapter.js.map +0 -1
  66. package/dist/storage/adapters/fileSystemStorage.js +0 -568
  67. package/dist/storage/adapters/fileSystemStorage.js.map +0 -1
  68. package/dist/storage/adapters/memoryStorage.js +0 -300
  69. package/dist/storage/adapters/memoryStorage.js.map +0 -1
  70. package/dist/storage/adapters/opfsStorage.js +0 -778
  71. package/dist/storage/adapters/opfsStorage.js.map +0 -1
  72. package/dist/storage/adapters/s3CompatibleStorage.js +0 -1021
  73. package/dist/storage/adapters/s3CompatibleStorage.js.map +0 -1
  74. package/dist/storage/baseStorage.js +0 -126
  75. package/dist/storage/baseStorage.js.map +0 -1
  76. package/dist/storage/storageFactory.js +0 -183
  77. package/dist/storage/storageFactory.js.map +0 -1
  78. package/dist/types/augmentations.js +0 -16
  79. package/dist/types/augmentations.js.map +0 -1
  80. package/dist/types/brainyDataInterface.js +0 -8
  81. package/dist/types/brainyDataInterface.js.map +0 -1
  82. package/dist/types/fileSystemTypes.js +0 -8
  83. package/dist/types/fileSystemTypes.js.map +0 -1
  84. package/dist/types/graphTypes.js +0 -36
  85. package/dist/types/graphTypes.js.map +0 -1
  86. package/dist/types/mcpTypes.js +0 -22
  87. package/dist/types/mcpTypes.js.map +0 -1
  88. package/dist/types/pipelineTypes.js +0 -7
  89. package/dist/types/pipelineTypes.js.map +0 -1
  90. package/dist/types/tensorflowTypes.js +0 -6
  91. package/dist/types/tensorflowTypes.js.map +0 -1
  92. package/dist/utils/distance.js +0 -239
  93. package/dist/utils/distance.js.map +0 -1
  94. package/dist/utils/embedding.js +0 -622
  95. package/dist/utils/embedding.js.map +0 -1
  96. package/dist/utils/environment.js +0 -75
  97. package/dist/utils/environment.js.map +0 -1
  98. package/dist/utils/index.js +0 -5
  99. package/dist/utils/index.js.map +0 -1
  100. package/dist/utils/statistics.js +0 -25
  101. package/dist/utils/statistics.js.map +0 -1
  102. package/dist/utils/tensorflowUtils.js +0 -25
  103. package/dist/utils/tensorflowUtils.js.map +0 -1
  104. package/dist/utils/textEncoding.js +0 -281
  105. package/dist/utils/textEncoding.js.map +0 -1
  106. package/dist/utils/workerUtils.js +0 -458
  107. package/dist/utils/workerUtils.js.map +0 -1
package/README.md CHANGED
@@ -494,7 +494,7 @@ const restoreResult = await db.restore(backupData, {clearExisting: true})
494
494
 
495
495
  ### Database Statistics
496
496
 
497
- Brainy provides a way to get statistics about the current state of the database:
497
+ Brainy provides a way to get statistics about the current state of the database. For detailed information about the statistics system, including implementation details, scalability improvements, and usage examples, see our [Statistics Guide](STATISTICS.md).
498
498
 
499
499
  ```typescript
500
500
  import {BrainyData, getStatistics} from '@soulcraft/brainy'
@@ -503,22 +503,12 @@ import {BrainyData, getStatistics} from '@soulcraft/brainy'
503
503
  const db = new BrainyData()
504
504
  await db.init()
505
505
 
506
- // Get statistics using the standalone function
507
- const stats = await getStatistics(db)
506
+ // Get statistics using the instance method
507
+ const stats = await db.getStatistics()
508
508
  console.log(stats)
509
- // Output: { nounCount: 0, verbCount: 0, metadataCount: 0, hnswIndexSize: 0 }
510
-
511
- // Or using the instance method
512
- const instanceStats = await db.getStatistics()
509
+ // Output: { nounCount: 0, verbCount: 0, metadataCount: 0, hnswIndexSize: 0, serviceBreakdown: {...} }
513
510
  ```
514
511
 
515
- The statistics include:
516
-
517
- - `nounCount`: Number of nouns (entities) in the database
518
- - `verbCount`: Number of verbs (relationships) in the database
519
- - `metadataCount`: Number of metadata entries
520
- - `hnswIndexSize`: Size of the HNSW index
521
-
522
512
  ### Working with Nouns (Entities)
523
513
 
524
514
  ```typescript
@@ -1317,8 +1307,24 @@ terabyte-scale data that can't fit entirely in memory, we provide several approa
1317
1307
  - **Distributed HNSW**: Sharding and partitioning across multiple machines
1318
1308
  - **Hybrid Solutions**: Combining quantization techniques with multi-tier architectures
1319
1309
 
1320
- For detailed information on how to scale Brainy for large datasets, see our
1321
- comprehensive [Scaling Strategy](scalingStrategy.md) document.
1310
+ For detailed information on how to scale Brainy for large datasets, vector dimension standardization, threading implementation, storage testing, and other technical topics, see our comprehensive [Technical Guides](TECHNICAL_GUIDES.md).
1311
+
1312
+ ## Testing
1313
+
1314
+ Brainy uses Vitest for testing. For detailed information about testing in Brainy, including test configuration, scripts, reporting tools, and best practices, see our [Testing Guide](TESTING.md).
1315
+
1316
+ Here are some common test commands:
1317
+
1318
+ ```bash
1319
+ # Run all tests
1320
+ npm test
1321
+
1322
+ # Run tests with comprehensive reporting
1323
+ npm run test:report
1324
+
1325
+ # Run tests with coverage
1326
+ npm run test:coverage
1327
+ ```
1322
1328
 
1323
1329
  ## Contributing
1324
1330