agentdb 3.0.0-alpha.10 → 3.0.0-alpha.12
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/LICENSE +21 -0
- package/README.md +2821 -225
- package/dist/src/backends/VectorBackend.d.ts +31 -6
- package/dist/src/backends/VectorBackend.d.ts.map +1 -1
- package/dist/src/backends/detector.js.map +1 -1
- package/dist/src/backends/factory.d.ts +16 -33
- package/dist/src/backends/factory.d.ts.map +1 -1
- package/dist/src/backends/factory.js +138 -108
- package/dist/src/backends/factory.js.map +1 -1
- package/dist/src/backends/hnswlib/HNSWLibBackend.d.ts.map +1 -1
- package/dist/src/backends/hnswlib/HNSWLibBackend.js +29 -2
- package/dist/src/backends/hnswlib/HNSWLibBackend.js.map +1 -1
- package/dist/src/backends/ruvector/RuVectorBackend.d.ts +198 -45
- package/dist/src/backends/ruvector/RuVectorBackend.d.ts.map +1 -1
- package/dist/src/backends/ruvector/RuVectorBackend.js +612 -277
- package/dist/src/backends/ruvector/RuVectorBackend.js.map +1 -1
- package/dist/src/backends/ruvector/RuVectorLearning.d.ts +0 -4
- package/dist/src/backends/ruvector/RuVectorLearning.d.ts.map +1 -1
- package/dist/src/backends/ruvector/RuVectorLearning.js +0 -6
- package/dist/src/backends/ruvector/RuVectorLearning.js.map +1 -1
- package/dist/src/backends/rvf/AdaptiveIndexTuner.d.ts +175 -0
- package/dist/src/backends/rvf/AdaptiveIndexTuner.d.ts.map +1 -0
- package/dist/src/backends/rvf/AdaptiveIndexTuner.js +559 -0
- package/dist/src/backends/rvf/AdaptiveIndexTuner.js.map +1 -0
- package/dist/src/backends/rvf/ContrastiveTrainer.d.ts +148 -0
- package/dist/src/backends/rvf/ContrastiveTrainer.d.ts.map +1 -0
- package/dist/src/backends/rvf/ContrastiveTrainer.js +438 -0
- package/dist/src/backends/rvf/ContrastiveTrainer.js.map +1 -0
- package/dist/src/backends/rvf/FederatedSessionManager.d.ts +211 -0
- package/dist/src/backends/rvf/FederatedSessionManager.d.ts.map +1 -0
- package/dist/src/backends/rvf/FederatedSessionManager.js +389 -0
- package/dist/src/backends/rvf/FederatedSessionManager.js.map +1 -0
- package/dist/src/backends/rvf/FilterBuilder.d.ts +136 -0
- package/dist/src/backends/rvf/FilterBuilder.d.ts.map +1 -0
- package/dist/src/backends/rvf/FilterBuilder.js +157 -0
- package/dist/src/backends/rvf/FilterBuilder.js.map +1 -0
- package/dist/src/backends/rvf/NativeAccelerator.d.ts +140 -0
- package/dist/src/backends/rvf/NativeAccelerator.d.ts.map +1 -0
- package/dist/src/backends/rvf/NativeAccelerator.js +630 -0
- package/dist/src/backends/rvf/NativeAccelerator.js.map +1 -0
- package/dist/src/backends/rvf/RvfBackend.d.ts +194 -0
- package/dist/src/backends/rvf/RvfBackend.d.ts.map +1 -0
- package/dist/src/backends/rvf/RvfBackend.js +607 -0
- package/dist/src/backends/rvf/RvfBackend.js.map +1 -0
- package/dist/src/backends/rvf/RvfSolver.d.ts +175 -0
- package/dist/src/backends/rvf/RvfSolver.d.ts.map +1 -0
- package/dist/src/backends/rvf/RvfSolver.js +176 -0
- package/dist/src/backends/rvf/RvfSolver.js.map +1 -0
- package/dist/src/backends/rvf/SelfLearningRvfBackend.d.ts +143 -0
- package/dist/src/backends/rvf/SelfLearningRvfBackend.d.ts.map +1 -0
- package/dist/src/backends/rvf/SelfLearningRvfBackend.js +569 -0
- package/dist/src/backends/rvf/SelfLearningRvfBackend.js.map +1 -0
- package/dist/src/backends/rvf/SemanticQueryRouter.d.ts +128 -0
- package/dist/src/backends/rvf/SemanticQueryRouter.d.ts.map +1 -0
- package/dist/src/backends/rvf/SemanticQueryRouter.js +415 -0
- package/dist/src/backends/rvf/SemanticQueryRouter.js.map +1 -0
- package/dist/src/backends/rvf/SimdFallbacks.d.ts +25 -0
- package/dist/src/backends/rvf/SimdFallbacks.d.ts.map +1 -0
- package/dist/src/backends/rvf/SimdFallbacks.js +287 -0
- package/dist/src/backends/rvf/SimdFallbacks.js.map +1 -0
- package/dist/src/backends/rvf/SolverBandit.d.ts +100 -0
- package/dist/src/backends/rvf/SolverBandit.d.ts.map +1 -0
- package/dist/src/backends/rvf/SolverBandit.js +216 -0
- package/dist/src/backends/rvf/SolverBandit.js.map +1 -0
- package/dist/src/backends/rvf/SonaLearningBackend.d.ts +157 -0
- package/dist/src/backends/rvf/SonaLearningBackend.d.ts.map +1 -0
- package/dist/src/backends/rvf/SonaLearningBackend.js +283 -0
- package/dist/src/backends/rvf/SonaLearningBackend.js.map +1 -0
- package/dist/src/backends/rvf/SqlJsRvfBackend.d.ts +77 -0
- package/dist/src/backends/rvf/SqlJsRvfBackend.d.ts.map +1 -0
- package/dist/src/backends/rvf/SqlJsRvfBackend.js +382 -0
- package/dist/src/backends/rvf/SqlJsRvfBackend.js.map +1 -0
- package/dist/src/backends/rvf/WasmStoreBridge.d.ts +27 -0
- package/dist/src/backends/rvf/WasmStoreBridge.d.ts.map +1 -0
- package/dist/src/backends/rvf/WasmStoreBridge.js +87 -0
- package/dist/src/backends/rvf/WasmStoreBridge.js.map +1 -0
- package/dist/src/backends/rvf/validation.d.ts +20 -0
- package/dist/src/backends/rvf/validation.d.ts.map +1 -0
- package/dist/src/backends/rvf/validation.js +78 -0
- package/dist/src/backends/rvf/validation.js.map +1 -0
- package/dist/src/benchmark/BenchmarkSuite.d.ts +318 -0
- package/dist/src/benchmark/BenchmarkSuite.d.ts.map +1 -0
- package/dist/src/benchmark/BenchmarkSuite.js +984 -0
- package/dist/src/benchmark/BenchmarkSuite.js.map +1 -0
- package/dist/src/benchmark/index.d.ts +29 -0
- package/dist/src/benchmark/index.d.ts.map +1 -0
- package/dist/src/benchmark/index.js +39 -0
- package/dist/src/benchmark/index.js.map +1 -0
- package/dist/src/browser/AttentionBrowser.d.ts.map +1 -1
- package/dist/src/browser/AttentionBrowser.js +1 -0
- package/dist/src/browser/AttentionBrowser.js.map +1 -1
- package/dist/src/cli/agentdb-cli.d.ts +13 -0
- package/dist/src/cli/agentdb-cli.d.ts.map +1 -1
- package/dist/src/cli/agentdb-cli.js +803 -94
- package/dist/src/cli/agentdb-cli.js.map +1 -1
- package/dist/src/cli/commands/hyperbolic.d.ts +11 -0
- package/dist/src/cli/commands/hyperbolic.d.ts.map +1 -0
- package/dist/src/cli/commands/hyperbolic.js +428 -0
- package/dist/src/cli/commands/hyperbolic.js.map +1 -0
- package/dist/src/cli/commands/learn.d.ts +11 -0
- package/dist/src/cli/commands/learn.d.ts.map +1 -0
- package/dist/src/cli/commands/learn.js +404 -0
- package/dist/src/cli/commands/learn.js.map +1 -0
- package/dist/src/cli/commands/migrate.d.ts +15 -0
- package/dist/src/cli/commands/migrate.d.ts.map +1 -1
- package/dist/src/cli/commands/migrate.js +176 -8
- package/dist/src/cli/commands/migrate.js.map +1 -1
- package/dist/src/cli/commands/route.d.ts +11 -0
- package/dist/src/cli/commands/route.d.ts.map +1 -0
- package/dist/src/cli/commands/route.js +414 -0
- package/dist/src/cli/commands/route.js.map +1 -0
- package/dist/src/cli/commands/rvf.d.ts +21 -0
- package/dist/src/cli/commands/rvf.d.ts.map +1 -0
- package/dist/src/cli/commands/rvf.js +448 -0
- package/dist/src/cli/commands/rvf.js.map +1 -0
- package/dist/src/cli/lib/report-store.d.ts +2 -1
- package/dist/src/cli/lib/report-store.d.ts.map +1 -1
- package/dist/src/cli/lib/report-store.js +85 -65
- package/dist/src/cli/lib/report-store.js.map +1 -1
- package/dist/src/cli/lib/simulation-runner.d.ts +40 -3
- package/dist/src/cli/lib/simulation-runner.d.ts.map +1 -1
- package/dist/src/cli/lib/simulation-runner.js +248 -6
- package/dist/src/cli/lib/simulation-runner.js.map +1 -1
- package/dist/src/compatibility/DeprecationWarnings.d.ts +54 -0
- package/dist/src/compatibility/DeprecationWarnings.d.ts.map +1 -0
- package/dist/src/compatibility/DeprecationWarnings.js +131 -0
- package/dist/src/compatibility/DeprecationWarnings.js.map +1 -0
- package/dist/src/compatibility/MigrationUtilities.d.ts +30 -0
- package/dist/src/compatibility/MigrationUtilities.d.ts.map +1 -0
- package/dist/src/compatibility/MigrationUtilities.js +184 -0
- package/dist/src/compatibility/MigrationUtilities.js.map +1 -0
- package/dist/src/compatibility/V1toV2Adapter.d.ts +76 -0
- package/dist/src/compatibility/V1toV2Adapter.d.ts.map +1 -0
- package/dist/src/compatibility/V1toV2Adapter.js +185 -0
- package/dist/src/compatibility/V1toV2Adapter.js.map +1 -0
- package/dist/src/compatibility/VersionDetector.d.ts +32 -0
- package/dist/src/compatibility/VersionDetector.d.ts.map +1 -0
- package/dist/src/compatibility/VersionDetector.js +144 -0
- package/dist/src/compatibility/VersionDetector.js.map +1 -0
- package/dist/src/compatibility/index.d.ts +14 -0
- package/dist/src/compatibility/index.d.ts.map +1 -0
- package/dist/src/compatibility/index.js +21 -0
- package/dist/src/compatibility/index.js.map +1 -0
- package/dist/src/compatibility/types.d.ts +103 -0
- package/dist/src/compatibility/types.d.ts.map +1 -0
- package/dist/src/compatibility/types.js +5 -0
- package/dist/src/compatibility/types.js.map +1 -0
- package/dist/src/controllers/AttentionService.d.ts +99 -202
- package/dist/src/controllers/AttentionService.d.ts.map +1 -1
- package/dist/src/controllers/AttentionService.js +450 -558
- package/dist/src/controllers/AttentionService.js.map +1 -1
- package/dist/src/controllers/CausalMemoryGraph.d.ts +30 -5
- package/dist/src/controllers/CausalMemoryGraph.d.ts.map +1 -1
- package/dist/src/controllers/CausalMemoryGraph.js +89 -13
- package/dist/src/controllers/CausalMemoryGraph.js.map +1 -1
- package/dist/src/controllers/CausalRecall.d.ts +4 -0
- package/dist/src/controllers/CausalRecall.d.ts.map +1 -1
- package/dist/src/controllers/CausalRecall.js +19 -2
- package/dist/src/controllers/CausalRecall.js.map +1 -1
- package/dist/src/controllers/EmbeddingService.d.ts.map +1 -1
- package/dist/src/controllers/EmbeddingService.js +28 -11
- package/dist/src/controllers/EmbeddingService.js.map +1 -1
- package/dist/src/controllers/EnhancedEmbeddingService.d.ts +4 -0
- package/dist/src/controllers/EnhancedEmbeddingService.d.ts.map +1 -1
- package/dist/src/controllers/EnhancedEmbeddingService.js +17 -3
- package/dist/src/controllers/EnhancedEmbeddingService.js.map +1 -1
- package/dist/src/controllers/ExplainableRecall.d.ts +1 -1
- package/dist/src/controllers/ExplainableRecall.d.ts.map +1 -1
- package/dist/src/controllers/ExplainableRecall.js +1 -1
- package/dist/src/controllers/ExplainableRecall.js.map +1 -1
- package/dist/src/controllers/HNSWIndex.d.ts +20 -2
- package/dist/src/controllers/HNSWIndex.d.ts.map +1 -1
- package/dist/src/controllers/HNSWIndex.js +82 -6
- package/dist/src/controllers/HNSWIndex.js.map +1 -1
- package/dist/src/controllers/LearningSystem.d.ts +1 -17
- package/dist/src/controllers/LearningSystem.d.ts.map +1 -1
- package/dist/src/controllers/LearningSystem.js +18 -135
- package/dist/src/controllers/LearningSystem.js.map +1 -1
- package/dist/src/controllers/MemoryController.d.ts +161 -0
- package/dist/src/controllers/MemoryController.d.ts.map +1 -0
- package/dist/src/controllers/MemoryController.js +303 -0
- package/dist/src/controllers/MemoryController.js.map +1 -0
- package/dist/src/controllers/MincutService.d.ts +92 -0
- package/dist/src/controllers/MincutService.d.ts.map +1 -0
- package/dist/src/controllers/MincutService.js +336 -0
- package/dist/src/controllers/MincutService.js.map +1 -0
- package/dist/src/controllers/NightlyLearner.d.ts +5 -1
- package/dist/src/controllers/NightlyLearner.d.ts.map +1 -1
- package/dist/src/controllers/NightlyLearner.js +17 -3
- package/dist/src/controllers/NightlyLearner.js.map +1 -1
- package/dist/src/controllers/QUICClient.d.ts +45 -0
- package/dist/src/controllers/QUICClient.d.ts.map +1 -1
- package/dist/src/controllers/QUICClient.js +190 -0
- package/dist/src/controllers/QUICClient.js.map +1 -1
- package/dist/src/controllers/ReasoningBank.d.ts +6 -3
- package/dist/src/controllers/ReasoningBank.d.ts.map +1 -1
- package/dist/src/controllers/ReasoningBank.js +47 -41
- package/dist/src/controllers/ReasoningBank.js.map +1 -1
- package/dist/src/controllers/ReflexionMemory.d.ts +115 -6
- package/dist/src/controllers/ReflexionMemory.d.ts.map +1 -1
- package/dist/src/controllers/ReflexionMemory.js +541 -213
- package/dist/src/controllers/ReflexionMemory.js.map +1 -1
- package/dist/src/controllers/SkillLibrary.d.ts +27 -3
- package/dist/src/controllers/SkillLibrary.d.ts.map +1 -1
- package/dist/src/controllers/SkillLibrary.js +187 -91
- package/dist/src/controllers/SkillLibrary.js.map +1 -1
- package/dist/src/controllers/SparsificationService.d.ts +151 -0
- package/dist/src/controllers/SparsificationService.d.ts.map +1 -0
- package/dist/src/controllers/SparsificationService.js +375 -0
- package/dist/src/controllers/SparsificationService.js.map +1 -0
- package/dist/src/controllers/SyncCoordinator.d.ts.map +1 -1
- package/dist/src/controllers/SyncCoordinator.js +115 -3
- package/dist/src/controllers/SyncCoordinator.js.map +1 -1
- package/dist/src/controllers/WASMVectorSearch.d.ts +12 -30
- package/dist/src/controllers/WASMVectorSearch.d.ts.map +1 -1
- package/dist/src/controllers/WASMVectorSearch.js +146 -93
- package/dist/src/controllers/WASMVectorSearch.js.map +1 -1
- package/dist/src/controllers/attention/AttentionCache.d.ts +38 -0
- package/dist/src/controllers/attention/AttentionCache.d.ts.map +1 -0
- package/dist/src/controllers/attention/AttentionCache.js +80 -0
- package/dist/src/controllers/attention/AttentionCache.js.map +1 -0
- package/dist/src/controllers/attention/AttentionConfig.d.ts +127 -0
- package/dist/src/controllers/attention/AttentionConfig.d.ts.map +1 -0
- package/dist/src/controllers/attention/AttentionConfig.js +124 -0
- package/dist/src/controllers/attention/AttentionConfig.js.map +1 -0
- package/dist/src/controllers/attention/AttentionCore.d.ts +89 -0
- package/dist/src/controllers/attention/AttentionCore.d.ts.map +1 -0
- package/dist/src/controllers/attention/AttentionCore.js +289 -0
- package/dist/src/controllers/attention/AttentionCore.js.map +1 -0
- package/dist/src/controllers/attention/AttentionHelpers.d.ts +55 -0
- package/dist/src/controllers/attention/AttentionHelpers.d.ts.map +1 -0
- package/dist/src/controllers/attention/AttentionHelpers.js +148 -0
- package/dist/src/controllers/attention/AttentionHelpers.js.map +1 -0
- package/dist/src/controllers/attention/AttentionMetrics.d.ts +55 -0
- package/dist/src/controllers/attention/AttentionMetrics.d.ts.map +1 -0
- package/dist/src/controllers/attention/AttentionMetrics.js +72 -0
- package/dist/src/controllers/attention/AttentionMetrics.js.map +1 -0
- package/dist/src/controllers/attention/AttentionWASM.d.ts +98 -0
- package/dist/src/controllers/attention/AttentionWASM.d.ts.map +1 -0
- package/dist/src/controllers/attention/AttentionWASM.js +147 -0
- package/dist/src/controllers/attention/AttentionWASM.js.map +1 -0
- package/dist/src/controllers/attention/CrossAttentionController.d.ts +141 -0
- package/dist/src/controllers/attention/CrossAttentionController.d.ts.map +1 -0
- package/dist/src/controllers/attention/CrossAttentionController.js +325 -0
- package/dist/src/controllers/attention/CrossAttentionController.js.map +1 -0
- package/dist/src/controllers/attention/MultiHeadAttentionController.d.ts +137 -0
- package/dist/src/controllers/attention/MultiHeadAttentionController.d.ts.map +1 -0
- package/dist/src/controllers/attention/MultiHeadAttentionController.js +336 -0
- package/dist/src/controllers/attention/MultiHeadAttentionController.js.map +1 -0
- package/dist/src/controllers/attention/SelfAttentionController.d.ts +117 -0
- package/dist/src/controllers/attention/SelfAttentionController.d.ts.map +1 -0
- package/dist/src/controllers/attention/SelfAttentionController.js +205 -0
- package/dist/src/controllers/attention/SelfAttentionController.js.map +1 -0
- package/dist/src/controllers/attention/index.d.ts +24 -0
- package/dist/src/controllers/attention/index.d.ts.map +1 -0
- package/dist/src/controllers/attention/index.js +20 -0
- package/dist/src/controllers/attention/index.js.map +1 -0
- package/dist/src/controllers/index.d.ts +14 -27
- package/dist/src/controllers/index.d.ts.map +1 -1
- package/dist/src/controllers/index.js +10 -18
- package/dist/src/controllers/index.js.map +1 -1
- package/dist/src/controllers/prerequisites.d.ts +76 -0
- package/dist/src/controllers/prerequisites.d.ts.map +1 -0
- package/dist/src/controllers/prerequisites.js +235 -0
- package/dist/src/controllers/prerequisites.js.map +1 -0
- package/dist/src/core/AgentDB.d.ts +27 -19
- package/dist/src/core/AgentDB.d.ts.map +1 -1
- package/dist/src/core/AgentDB.js +76 -124
- package/dist/src/core/AgentDB.js.map +1 -1
- package/dist/src/core/QueryCache.d.ts +138 -0
- package/dist/src/core/QueryCache.d.ts.map +1 -0
- package/dist/src/core/QueryCache.js +309 -0
- package/dist/src/core/QueryCache.js.map +1 -0
- package/dist/src/db-fallback.d.ts +10 -1
- package/dist/src/db-fallback.d.ts.map +1 -1
- package/dist/src/db-fallback.js +205 -28
- package/dist/src/db-fallback.js.map +1 -1
- package/dist/src/examples/quic-sync-example.js +2 -2
- package/dist/src/examples/quic-sync-example.js.map +1 -1
- package/dist/src/index.d.ts +15 -15
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +39 -11
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/agentdb-mcp-server.js +47 -2
- package/dist/src/mcp/agentdb-mcp-server.js.map +1 -1
- package/dist/src/model/ModelCacheLoader.d.ts +24 -0
- package/dist/src/model/ModelCacheLoader.d.ts.map +1 -0
- package/dist/src/model/ModelCacheLoader.js +121 -0
- package/dist/src/model/ModelCacheLoader.js.map +1 -0
- package/dist/src/observability/index.d.ts +8 -0
- package/dist/src/observability/index.d.ts.map +1 -0
- package/dist/src/observability/index.js +8 -0
- package/dist/src/observability/index.js.map +1 -0
- package/dist/src/observability/integration.d.ts +32 -0
- package/dist/src/observability/integration.d.ts.map +1 -0
- package/dist/src/observability/integration.js +159 -0
- package/dist/src/observability/integration.js.map +1 -0
- package/dist/src/observability/telemetry.d.ts +137 -0
- package/dist/src/observability/telemetry.d.ts.map +1 -0
- package/dist/src/observability/telemetry.js +416 -0
- package/dist/src/observability/telemetry.js.map +1 -0
- package/dist/src/optimizations/BatchOperations.d.ts +47 -0
- package/dist/src/optimizations/BatchOperations.d.ts.map +1 -1
- package/dist/src/optimizations/BatchOperations.js +183 -31
- package/dist/src/optimizations/BatchOperations.js.map +1 -1
- package/dist/src/optimizations/Quantization.d.ts +330 -0
- package/dist/src/optimizations/Quantization.d.ts.map +1 -0
- package/dist/src/optimizations/Quantization.js +793 -0
- package/dist/src/optimizations/Quantization.js.map +1 -0
- package/dist/src/optimizations/index.d.ts +1 -3
- package/dist/src/optimizations/index.d.ts.map +1 -1
- package/dist/src/optimizations/index.js +0 -1
- package/dist/src/optimizations/index.js.map +1 -1
- package/dist/src/quantization/index.d.ts +7 -0
- package/dist/src/quantization/index.d.ts.map +1 -0
- package/dist/src/quantization/index.js +15 -0
- package/dist/src/quantization/index.js.map +1 -0
- package/dist/src/quantization/vector-quantization.d.ts +388 -0
- package/dist/src/quantization/vector-quantization.d.ts.map +1 -0
- package/dist/src/quantization/vector-quantization.js +1132 -0
- package/dist/src/quantization/vector-quantization.js.map +1 -0
- package/dist/src/search/HybridSearch.d.ts +311 -0
- package/dist/src/search/HybridSearch.d.ts.map +1 -0
- package/dist/src/search/HybridSearch.js +712 -0
- package/dist/src/search/HybridSearch.js.map +1 -0
- package/dist/src/search/index.d.ts +12 -0
- package/dist/src/search/index.d.ts.map +1 -0
- package/dist/src/search/index.js +16 -0
- package/dist/src/search/index.js.map +1 -0
- package/dist/src/services/AttentionService.d.ts +303 -0
- package/dist/src/services/AttentionService.d.ts.map +1 -0
- package/dist/src/services/AttentionService.js +1165 -0
- package/dist/src/services/AttentionService.js.map +1 -0
- package/dist/src/services/LLMRouter.d.ts +61 -7
- package/dist/src/services/LLMRouter.d.ts.map +1 -1
- package/dist/src/services/LLMRouter.js +286 -22
- package/dist/src/services/LLMRouter.js.map +1 -1
- package/dist/src/services/audit-logger.service.d.ts +168 -0
- package/dist/src/services/audit-logger.service.d.ts.map +1 -0
- package/dist/src/services/audit-logger.service.js +331 -0
- package/dist/src/services/audit-logger.service.js.map +1 -0
- package/dist/src/services/enhanced-embeddings.d.ts +271 -0
- package/dist/src/services/enhanced-embeddings.d.ts.map +1 -0
- package/dist/src/services/enhanced-embeddings.js +1035 -0
- package/dist/src/services/enhanced-embeddings.js.map +1 -0
- package/dist/src/services/federated-learning.d.ts +172 -0
- package/dist/src/services/federated-learning.d.ts.map +1 -0
- package/dist/src/services/federated-learning.js +342 -0
- package/dist/src/services/federated-learning.js.map +1 -0
- package/dist/src/simd/index.d.ts +9 -0
- package/dist/src/simd/index.d.ts.map +1 -0
- package/dist/src/simd/index.js +27 -0
- package/dist/src/simd/index.js.map +1 -0
- package/dist/src/simd/simd-vector-ops.d.ts +332 -0
- package/dist/src/simd/simd-vector-ops.d.ts.map +1 -0
- package/dist/src/simd/simd-vector-ops.js +945 -0
- package/dist/src/simd/simd-vector-ops.js.map +1 -0
- package/dist/src/types/database.types.d.ts +275 -0
- package/dist/src/types/database.types.d.ts.map +1 -0
- package/dist/src/types/database.types.js +55 -0
- package/dist/src/types/database.types.js.map +1 -0
- package/dist/src/types/graph.d.ts +29 -0
- package/dist/src/types/graph.d.ts.map +1 -0
- package/dist/src/types/graph.js +8 -0
- package/dist/src/types/graph.js.map +1 -0
- package/dist/src/utils/chalk-fallback.d.ts +3 -0
- package/dist/src/utils/chalk-fallback.d.ts.map +1 -0
- package/dist/src/utils/chalk-fallback.js +20 -0
- package/dist/src/utils/chalk-fallback.js.map +1 -0
- package/dist/src/utils/similarity.d.ts +11 -0
- package/dist/src/utils/similarity.d.ts.map +1 -0
- package/dist/src/utils/similarity.js +25 -0
- package/dist/src/utils/similarity.js.map +1 -0
- package/dist/src/wasm-loader.d.ts +66 -0
- package/dist/src/wasm-loader.d.ts.map +1 -0
- package/dist/src/wasm-loader.js +76 -0
- package/dist/src/wasm-loader.js.map +1 -0
- package/dist/src/wrappers/agentdb-fast.d.ts +139 -0
- package/dist/src/wrappers/agentdb-fast.d.ts.map +1 -0
- package/dist/src/wrappers/agentdb-fast.js +307 -0
- package/dist/src/wrappers/agentdb-fast.js.map +1 -0
- package/dist/src/wrappers/attention-fallbacks.d.ts +343 -0
- package/dist/src/wrappers/attention-fallbacks.d.ts.map +1 -0
- package/dist/src/wrappers/attention-fallbacks.js +1484 -0
- package/dist/src/wrappers/attention-fallbacks.js.map +1 -0
- package/dist/src/wrappers/attention-native.d.ts +111 -0
- package/dist/src/wrappers/attention-native.d.ts.map +1 -0
- package/dist/src/wrappers/attention-native.js +273 -0
- package/dist/src/wrappers/attention-native.js.map +1 -0
- package/dist/src/wrappers/embedding-service.d.ts +117 -0
- package/dist/src/wrappers/embedding-service.d.ts.map +1 -0
- package/dist/src/wrappers/embedding-service.js +370 -0
- package/dist/src/wrappers/embedding-service.js.map +1 -0
- package/dist/src/wrappers/gnn-wrapper.d.ts +71 -0
- package/dist/src/wrappers/gnn-wrapper.d.ts.map +1 -0
- package/dist/src/wrappers/gnn-wrapper.js +236 -0
- package/dist/src/wrappers/gnn-wrapper.js.map +1 -0
- package/dist/src/wrappers/index.d.ts +48 -0
- package/dist/src/wrappers/index.d.ts.map +1 -0
- package/dist/src/wrappers/index.js +83 -0
- package/dist/src/wrappers/index.js.map +1 -0
- package/package.json +77 -76
- package/scripts/postinstall.cjs +13 -144
- package/dist/agentdb.browser.js +0 -1685
- package/dist/agentdb.browser.js.map +0 -7
- package/dist/agentdb.browser.min.js +0 -3
- package/dist/agentdb.browser.min.js.map +0 -7
- package/dist/agentdb.wasm-loader.js +0 -207
- package/dist/backends/VectorBackend.d.ts +0 -120
- package/dist/backends/VectorBackend.js +0 -14
- package/dist/backends/VectorBackend.js.map +0 -1
- package/dist/optimizations/RVFOptimizer.d.ts +0 -225
- package/dist/optimizations/RVFOptimizer.js +0 -541
- package/dist/optimizations/RVFOptimizer.js.map +0 -1
- package/dist/schemas/frontier-schema.sql +0 -378
- package/dist/schemas/schema.sql +0 -382
- package/dist/simulation/cli.d.ts +0 -9
- package/dist/simulation/cli.d.ts.map +0 -1
- package/dist/simulation/cli.js +0 -68
- package/dist/simulation/cli.js.map +0 -1
- package/dist/simulation/runner.d.ts +0 -21
- package/dist/simulation/runner.d.ts.map +0 -1
- package/dist/simulation/runner.js +0 -241
- package/dist/simulation/runner.js.map +0 -1
- package/dist/simulation/scenarios/aidefence-integration.d.ts +0 -24
- package/dist/simulation/scenarios/aidefence-integration.d.ts.map +0 -1
- package/dist/simulation/scenarios/aidefence-integration.js +0 -124
- package/dist/simulation/scenarios/aidefence-integration.js.map +0 -1
- package/dist/simulation/scenarios/bmssp-integration.d.ts +0 -23
- package/dist/simulation/scenarios/bmssp-integration.d.ts.map +0 -1
- package/dist/simulation/scenarios/bmssp-integration.js +0 -104
- package/dist/simulation/scenarios/bmssp-integration.js.map +0 -1
- package/dist/simulation/scenarios/causal-reasoning.d.ts +0 -16
- package/dist/simulation/scenarios/causal-reasoning.d.ts.map +0 -1
- package/dist/simulation/scenarios/causal-reasoning.js +0 -108
- package/dist/simulation/scenarios/causal-reasoning.js.map +0 -1
- package/dist/simulation/scenarios/consciousness-explorer.d.ts +0 -25
- package/dist/simulation/scenarios/consciousness-explorer.d.ts.map +0 -1
- package/dist/simulation/scenarios/consciousness-explorer.js +0 -108
- package/dist/simulation/scenarios/consciousness-explorer.js.map +0 -1
- package/dist/simulation/scenarios/domain-examples/e-commerce-recommendations.d.ts +0 -135
- package/dist/simulation/scenarios/domain-examples/e-commerce-recommendations.d.ts.map +0 -1
- package/dist/simulation/scenarios/domain-examples/e-commerce-recommendations.js +0 -158
- package/dist/simulation/scenarios/domain-examples/e-commerce-recommendations.js.map +0 -1
- package/dist/simulation/scenarios/domain-examples/index.d.ts +0 -14
- package/dist/simulation/scenarios/domain-examples/index.d.ts.map +0 -1
- package/dist/simulation/scenarios/domain-examples/index.js +0 -14
- package/dist/simulation/scenarios/domain-examples/index.js.map +0 -1
- package/dist/simulation/scenarios/domain-examples/iot-sensor-networks.d.ts +0 -178
- package/dist/simulation/scenarios/domain-examples/iot-sensor-networks.d.ts.map +0 -1
- package/dist/simulation/scenarios/domain-examples/iot-sensor-networks.js +0 -218
- package/dist/simulation/scenarios/domain-examples/iot-sensor-networks.js.map +0 -1
- package/dist/simulation/scenarios/domain-examples/medical-imaging.d.ts +0 -122
- package/dist/simulation/scenarios/domain-examples/medical-imaging.d.ts.map +0 -1
- package/dist/simulation/scenarios/domain-examples/medical-imaging.js +0 -129
- package/dist/simulation/scenarios/domain-examples/medical-imaging.js.map +0 -1
- package/dist/simulation/scenarios/domain-examples/robotics-navigation.d.ts +0 -166
- package/dist/simulation/scenarios/domain-examples/robotics-navigation.d.ts.map +0 -1
- package/dist/simulation/scenarios/domain-examples/robotics-navigation.js +0 -161
- package/dist/simulation/scenarios/domain-examples/robotics-navigation.js.map +0 -1
- package/dist/simulation/scenarios/domain-examples/scientific-research.d.ts +0 -151
- package/dist/simulation/scenarios/domain-examples/scientific-research.d.ts.map +0 -1
- package/dist/simulation/scenarios/domain-examples/scientific-research.js +0 -187
- package/dist/simulation/scenarios/domain-examples/scientific-research.js.map +0 -1
- package/dist/simulation/scenarios/domain-examples/trading-systems.d.ts +0 -102
- package/dist/simulation/scenarios/domain-examples/trading-systems.d.ts.map +0 -1
- package/dist/simulation/scenarios/domain-examples/trading-systems.js +0 -100
- package/dist/simulation/scenarios/domain-examples/trading-systems.js.map +0 -1
- package/dist/simulation/scenarios/goalie-integration.d.ts +0 -24
- package/dist/simulation/scenarios/goalie-integration.d.ts.map +0 -1
- package/dist/simulation/scenarios/goalie-integration.js +0 -121
- package/dist/simulation/scenarios/goalie-integration.js.map +0 -1
- package/dist/simulation/scenarios/graph-traversal.d.ts +0 -17
- package/dist/simulation/scenarios/graph-traversal.d.ts.map +0 -1
- package/dist/simulation/scenarios/graph-traversal.js +0 -101
- package/dist/simulation/scenarios/graph-traversal.js.map +0 -1
- package/dist/simulation/scenarios/latent-space/attention-analysis.d.ts +0 -45
- package/dist/simulation/scenarios/latent-space/attention-analysis.d.ts.map +0 -1
- package/dist/simulation/scenarios/latent-space/attention-analysis.js +0 -435
- package/dist/simulation/scenarios/latent-space/attention-analysis.js.map +0 -1
- package/dist/simulation/scenarios/latent-space/clustering-analysis.d.ts +0 -55
- package/dist/simulation/scenarios/latent-space/clustering-analysis.d.ts.map +0 -1
- package/dist/simulation/scenarios/latent-space/clustering-analysis.js +0 -606
- package/dist/simulation/scenarios/latent-space/clustering-analysis.js.map +0 -1
- package/dist/simulation/scenarios/latent-space/hnsw-exploration.d.ts +0 -74
- package/dist/simulation/scenarios/latent-space/hnsw-exploration.d.ts.map +0 -1
- package/dist/simulation/scenarios/latent-space/hnsw-exploration.js +0 -391
- package/dist/simulation/scenarios/latent-space/hnsw-exploration.js.map +0 -1
- package/dist/simulation/scenarios/latent-space/hypergraph-exploration.d.ts +0 -51
- package/dist/simulation/scenarios/latent-space/hypergraph-exploration.d.ts.map +0 -1
- package/dist/simulation/scenarios/latent-space/hypergraph-exploration.js +0 -536
- package/dist/simulation/scenarios/latent-space/hypergraph-exploration.js.map +0 -1
- package/dist/simulation/scenarios/latent-space/index.d.ts +0 -35
- package/dist/simulation/scenarios/latent-space/index.d.ts.map +0 -1
- package/dist/simulation/scenarios/latent-space/index.js +0 -35
- package/dist/simulation/scenarios/latent-space/index.js.map +0 -1
- package/dist/simulation/scenarios/latent-space/neural-augmentation.d.ts +0 -52
- package/dist/simulation/scenarios/latent-space/neural-augmentation.d.ts.map +0 -1
- package/dist/simulation/scenarios/latent-space/neural-augmentation.js +0 -472
- package/dist/simulation/scenarios/latent-space/neural-augmentation.js.map +0 -1
- package/dist/simulation/scenarios/latent-space/quantum-hybrid.d.ts +0 -53
- package/dist/simulation/scenarios/latent-space/quantum-hybrid.d.ts.map +0 -1
- package/dist/simulation/scenarios/latent-space/quantum-hybrid.js +0 -391
- package/dist/simulation/scenarios/latent-space/quantum-hybrid.js.map +0 -1
- package/dist/simulation/scenarios/latent-space/self-organizing-hnsw.d.ts +0 -52
- package/dist/simulation/scenarios/latent-space/self-organizing-hnsw.d.ts.map +0 -1
- package/dist/simulation/scenarios/latent-space/self-organizing-hnsw.js +0 -514
- package/dist/simulation/scenarios/latent-space/self-organizing-hnsw.js.map +0 -1
- package/dist/simulation/scenarios/latent-space/traversal-optimization.d.ts +0 -53
- package/dist/simulation/scenarios/latent-space/traversal-optimization.d.ts.map +0 -1
- package/dist/simulation/scenarios/latent-space/traversal-optimization.js +0 -595
- package/dist/simulation/scenarios/latent-space/traversal-optimization.js.map +0 -1
- package/dist/simulation/scenarios/lean-agentic-swarm.d.ts +0 -18
- package/dist/simulation/scenarios/lean-agentic-swarm.d.ts.map +0 -1
- package/dist/simulation/scenarios/lean-agentic-swarm.js +0 -132
- package/dist/simulation/scenarios/lean-agentic-swarm.js.map +0 -1
- package/dist/simulation/scenarios/multi-agent-swarm.d.ts +0 -17
- package/dist/simulation/scenarios/multi-agent-swarm.d.ts.map +0 -1
- package/dist/simulation/scenarios/multi-agent-swarm.js +0 -111
- package/dist/simulation/scenarios/multi-agent-swarm.js.map +0 -1
- package/dist/simulation/scenarios/psycho-symbolic-reasoner.d.ts +0 -23
- package/dist/simulation/scenarios/psycho-symbolic-reasoner.d.ts.map +0 -1
- package/dist/simulation/scenarios/psycho-symbolic-reasoner.js +0 -98
- package/dist/simulation/scenarios/psycho-symbolic-reasoner.js.map +0 -1
- package/dist/simulation/scenarios/reflexion-learning.d.ts +0 -16
- package/dist/simulation/scenarios/reflexion-learning.d.ts.map +0 -1
- package/dist/simulation/scenarios/reflexion-learning.js +0 -98
- package/dist/simulation/scenarios/reflexion-learning.js.map +0 -1
- package/dist/simulation/scenarios/research-swarm.d.ts +0 -24
- package/dist/simulation/scenarios/research-swarm.d.ts.map +0 -1
- package/dist/simulation/scenarios/research-swarm.js +0 -146
- package/dist/simulation/scenarios/research-swarm.js.map +0 -1
- package/dist/simulation/scenarios/skill-evolution.d.ts +0 -16
- package/dist/simulation/scenarios/skill-evolution.d.ts.map +0 -1
- package/dist/simulation/scenarios/skill-evolution.js +0 -109
- package/dist/simulation/scenarios/skill-evolution.js.map +0 -1
- package/dist/simulation/scenarios/stock-market-emergence.d.ts +0 -33
- package/dist/simulation/scenarios/stock-market-emergence.d.ts.map +0 -1
- package/dist/simulation/scenarios/stock-market-emergence.js +0 -246
- package/dist/simulation/scenarios/stock-market-emergence.js.map +0 -1
- package/dist/simulation/scenarios/strange-loops.d.ts +0 -18
- package/dist/simulation/scenarios/strange-loops.d.ts.map +0 -1
- package/dist/simulation/scenarios/strange-loops.js +0 -133
- package/dist/simulation/scenarios/strange-loops.js.map +0 -1
- package/dist/simulation/scenarios/sublinear-solver.d.ts +0 -22
- package/dist/simulation/scenarios/sublinear-solver.d.ts.map +0 -1
- package/dist/simulation/scenarios/sublinear-solver.js +0 -82
- package/dist/simulation/scenarios/sublinear-solver.js.map +0 -1
- package/dist/simulation/scenarios/temporal-lead-solver.d.ts +0 -23
- package/dist/simulation/scenarios/temporal-lead-solver.d.ts.map +0 -1
- package/dist/simulation/scenarios/temporal-lead-solver.js +0 -90
- package/dist/simulation/scenarios/temporal-lead-solver.js.map +0 -1
- package/dist/simulation/scenarios/voting-system-consensus.d.ts +0 -27
- package/dist/simulation/scenarios/voting-system-consensus.d.ts.map +0 -1
- package/dist/simulation/scenarios/voting-system-consensus.js +0 -175
- package/dist/simulation/scenarios/voting-system-consensus.js.map +0 -1
- package/dist/simulation/types.d.ts +0 -162
- package/dist/simulation/types.d.ts.map +0 -1
- package/dist/simulation/types.js +0 -5
- package/dist/simulation/types.js.map +0 -1
- package/dist/simulation/utils/PerformanceOptimizer.d.ts +0 -115
- package/dist/simulation/utils/PerformanceOptimizer.d.ts.map +0 -1
- package/dist/simulation/utils/PerformanceOptimizer.js +0 -223
- package/dist/simulation/utils/PerformanceOptimizer.js.map +0 -1
- package/dist/src/backends/index.cjs +0 -6
- package/dist/src/backends/ruvector/GuardedVectorBackend.d.ts +0 -93
- package/dist/src/backends/ruvector/GuardedVectorBackend.d.ts.map +0 -1
- package/dist/src/backends/ruvector/GuardedVectorBackend.js +0 -182
- package/dist/src/backends/ruvector/GuardedVectorBackend.js.map +0 -1
- package/dist/src/consensus/RaftConsensus.d.ts +0 -220
- package/dist/src/consensus/RaftConsensus.d.ts.map +0 -1
- package/dist/src/consensus/RaftConsensus.js +0 -762
- package/dist/src/consensus/RaftConsensus.js.map +0 -1
- package/dist/src/controllers/HierarchicalMemory.d.ts +0 -197
- package/dist/src/controllers/HierarchicalMemory.d.ts.map +0 -1
- package/dist/src/controllers/HierarchicalMemory.js +0 -519
- package/dist/src/controllers/HierarchicalMemory.js.map +0 -1
- package/dist/src/controllers/MemoryConsolidation.d.ts +0 -142
- package/dist/src/controllers/MemoryConsolidation.d.ts.map +0 -1
- package/dist/src/controllers/MemoryConsolidation.js +0 -479
- package/dist/src/controllers/MemoryConsolidation.js.map +0 -1
- package/dist/src/controllers/QUICConnection.d.ts +0 -122
- package/dist/src/controllers/QUICConnection.d.ts.map +0 -1
- package/dist/src/controllers/QUICConnection.js +0 -329
- package/dist/src/controllers/QUICConnection.js.map +0 -1
- package/dist/src/controllers/QUICConnectionPool.d.ts +0 -83
- package/dist/src/controllers/QUICConnectionPool.d.ts.map +0 -1
- package/dist/src/controllers/QUICConnectionPool.js +0 -256
- package/dist/src/controllers/QUICConnectionPool.js.map +0 -1
- package/dist/src/controllers/QUICStreamManager.d.ts +0 -114
- package/dist/src/controllers/QUICStreamManager.d.ts.map +0 -1
- package/dist/src/controllers/QUICStreamManager.js +0 -267
- package/dist/src/controllers/QUICStreamManager.js.map +0 -1
- package/dist/src/controllers/StreamingEmbeddingService.d.ts +0 -82
- package/dist/src/controllers/StreamingEmbeddingService.d.ts.map +0 -1
- package/dist/src/controllers/StreamingEmbeddingService.js +0 -243
- package/dist/src/controllers/StreamingEmbeddingService.js.map +0 -1
- package/dist/src/controllers/index.cjs +0 -6
- package/dist/src/coordination/MultiDatabaseCoordinator.d.ts +0 -348
- package/dist/src/coordination/MultiDatabaseCoordinator.d.ts.map +0 -1
- package/dist/src/coordination/MultiDatabaseCoordinator.js +0 -803
- package/dist/src/coordination/MultiDatabaseCoordinator.js.map +0 -1
- package/dist/src/coordination/index.d.ts +0 -10
- package/dist/src/coordination/index.d.ts.map +0 -1
- package/dist/src/coordination/index.js +0 -10
- package/dist/src/coordination/index.js.map +0 -1
- package/dist/src/index.cjs +0 -6
- package/dist/src/optimizations/RVFOptimizer.d.ts +0 -226
- package/dist/src/optimizations/RVFOptimizer.d.ts.map +0 -1
- package/dist/src/optimizations/RVFOptimizer.js +0 -541
- package/dist/src/optimizations/RVFOptimizer.js.map +0 -1
- package/dist/src/security/AttestationLog.d.ts +0 -70
- package/dist/src/security/AttestationLog.d.ts.map +0 -1
- package/dist/src/security/AttestationLog.js +0 -174
- package/dist/src/security/AttestationLog.js.map +0 -1
- package/dist/src/security/MutationGuard.d.ts +0 -83
- package/dist/src/security/MutationGuard.d.ts.map +0 -1
- package/dist/src/security/MutationGuard.js +0 -364
- package/dist/src/security/MutationGuard.js.map +0 -1
- package/dist/src/security/index.cjs +0 -6
- package/dist/src/security/index.d.ts +0 -15
- package/dist/src/security/index.d.ts.map +0 -1
- package/dist/src/security/index.js +0 -18
- package/dist/src/security/index.js.map +0 -1
- package/dist/src/services/GNNService.d.ts +0 -173
- package/dist/src/services/GNNService.d.ts.map +0 -1
- package/dist/src/services/GNNService.js +0 -639
- package/dist/src/services/GNNService.js.map +0 -1
- package/dist/src/services/GraphTransformerService.d.ts +0 -80
- package/dist/src/services/GraphTransformerService.d.ts.map +0 -1
- package/dist/src/services/GraphTransformerService.js +0 -369
- package/dist/src/services/GraphTransformerService.js.map +0 -1
- package/dist/src/services/SemanticRouter.d.ts +0 -83
- package/dist/src/services/SemanticRouter.d.ts.map +0 -1
- package/dist/src/services/SemanticRouter.js +0 -160
- package/dist/src/services/SemanticRouter.js.map +0 -1
- package/dist/src/services/SonaTrajectoryService.d.ts +0 -224
- package/dist/src/services/SonaTrajectoryService.d.ts.map +0 -1
- package/dist/src/services/SonaTrajectoryService.js +0 -539
- package/dist/src/services/SonaTrajectoryService.js.map +0 -1
- package/dist/src/utils/LegacyAttentionAdapter.d.ts +0 -93
- package/dist/src/utils/LegacyAttentionAdapter.d.ts.map +0 -1
- package/dist/src/utils/LegacyAttentionAdapter.js +0 -241
- package/dist/src/utils/LegacyAttentionAdapter.js.map +0 -1
- package/dist/src/utils/vector-math.d.ts +0 -29
- package/dist/src/utils/vector-math.d.ts.map +0 -1
- package/dist/src/utils/vector-math.js +0 -66
- package/dist/src/utils/vector-math.js.map +0 -1
|
@@ -0,0 +1,1035 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enhanced Embedding Service with RuVector Integration
|
|
3
|
+
*
|
|
4
|
+
* A comprehensive embedding service supporting:
|
|
5
|
+
* - Multiple providers (@xenova/transformers, OpenAI, Cohere, custom)
|
|
6
|
+
* - LRU cache with O(1) operations using doubly-linked list
|
|
7
|
+
* - Batch processing with semaphore-controlled parallelism
|
|
8
|
+
* - Text pre-processing pipeline (normalization, chunking, deduplication)
|
|
9
|
+
* - Direct RuVector storage and hybrid search
|
|
10
|
+
* - Lazy model loading with runtime switching
|
|
11
|
+
*/
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// Performance & Security Constants
|
|
14
|
+
// ============================================================================
|
|
15
|
+
/** @inline Maximum allowed vector dimension for bounds checking */
|
|
16
|
+
export const MAX_VECTOR_DIMENSION = 4096;
|
|
17
|
+
/** @inline Maximum allowed cache size to prevent memory exhaustion */
|
|
18
|
+
export const MAX_CACHE_SIZE = 100_000;
|
|
19
|
+
/** @inline Default cache size for embedding storage */
|
|
20
|
+
export const DEFAULT_CACHE_SIZE = 10000;
|
|
21
|
+
/** @inline Maximum text length to prevent DoS via large inputs */
|
|
22
|
+
const MAX_TEXT_LENGTH = 100_000;
|
|
23
|
+
/** @inline Maximum batch size to prevent memory exhaustion */
|
|
24
|
+
export const MAX_BATCH_SIZE = 10000;
|
|
25
|
+
/** @inline API request timeout in milliseconds */
|
|
26
|
+
const API_TIMEOUT_MS = 30_000;
|
|
27
|
+
/** @inline Maximum concurrent API requests */
|
|
28
|
+
const MAX_CONCURRENT_REQUESTS = 10;
|
|
29
|
+
/** @inline Small epsilon for numerical stability */
|
|
30
|
+
const EPSILON = 1e-10;
|
|
31
|
+
/** Allowed API hosts for external calls */
|
|
32
|
+
const ALLOWED_API_HOSTS = [
|
|
33
|
+
'api.openai.com',
|
|
34
|
+
'api.cohere.ai',
|
|
35
|
+
];
|
|
36
|
+
// ============================================================================
|
|
37
|
+
// Security Helpers
|
|
38
|
+
// ============================================================================
|
|
39
|
+
/**
|
|
40
|
+
* Mask sensitive data in error messages
|
|
41
|
+
*/
|
|
42
|
+
function maskApiKey(key) {
|
|
43
|
+
if (!key)
|
|
44
|
+
return '[not set]';
|
|
45
|
+
if (key.length <= 8)
|
|
46
|
+
return '***';
|
|
47
|
+
return `${key.slice(0, 4)}...${key.slice(-4)}`;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Validate URL is allowed for external API calls
|
|
51
|
+
*/
|
|
52
|
+
function validateApiUrl(url) {
|
|
53
|
+
try {
|
|
54
|
+
const parsed = new URL(url);
|
|
55
|
+
if (!ALLOWED_API_HOSTS.includes(parsed.host)) {
|
|
56
|
+
throw new Error(`API host not allowed: ${parsed.host}`);
|
|
57
|
+
}
|
|
58
|
+
if (parsed.protocol !== 'https:') {
|
|
59
|
+
throw new Error('Only HTTPS connections are allowed');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
if (e instanceof Error && e.message.includes('not allowed')) {
|
|
64
|
+
throw e;
|
|
65
|
+
}
|
|
66
|
+
throw new Error('Invalid API URL');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Create a fetch request with timeout
|
|
71
|
+
*/
|
|
72
|
+
async function fetchWithTimeout(url, options, timeoutMs = API_TIMEOUT_MS) {
|
|
73
|
+
const controller = new AbortController();
|
|
74
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
75
|
+
try {
|
|
76
|
+
const response = await fetch(url, {
|
|
77
|
+
...options,
|
|
78
|
+
signal: controller.signal,
|
|
79
|
+
});
|
|
80
|
+
return response;
|
|
81
|
+
}
|
|
82
|
+
finally {
|
|
83
|
+
clearTimeout(timeoutId);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* LRU Cache with O(1) get/put operations using doubly-linked list + hash map
|
|
88
|
+
*/
|
|
89
|
+
class LRUCache {
|
|
90
|
+
capacity;
|
|
91
|
+
map = new Map();
|
|
92
|
+
head = null;
|
|
93
|
+
tail = null;
|
|
94
|
+
// Statistics
|
|
95
|
+
_hits = 0;
|
|
96
|
+
_misses = 0;
|
|
97
|
+
trackStats;
|
|
98
|
+
constructor(capacity, trackStats = true) {
|
|
99
|
+
// Enforce maximum cache size for security
|
|
100
|
+
this.capacity = Math.min(Math.max(1, capacity), MAX_CACHE_SIZE);
|
|
101
|
+
this.trackStats = trackStats;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Get value from cache - O(1)
|
|
105
|
+
*/
|
|
106
|
+
get(key) {
|
|
107
|
+
const node = this.map.get(key);
|
|
108
|
+
if (!node) {
|
|
109
|
+
if (this.trackStats)
|
|
110
|
+
this._misses++;
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
if (this.trackStats)
|
|
114
|
+
this._hits++;
|
|
115
|
+
// Move to front (most recently used)
|
|
116
|
+
this.moveToFront(node);
|
|
117
|
+
return node.value;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Put value in cache - O(1)
|
|
121
|
+
*/
|
|
122
|
+
put(key, value) {
|
|
123
|
+
const existingNode = this.map.get(key);
|
|
124
|
+
if (existingNode) {
|
|
125
|
+
// Update existing node and move to front
|
|
126
|
+
existingNode.value = value;
|
|
127
|
+
this.moveToFront(existingNode);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
// Create new node
|
|
131
|
+
const newNode = {
|
|
132
|
+
key,
|
|
133
|
+
value,
|
|
134
|
+
prev: null,
|
|
135
|
+
next: this.head,
|
|
136
|
+
};
|
|
137
|
+
// Add to front
|
|
138
|
+
if (this.head) {
|
|
139
|
+
this.head.prev = newNode;
|
|
140
|
+
}
|
|
141
|
+
this.head = newNode;
|
|
142
|
+
if (!this.tail) {
|
|
143
|
+
this.tail = newNode;
|
|
144
|
+
}
|
|
145
|
+
this.map.set(key, newNode);
|
|
146
|
+
// Evict if over capacity
|
|
147
|
+
if (this.map.size > this.capacity) {
|
|
148
|
+
this.evictLRU();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Check if key exists - O(1)
|
|
153
|
+
*/
|
|
154
|
+
has(key) {
|
|
155
|
+
return this.map.has(key);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Delete key from cache - O(1)
|
|
159
|
+
*/
|
|
160
|
+
delete(key) {
|
|
161
|
+
const node = this.map.get(key);
|
|
162
|
+
if (!node)
|
|
163
|
+
return false;
|
|
164
|
+
this.removeNode(node);
|
|
165
|
+
this.map.delete(key);
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Clear all entries
|
|
170
|
+
*/
|
|
171
|
+
clear() {
|
|
172
|
+
this.map.clear();
|
|
173
|
+
this.head = null;
|
|
174
|
+
this.tail = null;
|
|
175
|
+
this._hits = 0;
|
|
176
|
+
this._misses = 0;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Get current size
|
|
180
|
+
*/
|
|
181
|
+
get size() {
|
|
182
|
+
return this.map.size;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Get cache statistics
|
|
186
|
+
*/
|
|
187
|
+
get stats() {
|
|
188
|
+
const total = this._hits + this._misses;
|
|
189
|
+
return {
|
|
190
|
+
hits: this._hits,
|
|
191
|
+
misses: this._misses,
|
|
192
|
+
hitRate: total > 0 ? this._hits / total : 0,
|
|
193
|
+
size: this.map.size,
|
|
194
|
+
maxSize: this.capacity,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Move node to front of list (most recently used)
|
|
199
|
+
*/
|
|
200
|
+
moveToFront(node) {
|
|
201
|
+
if (node === this.head)
|
|
202
|
+
return;
|
|
203
|
+
// Remove from current position
|
|
204
|
+
this.removeNode(node);
|
|
205
|
+
// Add to front
|
|
206
|
+
node.prev = null;
|
|
207
|
+
node.next = this.head;
|
|
208
|
+
if (this.head) {
|
|
209
|
+
this.head.prev = node;
|
|
210
|
+
}
|
|
211
|
+
this.head = node;
|
|
212
|
+
if (!this.tail) {
|
|
213
|
+
this.tail = node;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Remove node from list
|
|
218
|
+
*/
|
|
219
|
+
removeNode(node) {
|
|
220
|
+
if (node.prev) {
|
|
221
|
+
node.prev.next = node.next;
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
this.head = node.next;
|
|
225
|
+
}
|
|
226
|
+
if (node.next) {
|
|
227
|
+
node.next.prev = node.prev;
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
this.tail = node.prev;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Evict least recently used entry
|
|
235
|
+
*/
|
|
236
|
+
evictLRU() {
|
|
237
|
+
if (!this.tail)
|
|
238
|
+
return;
|
|
239
|
+
const lruKey = this.tail.key;
|
|
240
|
+
this.removeNode(this.tail);
|
|
241
|
+
this.map.delete(lruKey);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
// ============================================================================
|
|
245
|
+
// Semaphore for Concurrency Control
|
|
246
|
+
// ============================================================================
|
|
247
|
+
/**
|
|
248
|
+
* Simple semaphore for controlling concurrent operations
|
|
249
|
+
*/
|
|
250
|
+
class Semaphore {
|
|
251
|
+
permits;
|
|
252
|
+
waiting = [];
|
|
253
|
+
maxWaiting;
|
|
254
|
+
constructor(permits, maxWaiting = 1000) {
|
|
255
|
+
// Enforce maximum concurrent requests for security
|
|
256
|
+
this.permits = Math.min(Math.max(1, permits), MAX_CONCURRENT_REQUESTS);
|
|
257
|
+
this.maxWaiting = maxWaiting;
|
|
258
|
+
}
|
|
259
|
+
async acquire() {
|
|
260
|
+
if (this.permits > 0) {
|
|
261
|
+
this.permits--;
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
// Prevent unbounded queue growth (deadlock protection)
|
|
265
|
+
if (this.waiting.length >= this.maxWaiting) {
|
|
266
|
+
throw new Error('Too many pending requests - semaphore queue full');
|
|
267
|
+
}
|
|
268
|
+
return new Promise((resolve) => {
|
|
269
|
+
this.waiting.push(resolve);
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
release() {
|
|
273
|
+
const next = this.waiting.shift();
|
|
274
|
+
if (next) {
|
|
275
|
+
next();
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
this.permits++;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
async withLock(fn) {
|
|
282
|
+
await this.acquire();
|
|
283
|
+
try {
|
|
284
|
+
return await fn();
|
|
285
|
+
}
|
|
286
|
+
finally {
|
|
287
|
+
this.release();
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
// ============================================================================
|
|
292
|
+
// Model Dimension Mapping
|
|
293
|
+
// ============================================================================
|
|
294
|
+
const MODEL_DIMENSIONS = {
|
|
295
|
+
'all-MiniLM-L6-v2': 384,
|
|
296
|
+
'Xenova/all-MiniLM-L6-v2': 384,
|
|
297
|
+
'all-mpnet-base-v2': 768,
|
|
298
|
+
'Xenova/all-mpnet-base-v2': 768,
|
|
299
|
+
'bge-small-en-v1.5': 384,
|
|
300
|
+
'BAAI/bge-small-en-v1.5': 384,
|
|
301
|
+
'text-embedding-ada-002': 1536, // OpenAI
|
|
302
|
+
'text-embedding-3-small': 1536, // OpenAI
|
|
303
|
+
'text-embedding-3-large': 3072, // OpenAI
|
|
304
|
+
'embed-english-v3.0': 1024, // Cohere
|
|
305
|
+
'embed-multilingual-v3.0': 1024, // Cohere
|
|
306
|
+
};
|
|
307
|
+
/**
|
|
308
|
+
* Get model dimension from model name
|
|
309
|
+
*/
|
|
310
|
+
function getModelDimension(model) {
|
|
311
|
+
return MODEL_DIMENSIONS[model] || MODEL_DIMENSIONS[`Xenova/${model}`] || 384;
|
|
312
|
+
}
|
|
313
|
+
// ============================================================================
|
|
314
|
+
// Enhanced Embedding Service Implementation
|
|
315
|
+
// ============================================================================
|
|
316
|
+
/**
|
|
317
|
+
* Enhanced Embedding Service with RuVector Integration
|
|
318
|
+
*/
|
|
319
|
+
export class EnhancedEmbeddingService {
|
|
320
|
+
config;
|
|
321
|
+
cache;
|
|
322
|
+
semaphore;
|
|
323
|
+
pipeline = null;
|
|
324
|
+
modelLoaded = false;
|
|
325
|
+
// Statistics
|
|
326
|
+
totalEmbeddings = 0;
|
|
327
|
+
totalBatches = 0;
|
|
328
|
+
totalBatchItems = 0;
|
|
329
|
+
constructor(config = {}) {
|
|
330
|
+
// Set defaults
|
|
331
|
+
this.config = {
|
|
332
|
+
provider: config.provider ?? 'transformers',
|
|
333
|
+
model: config.model ?? 'all-MiniLM-L6-v2',
|
|
334
|
+
dimension: config.dimension ?? getModelDimension(config.model ?? 'all-MiniLM-L6-v2'),
|
|
335
|
+
apiKey: config.apiKey ?? '',
|
|
336
|
+
customEmbedder: config.customEmbedder,
|
|
337
|
+
cache: {
|
|
338
|
+
maxSize: config.cache?.maxSize ?? 10000,
|
|
339
|
+
trackStats: config.cache?.trackStats ?? true,
|
|
340
|
+
},
|
|
341
|
+
batch: {
|
|
342
|
+
batchSize: config.batch?.batchSize ?? 32,
|
|
343
|
+
maxConcurrency: config.batch?.maxConcurrency ?? 4,
|
|
344
|
+
enableProgress: config.batch?.enableProgress ?? true,
|
|
345
|
+
},
|
|
346
|
+
preprocessing: {
|
|
347
|
+
normalize: config.preprocessing?.normalize ?? true,
|
|
348
|
+
maxLength: config.preprocessing?.maxLength ?? 2000,
|
|
349
|
+
chunkOverlap: config.preprocessing?.chunkOverlap ?? 50,
|
|
350
|
+
deduplicate: config.preprocessing?.deduplicate ?? true,
|
|
351
|
+
},
|
|
352
|
+
vectorBackend: config.vectorBackend,
|
|
353
|
+
};
|
|
354
|
+
// Initialize cache
|
|
355
|
+
this.cache = new LRUCache(this.config.cache.maxSize, this.config.cache.trackStats);
|
|
356
|
+
// Initialize semaphore for concurrency control
|
|
357
|
+
this.semaphore = new Semaphore(this.config.batch.maxConcurrency);
|
|
358
|
+
}
|
|
359
|
+
// ==========================================================================
|
|
360
|
+
// Core Embedding Methods
|
|
361
|
+
// ==========================================================================
|
|
362
|
+
/**
|
|
363
|
+
* Generate embedding for a single text
|
|
364
|
+
*/
|
|
365
|
+
async embed(text) {
|
|
366
|
+
// Pre-process text
|
|
367
|
+
const processedText = this.preprocessText(text);
|
|
368
|
+
// Check cache
|
|
369
|
+
const cacheKey = this.getCacheKey(processedText);
|
|
370
|
+
const cached = this.cache.get(cacheKey);
|
|
371
|
+
if (cached) {
|
|
372
|
+
return cached;
|
|
373
|
+
}
|
|
374
|
+
// Generate embedding
|
|
375
|
+
const embedding = await this.generateEmbedding(processedText);
|
|
376
|
+
// Cache result
|
|
377
|
+
this.cache.put(cacheKey, embedding);
|
|
378
|
+
this.totalEmbeddings++;
|
|
379
|
+
return embedding;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Generate embeddings for multiple texts with batch processing
|
|
383
|
+
*/
|
|
384
|
+
async embedBatch(texts, onProgress) {
|
|
385
|
+
if (texts.length === 0)
|
|
386
|
+
return [];
|
|
387
|
+
// Enforce maximum batch size
|
|
388
|
+
if (texts.length > MAX_BATCH_SIZE) {
|
|
389
|
+
throw new Error(`Batch size ${texts.length} exceeds maximum of ${MAX_BATCH_SIZE}`);
|
|
390
|
+
}
|
|
391
|
+
// Pre-process all texts
|
|
392
|
+
const processedTexts = texts.map((t) => this.preprocessText(t));
|
|
393
|
+
// Check cache and separate cached/uncached
|
|
394
|
+
const results = new Array(texts.length);
|
|
395
|
+
const uncachedIndices = [];
|
|
396
|
+
const uncachedTexts = [];
|
|
397
|
+
for (let i = 0; i < processedTexts.length; i++) {
|
|
398
|
+
const cacheKey = this.getCacheKey(processedTexts[i]);
|
|
399
|
+
const cached = this.cache.get(cacheKey);
|
|
400
|
+
if (cached) {
|
|
401
|
+
results[i] = cached;
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
uncachedIndices.push(i);
|
|
405
|
+
uncachedTexts.push(processedTexts[i]);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
// If all cached, return immediately
|
|
409
|
+
if (uncachedTexts.length === 0) {
|
|
410
|
+
if (onProgress) {
|
|
411
|
+
onProgress({ current: texts.length, total: texts.length, percentage: 100 });
|
|
412
|
+
}
|
|
413
|
+
return results;
|
|
414
|
+
}
|
|
415
|
+
// Deduplicate uncached texts if enabled
|
|
416
|
+
let textsToEmbed = uncachedTexts;
|
|
417
|
+
let indexMapping = null;
|
|
418
|
+
if (this.config.preprocessing.deduplicate) {
|
|
419
|
+
const { unique, mapping } = this.deduplicateTexts(uncachedTexts);
|
|
420
|
+
textsToEmbed = unique;
|
|
421
|
+
indexMapping = mapping;
|
|
422
|
+
}
|
|
423
|
+
// Split into batches
|
|
424
|
+
const batchSize = this.config.batch.batchSize;
|
|
425
|
+
const batches = [];
|
|
426
|
+
for (let i = 0; i < textsToEmbed.length; i += batchSize) {
|
|
427
|
+
batches.push(textsToEmbed.slice(i, i + batchSize));
|
|
428
|
+
}
|
|
429
|
+
// Process batches with semaphore-controlled concurrency
|
|
430
|
+
let processed = texts.length - uncachedTexts.length; // Start with cached count
|
|
431
|
+
const batchResults = [];
|
|
432
|
+
await Promise.all(batches.map((batch, batchIndex) => this.semaphore.withLock(async () => {
|
|
433
|
+
const embeddings = await this.processBatch(batch);
|
|
434
|
+
batchResults[batchIndex] = embeddings;
|
|
435
|
+
processed += batch.length;
|
|
436
|
+
this.totalBatches++;
|
|
437
|
+
this.totalBatchItems += batch.length;
|
|
438
|
+
if (onProgress) {
|
|
439
|
+
onProgress({
|
|
440
|
+
current: processed,
|
|
441
|
+
total: texts.length,
|
|
442
|
+
percentage: Math.round((processed / texts.length) * 100),
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
})));
|
|
446
|
+
// Flatten batch results
|
|
447
|
+
const allNewEmbeddings = batchResults.flat();
|
|
448
|
+
// Map embeddings back to original indices
|
|
449
|
+
if (indexMapping) {
|
|
450
|
+
// With deduplication
|
|
451
|
+
let embeddingIndex = 0;
|
|
452
|
+
for (const uniqueText of textsToEmbed) {
|
|
453
|
+
const embedding = allNewEmbeddings[embeddingIndex++];
|
|
454
|
+
const originalIndices = indexMapping.get(uniqueText) || [];
|
|
455
|
+
// Cache the embedding
|
|
456
|
+
const cacheKey = this.getCacheKey(uniqueText);
|
|
457
|
+
this.cache.put(cacheKey, embedding);
|
|
458
|
+
// Assign to all original positions
|
|
459
|
+
for (const origIdx of originalIndices) {
|
|
460
|
+
results[uncachedIndices[origIdx]] = embedding;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
else {
|
|
465
|
+
// Without deduplication
|
|
466
|
+
for (let i = 0; i < allNewEmbeddings.length; i++) {
|
|
467
|
+
const embedding = allNewEmbeddings[i];
|
|
468
|
+
const originalIndex = uncachedIndices[i];
|
|
469
|
+
// Cache the embedding
|
|
470
|
+
const cacheKey = this.getCacheKey(uncachedTexts[i]);
|
|
471
|
+
this.cache.put(cacheKey, embedding);
|
|
472
|
+
results[originalIndex] = embedding;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
this.totalEmbeddings += uncachedTexts.length;
|
|
476
|
+
return results;
|
|
477
|
+
}
|
|
478
|
+
// ==========================================================================
|
|
479
|
+
// Search Methods (RuVector Integration)
|
|
480
|
+
// ==========================================================================
|
|
481
|
+
/**
|
|
482
|
+
* Search for similar texts using RuVector backend
|
|
483
|
+
*/
|
|
484
|
+
async search(query, k = 10) {
|
|
485
|
+
if (!this.config.vectorBackend) {
|
|
486
|
+
throw new Error('Vector backend not configured. Pass vectorBackend in config.');
|
|
487
|
+
}
|
|
488
|
+
// Generate query embedding
|
|
489
|
+
const queryEmbedding = await this.embed(query);
|
|
490
|
+
// Search using RuVector
|
|
491
|
+
const results = this.config.vectorBackend.search(queryEmbedding, k);
|
|
492
|
+
// Convert to SearchResult format
|
|
493
|
+
return results.map((r) => ({
|
|
494
|
+
id: r.id,
|
|
495
|
+
text: r.metadata?.text,
|
|
496
|
+
similarity: r.similarity,
|
|
497
|
+
distance: r.distance,
|
|
498
|
+
metadata: r.metadata,
|
|
499
|
+
}));
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Store text with embedding in RuVector
|
|
503
|
+
*/
|
|
504
|
+
async store(id, text, metadata) {
|
|
505
|
+
if (!this.config.vectorBackend) {
|
|
506
|
+
throw new Error('Vector backend not configured. Pass vectorBackend in config.');
|
|
507
|
+
}
|
|
508
|
+
const embedding = await this.embed(text);
|
|
509
|
+
this.config.vectorBackend.insert(id, embedding, {
|
|
510
|
+
...metadata,
|
|
511
|
+
text, // Store original text in metadata
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Store multiple texts with embeddings in RuVector (batch operation)
|
|
516
|
+
*/
|
|
517
|
+
async storeBatch(items, onProgress) {
|
|
518
|
+
if (!this.config.vectorBackend) {
|
|
519
|
+
throw new Error('Vector backend not configured. Pass vectorBackend in config.');
|
|
520
|
+
}
|
|
521
|
+
// Extract texts for batch embedding
|
|
522
|
+
const texts = items.map((item) => item.text);
|
|
523
|
+
const embeddings = await this.embedBatch(texts, onProgress);
|
|
524
|
+
// Insert into vector backend
|
|
525
|
+
const insertItems = items.map((item, i) => ({
|
|
526
|
+
id: item.id,
|
|
527
|
+
embedding: embeddings[i],
|
|
528
|
+
metadata: {
|
|
529
|
+
...item.metadata,
|
|
530
|
+
text: item.text,
|
|
531
|
+
},
|
|
532
|
+
}));
|
|
533
|
+
this.config.vectorBackend.insertBatch(insertItems);
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Hybrid search combining embedding similarity with metadata filters
|
|
537
|
+
*/
|
|
538
|
+
async hybridSearch(query, k = 10, filter) {
|
|
539
|
+
if (!this.config.vectorBackend) {
|
|
540
|
+
throw new Error('Vector backend not configured. Pass vectorBackend in config.');
|
|
541
|
+
}
|
|
542
|
+
const queryEmbedding = await this.embed(query);
|
|
543
|
+
const results = this.config.vectorBackend.search(queryEmbedding, k, {
|
|
544
|
+
filter: filter,
|
|
545
|
+
});
|
|
546
|
+
return results.map((r) => ({
|
|
547
|
+
id: r.id,
|
|
548
|
+
text: r.metadata?.text,
|
|
549
|
+
similarity: r.similarity,
|
|
550
|
+
distance: r.distance,
|
|
551
|
+
metadata: r.metadata,
|
|
552
|
+
}));
|
|
553
|
+
}
|
|
554
|
+
// ==========================================================================
|
|
555
|
+
// Model Management
|
|
556
|
+
// ==========================================================================
|
|
557
|
+
/**
|
|
558
|
+
* Lazy load the embedding model
|
|
559
|
+
*/
|
|
560
|
+
async loadModel() {
|
|
561
|
+
if (this.modelLoaded && this.pipeline)
|
|
562
|
+
return;
|
|
563
|
+
if (this.config.provider === 'transformers') {
|
|
564
|
+
await this.loadTransformersModel();
|
|
565
|
+
}
|
|
566
|
+
// OpenAI and Cohere don't need preloading
|
|
567
|
+
this.modelLoaded = true;
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Switch to a different model at runtime
|
|
571
|
+
*/
|
|
572
|
+
async switchModel(model, provider) {
|
|
573
|
+
// Update config
|
|
574
|
+
this.config.model = model;
|
|
575
|
+
if (provider) {
|
|
576
|
+
this.config.provider = provider;
|
|
577
|
+
}
|
|
578
|
+
this.config.dimension = getModelDimension(model);
|
|
579
|
+
// Reset model state
|
|
580
|
+
this.pipeline = null;
|
|
581
|
+
this.modelLoaded = false;
|
|
582
|
+
// Clear cache (embeddings are model-specific)
|
|
583
|
+
this.cache.clear();
|
|
584
|
+
// Load new model if transformers
|
|
585
|
+
if (this.config.provider === 'transformers') {
|
|
586
|
+
await this.loadTransformersModel();
|
|
587
|
+
}
|
|
588
|
+
this.modelLoaded = true;
|
|
589
|
+
}
|
|
590
|
+
// ==========================================================================
|
|
591
|
+
// Statistics
|
|
592
|
+
// ==========================================================================
|
|
593
|
+
/**
|
|
594
|
+
* Get service statistics
|
|
595
|
+
*/
|
|
596
|
+
getStats() {
|
|
597
|
+
const cacheStats = this.cache.stats;
|
|
598
|
+
return {
|
|
599
|
+
totalEmbeddings: this.totalEmbeddings,
|
|
600
|
+
cache: cacheStats,
|
|
601
|
+
batch: {
|
|
602
|
+
totalBatches: this.totalBatches,
|
|
603
|
+
averageBatchSize: this.totalBatches > 0
|
|
604
|
+
? Math.round(this.totalBatchItems / this.totalBatches)
|
|
605
|
+
: 0,
|
|
606
|
+
},
|
|
607
|
+
model: {
|
|
608
|
+
name: this.config.model,
|
|
609
|
+
dimension: this.config.dimension,
|
|
610
|
+
provider: this.config.provider,
|
|
611
|
+
loaded: this.modelLoaded,
|
|
612
|
+
},
|
|
613
|
+
vectorBackend: this.config.vectorBackend
|
|
614
|
+
? {
|
|
615
|
+
count: this.config.vectorBackend.getStats().count,
|
|
616
|
+
backend: this.config.vectorBackend.getStats().backend,
|
|
617
|
+
}
|
|
618
|
+
: undefined,
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Clear the embedding cache
|
|
623
|
+
*/
|
|
624
|
+
clearCache() {
|
|
625
|
+
this.cache.clear();
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Get current model dimension
|
|
629
|
+
*/
|
|
630
|
+
getDimension() {
|
|
631
|
+
return this.config.dimension;
|
|
632
|
+
}
|
|
633
|
+
// ==========================================================================
|
|
634
|
+
// Private Methods
|
|
635
|
+
// ==========================================================================
|
|
636
|
+
/**
|
|
637
|
+
* Pre-process text according to config
|
|
638
|
+
*/
|
|
639
|
+
preprocessText(text) {
|
|
640
|
+
if (!text)
|
|
641
|
+
return '';
|
|
642
|
+
// Early length check to prevent DoS
|
|
643
|
+
if (text.length > MAX_TEXT_LENGTH) {
|
|
644
|
+
text = text.slice(0, MAX_TEXT_LENGTH);
|
|
645
|
+
}
|
|
646
|
+
let processed = text;
|
|
647
|
+
if (this.config.preprocessing.normalize) {
|
|
648
|
+
// Normalize whitespace
|
|
649
|
+
processed = processed.replace(/\s+/g, ' ').trim();
|
|
650
|
+
// Normalize unicode
|
|
651
|
+
processed = processed.normalize('NFKC');
|
|
652
|
+
// Remove control characters
|
|
653
|
+
processed = processed.replace(/[\x00-\x1F\x7F]/g, '');
|
|
654
|
+
}
|
|
655
|
+
// Truncate if too long
|
|
656
|
+
if (processed.length > this.config.preprocessing.maxLength) {
|
|
657
|
+
processed = processed.slice(0, this.config.preprocessing.maxLength);
|
|
658
|
+
}
|
|
659
|
+
return processed;
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* Chunk long text into smaller pieces with overlap
|
|
663
|
+
*/
|
|
664
|
+
chunkText(text) {
|
|
665
|
+
const maxLength = this.config.preprocessing.maxLength;
|
|
666
|
+
const overlap = this.config.preprocessing.chunkOverlap;
|
|
667
|
+
if (text.length <= maxLength) {
|
|
668
|
+
return [text];
|
|
669
|
+
}
|
|
670
|
+
const chunks = [];
|
|
671
|
+
let start = 0;
|
|
672
|
+
while (start < text.length) {
|
|
673
|
+
const end = Math.min(start + maxLength, text.length);
|
|
674
|
+
chunks.push(text.slice(start, end));
|
|
675
|
+
if (end >= text.length)
|
|
676
|
+
break;
|
|
677
|
+
start = end - overlap;
|
|
678
|
+
}
|
|
679
|
+
return chunks;
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Generate cache key for text
|
|
683
|
+
*/
|
|
684
|
+
getCacheKey(text) {
|
|
685
|
+
return `${this.config.provider}:${this.config.model}:${text}`;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Deduplicate texts and create mapping
|
|
689
|
+
*/
|
|
690
|
+
deduplicateTexts(texts) {
|
|
691
|
+
const mapping = new Map();
|
|
692
|
+
const unique = [];
|
|
693
|
+
for (let i = 0; i < texts.length; i++) {
|
|
694
|
+
const text = texts[i];
|
|
695
|
+
const existing = mapping.get(text);
|
|
696
|
+
if (existing) {
|
|
697
|
+
existing.push(i);
|
|
698
|
+
}
|
|
699
|
+
else {
|
|
700
|
+
mapping.set(text, [i]);
|
|
701
|
+
unique.push(text);
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
return { unique, mapping };
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Generate embedding using configured provider
|
|
708
|
+
*/
|
|
709
|
+
async generateEmbedding(text) {
|
|
710
|
+
switch (this.config.provider) {
|
|
711
|
+
case 'transformers':
|
|
712
|
+
return this.embedWithTransformers(text);
|
|
713
|
+
case 'openai':
|
|
714
|
+
return this.embedWithOpenAI(text);
|
|
715
|
+
case 'cohere':
|
|
716
|
+
return this.embedWithCohere(text);
|
|
717
|
+
case 'custom':
|
|
718
|
+
return this.embedWithCustom(text);
|
|
719
|
+
default:
|
|
720
|
+
throw new Error(`Unknown provider: ${this.config.provider}`);
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Process a batch of texts
|
|
725
|
+
*/
|
|
726
|
+
async processBatch(texts) {
|
|
727
|
+
switch (this.config.provider) {
|
|
728
|
+
case 'transformers':
|
|
729
|
+
return this.batchEmbedWithTransformers(texts);
|
|
730
|
+
case 'openai':
|
|
731
|
+
return this.batchEmbedWithOpenAI(texts);
|
|
732
|
+
case 'cohere':
|
|
733
|
+
return this.batchEmbedWithCohere(texts);
|
|
734
|
+
case 'custom':
|
|
735
|
+
return Promise.all(texts.map((t) => this.embedWithCustom(t)));
|
|
736
|
+
default:
|
|
737
|
+
throw new Error(`Unknown provider: ${this.config.provider}`);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Load transformers.js model
|
|
742
|
+
*/
|
|
743
|
+
async loadTransformersModel() {
|
|
744
|
+
try {
|
|
745
|
+
const transformers = await import('@xenova/transformers');
|
|
746
|
+
// Set HF token if available
|
|
747
|
+
const hfToken = process.env.HUGGINGFACE_API_KEY || process.env.HF_TOKEN;
|
|
748
|
+
if (hfToken && transformers.env) {
|
|
749
|
+
transformers.env.HF_TOKEN = hfToken;
|
|
750
|
+
}
|
|
751
|
+
// Determine model path
|
|
752
|
+
const modelPath = this.config.model.includes('/')
|
|
753
|
+
? this.config.model
|
|
754
|
+
: `Xenova/${this.config.model}`;
|
|
755
|
+
this.pipeline = await transformers.pipeline('feature-extraction', modelPath);
|
|
756
|
+
}
|
|
757
|
+
catch (error) {
|
|
758
|
+
console.warn(`Failed to load transformers model: ${error.message}`);
|
|
759
|
+
console.warn('Falling back to mock embeddings');
|
|
760
|
+
this.pipeline = null;
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Embed with @xenova/transformers (single)
|
|
765
|
+
*/
|
|
766
|
+
async embedWithTransformers(text) {
|
|
767
|
+
if (!this.pipeline) {
|
|
768
|
+
await this.loadTransformersModel();
|
|
769
|
+
}
|
|
770
|
+
if (this.pipeline) {
|
|
771
|
+
const output = await this.pipeline(text, {
|
|
772
|
+
pooling: 'mean',
|
|
773
|
+
normalize: true,
|
|
774
|
+
});
|
|
775
|
+
return new Float32Array(output.data);
|
|
776
|
+
}
|
|
777
|
+
// Fallback to mock
|
|
778
|
+
return this.mockEmbedding(text);
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Batch embed with transformers
|
|
782
|
+
*/
|
|
783
|
+
async batchEmbedWithTransformers(texts) {
|
|
784
|
+
if (!this.pipeline) {
|
|
785
|
+
await this.loadTransformersModel();
|
|
786
|
+
}
|
|
787
|
+
if (this.pipeline) {
|
|
788
|
+
// Process one at a time for transformers.js (batch not well supported)
|
|
789
|
+
return Promise.all(texts.map(async (text) => {
|
|
790
|
+
const output = await this.pipeline(text, {
|
|
791
|
+
pooling: 'mean',
|
|
792
|
+
normalize: true,
|
|
793
|
+
});
|
|
794
|
+
return new Float32Array(output.data);
|
|
795
|
+
}));
|
|
796
|
+
}
|
|
797
|
+
return texts.map((t) => this.mockEmbedding(t));
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* Embed with OpenAI API
|
|
801
|
+
*/
|
|
802
|
+
async embedWithOpenAI(text) {
|
|
803
|
+
if (!this.config.apiKey) {
|
|
804
|
+
throw new Error('OpenAI API key required');
|
|
805
|
+
}
|
|
806
|
+
const apiUrl = 'https://api.openai.com/v1/embeddings';
|
|
807
|
+
validateApiUrl(apiUrl);
|
|
808
|
+
try {
|
|
809
|
+
const response = await fetchWithTimeout(apiUrl, {
|
|
810
|
+
method: 'POST',
|
|
811
|
+
headers: {
|
|
812
|
+
Authorization: `Bearer ${this.config.apiKey}`,
|
|
813
|
+
'Content-Type': 'application/json',
|
|
814
|
+
},
|
|
815
|
+
body: JSON.stringify({
|
|
816
|
+
model: this.config.model || 'text-embedding-ada-002',
|
|
817
|
+
input: text,
|
|
818
|
+
}),
|
|
819
|
+
});
|
|
820
|
+
if (!response.ok) {
|
|
821
|
+
// Don't expose API key in error message
|
|
822
|
+
throw new Error(`OpenAI API error: ${response.status} ${response.statusText}`);
|
|
823
|
+
}
|
|
824
|
+
const data = (await response.json());
|
|
825
|
+
// Validate response structure
|
|
826
|
+
if (!data?.data?.[0]?.embedding || !Array.isArray(data.data[0].embedding)) {
|
|
827
|
+
throw new Error('Invalid response format from OpenAI API');
|
|
828
|
+
}
|
|
829
|
+
return new Float32Array(data.data[0].embedding);
|
|
830
|
+
}
|
|
831
|
+
catch (error) {
|
|
832
|
+
if (error instanceof Error) {
|
|
833
|
+
// Sanitize error message to not expose API key
|
|
834
|
+
if (error.name === 'AbortError') {
|
|
835
|
+
throw new Error('OpenAI API request timed out');
|
|
836
|
+
}
|
|
837
|
+
// Re-throw without exposing internal details
|
|
838
|
+
throw new Error(`OpenAI embedding failed: ${error.message}`);
|
|
839
|
+
}
|
|
840
|
+
throw error;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* Batch embed with OpenAI API
|
|
845
|
+
*/
|
|
846
|
+
async batchEmbedWithOpenAI(texts) {
|
|
847
|
+
if (!this.config.apiKey) {
|
|
848
|
+
throw new Error('OpenAI API key required');
|
|
849
|
+
}
|
|
850
|
+
const apiUrl = 'https://api.openai.com/v1/embeddings';
|
|
851
|
+
validateApiUrl(apiUrl);
|
|
852
|
+
try {
|
|
853
|
+
const response = await fetchWithTimeout(apiUrl, {
|
|
854
|
+
method: 'POST',
|
|
855
|
+
headers: {
|
|
856
|
+
Authorization: `Bearer ${this.config.apiKey}`,
|
|
857
|
+
'Content-Type': 'application/json',
|
|
858
|
+
},
|
|
859
|
+
body: JSON.stringify({
|
|
860
|
+
model: this.config.model || 'text-embedding-ada-002',
|
|
861
|
+
input: texts,
|
|
862
|
+
}),
|
|
863
|
+
});
|
|
864
|
+
if (!response.ok) {
|
|
865
|
+
throw new Error(`OpenAI API error: ${response.status} ${response.statusText}`);
|
|
866
|
+
}
|
|
867
|
+
const data = (await response.json());
|
|
868
|
+
// Validate response structure
|
|
869
|
+
if (!data?.data || !Array.isArray(data.data)) {
|
|
870
|
+
throw new Error('Invalid response format from OpenAI API');
|
|
871
|
+
}
|
|
872
|
+
// Sort by index to maintain order
|
|
873
|
+
const sorted = data.data.sort((a, b) => a.index - b.index);
|
|
874
|
+
return sorted.map((item) => {
|
|
875
|
+
if (!item?.embedding || !Array.isArray(item.embedding)) {
|
|
876
|
+
throw new Error('Invalid embedding format in OpenAI response');
|
|
877
|
+
}
|
|
878
|
+
return new Float32Array(item.embedding);
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
catch (error) {
|
|
882
|
+
if (error instanceof Error) {
|
|
883
|
+
if (error.name === 'AbortError') {
|
|
884
|
+
throw new Error('OpenAI API request timed out');
|
|
885
|
+
}
|
|
886
|
+
throw new Error(`OpenAI batch embedding failed: ${error.message}`);
|
|
887
|
+
}
|
|
888
|
+
throw error;
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
/**
|
|
892
|
+
* Embed with Cohere API
|
|
893
|
+
*/
|
|
894
|
+
async embedWithCohere(text) {
|
|
895
|
+
if (!this.config.apiKey) {
|
|
896
|
+
throw new Error('Cohere API key required');
|
|
897
|
+
}
|
|
898
|
+
const apiUrl = 'https://api.cohere.ai/v1/embed';
|
|
899
|
+
validateApiUrl(apiUrl);
|
|
900
|
+
try {
|
|
901
|
+
const response = await fetchWithTimeout(apiUrl, {
|
|
902
|
+
method: 'POST',
|
|
903
|
+
headers: {
|
|
904
|
+
Authorization: `Bearer ${this.config.apiKey}`,
|
|
905
|
+
'Content-Type': 'application/json',
|
|
906
|
+
},
|
|
907
|
+
body: JSON.stringify({
|
|
908
|
+
model: this.config.model || 'embed-english-v3.0',
|
|
909
|
+
texts: [text],
|
|
910
|
+
input_type: 'search_document',
|
|
911
|
+
}),
|
|
912
|
+
});
|
|
913
|
+
if (!response.ok) {
|
|
914
|
+
throw new Error(`Cohere API error: ${response.status} ${response.statusText}`);
|
|
915
|
+
}
|
|
916
|
+
const data = (await response.json());
|
|
917
|
+
// Validate response structure
|
|
918
|
+
if (!data?.embeddings?.[0] || !Array.isArray(data.embeddings[0])) {
|
|
919
|
+
throw new Error('Invalid response format from Cohere API');
|
|
920
|
+
}
|
|
921
|
+
return new Float32Array(data.embeddings[0]);
|
|
922
|
+
}
|
|
923
|
+
catch (error) {
|
|
924
|
+
if (error instanceof Error) {
|
|
925
|
+
if (error.name === 'AbortError') {
|
|
926
|
+
throw new Error('Cohere API request timed out');
|
|
927
|
+
}
|
|
928
|
+
throw new Error(`Cohere embedding failed: ${error.message}`);
|
|
929
|
+
}
|
|
930
|
+
throw error;
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
/**
|
|
934
|
+
* Batch embed with Cohere API
|
|
935
|
+
*/
|
|
936
|
+
async batchEmbedWithCohere(texts) {
|
|
937
|
+
if (!this.config.apiKey) {
|
|
938
|
+
throw new Error('Cohere API key required');
|
|
939
|
+
}
|
|
940
|
+
const apiUrl = 'https://api.cohere.ai/v1/embed';
|
|
941
|
+
validateApiUrl(apiUrl);
|
|
942
|
+
try {
|
|
943
|
+
const response = await fetchWithTimeout(apiUrl, {
|
|
944
|
+
method: 'POST',
|
|
945
|
+
headers: {
|
|
946
|
+
Authorization: `Bearer ${this.config.apiKey}`,
|
|
947
|
+
'Content-Type': 'application/json',
|
|
948
|
+
},
|
|
949
|
+
body: JSON.stringify({
|
|
950
|
+
model: this.config.model || 'embed-english-v3.0',
|
|
951
|
+
texts,
|
|
952
|
+
input_type: 'search_document',
|
|
953
|
+
}),
|
|
954
|
+
});
|
|
955
|
+
if (!response.ok) {
|
|
956
|
+
throw new Error(`Cohere API error: ${response.status} ${response.statusText}`);
|
|
957
|
+
}
|
|
958
|
+
const data = (await response.json());
|
|
959
|
+
// Validate response structure
|
|
960
|
+
if (!data?.embeddings || !Array.isArray(data.embeddings)) {
|
|
961
|
+
throw new Error('Invalid response format from Cohere API');
|
|
962
|
+
}
|
|
963
|
+
return data.embeddings.map((emb) => {
|
|
964
|
+
if (!Array.isArray(emb)) {
|
|
965
|
+
throw new Error('Invalid embedding format in Cohere response');
|
|
966
|
+
}
|
|
967
|
+
return new Float32Array(emb);
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
catch (error) {
|
|
971
|
+
if (error instanceof Error) {
|
|
972
|
+
if (error.name === 'AbortError') {
|
|
973
|
+
throw new Error('Cohere API request timed out');
|
|
974
|
+
}
|
|
975
|
+
throw new Error(`Cohere batch embedding failed: ${error.message}`);
|
|
976
|
+
}
|
|
977
|
+
throw error;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* Embed with custom function
|
|
982
|
+
*/
|
|
983
|
+
async embedWithCustom(text) {
|
|
984
|
+
if (!this.config.customEmbedder) {
|
|
985
|
+
throw new Error('Custom embedder function required');
|
|
986
|
+
}
|
|
987
|
+
return this.config.customEmbedder(text);
|
|
988
|
+
}
|
|
989
|
+
/**
|
|
990
|
+
* Generate mock embedding for testing/fallback
|
|
991
|
+
*/
|
|
992
|
+
mockEmbedding(text) {
|
|
993
|
+
const embedding = new Float32Array(this.config.dimension);
|
|
994
|
+
if (!text || text.length === 0) {
|
|
995
|
+
return embedding;
|
|
996
|
+
}
|
|
997
|
+
// Deterministic hash-based generation
|
|
998
|
+
let hash = 0;
|
|
999
|
+
for (let i = 0; i < text.length; i++) {
|
|
1000
|
+
hash = (hash << 5) - hash + text.charCodeAt(i);
|
|
1001
|
+
hash = hash & hash;
|
|
1002
|
+
}
|
|
1003
|
+
// Fill with pseudo-random values
|
|
1004
|
+
for (let i = 0; i < this.config.dimension; i++) {
|
|
1005
|
+
const seed = hash + i * 31;
|
|
1006
|
+
embedding[i] = Math.sin(seed) * Math.cos(seed * 0.5);
|
|
1007
|
+
}
|
|
1008
|
+
// Normalize
|
|
1009
|
+
let norm = 0;
|
|
1010
|
+
for (let i = 0; i < embedding.length; i++) {
|
|
1011
|
+
norm += embedding[i] * embedding[i];
|
|
1012
|
+
}
|
|
1013
|
+
norm = Math.sqrt(norm);
|
|
1014
|
+
if (norm > 0) {
|
|
1015
|
+
for (let i = 0; i < embedding.length; i++) {
|
|
1016
|
+
embedding[i] /= norm;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
return embedding;
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
// ============================================================================
|
|
1023
|
+
// Factory Function
|
|
1024
|
+
// ============================================================================
|
|
1025
|
+
/**
|
|
1026
|
+
* Create an enhanced embedding service with default configuration
|
|
1027
|
+
*/
|
|
1028
|
+
export function createEmbeddingService(config) {
|
|
1029
|
+
return new EnhancedEmbeddingService(config);
|
|
1030
|
+
}
|
|
1031
|
+
// ============================================================================
|
|
1032
|
+
// Default Export
|
|
1033
|
+
// ============================================================================
|
|
1034
|
+
export default EnhancedEmbeddingService;
|
|
1035
|
+
//# sourceMappingURL=enhanced-embeddings.js.map
|