@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.
- package/LICENSE +674 -674
- package/README.md +395 -186
- package/bin/cli.js +14 -62
- package/contracts/embedder-contract.json +52 -0
- package/contracts/llm-contract.json +36 -0
- package/contracts/loader-contract.json +43 -0
- package/contracts/retriever-contract.json +68 -0
- package/dist/index.cjs +67 -0
- package/dist/index.mjs +51 -0
- package/package.json +107 -21
- package/.codecov.yml +0 -21
- package/.dockerignore +0 -14
- package/.eslintignore +0 -5
- package/.eslintrc.json +0 -28
- package/.github/PROJECT_ROADMAP.md +0 -102
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -8
- package/.github/release-template.md +0 -20
- package/.github/workflows/auto-release-note.yml +0 -73
- package/.github/workflows/ci.yml +0 -55
- package/.github/workflows/docs-ci.yml +0 -46
- package/.github/workflows/docs-deploy.yml +0 -64
- package/.github/workflows/enforce-release-review.yml +0 -50
- package/.github/workflows/generate-blog-post.yml +0 -44
- package/.github/workflows/post-release-generate-blog.yml +0 -71
- package/.github/workflows/publish-release-blog.yml +0 -47
- package/.github/workflows/release-sync.yml +0 -50
- package/.github/workflows/roadmap-label-sync.yml +0 -35
- package/.github/workflows/roadmap-labels.yml +0 -67
- package/.github/workflows/roadmap-sync.yml +0 -44
- package/.github/workflows/sync-roadmap.yml +0 -62
- package/.github/workflows/verify-blog-badge.yml +0 -50
- package/.husky/pre-commit +0 -6
- package/CHANGELOG.md +0 -131
- package/Dockerfile +0 -22
- package/Use-Cases.md +0 -134
- package/__tests__/fixtures/.ragrc.json +0 -8
- package/__tests__/fixtures/invalid-ragrc.json +0 -4
- package/__tests__/fixtures/sample-eval-dataset.json +0 -15
- package/__tests__/fixtures/sample.pdf +0 -1
- package/__tests__/fixtures/src/mocks/openai-embedder.js +0 -16
- package/__tests__/fixtures/src/mocks/openai-llm.js +0 -9
- package/__tests__/fixtures/src/mocks/pdf-loader.js +0 -17
- package/__tests__/fixtures/src/mocks/pinecone-retriever.js +0 -26
- package/__tests__/fixtures/valid-ragrc.json +0 -16
- package/__tests__/integration/cli/config-flow.test.js +0 -98
- package/__tests__/integration/config/load-config.test.js +0 -67
- package/__tests__/scripts/ensure-roadmap-labels.test.js +0 -64
- package/__tests__/unit/config/validate-schema.test.js +0 -121
- package/__tests__/unit/core/plugin-registry.test.js +0 -55
- package/__tests__/unit/reranker/__snapshots__/reranker.snapshot.test.js.snap +0 -15
- package/__tests__/unit/reranker/llm-reranker.test.js +0 -18
- package/__tests__/unit/reranker/reranker.enriched.test.js +0 -19
- package/__tests__/unit/reranker/reranker.fallback.test.js +0 -15
- package/__tests__/unit/reranker/reranker.snapshot.test.js +0 -15
- package/__tests__/unit/reranker/reranker.structured-output.test.js +0 -17
- package/codecov +0 -0
- package/codecov.SHA256SUM +0 -1
- package/codecov.SHA256SUM.sig +0 -16
- package/docs-site/README.md +0 -41
- package/docs-site/blog/2025-04-18-architecture-overview.md +0 -16
- package/docs-site/blog/2025-04-18-release-v2.1.1.md +0 -13
- package/docs-site/blog/2025-04-19-prompt-engineering-best-practices.md +0 -16
- package/docs-site/blog/2025-04-20-image-showcase.md +0 -14
- package/docs-site/blog/2025-04-20-release-2.1.1.md +0 -21
- package/docs-site/blog/2025-04-21-release-v2.1.3.md +0 -13
- package/docs-site/blog/2025-04-21-release-v2.1.4.md +0 -13
- package/docs-site/blog/2025-04-22-release-v2.1.5.md +0 -13
- package/docs-site/blog/2025-04-24-v2.1.6.md +0 -21
- package/docs-site/blog/authors.yml +0 -5
- package/docs-site/blog/tags.yml +0 -60
- package/docs-site/docs/Architecture.md +0 -76
- package/docs-site/docs/CLI.md +0 -69
- package/docs-site/docs/Evaluation.md +0 -61
- package/docs-site/docs/FAQ.md +0 -50
- package/docs-site/docs/Introduction.md +0 -58
- package/docs-site/docs/Plugins.md +0 -61
- package/docs-site/docs/Tutorials.md +0 -106
- package/docs-site/docs/Usage.md +0 -72
- package/docs-site/docs/Use-Cases.md +0 -77
- package/docs-site/docs/intro.mdx +0 -6
- package/docs-site/docusaurus.config.js +0 -88
- package/docs-site/package-lock.json +0 -17914
- package/docs-site/package.json +0 -47
- package/docs-site/sidebars.js +0 -39
- package/docs-site/src/components/HomepageFeatures/index.js +0 -56
- package/docs-site/src/components/HomepageFeatures/index.module.css +0 -57
- package/docs-site/src/components/HomepageHeader/index.js +0 -46
- package/docs-site/src/components/HomepageHeader/index.module.css +0 -77
- package/docs-site/src/css/custom.css +0 -104
- package/docs-site/src/pages/index.js +0 -20
- package/docs-site/src/pages/index.module.css +0 -23
- package/docs-site/src/pages/markdown-page.md +0 -7
- package/docs-site/static/.nojekyll +0 -0
- package/docs-site/static/img/authors/ali.jpg +0 -0
- package/docs-site/static/img/hero.jpg +0 -0
- package/docs-site/static/img/logo.png +0 -0
- package/docs-site/static/img/logo.svg +0 -6
- package/docs-site/static/img/social-card.jpg +0 -0
- package/jest.config.js +0 -24
- package/plugin.config.json +0 -14
- package/public/index.html +0 -0
- package/public/results/sample-eval.json +0 -0
- package/public/src/App.jsx +0 -57
- package/release.config.js +0 -36
- package/scripts/banner-injector.js +0 -102
- package/scripts/ci-runner.js +0 -51
- package/scripts/close-done-roadmap-issues.js +0 -65
- package/scripts/create-roadmap-issues.js +0 -47
- package/scripts/ensure-roadmap-labels.js +0 -73
- package/scripts/fix-mdx-blog-imports.js +0 -50
- package/scripts/fix-mdx-image-imports.js +0 -27
- package/scripts/generate-release-note.js +0 -110
- package/scripts/get-previous-tag.js +0 -40
- package/scripts/label-roadmap-issues.js +0 -125
- package/scripts/manual-test-checklist.md +0 -90
- package/scripts/repair-fixtures.js +0 -30
- package/scripts/setup.js +0 -31
- package/scripts/sync-labels.js +0 -71
- package/scripts/sync-roadmap-labels.js +0 -21
- package/scripts/tag-release.js +0 -64
- package/scripts/test-global-setup.js +0 -18
- package/scripts/validate-changelog-version.js +0 -48
- package/scripts/verify-fixture-mocks.js +0 -45
- package/scripts/verify-fixtures.js +0 -36
- package/server.js +0 -31
- package/src/config/load-config.js +0 -33
- package/src/config/load-plugin-config.js +0 -56
- package/src/config/validate-plugin-schema.js +0 -28
- package/src/config/validate-schema.js +0 -107
- package/src/core/create-pipeline.js +0 -96
- package/src/core/plugin-contracts.js +0 -21
- package/src/core/plugin-registry.js +0 -48
- package/src/dag/dag-engine.js +0 -70
- package/src/evaluate/evaluator.js +0 -44
- package/src/evaluate/scoring.js +0 -74
- package/src/loader/csv-loader.js +0 -30
- package/src/loader/directory-loader.js +0 -38
- package/src/loader/html-loader.js +0 -57
- package/src/loader/markdown-loader.js +0 -58
- package/src/mocks/openai-embedder.js +0 -30
- package/src/mocks/openai-llm.js +0 -18
- package/src/mocks/pdf-loader.js +0 -17
- package/src/mocks/pinecone-retriever.js +0 -25
- package/src/reranker/llm-reranker.js +0 -34
- package/src/utils/ci/diagnostic-reporter.js +0 -36
- package/src/utils/logger.js +0 -29
- package/src/utils/retry.js +0 -42
- 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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
[](https://github.com/DevilsDev/rag-pipeline-utils/actions)
|
|
4
|
+
[](https://badge.fury.io/js/%40devilsdev%2Frag-pipeline-utils)
|
|
5
|
+
[](https://github.com/DevilsDev/rag-pipeline-utils)
|
|
6
|
+
[](https://nodejs.org/)
|
|
7
|
+
[](https://github.com/DevilsDev/rag-pipeline-utils/blob/main/LICENSE)
|
|
8
|
+
[](https://codecov.io/gh/DevilsDev/rag-pipeline-utils)
|
|
9
|
+
[](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
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
+
});
|