@devilsdev/rag-pipeline-utils 2.1.7 → 2.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/LICENSE +674 -674
  2. package/README.md +395 -186
  3. package/bin/cli.js +14 -62
  4. package/contracts/embedder-contract.json +52 -0
  5. package/contracts/llm-contract.json +36 -0
  6. package/contracts/loader-contract.json +43 -0
  7. package/contracts/retriever-contract.json +68 -0
  8. package/dist/index.cjs +67 -0
  9. package/dist/index.mjs +51 -0
  10. package/package.json +107 -21
  11. package/.codecov.yml +0 -21
  12. package/.dockerignore +0 -14
  13. package/.eslintignore +0 -5
  14. package/.eslintrc.json +0 -28
  15. package/.github/PROJECT_ROADMAP.md +0 -102
  16. package/.github/PULL_REQUEST_TEMPLATE.md +0 -8
  17. package/.github/release-template.md +0 -20
  18. package/.github/workflows/auto-release-note.yml +0 -73
  19. package/.github/workflows/ci.yml +0 -55
  20. package/.github/workflows/docs-ci.yml +0 -46
  21. package/.github/workflows/docs-deploy.yml +0 -64
  22. package/.github/workflows/enforce-release-review.yml +0 -50
  23. package/.github/workflows/generate-blog-post.yml +0 -44
  24. package/.github/workflows/post-release-generate-blog.yml +0 -71
  25. package/.github/workflows/publish-release-blog.yml +0 -47
  26. package/.github/workflows/release-sync.yml +0 -50
  27. package/.github/workflows/roadmap-label-sync.yml +0 -35
  28. package/.github/workflows/roadmap-labels.yml +0 -67
  29. package/.github/workflows/roadmap-sync.yml +0 -44
  30. package/.github/workflows/sync-roadmap.yml +0 -62
  31. package/.github/workflows/verify-blog-badge.yml +0 -50
  32. package/.husky/pre-commit +0 -6
  33. package/CHANGELOG.md +0 -131
  34. package/Dockerfile +0 -22
  35. package/Use-Cases.md +0 -134
  36. package/__tests__/fixtures/.ragrc.json +0 -8
  37. package/__tests__/fixtures/invalid-ragrc.json +0 -4
  38. package/__tests__/fixtures/sample-eval-dataset.json +0 -15
  39. package/__tests__/fixtures/sample.pdf +0 -1
  40. package/__tests__/fixtures/src/mocks/openai-embedder.js +0 -16
  41. package/__tests__/fixtures/src/mocks/openai-llm.js +0 -9
  42. package/__tests__/fixtures/src/mocks/pdf-loader.js +0 -17
  43. package/__tests__/fixtures/src/mocks/pinecone-retriever.js +0 -26
  44. package/__tests__/fixtures/valid-ragrc.json +0 -16
  45. package/__tests__/integration/cli/config-flow.test.js +0 -98
  46. package/__tests__/integration/config/load-config.test.js +0 -67
  47. package/__tests__/scripts/ensure-roadmap-labels.test.js +0 -64
  48. package/__tests__/unit/config/validate-schema.test.js +0 -121
  49. package/__tests__/unit/core/plugin-registry.test.js +0 -55
  50. package/__tests__/unit/reranker/__snapshots__/reranker.snapshot.test.js.snap +0 -15
  51. package/__tests__/unit/reranker/llm-reranker.test.js +0 -18
  52. package/__tests__/unit/reranker/reranker.enriched.test.js +0 -19
  53. package/__tests__/unit/reranker/reranker.fallback.test.js +0 -15
  54. package/__tests__/unit/reranker/reranker.snapshot.test.js +0 -15
  55. package/__tests__/unit/reranker/reranker.structured-output.test.js +0 -17
  56. package/codecov +0 -0
  57. package/codecov.SHA256SUM +0 -1
  58. package/codecov.SHA256SUM.sig +0 -16
  59. package/docs-site/README.md +0 -41
  60. package/docs-site/blog/2025-04-18-architecture-overview.md +0 -16
  61. package/docs-site/blog/2025-04-18-release-v2.1.1.md +0 -13
  62. package/docs-site/blog/2025-04-19-prompt-engineering-best-practices.md +0 -16
  63. package/docs-site/blog/2025-04-20-image-showcase.md +0 -14
  64. package/docs-site/blog/2025-04-20-release-2.1.1.md +0 -21
  65. package/docs-site/blog/2025-04-21-release-v2.1.3.md +0 -13
  66. package/docs-site/blog/2025-04-21-release-v2.1.4.md +0 -13
  67. package/docs-site/blog/2025-04-22-release-v2.1.5.md +0 -13
  68. package/docs-site/blog/2025-04-24-v2.1.6.md +0 -21
  69. package/docs-site/blog/authors.yml +0 -5
  70. package/docs-site/blog/tags.yml +0 -60
  71. package/docs-site/docs/Architecture.md +0 -76
  72. package/docs-site/docs/CLI.md +0 -69
  73. package/docs-site/docs/Evaluation.md +0 -61
  74. package/docs-site/docs/FAQ.md +0 -50
  75. package/docs-site/docs/Introduction.md +0 -58
  76. package/docs-site/docs/Plugins.md +0 -61
  77. package/docs-site/docs/Tutorials.md +0 -106
  78. package/docs-site/docs/Usage.md +0 -72
  79. package/docs-site/docs/Use-Cases.md +0 -77
  80. package/docs-site/docs/intro.mdx +0 -6
  81. package/docs-site/docusaurus.config.js +0 -88
  82. package/docs-site/package-lock.json +0 -17914
  83. package/docs-site/package.json +0 -47
  84. package/docs-site/sidebars.js +0 -39
  85. package/docs-site/src/components/HomepageFeatures/index.js +0 -56
  86. package/docs-site/src/components/HomepageFeatures/index.module.css +0 -57
  87. package/docs-site/src/components/HomepageHeader/index.js +0 -46
  88. package/docs-site/src/components/HomepageHeader/index.module.css +0 -77
  89. package/docs-site/src/css/custom.css +0 -104
  90. package/docs-site/src/pages/index.js +0 -20
  91. package/docs-site/src/pages/index.module.css +0 -23
  92. package/docs-site/src/pages/markdown-page.md +0 -7
  93. package/docs-site/static/.nojekyll +0 -0
  94. package/docs-site/static/img/authors/ali.jpg +0 -0
  95. package/docs-site/static/img/hero.jpg +0 -0
  96. package/docs-site/static/img/logo.png +0 -0
  97. package/docs-site/static/img/logo.svg +0 -6
  98. package/docs-site/static/img/social-card.jpg +0 -0
  99. package/jest.config.js +0 -24
  100. package/plugin.config.json +0 -14
  101. package/public/index.html +0 -0
  102. package/public/results/sample-eval.json +0 -0
  103. package/public/src/App.jsx +0 -57
  104. package/release.config.js +0 -36
  105. package/scripts/banner-injector.js +0 -102
  106. package/scripts/ci-runner.js +0 -51
  107. package/scripts/close-done-roadmap-issues.js +0 -65
  108. package/scripts/create-roadmap-issues.js +0 -47
  109. package/scripts/ensure-roadmap-labels.js +0 -73
  110. package/scripts/fix-mdx-blog-imports.js +0 -50
  111. package/scripts/fix-mdx-image-imports.js +0 -27
  112. package/scripts/generate-release-note.js +0 -110
  113. package/scripts/get-previous-tag.js +0 -40
  114. package/scripts/label-roadmap-issues.js +0 -125
  115. package/scripts/manual-test-checklist.md +0 -90
  116. package/scripts/repair-fixtures.js +0 -30
  117. package/scripts/setup.js +0 -31
  118. package/scripts/sync-labels.js +0 -71
  119. package/scripts/sync-roadmap-labels.js +0 -21
  120. package/scripts/tag-release.js +0 -64
  121. package/scripts/test-global-setup.js +0 -18
  122. package/scripts/validate-changelog-version.js +0 -48
  123. package/scripts/verify-fixture-mocks.js +0 -45
  124. package/scripts/verify-fixtures.js +0 -36
  125. package/server.js +0 -31
  126. package/src/config/load-config.js +0 -33
  127. package/src/config/load-plugin-config.js +0 -56
  128. package/src/config/validate-plugin-schema.js +0 -28
  129. package/src/config/validate-schema.js +0 -107
  130. package/src/core/create-pipeline.js +0 -96
  131. package/src/core/plugin-contracts.js +0 -21
  132. package/src/core/plugin-registry.js +0 -48
  133. package/src/dag/dag-engine.js +0 -70
  134. package/src/evaluate/evaluator.js +0 -44
  135. package/src/evaluate/scoring.js +0 -74
  136. package/src/loader/csv-loader.js +0 -30
  137. package/src/loader/directory-loader.js +0 -38
  138. package/src/loader/html-loader.js +0 -57
  139. package/src/loader/markdown-loader.js +0 -58
  140. package/src/mocks/openai-embedder.js +0 -30
  141. package/src/mocks/openai-llm.js +0 -18
  142. package/src/mocks/pdf-loader.js +0 -17
  143. package/src/mocks/pinecone-retriever.js +0 -25
  144. package/src/reranker/llm-reranker.js +0 -34
  145. package/src/utils/ci/diagnostic-reporter.js +0 -36
  146. package/src/utils/logger.js +0 -29
  147. package/src/utils/retry.js +0 -42
  148. package/src/utils/validate-plugin-contract.js +0 -36
