@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
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
slug: release-v2.1.3
|
|
3
|
-
title: ✨ Version v2.1.3 Released
|
|
4
|
-
authors: [ali]
|
|
5
|
-
tags: [release, changelog]
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
RAG Pipeline Utils vv2.1.3 is now available on NPM!
|
|
9
|
-
|
|
10
|
-
#### Highlights
|
|
11
|
-
- 🚀 Auto-published blog from GitHub Release
|
|
12
|
-
- 📦 Version bump: v2.1.3
|
|
13
|
-
- 📘 See CHANGELOG.md for full details
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
slug: release-v2.1.4
|
|
3
|
-
title: ✨ Version v2.1.4 Released
|
|
4
|
-
authors: [ali]
|
|
5
|
-
tags: [release, changelog]
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
RAG Pipeline Utils vv2.1.4 is now available on NPM!
|
|
9
|
-
|
|
10
|
-
#### Highlights
|
|
11
|
-
- 🚀 Auto-published blog from GitHub Release
|
|
12
|
-
- 📦 Version bump: v2.1.4
|
|
13
|
-
- 📘 See CHANGELOG.md for full details
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
slug: release-v2.1.5
|
|
3
|
-
title: ✨ Version v2.1.5 Released
|
|
4
|
-
authors: [ali]
|
|
5
|
-
tags: [release, changelog]
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
RAG Pipeline Utils vv2.1.5 is now available on NPM!
|
|
9
|
-
|
|
10
|
-
#### Highlights
|
|
11
|
-
- 🚀 Auto-published blog from GitHub Release
|
|
12
|
-
- 📦 Version bump: v2.1.5
|
|
13
|
-
- 📘 See CHANGELOG.md for full details
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
slug: release-v2.1.6
|
|
3
|
-
title: "🚀 Version v2.1.6 Released"
|
|
4
|
-
authors: [ali]
|
|
5
|
-
tags: [release, changelog]
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
RAG Pipeline Utils **v2.1.6** is now available on NPM!
|
|
9
|
-
|
|
10
|
-
## 🔧 Changes
|
|
11
|
-
|
|
12
|
-
- chore: remove legacy changelog workflow and finalize blog badge
|
|
13
|
-
- ci(workflows): add blog badge verification workflow
|
|
14
|
-
- ci(workflows): add blog badge verification workflow
|
|
15
|
-
- ci(workflows): add blog badge verification workflow
|
|
16
|
-
- docs(blog): add release post for v2.1.5
|
|
17
|
-
|
|
18
|
-
## 🔗 Resources
|
|
19
|
-
|
|
20
|
-
- GitHub Compare: [v2.1.5...v2.1.6](https://github.com/DevilsDev/rag-pipeline-utils/compare/v2.1.5...v2.1.6)
|
|
21
|
-
- View full [CHANGELOG.md](../../CHANGELOG.md)
|
package/docs-site/blog/tags.yml
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# docs-site/blog/tags.yml
|
|
2
|
-
# Description: Central tag definitions for Docusaurus blog filtering and grouping
|
|
3
|
-
|
|
4
|
-
release:
|
|
5
|
-
label: Release
|
|
6
|
-
permalink: /blog/tags/release
|
|
7
|
-
|
|
8
|
-
architecture:
|
|
9
|
-
label: Architecture
|
|
10
|
-
permalink: /blog/tags/architecture
|
|
11
|
-
|
|
12
|
-
prompt-engineering:
|
|
13
|
-
label: Prompt Engineering
|
|
14
|
-
permalink: /blog/tags/prompt-engineering
|
|
15
|
-
|
|
16
|
-
evaluation:
|
|
17
|
-
label: Evaluation
|
|
18
|
-
permalink: /blog/tags/evaluation
|
|
19
|
-
|
|
20
|
-
tutorials:
|
|
21
|
-
label: Tutorials
|
|
22
|
-
permalink: /blog/tags/tutorials
|
|
23
|
-
|
|
24
|
-
changelog:
|
|
25
|
-
label: Changelog
|
|
26
|
-
permalink: /blog/tags/changelog
|
|
27
|
-
|
|
28
|
-
design:
|
|
29
|
-
label: Design
|
|
30
|
-
permalink: /blog/tags/design
|
|
31
|
-
|
|
32
|
-
rag:
|
|
33
|
-
label: RAG
|
|
34
|
-
permalink: /blog/tags/rag
|
|
35
|
-
|
|
36
|
-
developer-tools:
|
|
37
|
-
label: Developer Tools
|
|
38
|
-
permalink: /blog/tags/developer-tools
|
|
39
|
-
|
|
40
|
-
modular:
|
|
41
|
-
label: Modular
|
|
42
|
-
permalink: /blog/tags/modular
|
|
43
|
-
|
|
44
|
-
image:
|
|
45
|
-
label: Image
|
|
46
|
-
permalink: /blog/tags/image
|
|
47
|
-
|
|
48
|
-
facebook:
|
|
49
|
-
label: Facebook
|
|
50
|
-
permalink: /blog/tags/facebook
|
|
51
|
-
|
|
52
|
-
hello:
|
|
53
|
-
label: Hello
|
|
54
|
-
permalink: /blog/tags/hello
|
|
55
|
-
|
|
56
|
-
docusaurus:
|
|
57
|
-
label: Docusaurus
|
|
58
|
-
permalink: /blog/tags/docusaurus
|
|
59
|
-
|
|
60
|
-
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
# Architecture
|
|
2
|
-
|
|
3
|
-
This page outlines the internal architecture of the RAG pipeline utilities, emphasizing modularity, plugin design, and SOLID-compliant structure.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Core Design Philosophy
|
|
8
|
-
|
|
9
|
-
The architecture adheres to enterprise-grade practices:
|
|
10
|
-
|
|
11
|
-
- **Single Responsibility**: Each component handles one domain concern
|
|
12
|
-
- **Pluggable Interfaces**: Any layer (loader, retriever, LLM) can be swapped
|
|
13
|
-
- **Streaming-Ready**: Async flows support token-based output
|
|
14
|
-
- **Environment-Safe**: Config via `.ragrc.json`, not hardcoded
|
|
15
|
-
- **Testable**: All modules can be mocked and unit tested
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## Layered Components
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
+-------------------------+
|
|
23
|
-
| createRagPipeline() |
|
|
24
|
-
+-------------------------+
|
|
25
|
-
| | |
|
|
26
|
-
▼ ▼ ▼
|
|
27
|
-
Loader Embedder Retriever
|
|
28
|
-
▼ | ▼
|
|
29
|
-
Chunks Embeddings Context
|
|
30
|
-
\ | /
|
|
31
|
-
▼ ▼ ▼
|
|
32
|
-
LLM Runner
|
|
33
|
-
|
|
|
34
|
-
Output
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
## Core Interfaces
|
|
40
|
-
|
|
41
|
-
Each plugin is registered via the `PluginRegistry` and looked up by key.
|
|
42
|
-
|
|
43
|
-
```ts
|
|
44
|
-
registry.register('loader', 'pdf', new PDFLoader())
|
|
45
|
-
const loader = registry.get('loader', 'pdf');
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
All plugins implement interface contracts like:
|
|
49
|
-
|
|
50
|
-
```ts
|
|
51
|
-
interface Loader {
|
|
52
|
-
load(path: string): Promise<{ chunk(): string[] }[]>;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
interface Embedder {
|
|
56
|
-
embed(chunks: string[]): Vector[];
|
|
57
|
-
embedQuery(prompt: string): Vector;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
interface Retriever {
|
|
61
|
-
store(vectors: Vector[]): Promise<void>;
|
|
62
|
-
retrieve(query: Vector): Promise<Context[]>;
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
## DAG Support
|
|
69
|
-
|
|
70
|
-
The `dag-engine.js` module supports chaining multiple components:
|
|
71
|
-
- Example: Summarize → Retrieve → Rerank → LLM
|
|
72
|
-
- Enables more complex workflows than linear ingestion/query
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
Next → [Evaluation](./Evaluation.md)
|
package/docs-site/docs/CLI.md
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
# CLI Reference
|
|
2
|
-
|
|
3
|
-
The CLI gives you interactive access to the RAG pipeline tools via terminal.
|
|
4
|
-
|
|
5
|
-
Install globally (optional):
|
|
6
|
-
```bash
|
|
7
|
-
npm install -g @yourorg/rag-pipeline-utils
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
Or run directly from your project:
|
|
11
|
-
```bash
|
|
12
|
-
npx rag-pipeline <command>
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## Commands
|
|
18
|
-
|
|
19
|
-
### `ingest`
|
|
20
|
-
```bash
|
|
21
|
-
rag-pipeline ingest ./docs/sample.pdf --loader pdf
|
|
22
|
-
```
|
|
23
|
-
- Loads and indexes documents into vector store
|
|
24
|
-
|
|
25
|
-
### `query`
|
|
26
|
-
```bash
|
|
27
|
-
rag-pipeline query "Explain vector databases" --llm openai-gpt-4
|
|
28
|
-
```
|
|
29
|
-
- Retrieves context and generates response
|
|
30
|
-
|
|
31
|
-
### `evaluate`
|
|
32
|
-
```bash
|
|
33
|
-
rag-pipeline evaluate ./fixtures/eval.json
|
|
34
|
-
```
|
|
35
|
-
- Runs batch evaluation with BLEU/ROUGE scoring
|
|
36
|
-
|
|
37
|
-
### `rerank`
|
|
38
|
-
```bash
|
|
39
|
-
rag-pipeline rerank "What is RAG?" --retriever pinecone
|
|
40
|
-
```
|
|
41
|
-
- Reorders retrieved context using an LLM reranker
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
## `.ragrc.json` Config
|
|
46
|
-
|
|
47
|
-
Defaults can be set in a file:
|
|
48
|
-
```json
|
|
49
|
-
{
|
|
50
|
-
"loader": "directory",
|
|
51
|
-
"embedder": "openai",
|
|
52
|
-
"retriever": "pinecone",
|
|
53
|
-
"llm": "openai-gpt-4",
|
|
54
|
-
"useReranker": true
|
|
55
|
-
}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
## Docker Usage
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
docker build -t rag-pipeline .
|
|
64
|
-
docker run --rm -v $PWD:/data rag-pipeline query "What is retrieval?"
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
---
|
|
68
|
-
|
|
69
|
-
Next → [Architecture](./Architecture.md)
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
# Evaluation
|
|
2
|
-
|
|
3
|
-
This module allows you to evaluate the quality of generated LLM responses in a RAG pipeline.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Objective
|
|
8
|
-
|
|
9
|
-
Quantify how well the pipeline performs on question-answer pairs using:
|
|
10
|
-
- **BLEU**: Precision on matching tokens
|
|
11
|
-
- **ROUGE**: Recall + overlap on longest subsequences
|
|
12
|
-
- **LLM Feedback** *(planned)*: Score generation based on LLM ratings
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
## Dataset Format
|
|
17
|
-
|
|
18
|
-
Each entry in your JSON dataset should include:
|
|
19
|
-
|
|
20
|
-
```json
|
|
21
|
-
{
|
|
22
|
-
"prompt": "What is a vector index?",
|
|
23
|
-
"groundTruth": "A data structure for fast similarity search in vector spaces."
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Saved as: `sample-eval-dataset.json`
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
## CLI Evaluation
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
rag-pipeline evaluate ./fixtures/sample-eval-dataset.json
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Outputs:
|
|
38
|
-
- Pass/fail per item
|
|
39
|
-
- BLEU/ROUGE scores
|
|
40
|
-
- Aggregated metrics
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## Dashboard Visualization
|
|
45
|
-
|
|
46
|
-
Use the React dashboard under `/public`:
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
node server.js
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Visit: [http://localhost:3000](http://localhost:3000)
|
|
53
|
-
|
|
54
|
-
Displays:
|
|
55
|
-
- Prompt vs Answer
|
|
56
|
-
- Success criteria
|
|
57
|
-
- Metric charts (BLEU, ROUGE)
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
Next → [Plugins](./Plugins.md)
|
package/docs-site/docs/FAQ.md
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# FAQ
|
|
2
|
-
|
|
3
|
-
### Can I use this with my own vector database?
|
|
4
|
-
Yes! You can implement the `Retriever` interface and register it:
|
|
5
|
-
```ts
|
|
6
|
-
registry.register('retriever', 'mydb', new MyRetriever());
|
|
7
|
-
```
|
|
8
|
-
Then use it via CLI or `.ragrc.json`.
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
### Is streaming LLM response supported?
|
|
13
|
-
Yes. LLM runners can yield async output tokens. This is handled internally via `AsyncIterable` in compatible models.
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
### How do I evaluate performance?
|
|
18
|
-
Use `rag-pipeline evaluate dataset.json` or open the dashboard at `http://localhost:3000` to visualize BLEU/ROUGE and pass rates.
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
### What file types can I ingest?
|
|
23
|
-
Currently supported:
|
|
24
|
-
- `.pdf` (mocked)
|
|
25
|
-
- `.md`
|
|
26
|
-
- `.html`
|
|
27
|
-
- `.csv`
|
|
28
|
-
- Full directory ingestion
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
### Can I rerank results using a local model?
|
|
33
|
-
Yes, as long as your local LLM implements:
|
|
34
|
-
```ts
|
|
35
|
-
llm.generate(prompt, context): Promise<string>
|
|
36
|
-
```
|
|
37
|
-
Use it to power `LLMReranker`.
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
### How do I contribute?
|
|
42
|
-
Fork the repo → add your plugin or CLI feature → test → submit PR.
|
|
43
|
-
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
Still stuck? Open an issue at [GitHub](https://github.com/DevilsDev/rag-pipeline-utils/issues).
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
Next → [Back to Introduction](./Introduction.md)
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 1
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Introduction
|
|
6
|
-
|
|
7
|
-
Welcome to **@DevilsDev/rag-pipeline-utils**, a modular Node.js toolkit for building scalable, pluggable Retrieval-Augmented Generation (RAG) systems.
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## What is RAG?
|
|
12
|
-
|
|
13
|
-
RAG combines information retrieval with large language models to enhance generation with factual grounding. It typically involves:
|
|
14
|
-
|
|
15
|
-
1. **Retrieving** relevant context (documents, chunks) from a vector store
|
|
16
|
-
2. **Generating** answers using an LLM, augmented by that context
|
|
17
|
-
|
|
18
|
-
This project provides all the composable parts to build your own RAG pipeline.
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## Why Use This Toolkit?
|
|
23
|
-
|
|
24
|
-
- **Plugin-based**: Swap in your own loaders, retrievers, LLMs
|
|
25
|
-
- **Streaming-ready**: Async-friendly, token-by-token output
|
|
26
|
-
- **CLI & API**: Use from terminal or integrate programmatically
|
|
27
|
-
- **Evaluation built-in**: BLEU, ROUGE, dashboard UI
|
|
28
|
-
- **Enterprise-quality**: SOLID, tested, typed, and CI-ready
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
## Architecture
|
|
33
|
-
|
|
34
|
-
Each RAG pipeline includes:
|
|
35
|
-
|
|
36
|
-
- `loader`: Document loader (e.g., PDF, Markdown, HTML)
|
|
37
|
-
- `embedder`: Embedding model interface (OpenAI, Cohere, local)
|
|
38
|
-
- `retriever`: Vector store adapter (e.g., Pinecone, Chroma)
|
|
39
|
-
- `llm`: Language model runner (OpenAI, Ollama, GPT-4-V)
|
|
40
|
-
- `reranker`: (Optional) Context re-ranking module via LLM
|
|
41
|
-
|
|
42
|
-
The pipeline can be used via code or via CLI commands.
|
|
43
|
-
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
## Status
|
|
47
|
-
|
|
48
|
-
This project is:
|
|
49
|
-
- Production-ready
|
|
50
|
-
- Covered by unit/integration tests
|
|
51
|
-
- Compatible with Node.js `>=18`
|
|
52
|
-
- Published to npm under `DevilsDev`
|
|
53
|
-
|
|
54
|
-
---
|
|
55
|
-
|
|
56
|
-
Let’s get started!
|
|
57
|
-
|
|
58
|
-
Next → [Usage](./Usage.md)
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
# Plugins
|
|
2
|
-
|
|
3
|
-
The toolkit is fully modular. You can inject your own loaders, retrievers, embedders, or LLMs.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Plugin Architecture
|
|
8
|
-
|
|
9
|
-
All plugins follow a strict interface pattern. Each is registered under a namespace using the plugin registry:
|
|
10
|
-
|
|
11
|
-
```ts
|
|
12
|
-
registry.register('loader', 'my-custom', new MyLoader());
|
|
13
|
-
const loader = registry.get('loader', 'my-custom');
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
You can register plugins for:
|
|
17
|
-
- `loader`
|
|
18
|
-
- `embedder`
|
|
19
|
-
- `retriever`
|
|
20
|
-
- `llm`
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## Loader Example
|
|
25
|
-
|
|
26
|
-
```ts
|
|
27
|
-
class MyMarkdownLoader {
|
|
28
|
-
async load(filePath) {
|
|
29
|
-
const raw = fs.readFileSync(filePath, 'utf-8');
|
|
30
|
-
return [{ chunk: () => raw.split('\n\n') }];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Register it:
|
|
36
|
-
```ts
|
|
37
|
-
registry.register('loader', 'md', new MyMarkdownLoader());
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## Runtime Override
|
|
43
|
-
|
|
44
|
-
CLI and API will resolve plugin names from `pluginRegistry`. Use:
|
|
45
|
-
|
|
46
|
-
```json
|
|
47
|
-
{
|
|
48
|
-
"loader": "md",
|
|
49
|
-
"embedder": "cohere",
|
|
50
|
-
"retriever": "chroma",
|
|
51
|
-
"llm": "openai-gpt-4"
|
|
52
|
-
}
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
in `.ragrc.json`
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
|
|
59
|
-
This design keeps the core minimal and lets you evolve.
|
|
60
|
-
|
|
61
|
-
Next → [FAQ](./FAQ.md)
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: Tutorials
|
|
3
|
-
title: Tutorials & Onboarding
|
|
4
|
-
sidebar_label: Tutorials
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
Welcome to the **RAG Pipeline Utils** tutorial section. These guides will help developers quickly onboard, integrate, and extend the modular RAG system.
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## 1. Install the Package
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm install @devilsdev/rag-pipeline-utils
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## 2. Ingest Documents Using CLI
|
|
20
|
-
|
|
21
|
-
This CLI command loads PDFs, embeds them, and stores the vectors.
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
npx rag-utils ingest ./sample.pdf --config .ragrc.json
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Ensure you have a valid `.ragrc.json` config:
|
|
28
|
-
|
|
29
|
-
```json
|
|
30
|
-
{
|
|
31
|
-
"loader": { "pdf": "./src/mocks/pdf-loader.js" },
|
|
32
|
-
"embedder": { "openai": "./src/mocks/openai-embedder.js" },
|
|
33
|
-
"retriever": { "pinecone": "./src/mocks/pinecone-retriever.js" },
|
|
34
|
-
"llm": { "openai": "./src/mocks/openai-llm.js" },
|
|
35
|
-
"namespace": "docs-example",
|
|
36
|
-
"pipeline": ["loader", "embedder", "retriever"]
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## 3. Run a Query Using CLI
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
npx rag-utils query "What is this document about?" --config .ragrc.json
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
## 4. Register a Custom Plugin
|
|
51
|
-
|
|
52
|
-
You can create your own loader/retriever/LLM:
|
|
53
|
-
|
|
54
|
-
```js
|
|
55
|
-
// src/plugins/my-custom-llm.js
|
|
56
|
-
export default class MyCustomLLM {
|
|
57
|
-
ask(prompt) {
|
|
58
|
-
return `Custom response to: ${prompt}`;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
Then reference it in `.ragrc.json`:
|
|
64
|
-
|
|
65
|
-
```json
|
|
66
|
-
"llm": {
|
|
67
|
-
"custom": "./src/plugins/my-custom-llm.js"
|
|
68
|
-
}
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
---
|
|
72
|
-
|
|
73
|
-
## 5. Validate Plugin Mocks
|
|
74
|
-
|
|
75
|
-
Ensure all mocks meet contract interfaces before commit:
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
npm run validate-fixtures
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## 6. Run All Tests + Coverage
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
npm run ci
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
This runs:
|
|
90
|
-
|
|
91
|
-
- Linting
|
|
92
|
-
- Fixture validation
|
|
93
|
-
- Unit/integration tests
|
|
94
|
-
- Coverage reporting
|
|
95
|
-
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
## Next Steps
|
|
99
|
-
|
|
100
|
-
- Explore `/src/core/plugin-registry.js` for plugin orchestration
|
|
101
|
-
- Browse `/scripts/` for CI and release utilities
|
|
102
|
-
- View `/__tests__/` for end-to-end RAG validation flows
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
Looking to build on top of this? Check out [Use Cases](./Use-Cases.md) for advanced scenarios.
|
package/docs-site/docs/Usage.md
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
# Usage
|
|
2
|
-
|
|
3
|
-
This guide covers how to use `@yourorg/rag-pipeline-utils` programmatically via API and through the CLI.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Installation
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install @yourorg/rag-pipeline-utils
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Programmatic API
|
|
16
|
-
|
|
17
|
-
Import and instantiate a RAG pipeline:
|
|
18
|
-
|
|
19
|
-
```js
|
|
20
|
-
import { createRagPipeline } from '@yourorg/rag-pipeline-utils';
|
|
21
|
-
|
|
22
|
-
const pipeline = createRagPipeline({
|
|
23
|
-
loader: 'markdown',
|
|
24
|
-
embedder: 'openai',
|
|
25
|
-
retriever: 'pinecone',
|
|
26
|
-
llm: 'openai-gpt-4',
|
|
27
|
-
useReranker: true
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const answer = await pipeline.query("What is retrieval-augmented generation?");
|
|
31
|
-
console.log(answer);
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## Pipeline Methods
|
|
37
|
-
|
|
38
|
-
- `pipeline.ingest(path: string)` → Load, chunk, embed, and store vectors
|
|
39
|
-
- `pipeline.query(prompt: string)` → Retrieve context, rerank (optional), and call LLM
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
## Plugin Configuration
|
|
44
|
-
|
|
45
|
-
You can customize the pipeline by registering plugins:
|
|
46
|
-
|
|
47
|
-
```js
|
|
48
|
-
registry.register('loader', 'custom', new MyCustomLoader());
|
|
49
|
-
registry.register('retriever', 'opensearch', new MyOpenSearchRetriever());
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
---
|
|
53
|
-
|
|
54
|
-
## Configuration via `.ragrc.json`
|
|
55
|
-
|
|
56
|
-
Create a JSON file at your root:
|
|
57
|
-
|
|
58
|
-
```json
|
|
59
|
-
{
|
|
60
|
-
"loader": "directory",
|
|
61
|
-
"embedder": "openai",
|
|
62
|
-
"retriever": "pinecone",
|
|
63
|
-
"llm": "openai-gpt-4",
|
|
64
|
-
"useReranker": true
|
|
65
|
-
}
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Used automatically when no CLI args are passed.
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
|
|
72
|
-
Next → [CLI](./CLI.md)
|