rag-lite-ts 2.1.1 → 2.3.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 +88 -5
- package/dist/{cli → cjs/cli}/indexer.js +73 -15
- package/dist/cjs/cli/ui-server.d.ts +5 -0
- package/dist/cjs/cli/ui-server.js +152 -0
- package/dist/{cli.js → cjs/cli.js} +25 -6
- package/dist/{core → cjs/core}/binary-index-format.js +6 -3
- package/dist/{core → cjs/core}/db.d.ts +56 -0
- package/dist/{core → cjs/core}/db.js +105 -0
- package/dist/{core → cjs/core}/ingestion.js +3 -0
- package/dist/cjs/core/knowledge-base-manager.d.ts +109 -0
- package/dist/cjs/core/knowledge-base-manager.js +256 -0
- package/dist/{core → cjs/core}/model-validator.js +1 -1
- package/dist/{core → cjs/core}/search-pipeline.js +1 -1
- package/dist/{core → cjs/core}/search.js +1 -1
- package/dist/cjs/core/vector-index-messages.d.ts +52 -0
- package/dist/cjs/core/vector-index-messages.js +5 -0
- package/dist/cjs/core/vector-index-worker.d.ts +6 -0
- package/dist/cjs/core/vector-index-worker.js +304 -0
- package/dist/cjs/core/vector-index.d.ts +107 -0
- package/dist/cjs/core/vector-index.js +344 -0
- package/dist/{factories → cjs/factories}/ingestion-factory.js +3 -7
- package/dist/{factories → cjs/factories}/search-factory.js +11 -0
- package/dist/{index-manager.d.ts → cjs/index-manager.d.ts} +23 -3
- package/dist/{index-manager.js → cjs/index-manager.js} +84 -15
- package/dist/{index.d.ts → cjs/index.d.ts} +2 -1
- package/dist/{index.js → cjs/index.js} +3 -1
- package/dist/esm/api-errors.d.ts +90 -0
- package/dist/esm/api-errors.js +320 -0
- package/dist/esm/cli/indexer.d.ts +11 -0
- package/dist/esm/cli/indexer.js +529 -0
- package/dist/esm/cli/search.d.ts +7 -0
- package/dist/esm/cli/search.js +332 -0
- package/dist/esm/cli/ui-server.d.ts +5 -0
- package/dist/esm/cli/ui-server.js +152 -0
- package/dist/esm/cli.d.ts +3 -0
- package/dist/esm/cli.js +548 -0
- package/dist/esm/config.d.ts +51 -0
- package/dist/esm/config.js +79 -0
- package/dist/esm/core/abstract-embedder.d.ts +125 -0
- package/dist/esm/core/abstract-embedder.js +264 -0
- package/dist/esm/core/actionable-error-messages.d.ts +60 -0
- package/dist/esm/core/actionable-error-messages.js +397 -0
- package/dist/esm/core/adapters.d.ts +93 -0
- package/dist/esm/core/adapters.js +139 -0
- package/dist/esm/core/batch-processing-optimizer.d.ts +155 -0
- package/dist/esm/core/batch-processing-optimizer.js +536 -0
- package/dist/esm/core/binary-index-format.d.ts +78 -0
- package/dist/esm/core/binary-index-format.js +294 -0
- package/dist/esm/core/chunker.d.ts +119 -0
- package/dist/esm/core/chunker.js +73 -0
- package/dist/esm/core/cli-database-utils.d.ts +53 -0
- package/dist/esm/core/cli-database-utils.js +239 -0
- package/dist/esm/core/config.d.ts +102 -0
- package/dist/esm/core/config.js +247 -0
- package/dist/esm/core/content-errors.d.ts +111 -0
- package/dist/esm/core/content-errors.js +362 -0
- package/dist/esm/core/content-manager.d.ts +335 -0
- package/dist/esm/core/content-manager.js +1476 -0
- package/dist/esm/core/content-performance-optimizer.d.ts +150 -0
- package/dist/esm/core/content-performance-optimizer.js +516 -0
- package/dist/esm/core/content-resolver.d.ts +104 -0
- package/dist/esm/core/content-resolver.js +285 -0
- package/dist/esm/core/cross-modal-search.d.ts +164 -0
- package/dist/esm/core/cross-modal-search.js +342 -0
- package/dist/esm/core/database-connection-manager.d.ts +109 -0
- package/dist/esm/core/database-connection-manager.js +310 -0
- package/dist/esm/core/db.d.ts +269 -0
- package/dist/esm/core/db.js +1000 -0
- package/dist/esm/core/embedder-factory.d.ts +154 -0
- package/dist/esm/core/embedder-factory.js +311 -0
- package/dist/esm/core/error-handler.d.ts +112 -0
- package/dist/esm/core/error-handler.js +239 -0
- package/dist/esm/core/index.d.ts +59 -0
- package/dist/esm/core/index.js +69 -0
- package/dist/esm/core/ingestion.d.ts +202 -0
- package/dist/esm/core/ingestion.js +904 -0
- package/dist/esm/core/interfaces.d.ts +408 -0
- package/dist/esm/core/interfaces.js +106 -0
- package/dist/esm/core/knowledge-base-manager.d.ts +109 -0
- package/dist/esm/core/knowledge-base-manager.js +256 -0
- package/dist/esm/core/lazy-dependency-loader.d.ts +147 -0
- package/dist/esm/core/lazy-dependency-loader.js +435 -0
- package/dist/esm/core/mode-detection-service.d.ts +150 -0
- package/dist/esm/core/mode-detection-service.js +565 -0
- package/dist/esm/core/mode-model-validator.d.ts +92 -0
- package/dist/esm/core/mode-model-validator.js +203 -0
- package/dist/esm/core/model-registry.d.ts +116 -0
- package/dist/esm/core/model-registry.js +411 -0
- package/dist/esm/core/model-validator.d.ts +217 -0
- package/dist/esm/core/model-validator.js +782 -0
- package/dist/esm/core/path-manager.d.ts +47 -0
- package/dist/esm/core/path-manager.js +71 -0
- package/dist/esm/core/raglite-paths.d.ts +121 -0
- package/dist/esm/core/raglite-paths.js +145 -0
- package/dist/esm/core/reranking-config.d.ts +42 -0
- package/dist/esm/core/reranking-config.js +147 -0
- package/dist/esm/core/reranking-factory.d.ts +92 -0
- package/dist/esm/core/reranking-factory.js +410 -0
- package/dist/esm/core/reranking-strategies.d.ts +310 -0
- package/dist/esm/core/reranking-strategies.js +650 -0
- package/dist/esm/core/resource-cleanup.d.ts +163 -0
- package/dist/esm/core/resource-cleanup.js +371 -0
- package/dist/esm/core/resource-manager.d.ts +212 -0
- package/dist/esm/core/resource-manager.js +564 -0
- package/dist/esm/core/search-pipeline.d.ts +111 -0
- package/dist/esm/core/search-pipeline.js +287 -0
- package/dist/esm/core/search.d.ts +141 -0
- package/dist/esm/core/search.js +320 -0
- package/dist/esm/core/streaming-operations.d.ts +145 -0
- package/dist/esm/core/streaming-operations.js +409 -0
- package/dist/esm/core/types.d.ts +66 -0
- package/dist/esm/core/types.js +6 -0
- package/dist/esm/core/universal-embedder.d.ts +177 -0
- package/dist/esm/core/universal-embedder.js +139 -0
- package/dist/esm/core/validation-messages.d.ts +99 -0
- package/dist/esm/core/validation-messages.js +334 -0
- package/dist/esm/core/vector-index-messages.d.ts +52 -0
- package/dist/esm/core/vector-index-messages.js +5 -0
- package/dist/esm/core/vector-index-worker.d.ts +6 -0
- package/dist/esm/core/vector-index-worker.js +304 -0
- package/dist/esm/core/vector-index.d.ts +107 -0
- package/dist/esm/core/vector-index.js +344 -0
- package/dist/esm/dom-polyfills.d.ts +6 -0
- package/dist/esm/dom-polyfills.js +37 -0
- package/dist/esm/factories/index.d.ts +27 -0
- package/dist/esm/factories/index.js +29 -0
- package/dist/esm/factories/ingestion-factory.d.ts +200 -0
- package/dist/esm/factories/ingestion-factory.js +473 -0
- package/dist/esm/factories/search-factory.d.ts +154 -0
- package/dist/esm/factories/search-factory.js +355 -0
- package/dist/esm/file-processor.d.ts +147 -0
- package/dist/esm/file-processor.js +963 -0
- package/dist/esm/index-manager.d.ts +136 -0
- package/dist/esm/index-manager.js +667 -0
- package/dist/esm/index.d.ts +76 -0
- package/dist/esm/index.js +112 -0
- package/dist/esm/indexer.d.ts +7 -0
- package/dist/esm/indexer.js +54 -0
- package/dist/esm/ingestion.d.ts +63 -0
- package/dist/esm/ingestion.js +124 -0
- package/dist/esm/mcp-server.d.ts +46 -0
- package/dist/esm/mcp-server.js +1820 -0
- package/dist/esm/multimodal/clip-embedder.d.ts +327 -0
- package/dist/esm/multimodal/clip-embedder.js +996 -0
- package/dist/esm/multimodal/index.d.ts +6 -0
- package/dist/esm/multimodal/index.js +6 -0
- package/dist/esm/preprocess.d.ts +19 -0
- package/dist/esm/preprocess.js +203 -0
- package/dist/esm/preprocessors/index.d.ts +17 -0
- package/dist/esm/preprocessors/index.js +38 -0
- package/dist/esm/preprocessors/mdx.d.ts +25 -0
- package/dist/esm/preprocessors/mdx.js +101 -0
- package/dist/esm/preprocessors/mermaid.d.ts +68 -0
- package/dist/esm/preprocessors/mermaid.js +329 -0
- package/dist/esm/preprocessors/registry.d.ts +56 -0
- package/dist/esm/preprocessors/registry.js +179 -0
- package/dist/esm/run-error-recovery-tests.d.ts +7 -0
- package/dist/esm/run-error-recovery-tests.js +101 -0
- package/dist/esm/search-standalone.d.ts +7 -0
- package/dist/esm/search-standalone.js +117 -0
- package/dist/esm/search.d.ts +99 -0
- package/dist/esm/search.js +177 -0
- package/dist/esm/test-utils.d.ts +18 -0
- package/dist/esm/test-utils.js +27 -0
- package/dist/esm/text/chunker.d.ts +33 -0
- package/dist/esm/text/chunker.js +279 -0
- package/dist/esm/text/embedder.d.ts +111 -0
- package/dist/esm/text/embedder.js +386 -0
- package/dist/esm/text/index.d.ts +8 -0
- package/dist/esm/text/index.js +9 -0
- package/dist/esm/text/preprocessors/index.d.ts +17 -0
- package/dist/esm/text/preprocessors/index.js +38 -0
- package/dist/esm/text/preprocessors/mdx.d.ts +25 -0
- package/dist/esm/text/preprocessors/mdx.js +101 -0
- package/dist/esm/text/preprocessors/mermaid.d.ts +68 -0
- package/dist/esm/text/preprocessors/mermaid.js +330 -0
- package/dist/esm/text/preprocessors/registry.d.ts +56 -0
- package/dist/esm/text/preprocessors/registry.js +180 -0
- package/dist/esm/text/reranker.d.ts +49 -0
- package/dist/esm/text/reranker.js +274 -0
- package/dist/esm/text/sentence-transformer-embedder.d.ts +96 -0
- package/dist/esm/text/sentence-transformer-embedder.js +340 -0
- package/dist/esm/text/tokenizer.d.ts +22 -0
- package/dist/esm/text/tokenizer.js +64 -0
- package/dist/esm/types.d.ts +83 -0
- package/dist/esm/types.js +3 -0
- package/dist/esm/utils/vector-math.d.ts +31 -0
- package/dist/esm/utils/vector-math.js +70 -0
- package/package.json +39 -14
- package/dist/core/vector-index.d.ts +0 -72
- package/dist/core/vector-index.js +0 -331
- /package/dist/{api-errors.d.ts → cjs/api-errors.d.ts} +0 -0
- /package/dist/{api-errors.js → cjs/api-errors.js} +0 -0
- /package/dist/{cli → cjs/cli}/indexer.d.ts +0 -0
- /package/dist/{cli → cjs/cli}/search.d.ts +0 -0
- /package/dist/{cli → cjs/cli}/search.js +0 -0
- /package/dist/{cli.d.ts → cjs/cli.d.ts} +0 -0
- /package/dist/{config.d.ts → cjs/config.d.ts} +0 -0
- /package/dist/{config.js → cjs/config.js} +0 -0
- /package/dist/{core → cjs/core}/abstract-embedder.d.ts +0 -0
- /package/dist/{core → cjs/core}/abstract-embedder.js +0 -0
- /package/dist/{core → cjs/core}/actionable-error-messages.d.ts +0 -0
- /package/dist/{core → cjs/core}/actionable-error-messages.js +0 -0
- /package/dist/{core → cjs/core}/adapters.d.ts +0 -0
- /package/dist/{core → cjs/core}/adapters.js +0 -0
- /package/dist/{core → cjs/core}/batch-processing-optimizer.d.ts +0 -0
- /package/dist/{core → cjs/core}/batch-processing-optimizer.js +0 -0
- /package/dist/{core → cjs/core}/binary-index-format.d.ts +0 -0
- /package/dist/{core → cjs/core}/chunker.d.ts +0 -0
- /package/dist/{core → cjs/core}/chunker.js +0 -0
- /package/dist/{core → cjs/core}/cli-database-utils.d.ts +0 -0
- /package/dist/{core → cjs/core}/cli-database-utils.js +0 -0
- /package/dist/{core → cjs/core}/config.d.ts +0 -0
- /package/dist/{core → cjs/core}/config.js +0 -0
- /package/dist/{core → cjs/core}/content-errors.d.ts +0 -0
- /package/dist/{core → cjs/core}/content-errors.js +0 -0
- /package/dist/{core → cjs/core}/content-manager.d.ts +0 -0
- /package/dist/{core → cjs/core}/content-manager.js +0 -0
- /package/dist/{core → cjs/core}/content-performance-optimizer.d.ts +0 -0
- /package/dist/{core → cjs/core}/content-performance-optimizer.js +0 -0
- /package/dist/{core → cjs/core}/content-resolver.d.ts +0 -0
- /package/dist/{core → cjs/core}/content-resolver.js +0 -0
- /package/dist/{core → cjs/core}/cross-modal-search.d.ts +0 -0
- /package/dist/{core → cjs/core}/cross-modal-search.js +0 -0
- /package/dist/{core → cjs/core}/database-connection-manager.d.ts +0 -0
- /package/dist/{core → cjs/core}/database-connection-manager.js +0 -0
- /package/dist/{core → cjs/core}/embedder-factory.d.ts +0 -0
- /package/dist/{core → cjs/core}/embedder-factory.js +0 -0
- /package/dist/{core → cjs/core}/error-handler.d.ts +0 -0
- /package/dist/{core → cjs/core}/error-handler.js +0 -0
- /package/dist/{core → cjs/core}/index.d.ts +0 -0
- /package/dist/{core → cjs/core}/index.js +0 -0
- /package/dist/{core → cjs/core}/ingestion.d.ts +0 -0
- /package/dist/{core → cjs/core}/interfaces.d.ts +0 -0
- /package/dist/{core → cjs/core}/interfaces.js +0 -0
- /package/dist/{core → cjs/core}/lazy-dependency-loader.d.ts +0 -0
- /package/dist/{core → cjs/core}/lazy-dependency-loader.js +0 -0
- /package/dist/{core → cjs/core}/mode-detection-service.d.ts +0 -0
- /package/dist/{core → cjs/core}/mode-detection-service.js +0 -0
- /package/dist/{core → cjs/core}/mode-model-validator.d.ts +0 -0
- /package/dist/{core → cjs/core}/mode-model-validator.js +0 -0
- /package/dist/{core → cjs/core}/model-registry.d.ts +0 -0
- /package/dist/{core → cjs/core}/model-registry.js +0 -0
- /package/dist/{core → cjs/core}/model-validator.d.ts +0 -0
- /package/dist/{core → cjs/core}/path-manager.d.ts +0 -0
- /package/dist/{core → cjs/core}/path-manager.js +0 -0
- /package/dist/{core → cjs/core}/raglite-paths.d.ts +0 -0
- /package/dist/{core → cjs/core}/raglite-paths.js +0 -0
- /package/dist/{core → cjs/core}/reranking-config.d.ts +0 -0
- /package/dist/{core → cjs/core}/reranking-config.js +0 -0
- /package/dist/{core → cjs/core}/reranking-factory.d.ts +0 -0
- /package/dist/{core → cjs/core}/reranking-factory.js +0 -0
- /package/dist/{core → cjs/core}/reranking-strategies.d.ts +0 -0
- /package/dist/{core → cjs/core}/reranking-strategies.js +0 -0
- /package/dist/{core → cjs/core}/resource-cleanup.d.ts +0 -0
- /package/dist/{core → cjs/core}/resource-cleanup.js +0 -0
- /package/dist/{core → cjs/core}/resource-manager.d.ts +0 -0
- /package/dist/{core → cjs/core}/resource-manager.js +0 -0
- /package/dist/{core → cjs/core}/search-pipeline.d.ts +0 -0
- /package/dist/{core → cjs/core}/search.d.ts +0 -0
- /package/dist/{core → cjs/core}/streaming-operations.d.ts +0 -0
- /package/dist/{core → cjs/core}/streaming-operations.js +0 -0
- /package/dist/{core → cjs/core}/types.d.ts +0 -0
- /package/dist/{core → cjs/core}/types.js +0 -0
- /package/dist/{core → cjs/core}/universal-embedder.d.ts +0 -0
- /package/dist/{core → cjs/core}/universal-embedder.js +0 -0
- /package/dist/{core → cjs/core}/validation-messages.d.ts +0 -0
- /package/dist/{core → cjs/core}/validation-messages.js +0 -0
- /package/dist/{dom-polyfills.d.ts → cjs/dom-polyfills.d.ts} +0 -0
- /package/dist/{dom-polyfills.js → cjs/dom-polyfills.js} +0 -0
- /package/dist/{factories → cjs/factories}/index.d.ts +0 -0
- /package/dist/{factories → cjs/factories}/index.js +0 -0
- /package/dist/{factories → cjs/factories}/ingestion-factory.d.ts +0 -0
- /package/dist/{factories → cjs/factories}/search-factory.d.ts +0 -0
- /package/dist/{file-processor.d.ts → cjs/file-processor.d.ts} +0 -0
- /package/dist/{file-processor.js → cjs/file-processor.js} +0 -0
- /package/dist/{indexer.d.ts → cjs/indexer.d.ts} +0 -0
- /package/dist/{indexer.js → cjs/indexer.js} +0 -0
- /package/dist/{ingestion.d.ts → cjs/ingestion.d.ts} +0 -0
- /package/dist/{ingestion.js → cjs/ingestion.js} +0 -0
- /package/dist/{mcp-server.d.ts → cjs/mcp-server.d.ts} +0 -0
- /package/dist/{mcp-server.js → cjs/mcp-server.js} +0 -0
- /package/dist/{multimodal → cjs/multimodal}/clip-embedder.d.ts +0 -0
- /package/dist/{multimodal → cjs/multimodal}/clip-embedder.js +0 -0
- /package/dist/{multimodal → cjs/multimodal}/index.d.ts +0 -0
- /package/dist/{multimodal → cjs/multimodal}/index.js +0 -0
- /package/dist/{preprocess.d.ts → cjs/preprocess.d.ts} +0 -0
- /package/dist/{preprocess.js → cjs/preprocess.js} +0 -0
- /package/dist/{preprocessors → cjs/preprocessors}/index.d.ts +0 -0
- /package/dist/{preprocessors → cjs/preprocessors}/index.js +0 -0
- /package/dist/{preprocessors → cjs/preprocessors}/mdx.d.ts +0 -0
- /package/dist/{preprocessors → cjs/preprocessors}/mdx.js +0 -0
- /package/dist/{preprocessors → cjs/preprocessors}/mermaid.d.ts +0 -0
- /package/dist/{preprocessors → cjs/preprocessors}/mermaid.js +0 -0
- /package/dist/{preprocessors → cjs/preprocessors}/registry.d.ts +0 -0
- /package/dist/{preprocessors → cjs/preprocessors}/registry.js +0 -0
- /package/dist/{run-error-recovery-tests.d.ts → cjs/run-error-recovery-tests.d.ts} +0 -0
- /package/dist/{run-error-recovery-tests.js → cjs/run-error-recovery-tests.js} +0 -0
- /package/dist/{search-standalone.d.ts → cjs/search-standalone.d.ts} +0 -0
- /package/dist/{search-standalone.js → cjs/search-standalone.js} +0 -0
- /package/dist/{search.d.ts → cjs/search.d.ts} +0 -0
- /package/dist/{search.js → cjs/search.js} +0 -0
- /package/dist/{test-utils.d.ts → cjs/test-utils.d.ts} +0 -0
- /package/dist/{test-utils.js → cjs/test-utils.js} +0 -0
- /package/dist/{text → cjs/text}/chunker.d.ts +0 -0
- /package/dist/{text → cjs/text}/chunker.js +0 -0
- /package/dist/{text → cjs/text}/embedder.d.ts +0 -0
- /package/dist/{text → cjs/text}/embedder.js +0 -0
- /package/dist/{text → cjs/text}/index.d.ts +0 -0
- /package/dist/{text → cjs/text}/index.js +0 -0
- /package/dist/{text → cjs/text}/preprocessors/index.d.ts +0 -0
- /package/dist/{text → cjs/text}/preprocessors/index.js +0 -0
- /package/dist/{text → cjs/text}/preprocessors/mdx.d.ts +0 -0
- /package/dist/{text → cjs/text}/preprocessors/mdx.js +0 -0
- /package/dist/{text → cjs/text}/preprocessors/mermaid.d.ts +0 -0
- /package/dist/{text → cjs/text}/preprocessors/mermaid.js +0 -0
- /package/dist/{text → cjs/text}/preprocessors/registry.d.ts +0 -0
- /package/dist/{text → cjs/text}/preprocessors/registry.js +0 -0
- /package/dist/{text → cjs/text}/reranker.d.ts +0 -0
- /package/dist/{text → cjs/text}/reranker.js +0 -0
- /package/dist/{text → cjs/text}/sentence-transformer-embedder.d.ts +0 -0
- /package/dist/{text → cjs/text}/sentence-transformer-embedder.js +0 -0
- /package/dist/{text → cjs/text}/tokenizer.d.ts +0 -0
- /package/dist/{text → cjs/text}/tokenizer.js +0 -0
- /package/dist/{types.d.ts → cjs/types.d.ts} +0 -0
- /package/dist/{types.js → cjs/types.js} +0 -0
- /package/dist/{utils → cjs/utils}/vector-math.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/vector-math.js +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* rag-lite-ts - Clean Architecture with Factory Pattern
|
|
3
|
+
*
|
|
4
|
+
* Quick Start (Recommended):
|
|
5
|
+
* ```typescript
|
|
6
|
+
* import { SearchFactory, IngestionFactory } from 'rag-lite-ts';
|
|
7
|
+
*
|
|
8
|
+
* // Simple search - just works!
|
|
9
|
+
* const search = await SearchFactory.create('./index.bin', './db.sqlite');
|
|
10
|
+
* const results = await search.search('your query');
|
|
11
|
+
*
|
|
12
|
+
* // Simple ingestion - just works!
|
|
13
|
+
* const ingestion = await IngestionFactory.create('./db.sqlite', './index.bin');
|
|
14
|
+
* await ingestion.ingestDirectory('./documents');
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* With Configuration:
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const search = await SearchFactory.create('./index.bin', './db.sqlite', {
|
|
20
|
+
* embeddingModel: 'Xenova/all-mpnet-base-v2',
|
|
21
|
+
* enableReranking: true
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* Complete RAG System:
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import { RAGFactory } from 'rag-lite-ts';
|
|
28
|
+
*
|
|
29
|
+
* const { searchEngine, ingestionPipeline } = await RAGFactory.createBoth(
|
|
30
|
+
* './index.bin',
|
|
31
|
+
* './db.sqlite'
|
|
32
|
+
* );
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* Advanced Usage (Direct Dependency Injection):
|
|
36
|
+
* ```typescript
|
|
37
|
+
* import { CoreSearchEngine, createTextEmbedFunction } from 'rag-lite-ts';
|
|
38
|
+
*
|
|
39
|
+
* const embedFn = await createTextEmbedFunction();
|
|
40
|
+
* const search = new CoreSearchEngine(embedFn, indexManager, db);
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export { IngestionFactory, SearchFactory } from './factories/index.js';
|
|
44
|
+
export type { IngestionFactoryOptions } from './factories/index.js';
|
|
45
|
+
export { SearchEngine as CoreSearchEngine } from './core/search.js';
|
|
46
|
+
export { IngestionPipeline as CoreIngestionPipeline } from './core/ingestion.js';
|
|
47
|
+
export { SearchEngine } from './search.js';
|
|
48
|
+
export { IngestionPipeline } from './ingestion.js';
|
|
49
|
+
export { LazyEmbedderLoader, LazyRerankerLoader, LazyMultimodalLoader, LazyDependencyManager } from './core/lazy-dependency-loader.js';
|
|
50
|
+
export type { EmbedFunction, RerankFunction, EmbeddingQueryInterface, RerankingInterface, SearchEngineConfig, ContentTypeStrategy, ModelAgnosticInterface, ExtendedEmbeddingInterface, ExtendedRerankingInterface, SearchPipelineInterface, SearchDependencyFactory } from './core/interfaces.js';
|
|
51
|
+
export { InterfaceValidator } from './core/interfaces.js';
|
|
52
|
+
export { validateModeModelCompatibility, validateModeModelCompatibilityOrThrow, getRecommendedModelsForMode, isModeModelCompatible, getCompatibleModelsForMode, type ModeModelValidationResult } from './core/mode-model-validator.js';
|
|
53
|
+
export { createMissingFileError, createInvalidPathError, createModelLoadingError, createDimensionMismatchError, createModeMismatchError, createInvalidContentError, createMissingDependencyError, createFactoryCreationError, enhanceError, createContextualError, type ActionableErrorConfig } from './core/actionable-error-messages.js';
|
|
54
|
+
export { EmbeddingEngine, getEmbeddingEngine, initializeEmbeddingEngine, createTextEmbedFunction } from './text/embedder.js';
|
|
55
|
+
export type { UniversalEmbedder } from './core/universal-embedder.js';
|
|
56
|
+
export { CLIPEmbedder } from './multimodal/clip-embedder.js';
|
|
57
|
+
export { createEmbedder } from './core/embedder-factory.js';
|
|
58
|
+
export { CrossEncoderReranker, createTextRerankFunction } from './text/reranker.js';
|
|
59
|
+
export { countTokens } from './text/tokenizer.js';
|
|
60
|
+
export type { RerankingStrategyType, RerankingConfig } from './core/reranking-config.js';
|
|
61
|
+
export { validateRerankingStrategy, validateRerankingConfig, getDefaultRerankingConfig, isStrategySupported, getSupportedStrategies, RerankingConfigBuilder, DEFAULT_TEXT_RERANKING_CONFIG, DEFAULT_MULTIMODAL_RERANKING_CONFIG } from './core/reranking-config.js';
|
|
62
|
+
export { openDatabase, initializeSchema, insertDocument, insertChunk, upsertDocument, getChunksByEmbeddingIds, resetDatabase, hasDatabaseData, type DatabaseConnection, type DatabaseResetOptions, type DatabaseResetResult } from './core/db.js';
|
|
63
|
+
export { KnowledgeBaseManager, type KnowledgeBaseResetOptions, type KnowledgeBaseResetResult } from './core/knowledge-base-manager.js';
|
|
64
|
+
export { IndexManager } from './index-manager.js';
|
|
65
|
+
export { VectorIndex } from './core/vector-index.js';
|
|
66
|
+
export { config, getModelDefaults, type CoreConfig, type ExtensibleConfig, type ModelDefaults, EXIT_CODES, ConfigurationError, getDefaultModelCachePath, handleUnrecoverableError, logError } from './core/config.js';
|
|
67
|
+
export { discoverFiles, processFiles, discoverAndProcessFiles, DEFAULT_FILE_PROCESSOR_OPTIONS, type FileProcessorOptions, type FileDiscoveryResult, type DocumentProcessingResult } from './file-processor.js';
|
|
68
|
+
export { chunkDocument, type ChunkConfig } from './core/chunker.js';
|
|
69
|
+
export { DocumentPathManager } from './core/path-manager.js';
|
|
70
|
+
export { resolveRagLitePaths, ensureRagLiteStructure, migrateToRagLiteStructure, getStandardRagLitePaths, type RagLiteConfig, type RagLitePaths } from './core/raglite-paths.js';
|
|
71
|
+
export type { SearchResult, SearchOptions, Document, EmbeddingResult, ContentDocument, ContentChunk } from './core/types.js';
|
|
72
|
+
export type { Chunk, Preprocessor, PreprocessorOptions, PreprocessingConfig } from './types.js';
|
|
73
|
+
export type { IngestionOptions, IngestionResult } from './core/ingestion.js';
|
|
74
|
+
export { handleError, safeExecute, ErrorCategory, ErrorSeverity, createError, type ErrorContext } from './core/error-handler.js';
|
|
75
|
+
export { APIError, IngestionError, SearchError, ResourceError, ModelCompatibilityError, ErrorFactory, CommonErrors, handleAPIError } from './api-errors.js';
|
|
76
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* rag-lite-ts - Clean Architecture with Factory Pattern
|
|
3
|
+
*
|
|
4
|
+
* Quick Start (Recommended):
|
|
5
|
+
* ```typescript
|
|
6
|
+
* import { SearchFactory, IngestionFactory } from 'rag-lite-ts';
|
|
7
|
+
*
|
|
8
|
+
* // Simple search - just works!
|
|
9
|
+
* const search = await SearchFactory.create('./index.bin', './db.sqlite');
|
|
10
|
+
* const results = await search.search('your query');
|
|
11
|
+
*
|
|
12
|
+
* // Simple ingestion - just works!
|
|
13
|
+
* const ingestion = await IngestionFactory.create('./db.sqlite', './index.bin');
|
|
14
|
+
* await ingestion.ingestDirectory('./documents');
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* With Configuration:
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const search = await SearchFactory.create('./index.bin', './db.sqlite', {
|
|
20
|
+
* embeddingModel: 'Xenova/all-mpnet-base-v2',
|
|
21
|
+
* enableReranking: true
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* Complete RAG System:
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import { RAGFactory } from 'rag-lite-ts';
|
|
28
|
+
*
|
|
29
|
+
* const { searchEngine, ingestionPipeline } = await RAGFactory.createBoth(
|
|
30
|
+
* './index.bin',
|
|
31
|
+
* './db.sqlite'
|
|
32
|
+
* );
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* Advanced Usage (Direct Dependency Injection):
|
|
36
|
+
* ```typescript
|
|
37
|
+
* import { CoreSearchEngine, createTextEmbedFunction } from 'rag-lite-ts';
|
|
38
|
+
*
|
|
39
|
+
* const embedFn = await createTextEmbedFunction();
|
|
40
|
+
* const search = new CoreSearchEngine(embedFn, indexManager, db);
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
// =============================================================================
|
|
44
|
+
// PRIMARY API (FACTORY PATTERN)
|
|
45
|
+
// =============================================================================
|
|
46
|
+
// Main factory classes for simple usage
|
|
47
|
+
export { IngestionFactory, SearchFactory } from './factories/index.js';
|
|
48
|
+
// =============================================================================
|
|
49
|
+
// REMOVED IN v3.0.0: Type aliases
|
|
50
|
+
// =============================================================================
|
|
51
|
+
// IngestionPipelineOptions has been removed. Use IngestionFactoryOptions directly.
|
|
52
|
+
// Migration: Replace IngestionPipelineOptions with IngestionFactoryOptions
|
|
53
|
+
// =============================================================================
|
|
54
|
+
// CORE ARCHITECTURE (FOR LIBRARY AUTHORS)
|
|
55
|
+
// =============================================================================
|
|
56
|
+
// Core classes for direct dependency injection (advanced)
|
|
57
|
+
export { SearchEngine as CoreSearchEngine } from './core/search.js';
|
|
58
|
+
export { IngestionPipeline as CoreIngestionPipeline } from './core/ingestion.js';
|
|
59
|
+
// Public API classes
|
|
60
|
+
export { SearchEngine } from './search.js';
|
|
61
|
+
export { IngestionPipeline } from './ingestion.js';
|
|
62
|
+
// Lazy loading system for performance optimization
|
|
63
|
+
export { LazyEmbedderLoader, LazyRerankerLoader, LazyMultimodalLoader, LazyDependencyManager } from './core/lazy-dependency-loader.js';
|
|
64
|
+
// Interface validation utilities
|
|
65
|
+
export { InterfaceValidator } from './core/interfaces.js';
|
|
66
|
+
// Mode-model compatibility validation
|
|
67
|
+
export { validateModeModelCompatibility, validateModeModelCompatibilityOrThrow, getRecommendedModelsForMode, isModeModelCompatible, getCompatibleModelsForMode } from './core/mode-model-validator.js';
|
|
68
|
+
// Actionable error messages
|
|
69
|
+
export { createMissingFileError, createInvalidPathError, createModelLoadingError, createDimensionMismatchError, createModeMismatchError, createInvalidContentError, createMissingDependencyError, createFactoryCreationError, enhanceError, createContextualError } from './core/actionable-error-messages.js';
|
|
70
|
+
// =============================================================================
|
|
71
|
+
// TEXT IMPLEMENTATIONS (FOR CUSTOM DEPENDENCY INJECTION)
|
|
72
|
+
// =============================================================================
|
|
73
|
+
// Text-specific embedding implementations
|
|
74
|
+
export { EmbeddingEngine, getEmbeddingEngine, initializeEmbeddingEngine, createTextEmbedFunction } from './text/embedder.js';
|
|
75
|
+
export { CLIPEmbedder } from './multimodal/clip-embedder.js';
|
|
76
|
+
export { createEmbedder } from './core/embedder-factory.js';
|
|
77
|
+
// Text-specific reranking implementations
|
|
78
|
+
export { CrossEncoderReranker, createTextRerankFunction } from './text/reranker.js';
|
|
79
|
+
// Text tokenization utilities
|
|
80
|
+
export { countTokens } from './text/tokenizer.js';
|
|
81
|
+
export { validateRerankingStrategy, validateRerankingConfig, getDefaultRerankingConfig, isStrategySupported, getSupportedStrategies, RerankingConfigBuilder, DEFAULT_TEXT_RERANKING_CONFIG, DEFAULT_MULTIMODAL_RERANKING_CONFIG } from './core/reranking-config.js';
|
|
82
|
+
// =============================================================================
|
|
83
|
+
// CORE INFRASTRUCTURE (FOR ADVANCED USERS)
|
|
84
|
+
// =============================================================================
|
|
85
|
+
// Database operations
|
|
86
|
+
export { openDatabase, initializeSchema, insertDocument, insertChunk, upsertDocument, getChunksByEmbeddingIds, resetDatabase, hasDatabaseData } from './core/db.js';
|
|
87
|
+
// Knowledge Base Manager (for reset operations)
|
|
88
|
+
export { KnowledgeBaseManager } from './core/knowledge-base-manager.js';
|
|
89
|
+
// Vector index management
|
|
90
|
+
export { IndexManager } from './index-manager.js';
|
|
91
|
+
export { VectorIndex } from './core/vector-index.js';
|
|
92
|
+
// Configuration and utilities
|
|
93
|
+
export { config, getModelDefaults, EXIT_CODES, ConfigurationError, getDefaultModelCachePath, handleUnrecoverableError, logError } from './core/config.js';
|
|
94
|
+
// =============================================================================
|
|
95
|
+
// FILE PROCESSING AND UTILITIES
|
|
96
|
+
// =============================================================================
|
|
97
|
+
// File processing operations
|
|
98
|
+
export { discoverFiles, processFiles, discoverAndProcessFiles, DEFAULT_FILE_PROCESSOR_OPTIONS } from './file-processor.js';
|
|
99
|
+
// Document chunking
|
|
100
|
+
export { chunkDocument } from './core/chunker.js';
|
|
101
|
+
// Path management
|
|
102
|
+
export { DocumentPathManager } from './core/path-manager.js';
|
|
103
|
+
// RAG-lite directory structure management
|
|
104
|
+
export { resolveRagLitePaths, ensureRagLiteStructure, migrateToRagLiteStructure, getStandardRagLitePaths } from './core/raglite-paths.js';
|
|
105
|
+
// =============================================================================
|
|
106
|
+
// ERROR HANDLING
|
|
107
|
+
// =============================================================================
|
|
108
|
+
// Core error handling
|
|
109
|
+
export { handleError, safeExecute, ErrorCategory, ErrorSeverity, createError } from './core/error-handler.js';
|
|
110
|
+
// API-specific errors
|
|
111
|
+
export { APIError, IngestionError, SearchError, ResourceError, ModelCompatibilityError, ErrorFactory, CommonErrors, handleAPIError } from './api-errors.js';
|
|
112
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Standalone indexer script for direct node execution
|
|
4
|
+
* Usage: node indexer.js <path>
|
|
5
|
+
*/
|
|
6
|
+
import { runIngest } from './cli/indexer.js';
|
|
7
|
+
import { EXIT_CODES, ConfigurationError } from './core/config.js';
|
|
8
|
+
async function main() {
|
|
9
|
+
const args = process.argv.slice(2);
|
|
10
|
+
if (args.length === 0) {
|
|
11
|
+
console.error('RAG-lite TS Document Indexer');
|
|
12
|
+
console.error('');
|
|
13
|
+
console.error('Usage: node indexer.js <path>');
|
|
14
|
+
console.error('');
|
|
15
|
+
console.error('Arguments:');
|
|
16
|
+
console.error(' <path> File or directory path to ingest (.md and .txt files)');
|
|
17
|
+
console.error('');
|
|
18
|
+
console.error('Examples:');
|
|
19
|
+
console.error(' node indexer.js ./docs/ # Ingest all .md/.txt/.pdf/.docs files in docs/');
|
|
20
|
+
console.error(' node indexer.js ./readme.md # Ingest single file');
|
|
21
|
+
console.error(' node indexer.js ../project/docs/ # Ingest from parent directory');
|
|
22
|
+
console.error('');
|
|
23
|
+
console.error('Supported file types:');
|
|
24
|
+
console.error(' Text: .md, .txt, .mdx');
|
|
25
|
+
console.error(' Documents: .pdf, .docx');
|
|
26
|
+
console.error(' Images (multimodal mode): .jpg, .jpeg, .png, .gif, .webp, .bmp');
|
|
27
|
+
console.error('');
|
|
28
|
+
console.error('After ingestion, use: node search.js "your query"');
|
|
29
|
+
process.exit(EXIT_CODES.INVALID_ARGUMENTS);
|
|
30
|
+
}
|
|
31
|
+
if (args.length > 1) {
|
|
32
|
+
console.error('Error: Too many arguments provided');
|
|
33
|
+
console.error('');
|
|
34
|
+
console.error('Usage: node indexer.js <path>');
|
|
35
|
+
console.error('');
|
|
36
|
+
console.error('If your path contains spaces, wrap it in quotes:');
|
|
37
|
+
console.error(' node indexer.js "my documents folder"');
|
|
38
|
+
process.exit(EXIT_CODES.INVALID_ARGUMENTS);
|
|
39
|
+
}
|
|
40
|
+
const path = args[0];
|
|
41
|
+
await runIngest(path);
|
|
42
|
+
}
|
|
43
|
+
main().catch((error) => {
|
|
44
|
+
if (error instanceof ConfigurationError) {
|
|
45
|
+
console.error('Configuration Error:');
|
|
46
|
+
console.error(error.message);
|
|
47
|
+
process.exit(error.exitCode);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
console.error('Fatal Error:', error instanceof Error ? error.message : String(error));
|
|
51
|
+
process.exit(EXIT_CODES.GENERAL_ERROR);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=indexer.js.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public API IngestionPipeline - Simple constructor interface with internal factory usage
|
|
3
|
+
*
|
|
4
|
+
* This class provides a clean, simple API while using the new core architecture
|
|
5
|
+
* internally. It handles dependency injection automatically.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // Simple usage
|
|
10
|
+
* const pipeline = new IngestionPipeline('./db.sqlite', './index.bin');
|
|
11
|
+
* await pipeline.ingestDirectory('./documents');
|
|
12
|
+
*
|
|
13
|
+
* // With options
|
|
14
|
+
* const pipeline = new IngestionPipeline('./db.sqlite', './index.bin', {
|
|
15
|
+
* embeddingModel: 'all-MiniLM-L6-v2',
|
|
16
|
+
* chunkSize: 512
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
import { type IngestionFactoryOptions } from './factories/index.js';
|
|
21
|
+
import type { IngestionOptions, IngestionResult } from './core/ingestion.js';
|
|
22
|
+
import type { MemoryContentMetadata } from './core/content-manager.js';
|
|
23
|
+
export declare class IngestionPipeline {
|
|
24
|
+
private dbPath;
|
|
25
|
+
private indexPath;
|
|
26
|
+
private options;
|
|
27
|
+
private corePipeline;
|
|
28
|
+
private initPromise;
|
|
29
|
+
private defaultChunkConfig;
|
|
30
|
+
constructor(dbPath: string, indexPath: string, options?: IngestionFactoryOptions);
|
|
31
|
+
/**
|
|
32
|
+
* Initialize the ingestion pipeline using the factory
|
|
33
|
+
*/
|
|
34
|
+
private initialize;
|
|
35
|
+
/**
|
|
36
|
+
* Ingest a single document
|
|
37
|
+
*/
|
|
38
|
+
ingestDocument(filePath: string, options?: IngestionOptions): Promise<IngestionResult>;
|
|
39
|
+
/**
|
|
40
|
+
* Ingest all documents in a directory
|
|
41
|
+
*/
|
|
42
|
+
ingestDirectory(directoryPath: string, options?: IngestionOptions): Promise<IngestionResult>;
|
|
43
|
+
/**
|
|
44
|
+
* Ingest content from memory buffer
|
|
45
|
+
* Enables MCP integration and real-time content processing
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const pipeline = new IngestionPipeline('./db.sqlite', './index.bin');
|
|
50
|
+
* const contentId = await pipeline.ingestFromMemory(buffer, {
|
|
51
|
+
* displayName: 'uploaded-file.txt',
|
|
52
|
+
* contentType: 'text/plain'
|
|
53
|
+
* });
|
|
54
|
+
* console.log('Content ingested with ID:', contentId);
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
ingestFromMemory(content: Buffer, metadata: MemoryContentMetadata, options?: IngestionOptions): Promise<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Clean up resources
|
|
60
|
+
*/
|
|
61
|
+
cleanup(): Promise<void>;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=ingestion.d.ts.map
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public API IngestionPipeline - Simple constructor interface with internal factory usage
|
|
3
|
+
*
|
|
4
|
+
* This class provides a clean, simple API while using the new core architecture
|
|
5
|
+
* internally. It handles dependency injection automatically.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // Simple usage
|
|
10
|
+
* const pipeline = new IngestionPipeline('./db.sqlite', './index.bin');
|
|
11
|
+
* await pipeline.ingestDirectory('./documents');
|
|
12
|
+
*
|
|
13
|
+
* // With options
|
|
14
|
+
* const pipeline = new IngestionPipeline('./db.sqlite', './index.bin', {
|
|
15
|
+
* embeddingModel: 'all-MiniLM-L6-v2',
|
|
16
|
+
* chunkSize: 512
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
import { IngestionFactory } from './factories/index.js';
|
|
21
|
+
export class IngestionPipeline {
|
|
22
|
+
dbPath;
|
|
23
|
+
indexPath;
|
|
24
|
+
options;
|
|
25
|
+
corePipeline = null;
|
|
26
|
+
initPromise = null;
|
|
27
|
+
defaultChunkConfig = null;
|
|
28
|
+
constructor(dbPath, indexPath, options = {}) {
|
|
29
|
+
this.dbPath = dbPath;
|
|
30
|
+
this.indexPath = indexPath;
|
|
31
|
+
this.options = options;
|
|
32
|
+
// Validate required parameters
|
|
33
|
+
if (!dbPath || typeof dbPath !== 'string' || dbPath.trim() === '') {
|
|
34
|
+
throw new Error('Both dbPath and indexPath are required.\n' +
|
|
35
|
+
'Example: const ingestion = new IngestionPipeline("./db.sqlite", "./index.bin");\n' +
|
|
36
|
+
'Or use: const ingestion = await IngestionFactory.create("./db.sqlite", "./index.bin");');
|
|
37
|
+
}
|
|
38
|
+
if (!indexPath || typeof indexPath !== 'string' || indexPath.trim() === '') {
|
|
39
|
+
throw new Error('Both dbPath and indexPath are required.\n' +
|
|
40
|
+
'Example: const ingestion = new IngestionPipeline("./db.sqlite", "./index.bin");\n' +
|
|
41
|
+
'Or use: const ingestion = await IngestionFactory.create("./db.sqlite", "./index.bin");');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Initialize the ingestion pipeline using the factory
|
|
46
|
+
*/
|
|
47
|
+
async initialize() {
|
|
48
|
+
if (this.corePipeline) {
|
|
49
|
+
return; // Already initialized
|
|
50
|
+
}
|
|
51
|
+
if (this.initPromise) {
|
|
52
|
+
return this.initPromise; // Initialization in progress
|
|
53
|
+
}
|
|
54
|
+
this.initPromise = (async () => {
|
|
55
|
+
this.corePipeline = await IngestionFactory.create(this.dbPath, this.indexPath, this.options);
|
|
56
|
+
})();
|
|
57
|
+
return this.initPromise;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Ingest a single document
|
|
61
|
+
*/
|
|
62
|
+
async ingestDocument(filePath, options) {
|
|
63
|
+
await this.initialize();
|
|
64
|
+
if (!this.corePipeline) {
|
|
65
|
+
throw new Error('IngestionPipeline failed to initialize');
|
|
66
|
+
}
|
|
67
|
+
// Merge mode from constructor options with runtime options
|
|
68
|
+
const mergedOptions = {
|
|
69
|
+
...options,
|
|
70
|
+
mode: options?.mode || this.options.mode
|
|
71
|
+
};
|
|
72
|
+
return this.corePipeline.ingestFile(filePath, mergedOptions);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Ingest all documents in a directory
|
|
76
|
+
*/
|
|
77
|
+
async ingestDirectory(directoryPath, options) {
|
|
78
|
+
await this.initialize();
|
|
79
|
+
if (!this.corePipeline) {
|
|
80
|
+
throw new Error('IngestionPipeline failed to initialize');
|
|
81
|
+
}
|
|
82
|
+
// Merge mode from constructor options with runtime options
|
|
83
|
+
const mergedOptions = {
|
|
84
|
+
...options,
|
|
85
|
+
mode: options?.mode || this.options.mode
|
|
86
|
+
};
|
|
87
|
+
return this.corePipeline.ingestDirectory(directoryPath, mergedOptions);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Ingest content from memory buffer
|
|
91
|
+
* Enables MCP integration and real-time content processing
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const pipeline = new IngestionPipeline('./db.sqlite', './index.bin');
|
|
96
|
+
* const contentId = await pipeline.ingestFromMemory(buffer, {
|
|
97
|
+
* displayName: 'uploaded-file.txt',
|
|
98
|
+
* contentType: 'text/plain'
|
|
99
|
+
* });
|
|
100
|
+
* console.log('Content ingested with ID:', contentId);
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
async ingestFromMemory(content, metadata, options) {
|
|
104
|
+
await this.initialize();
|
|
105
|
+
if (!this.corePipeline) {
|
|
106
|
+
throw new Error('IngestionPipeline failed to initialize');
|
|
107
|
+
}
|
|
108
|
+
// Merge mode from constructor options with runtime options
|
|
109
|
+
const mergedOptions = {
|
|
110
|
+
...options,
|
|
111
|
+
mode: options?.mode || this.options.mode
|
|
112
|
+
};
|
|
113
|
+
return this.corePipeline.ingestFromMemory(content, metadata, mergedOptions);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Clean up resources
|
|
117
|
+
*/
|
|
118
|
+
async cleanup() {
|
|
119
|
+
if (this.corePipeline) {
|
|
120
|
+
await this.corePipeline.cleanup();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=ingestion.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* MCP server entry point for rag-lite-ts with Chameleon Multimodal Architecture
|
|
4
|
+
*
|
|
5
|
+
* This is a thin wrapper around the polymorphic search and ingestion functions
|
|
6
|
+
* that exposes them as MCP tools without creating REST/GraphQL endpoints.
|
|
7
|
+
*
|
|
8
|
+
* The MCP server supports both text-only and multimodal modes:
|
|
9
|
+
* - Text mode: Optimized for text documents using sentence-transformer models
|
|
10
|
+
* - Multimodal mode: Supports mixed text and image content using CLIP models
|
|
11
|
+
*
|
|
12
|
+
* Key Features:
|
|
13
|
+
* - Automatic mode detection from database configuration
|
|
14
|
+
* - Polymorphic runtime that adapts to stored mode settings
|
|
15
|
+
* - Support for multiple embedding models and reranking strategies
|
|
16
|
+
* - Content type filtering and multimodal search capabilities
|
|
17
|
+
* - Comprehensive model and strategy information tools
|
|
18
|
+
*
|
|
19
|
+
* The MCP server lives in the same package as CLI with dual entry points
|
|
20
|
+
* and provides proper MCP tool definitions for search and indexing capabilities.
|
|
21
|
+
*
|
|
22
|
+
* Requirements addressed: 6.2, 6.4, 6.5, 6.6, 9.1, 9.2, 9.3
|
|
23
|
+
*/
|
|
24
|
+
export {};
|
|
25
|
+
/**
|
|
26
|
+
* MCP Server Multimodal Integration Complete
|
|
27
|
+
*
|
|
28
|
+
* This implementation addresses task 9.3 requirements:
|
|
29
|
+
* ✅ Updated MCP server configuration to support multimodal parameters
|
|
30
|
+
* ✅ Added new MCP tools for mode configuration and multimodal search
|
|
31
|
+
* ✅ Integrated with polymorphic runtime system and mode detection
|
|
32
|
+
* ✅ Enhanced error handling for multimodal-specific errors
|
|
33
|
+
* ✅ Created comprehensive documentation and examples
|
|
34
|
+
* ✅ Added support for content type filtering and model selection
|
|
35
|
+
* ✅ Implemented reranking strategy configuration
|
|
36
|
+
* ✅ Provided detailed system information and statistics tools
|
|
37
|
+
*
|
|
38
|
+
* Key Features Added:
|
|
39
|
+
* - Multimodal ingestion with mode and model parameters
|
|
40
|
+
* - Content type filtering in search operations
|
|
41
|
+
* - Comprehensive model and strategy information tools
|
|
42
|
+
* - Enhanced error handling with recovery guidance
|
|
43
|
+
* - Automatic mode detection and polymorphic behavior
|
|
44
|
+
* - Detailed documentation and configuration examples
|
|
45
|
+
*/
|
|
46
|
+
//# sourceMappingURL=mcp-server.d.ts.map
|