package/README.md CHANGED
@@ -1,186 +1,395 @@
1
- # @DevilsDev/rag-pipeline-utils
2
-
3
-
4
-
5
- # RAG Pipeline Utils
6
-
7
- > Modular utilities for building Retrieval-Augmented Generation (RAG) pipelines, with CI-verified plugin contracts and mockable interfaces.
8
-
9
- [![CI](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/ci.yml/badge.svg)](https://github.com/DevilsDev/rag-pipeline-utils/actions)
10
- [![codecov](https://codecov.io/gh/DevilsDev/rag-pipeline-utils/branch/main/graph/badge.svg)](https://codecov.io/gh/DevilsDev/rag-pipeline-utils)
11
- ![Release](https://img.shields.io/github/v/release/DevilsDev/rag-pipeline-utils?label=release)
12
- ![License](https://img.shields.io/github/license/devilsdev/rag-pipeline-utils)
13
- ![Release Review Passed](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/enforce-release-review.yml/badge.svg?branch=main)
14
- [![Docs Deploy](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/docs-deploy.yml/badge.svg)](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/docs-deploy.yml)
15
- [![Docs CI](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/docs-ci.yml/badge.svg)](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/docs-ci.yml)
16
- [![Blog Generated](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/post-release-generate-blog.yml/badge.svg?branch=main)](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/post-release-generate-blog.yml)
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
- ## Description
25
-
26
- `@devilsdev/rag-pipeline-utils` provides a clean, extensible, and test-friendly foundation for constructing robust RAG pipelines using a plugin-based architecture. It enables developers to plug in their own document loaders, embedders, retrievers, and LLMs via configuration, and includes a CLI, mock contract verification, schema validation, and test harnesses to ensure production-readiness.
27
-
28
- ## Key Features
29
-
30
- - **Plugin Contracts**: Runtime and CI verification of plugin interfaces (loader, embedder, retriever, llm).
31
- - **CLI Support**: Easily run `ingest` and `query` commands using `.ragrc.json` configuration.
32
- - **Test Fixtures**: Snapshot, fallback, and structured reranker validation.
33
- - **Schema Enforcement**: `.ragrc.json` schema validation to catch config issues early.
34
- - **Mock Repair Utilities**: Auto-fix for missing or broken mock implementations.
35
- - **Modular Design**: Drop-in plugin support using custom class-based implementations.
36
-
37
- ## Benefits of This Modular Design
38
-
39
- - **Extensibility**: Developers can inject their own loader, retriever, or LLM logic without modifying the core.
40
- - **Testability**: Mocks and CI tools validate contract adherence for reliable test coverage.
41
- - **Decoupling**: Each plugin can be independently implemented and swapped in via `.ragrc.json`.
42
- - **CI Resilience**: The CI pipeline includes linting, contract verification, and test coverage enforcement.
43
-
44
- ## Installation
45
-
46
- ```bash
47
- npm install @devilsdev/rag-pipeline-utils
48
- ```
49
-
50
- ## Basic Usage
51
-
52
- 1. Create a `.ragrc.json` config:
53
-
54
- ```json
55
- {
56
- "loader": {
57
- "pdf": "./src/mocks/pdf-loader.js"
58
- },
59
- "embedder": {
60
- "openai": "./src/mocks/openai-embedder.js"
61
- },
62
- "retriever": {
63
- "pinecone": "./src/mocks/pinecone-retriever.js"
64
- },
65
- "llm": {
66
- "openai": "./src/mocks/openai-llm.js"
67
- },
68
- "namespace": "demo-namespace",
69
- "pipeline": ["loader", "embedder", "retriever"]
70
- }
71
- ```
72
-
73
- 2. Run an ingestion:
74
-
75
- ```bash
76
- node bin/cli.js ingest ./docs/sample.pdf
77
- ```
78
-
79
- 3. Run a query:
80
-
81
- ```bash
82
- node bin/cli.js query "What is in the document?"
83
- ```
84
-
85
- ## Plugin Contracts
86
-
87
- Each plugin must implement the following interface:
88
-
89
- | Type | Required Methods |
90
- | --------- | ------------------------------------------- |
91
- | loader | `load(filePath)` |
92
- | embedder | `embed(documents)`, `embedQuery(query)` |
93
- | retriever | `store(vectors)`, `search(queryVector)` |
94
- | llm | `ask(prompt)` |
95
-
96
- ## Folder Structure
97
-
98
- ```text
99
- /project-root
100
- ├── /src
101
- │ ├── /routes
102
- │ ├── /services
103
- │ ├── /utils
104
- │ └── app.js
105
- ├── /scripts
106
- │ ├── setup.js
107
- │ ├── ci-runner.js
108
- │ └── repair-fixtures.js
109
- ├── /__tests__
110
- │ ├── /fixtures
111
- │ ├── /unit
112
- │ ├── /integration
113
- ├── /public
114
- ├── README.md
115
- ├── USE_CASES.md
116
- ├── CHANGELOG.md
117
- └── .env.example
118
- ```
119
-
120
-
121
-
122
- ## Why Use This?
123
-
124
- - **Developer Experience**: Fast iteration, full contract CI
125
- - **Pluggable Design**: Swap in your stack (OpenAI, Pinecone, Langchain, etc.)
126
- - **Minimal & Modular**: Clean separation of concerns
127
- - **Prod-ready**: 100% test coverage, schema validation, CLI control
128
-
129
-
130
-
131
- ## Use Cases
132
-
133
- Explore real-world DevX-focused examples in [USE_CASES.md](./Use-Cases.md), including:
134
-
135
- - Mock-driven plugin TDD
136
- - CI-based interface validation
137
- - Multivendor ingestion and search
138
- - Runtime swap of LLM, retrievers, or embedders
139
- - Bootstrap pipelines with auto-repairable defaults
140
-
141
-
142
-
143
- ## Contributing
144
-
145
- We welcome contributions via PRs, especially new mock providers, validation helpers, and runtime extensions. Please follow the test + CI conventions before submitting.
146
-
147
-
148
-
149
- ## Contributors Guide
150
-
151
- For active maintainers and collaborators:
152
-
153
- - **Roadmap & Feature Planning**
154
- See [.github/PROJECT_ROADMAP.md](.github/PROJECT_ROADMAP.md) for the implementation phases, priorities, and tracking tags for all major developer-facing features.
155
-
156
- - **Milestone Tags**
157
- | Tag | Description |
158
- |-------------|------------------------------------|
159
- | `phase-1` | Foundation – testing, CI, tutorials |
160
- | `phase-2` | Community, blog, discussions |
161
- | `phase-3` | CLI, VS Code tools, theming |
162
- | `phase-4` | i18n, integrations, case studies |
163
-
164
- _Note: This file is not included in public documentation builds._
165
-
166
-
167
- ## Manual Test Checklist
168
-
169
- For full validation of roadmap sync, changelog automation, CI/CD, and blog generation:
170
-
171
- ➡️ [View Manual Test Checklist](scripts/manual-test-checklist.md)
172
-
173
- ## Manual CI Rollout
174
-
175
- git commit --allow-empty -m "ci(test): trigger all CI workflows"
176
- git push origin main
177
-
178
-
179
- ## License
180
-
181
- This project is licensed under the **GNU GPL v3.0** License - see the [LICENSE](./LICENSE) file for details.
182
-
183
- ---
184
-
185
- Built with ❤️ by [Ali Kahwaji].
186
-
1
+ # @DevilsDev/rag-pipeline-utils
2
+
3
+ [![CI](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/ci.yml/badge.svg)](https://github.com/DevilsDev/rag-pipeline-utils/actions)
4
+ [![npm version](https://badge.fury.io/js/%40devilsdev%2Frag-pipeline-utils.svg)](https://badge.fury.io/js/%40devilsdev%2Frag-pipeline-utils)
5
+ [![Enterprise Ready](https://img.shields.io/badge/Enterprise-Ready-green.svg)](https://github.com/DevilsDev/rag-pipeline-utils)
6
+ [![Node.js Version](https://img.shields.io/node/v/@devilsdev/rag-pipeline-utils.svg)](https://nodejs.org/)
7
+ [![License](https://img.shields.io/npm/l/@devilsdev/rag-pipeline-utils.svg)](https://github.com/DevilsDev/rag-pipeline-utils/blob/main/LICENSE)
8
+ [![codecov](https://codecov.io/gh/DevilsDev/rag-pipeline-utils/branch/main/graph/badge.svg)](https://codecov.io/gh/DevilsDev/rag-pipeline-utils)
9
+ [![Downloads](https://img.shields.io/npm/dm/@devilsdev/rag-pipeline-utils.svg)](https://www.npmjs.com/package/@devilsdev/rag-pipeline-utils)
10
+
11
+ > **Enterprise-grade RAG Pipeline Utils toolkit for Node.js** — Build production-ready Retrieval-Augmented Generation systems with modular plugins, streaming support, and comprehensive observability.
12
+
13
+ ## Overview
14
+
15
+ `@devilsdev/rag-pipeline-utils` is a modular toolkit for building scalable RAG (Retrieval-Augmented Generation) pipelines in Node.js. Designed for enterprise applications, it provides a plugin-based architecture with built-in streaming, performance optimization, observability, and comprehensive testing utilities.
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+ ## ✨ Key Features
24
+
25
+ ### 🔌 **Plugin Architecture**
26
+ - **Modular Components**: Swap loaders, embedders, retrievers, LLMs, and rerankers without code changes
27
+ - **Contract Validation**: Runtime and CI verification of plugin interfaces
28
+ - **Plugin Marketplace**: Discover and publish community plugins
29
+ - **Hot-swappable**: Change components via configuration without restarts
30
+
31
+ ### 🚀 **Performance & Scalability**
32
+ - **Streaming Support**: Real-time token streaming for LLM responses
33
+ - **Parallel Processing**: Concurrent embedding and retrieval operations
34
+ - **Memory Safeguards**: Automatic backpressure and memory management
35
+ - **Benchmarking Tools**: Built-in performance measurement and optimization
36
+
37
+ ### 📊 **Enterprise Observability**
38
+ - **Structured Logging**: Comprehensive event tracking and debugging
39
+ - **Metrics Collection**: Performance counters, histograms, and gauges
40
+ - **Distributed Tracing**: OpenTelemetry-compatible request tracing
41
+ - **Health Monitoring**: Built-in diagnostics and system health checks
42
+
43
+ ### 🛠️ **Developer Experience**
44
+ - **CLI Tools**: Full-featured command-line interface
45
+ - **Interactive Wizard**: Guided pipeline setup and configuration
46
+ - **Plugin Scaffolding**: Generate new plugins with best practices
47
+ - **Comprehensive Testing**: Unit, integration, and contract testing utilities
48
+
49
+ ### 🔒 **Production Ready**
50
+ - **Schema Validation**: Strict configuration validation with JSON Schema
51
+ - **Error Handling**: Robust error recovery and reporting
52
+ - **Type Safety**: Full TypeScript support and JSDoc annotations
53
+ - **CI/CD Integration**: GitHub Actions workflows and automated testing
54
+
55
+ ### 🛡️ **Enterprise Security**
56
+ - **Zero Critical Vulnerabilities**: 98→17 vulnerabilities eliminated (83% reduction)
57
+ - **Automated Security Monitoring**: GitHub Dependabot with weekly vulnerability scans
58
+ - **CI/CD Security Integration**: Build failure on critical vulnerabilities
59
+ - **Compliance Ready**: OWASP, NIST, and CIS security standards
60
+ - **Dependency Validation**: Automated license and security compliance checking
61
+ - **Security Audit Tools**: Built-in `npm run security:audit` and reporting
62
+
63
+ ## 📦 Installation
64
+
65
+ ### Prerequisites
66
+ - **Node.js** 18.0.0 or higher
67
+ - **npm** or **yarn** package manager
68
+
69
+ ### Install via npm
70
+ ```bash
71
+ npm install -g @devilsdev/rag-pipeline-utils
72
+ ```
73
+
74
+ ### Install as project dependency
75
+ ```bash
76
+ npm install @devilsdev/rag-pipeline-utils
77
+ ```
78
+
79
+ ## 🚀 Quick Start
80
+
81
+ ### 1. Initialize a new RAG pipeline
82
+ ```bash
83
+ rag-pipeline init
84
+ ```
85
+ This launches an interactive wizard to configure your pipeline with preferred plugins.
86
+
87
+ ### 2. Configure your pipeline
88
+ Create a `.ragrc.json` configuration file:
89
+
90
+ ```json
91
+ {
92
+ "loader": {
93
+ "pdf": "@devilsdev/pdf-loader",
94
+ "markdown": "@devilsdev/markdown-loader"
95
+ },
96
+ "embedder": {
97
+ "openai": "@devilsdev/openai-embedder"
98
+ },
99
+ "retriever": {
100
+ "chroma": "@devilsdev/chroma-retriever"
101
+ },
102
+ "llm": {
103
+ "openai": "@devilsdev/openai-llm"
104
+ },
105
+ "pipeline": {
106
+ "loader": "pdf",
107
+ "embedder": "openai",
108
+ "retriever": "chroma",
109
+ "llm": "openai"
110
+ },
111
+ "performance": {
112
+ "maxConcurrency": 5,
113
+ "enableStreaming": true,
114
+ "enableObservability": true
115
+ }
116
+ }
117
+ ```
118
+
119
+ ## 🖥️ CLI Usage
120
+
121
+ ### Document Ingestion
122
+ ```bash
123
+ # Ingest documents with automatic plugin detection
124
+ rag-pipeline ingest ./docs --loader pdf --embedder openai --retriever chroma
125
+
126
+ # Ingest with streaming and performance monitoring
127
+ rag-pipeline ingest ./docs --stream --benchmark --trace
128
+
129
+ # Batch ingest multiple document types
130
+ rag-pipeline ingest ./docs/**/*.{pdf,md,txt} --parallel --batch-size 10
131
+ ```
132
+
133
+ ### Querying
134
+ ```bash
135
+ # Basic query
136
+ rag-pipeline query "What is vector search?" --llm openai
137
+
138
+ # Streaming query with real-time responses
139
+ rag-pipeline query "Explain RAG architecture" --llm openai --stream
140
+
141
+ # Query with custom retrieval parameters
142
+ rag-pipeline query "How does embedding work?" --top-k 5 --similarity-threshold 0.8
143
+ ```
144
+
145
+ ### Advanced Workflows
146
+ ```bash
147
+ # Run complex DAG pipelines
148
+ rag-pipeline dag run ./examples/academic-rag.yaml
149
+
150
+ # Interactive pipeline builder
151
+ rag-pipeline wizard
152
+
153
+ # System diagnostics and health check
154
+ rag-pipeline doctor
155
+
156
+ # Plugin management
157
+ rag-pipeline plugin list
158
+ rag-pipeline plugin install @community/custom-embedder
159
+ rag-pipeline plugin scaffold my-custom-loader
160
+ ```
161
+
162
+ ## 🔌 Plugin Architecture
163
+
164
+ ### Plugin Contracts
165
+ Each plugin type implements a standardized interface with runtime validation:
166
+
167
+ | Plugin Type | Required Methods | Optional Methods | Description |
168
+ |-------------|------------------|------------------|-------------|
169
+ | **Loader** | `load(filePath)` | `validate()`, `getMetadata()` | Document ingestion and parsing |
170
+ | **Embedder** | `embed(texts)`, `embedQuery(query)` | `getDimensions()`, `getBatchSize()` | Text vectorization |
171
+ | **Retriever** | `store(vectors)`, `retrieve(queryVector)` | `delete()`, `update()` | Vector storage and similarity search |
172
+ | **LLM** | `generate(prompt)`, `stream(prompt)` | `getTokenCount()`, `getModels()` | Language model inference |
173
+ | **Reranker** | `rerank(query, documents)` | `getScore()` | Result relevance optimization |
174
+
175
+ ### Plugin Development
176
+ ```javascript
177
+ // Example: Custom embedder plugin
178
+ export class MyCustomEmbedder {
179
+ constructor(options = {}) {
180
+ this.apiKey = options.apiKey;
181
+ this.model = options.model || 'text-embedding-ada-002';
182
+ }
183
+
184
+ async embed(texts) {
185
+ // Implementation for batch embedding
186
+ return vectors;
187
+ }
188
+
189
+ async embedQuery(query) {
190
+ // Implementation for single query embedding
191
+ return vector;
192
+ }
193
+
194
+ // Plugin metadata (required)
195
+ static metadata = {
196
+ name: 'my-custom-embedder',
197
+ version: '1.0.0',
198
+ type: 'embedder',
199
+ description: 'Custom embedding implementation'
200
+ };
201
+ }
202
+ ```
203
+
204
+ ## 🏗️ Architecture Overview
205
+
206
+ ```
207
+ ┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
208
+ │ CLI Interface │────│ Pipeline Engine │────│ Plugin Registry │
209
+ └─────────────────┘ └──────────────────┘ └─────────────────┘
210
+ │
211
+ ┌───────────────┼───────────────┐
212
+ │ │ │
213
+ ┌───────▼──────┐ ┌──────▼──────┐ ┌─────▼─────┐
214
+ │ Observability│ │Performance │ │ DAG │
215
+ │ System │ │ Optimizer │ │ Engine │
216
+ └──────────────┘ └─────────────┘ └───────────┘
217
+ │ │ │
218
+ ┌───────▼──────┐ ┌──────▼──────┐ ┌─────▼─────┐
219
+ │ Logging │ │ Streaming │ │Workflow │
220
+ │ Tracing │ │ Parallel │ │Execution │
221
+ │ Metrics │ │ Memory │ │Validation │
222
+ └──────────────┘ └─────────────┘ └───────────┘
223
+ ```
224
+
225
+ ## 📁 Project Structure
226
+
227
+ ```
228
+ @devilsdev/rag-pipeline-utils/
229
+ ├── bin/
230
+ │ └── cli.js # CLI entry point
231
+ ├── src/
232
+ │ ├── cli/ # Command-line interface
233
+ │ │ ├── enhanced-cli-commands.js
234
+ │ │ ├── interactive-wizard.js
235
+ │ │ ├── doctor-command.js
236
+ │ │ └── plugin-marketplace-commands.js
237
+ │ ├── core/ # Core pipeline engine
238
+ │ │ ├── create-pipeline.js
239
+ │ │ ├── plugin-registry.js
240
+ │ │ ├── plugin-contracts.js
241
+ │ │ ├── observability/ # Monitoring & logging
242
+ │ │ ├── performance/ # Optimization tools
243
+ │ │ └── plugin-marketplace/
244
+ │ ├── config/ # Configuration management
245
+ │ │ ├── load-config.js
246
+ │ │ └── enhanced-ragrc-schema.js
247
+ │ ├── dag/ # DAG workflow engine
248
+ │ │ └── dag-engine.js
249
+ │ ├── utils/ # Utility functions
250
+ │ │ ├── logger.js
251
+ │ │ ├── retry.js
252
+ │ │ └── plugin-scaffolder.js
253
+ │ └── mocks/ # Development mocks
254
+ ├── __tests__/ # Test suites
255
+ │ ├── unit/
256
+ │ ├── integration/
257
+ │ └── fixtures/
258
+ ├── docs/ # Documentation
259
+ ├── examples/ # Usage examples
260
+ ├── scripts/ # Build & maintenance
261
+ ├── .ragrc.schema.json # Configuration schema
262
+ ├── package.json
263
+ └── README.md
264
+ ```
265
+
266
+
267
+
268
+ ## 📚 Configuration
269
+
270
+ ### Environment Variables
271
+ ```bash
272
+ # OpenAI Configuration
273
+ OPENAI_API_KEY=your_openai_api_key
274
+ OPENAI_MODEL=gpt-4
275
+
276
+ # Vector Database Configuration
277
+ PINECONE_API_KEY=your_pinecone_key
278
+ PINECONE_ENVIRONMENT=us-west1-gcp
279
+
280
+ # Performance Settings
281
+ RAG_MAX_CONCURRENCY=5
282
+ RAG_BATCH_SIZE=10
283
+ RAG_ENABLE_STREAMING=true
284
+ ```
285
+
286
+ ### Advanced Configuration
287
+ ```json
288
+ {
289
+ "pipeline": {
290
+ "loader": "pdf",
291
+ "embedder": "openai",
292
+ "retriever": "chroma",
293
+ "llm": "openai",
294
+ "reranker": "cross-encoder"
295
+ },
296
+ "performance": {
297
+ "maxConcurrency": 5,
298
+ "batchSize": 10,
299
+ "enableStreaming": true,
300
+ "enableObservability": true,
301
+ "maxMemoryMB": 512,
302
+ "tokenLimit": 100000
303
+ },
304
+ "observability": {
305
+ "enableLogging": true,
306
+ "enableTracing": true,
307
+ "enableMetrics": true,
308
+ "logLevel": "info",
309
+ "exportFormat": "json"
310
+ },
311
+ "plugins": {
312
+ "marketplace": {
313
+ "registryUrl": "https://registry.rag-pipeline.dev",
314
+ "autoUpdate": false,
315
+ "allowPrerelease": false
316
+ }
317
+ }
318
+ }
319
+ ```
320
+
321
+ ## 🚀 Use Cases
322
+
323
+ ### Enterprise Document Processing
324
+ - **Legal Document Analysis**: Process contracts, agreements, and legal documents
325
+ - **Technical Documentation**: Index API docs, manuals, and knowledge bases
326
+ - **Research Papers**: Academic literature search and analysis
327
+ - **Customer Support**: FAQ automation and ticket resolution
328
+
329
+ ### Development Workflows
330
+ - **Code Documentation**: Generate and maintain code documentation
331
+ - **API Integration**: Semantic search across API documentation
332
+ - **Knowledge Management**: Team knowledge base and onboarding
333
+ - **Content Generation**: Automated content creation and editing
334
+
335
+ ### Industry Applications
336
+ - **Healthcare**: Medical literature search and clinical decision support
337
+ - **Finance**: Financial document analysis and compliance
338
+ - **Education**: Personalized learning and content recommendation
339
+ - **E-commerce**: Product search and recommendation systems
340
+
341
+ ## 🤝 Contributing
342
+
343
+ We welcome contributions from the community! Here's how you can help:
344
+
345
+ ### Development Setup
346
+ ```bash
347
+ # Clone the repository
348
+ git clone https://github.com/DevilsDev/rag-pipeline-utils.git
349
+ cd rag-pipeline-utils
350
+
351
+ # Install dependencies
352
+ npm install
353
+
354
+ # Run tests
355
+ npm test
356
+
357
+ # Run linting
358
+ npm run lint
359
+
360
+ # Start development server
361
+ npm run dev
362
+ ```
363
+
364
+ ### Contribution Guidelines
365
+ - **Plugin Development**: Create new plugins following our [Plugin Developer Guide](./docs/PLUGIN_DEVELOPER_GUIDE.md)
366
+ - **Bug Reports**: Use GitHub Issues with detailed reproduction steps
367
+ - **Feature Requests**: Discuss new features in GitHub Discussions
368
+ - **Documentation**: Help improve docs and examples
369
+ - **Testing**: Add tests for new features and bug fixes
370
+
371
+ ### Community
372
+ - 💬 [GitHub Discussions](https://github.com/DevilsDev/rag-pipeline-utils/discussions) - Questions and community chat
373
+ - 🐛 [GitHub Issues](https://github.com/DevilsDev/rag-pipeline-utils/issues) - Bug reports and feature requests
374
+ - 📖 [Documentation](https://devilsdev.github.io/rag-pipeline-utils/) - Comprehensive guides and API docs
375
+ - 🔌 [Plugin Marketplace](https://registry.rag-pipeline.dev) - Community plugins and extensions
376
+
377
+ ## 📄 License
378
+
379
+ This project is licensed under the **Apache License 2.0** - see the [LICENSE](LICENSE) file for details.
380
+
381
+ ## 🙏 Acknowledgments
382
+
383
+ - Built with ❤️ by [Ali Kahwaji](https://github.com/alikahwaji) and the DevilsDev team
384
+ - Inspired by the open-source AI/ML community
385
+ - Special thanks to all [contributors](https://github.com/DevilsDev/rag-pipeline-utils/graphs/contributors)
386
+
387
+ ---
388
+
389
+ <div align="center">
390
+ <strong>Ready to build your next RAG application?</strong><br>
391
+ <a href="#-installation">Get Started</a> •
392
+ <a href="https://devilsdev.github.io/rag-pipeline-utils/">Documentation</a> •
393
+ <a href="https://github.com/DevilsDev/rag-pipeline-utils/discussions">Community</a>
394
+ </div>
395
+
package/bin/cli.js CHANGED
@@ -1,62 +1,14 @@
1
- /**
2
- * Version: 1.1.0
3
- * Description: Final CLI entrypoint with dynamic plugin loading and full config validation
4
- * Author: Ali Kahwaji
5
- */
6
-
7
- import { resolve } from 'path';
8
- import { fileURLToPath } from 'url';
9
- import { loadRagConfig } from '../src/config/load-config.js';
10
- import { loadPluginsFromJson } from '../src/config/load-plugin-config.js';
11
- import registry from '../src/core/plugin-registry.js';
12
-
13
- const __filename = fileURLToPath(import.meta.url);
14
- const __dirname = resolve(__filename, '..');
15
- const CONFIG_PATH = resolve('.ragrc.json');
16
-
17
- const args = process.argv.slice(2);
18
- const command = args[0];
19
-
20
- async function runCLI() {
21
- try {
22
- const config = loadRagConfig(CONFIG_PATH);
23
- await loadPluginsFromJson(CONFIG_PATH);
24
-
25
- switch (command) {
26
- case 'ingest': {
27
- const input = args[1];
28
- const loader = registry.get('loader', Object.keys(config.loader)[0]);
29
- const embedder = registry.get('embedder', Object.keys(config.embedder)[0]);
30
- const retriever = registry.get('retriever', Object.keys(config.retriever)[0]);
31
-
32
- const docs = await loader.load(input);
33
- const vectors = await embedder.embed(docs);
34
- await retriever.store(vectors, config.namespace);
35
-
36
- console.log('Ingestion complete');
37
- break;
38
- }
39
- case 'query': {
40
- const question = args.slice(1).join(' ');
41
- const embedder = registry.get('embedder', Object.keys(config.embedder)[0]);
42
- const retriever = registry.get('retriever', Object.keys(config.retriever)[0]);
43
- const llm = registry.get('llm', Object.keys(config.llm)[0]);
44
-
45
- const queryVec = await embedder.embedQuery(question);
46
- const docs = await retriever.search(queryVec, config.namespace);
47
- const answer = await llm.ask(question, docs);
48
-
49
- console.log('Answer:', answer);
50
- break;
51
- }
52
- default:
53
- console.error('Unknown command:', command);
54
- process.exit(1);
55
- }
56
- } catch (err) {
57
- console.error('Error during execution:', err.message);
58
- process.exit(1);
59
- }
60
- }
61
-
62
- await runCLI();
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Enhanced RAG Pipeline CLI with comprehensive UX improvements
5
+ * Integrates observability, plugin marketplace, interactive wizard, and diagnostics
6
+ */
7
+
8
+ import { runEnhancedCLI } from '../src/cli/enhanced-cli-commands.js';
9
+
10
+ // Run the enhanced CLI
11
+ runEnhancedCLI().catch(error => {
12
+ console.error('❌ CLI error:', error.message);
13
+ process.exit(1);
14
+ });