@devilsdev/rag-pipeline-utils 2.0.0 β 2.1.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/.eslintrc.json +24 -18
- package/.github/workflows/docs-deploy.yml +46 -0
- package/.github/workflows/publish-release-blog.yml +53 -0
- package/.github/workflows/storybook-deploy.yml +33 -0
- package/.husky/pre-commit +1 -0
- package/.storybook/main.js +20 -0
- package/.storybook/preview.js +13 -0
- package/CHANGELOG.md +15 -1
- package/README.md +101 -72
- package/Use-Cases.md +134 -0
- package/docs-site/.plaiceholder-cache/img_hero.jpg.json +1 -0
- package/docs-site/.plaiceholder-cache/img_logo.png.json +1 -0
- package/docs-site/.storybook/preview.js +8 -0
- package/docs-site/blog/2021-08-26-welcome/index.md +0 -1
- package/docs-site/blog/2025-04-17-release-2.0.md +67 -0
- package/docs-site/blog/2025-04-17-release-v2.0.2.md +13 -0
- package/docs-site/blog/2025-04-18-architecture-overview.md +34 -0
- package/docs-site/blog/2025-04-18-release-2.0.0.md +21 -0
- package/docs-site/blog/2025-04-19-prompt-engineering-best-practices.md +31 -0
- package/docs-site/blog/2025-04-20-image-showcase.md +23 -0
- package/docs-site/blog/authors.yml +5 -23
- package/docs-site/blog/tags.yml +27 -16
- package/docs-site/docs/Architecture.md +4 -4
- package/docs-site/docs/CLI.md +3 -3
- package/docs-site/docs/Evaluation.md +7 -7
- package/docs-site/docs/FAQ.md +6 -6
- package/docs-site/docs/Introduction.md +9 -9
- package/docs-site/docs/Plugins.md +3 -3
- package/docs-site/docs/Tutorials.md +106 -0
- package/docs-site/docs/Usage.md +5 -5
- package/docs-site/docs/Use-Cases.md +77 -0
- package/docs-site/docs/components/BlogCardExample.mdx +7 -0
- package/docs-site/docusaurus.config.js +16 -2
- package/docs-site/package-lock.json +487 -2
- package/docs-site/package.json +7 -3
- package/docs-site/scripts/generate-placeholders.js +17 -0
- package/docs-site/scripts/watch-images.js +40 -0
- package/docs-site/sidebar-snippet.txt +5 -0
- package/docs-site/sidebars.js +26 -9
- package/docs-site/src/components/BlogCard.jsx +31 -0
- package/docs-site/src/components/BlogCard.stories.jsx +34 -0
- package/docs-site/src/components/BlogImage.jsx +58 -0
- package/docs-site/src/components/BlogImage.stories.jsx +20 -0
- package/docs-site/static/img/authors/ali.jpg +0 -0
- package/docs-site/static/img/hero.jpg +0 -0
- package/docs-site/utils/image.js +19 -0
- package/package.json +27 -3
- package/scripts/validate-changelog-version.js +48 -0
- package/src/stories/Button.jsx +39 -0
- package/src/stories/Button.stories.js +49 -0
- package/src/stories/Configure.mdx +364 -0
- package/src/stories/Header.jsx +56 -0
- package/src/stories/Header.stories.js +29 -0
- package/src/stories/Page.jsx +69 -0
- package/src/stories/Page.stories.js +28 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/stories/button.css +30 -0
- package/src/stories/header.css +32 -0
- package/src/stories/page.css +68 -0
- package/docs-site/blog/2019-05-28-first-blog-post.md +0 -12
- package/docs-site/blog/2019-05-29-long-blog-post.md +0 -44
- package/docs-site/blog/2021-08-01-mdx-blog-post.mdx +0 -24
package/.eslintrc.json
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
"env": {
|
|
3
|
+
"es2022": true,
|
|
4
|
+
"node": true,
|
|
5
|
+
"jest": true
|
|
6
|
+
},
|
|
7
|
+
"extends": [
|
|
8
|
+
"eslint:recommended",
|
|
9
|
+
"plugin:storybook/recommended"
|
|
10
|
+
],
|
|
11
|
+
"parserOptions": {
|
|
12
|
+
"ecmaVersion": "latest",
|
|
13
|
+
"sourceType": "module"
|
|
14
|
+
},
|
|
15
|
+
"rules": {
|
|
16
|
+
"no-unused-vars": "warn",
|
|
17
|
+
"no-console": "off",
|
|
18
|
+
"semi": [
|
|
19
|
+
"error",
|
|
20
|
+
"always"
|
|
9
21
|
],
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
"rules": {
|
|
15
|
-
"no-unused-vars": "warn",
|
|
16
|
-
"no-console": "off",
|
|
17
|
-
"semi": ["error", "always"],
|
|
18
|
-
"quotes": ["error", "single"]
|
|
19
|
-
}
|
|
22
|
+
"quotes": [
|
|
23
|
+
"error",
|
|
24
|
+
"single"
|
|
25
|
+
]
|
|
20
26
|
}
|
|
21
|
-
|
|
27
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# .github/workflows/docs-deploy.yml
|
|
2
|
+
# Version: 1.1.0
|
|
3
|
+
# Description: Deploys Docusaurus to GitHub Pages on changes to documentation files
|
|
4
|
+
# Author: Ali Kahwaji
|
|
5
|
+
|
|
6
|
+
name: π Deploy Docusaurus Docs
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
branches: [main]
|
|
11
|
+
paths:
|
|
12
|
+
- 'docs-site/**'
|
|
13
|
+
- 'docs/**'
|
|
14
|
+
- 'blog/**'
|
|
15
|
+
- 'sidebars.js'
|
|
16
|
+
- 'docusaurus.config.js'
|
|
17
|
+
- 'package.json'
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
deploy:
|
|
21
|
+
name: Deploy to GitHub Pages
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
|
|
24
|
+
steps:
|
|
25
|
+
- name: π₯ Checkout repository
|
|
26
|
+
uses: actions/checkout@v4
|
|
27
|
+
|
|
28
|
+
- name: βοΈ Setup Node.js
|
|
29
|
+
uses: actions/setup-node@v4
|
|
30
|
+
with:
|
|
31
|
+
node-version: 20
|
|
32
|
+
|
|
33
|
+
- name: π¦ Install dependencies
|
|
34
|
+
run: npm ci
|
|
35
|
+
|
|
36
|
+
- name: π οΈ Build Docusaurus site
|
|
37
|
+
run: npm run docs:build
|
|
38
|
+
|
|
39
|
+
- name: π Deploy to GitHub Pages
|
|
40
|
+
uses: peaceiris/actions-gh-pages@v4
|
|
41
|
+
with:
|
|
42
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
43
|
+
publish_dir: ./docs-site/build
|
|
44
|
+
publish_branch: gh-pages
|
|
45
|
+
user_name: github-actions[bot]
|
|
46
|
+
user_email: 41898282+github-actions[bot]@users.noreply.github.com
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# .github/workflows/publish-release-blog.yml
|
|
2
|
+
# Version: 1.1.0
|
|
3
|
+
# Description: Auto-publish blog post from CHANGELOG or prepared .md after NPM release
|
|
4
|
+
# Author: Ali Kahwaji
|
|
5
|
+
|
|
6
|
+
name: β¨ Publish Release Blog Post
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
release:
|
|
10
|
+
types: [published]
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
publish-blog-post:
|
|
14
|
+
name: Generate & Commit Blog Post
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: β¬οΈ Checkout main branch
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
with:
|
|
21
|
+
ref: main # β
Ensures blog is committed to 'main'
|
|
22
|
+
fetch-depth: 0
|
|
23
|
+
|
|
24
|
+
- name: π§ Set up Node.js
|
|
25
|
+
uses: actions/setup-node@v4
|
|
26
|
+
with:
|
|
27
|
+
node-version: 20
|
|
28
|
+
|
|
29
|
+
- name: βοΈ Generate blog post
|
|
30
|
+
run: |
|
|
31
|
+
VERSION=${GITHUB_REF#refs/tags/}
|
|
32
|
+
DATE=$(date +'%Y-%m-%d')
|
|
33
|
+
FILE="docs-site/blog/${DATE}-release-${VERSION}.md"
|
|
34
|
+
|
|
35
|
+
echo "---" > $FILE
|
|
36
|
+
echo "slug: release-${VERSION}" >> $FILE
|
|
37
|
+
echo "title: β¨ Version ${VERSION} Released" >> $FILE
|
|
38
|
+
echo "authors: [ali]" >> $FILE
|
|
39
|
+
echo "tags: [release, changelog]" >> $FILE
|
|
40
|
+
echo "---" >> $FILE
|
|
41
|
+
echo >> $FILE
|
|
42
|
+
echo "RAG Pipeline Utils v${VERSION} is now available on NPM!" >> $FILE
|
|
43
|
+
echo >> $FILE
|
|
44
|
+
echo "#### Highlights" >> $FILE
|
|
45
|
+
echo "- π Auto-published blog from GitHub release" >> $FILE
|
|
46
|
+
echo "- π¦ Version bump: ${VERSION}" >> $FILE
|
|
47
|
+
echo "- π See CHANGELOG.md for full details" >> $FILE
|
|
48
|
+
|
|
49
|
+
- name: π Commit blog post
|
|
50
|
+
uses: stefanzweifel/git-auto-commit-action@v5
|
|
51
|
+
with:
|
|
52
|
+
commit_message: "docs(blog): add release post for ${{ github.ref_name }}"
|
|
53
|
+
file_pattern: "docs-site/blog/*.md"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# .github/workflows/storybook-deploy.yml
|
|
2
|
+
name: π Deploy Storybook
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
paths:
|
|
8
|
+
- 'docs-site/src/components/**'
|
|
9
|
+
- '.storybook/**'
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
deploy-storybook:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Setup Node
|
|
19
|
+
uses: actions/setup-node@v4
|
|
20
|
+
with:
|
|
21
|
+
node-version: 20
|
|
22
|
+
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
run: npm ci
|
|
25
|
+
|
|
26
|
+
- name: Build Storybook
|
|
27
|
+
run: npm run build-storybook
|
|
28
|
+
|
|
29
|
+
- name: Deploy to GitHub Pages
|
|
30
|
+
uses: peaceiris/actions-gh-pages@v4
|
|
31
|
+
with:
|
|
32
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
33
|
+
publish_dir: ./storybook-static
|
package/.husky/pre-commit
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
/** @type { import('@storybook/react-webpack5').StorybookConfig } */
|
|
4
|
+
const config = {
|
|
5
|
+
"stories": [
|
|
6
|
+
"../src/**/*.mdx",
|
|
7
|
+
"../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"
|
|
8
|
+
],
|
|
9
|
+
"addons": [
|
|
10
|
+
"@storybook/addon-webpack5-compiler-swc",
|
|
11
|
+
"@storybook/addon-essentials",
|
|
12
|
+
"@storybook/addon-onboarding",
|
|
13
|
+
"@storybook/addon-interactions"
|
|
14
|
+
],
|
|
15
|
+
"framework": {
|
|
16
|
+
"name": "@storybook/react-webpack5",
|
|
17
|
+
"options": {}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export default config;
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
# [2.
|
|
3
|
+
# [2.1.0](https://github.com/DevilsDev/rag-pipeline-utils/compare/v2.0.2...v2.1.0) (2025-04-18)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **docs-site:** add Storybook integration with BlogCard + LQIP image automation ([80965b8](https://github.com/DevilsDev/rag-pipeline-utils/commit/80965b8ef1d26372852ee0f39b56a73f337e0cea))
|
|
9
|
+
|
|
10
|
+
## [2.0.1](https://github.com/DevilsDev/rag-pipeline-utils/compare/v2.0.0...v2.0.1) (2025-04-17)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* add @docusaurus/preset-classic to enable CI builds ([ed5e771](https://github.com/DevilsDev/rag-pipeline-utils/commit/ed5e771f919face4693a6a7abfed4cf0fe1325ca))
|
|
16
|
+
|
|
17
|
+
## [2.0.0] - 2025-04-17 (2025-04-17)
|
|
4
18
|
|
|
5
19
|
|
|
6
20
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -1,117 +1,146 @@
|
|
|
1
1
|
# @DevilsDev/rag-pipeline-utils
|
|
2
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
|
+
|
|
3
9
|
[](https://github.com/DevilsDev/rag-pipeline-utils/actions)
|
|
4
10
|
[](https://codecov.io/gh/DevilsDev/rag-pipeline-utils)
|
|
5
11
|

|
|
12
|
+

|
|
6
13
|
|
|
7
|
-
|
|
14
|
+
## Description
|
|
8
15
|
|
|
9
|
-
|
|
16
|
+
`@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.
|
|
10
17
|
|
|
11
|
-
## Features
|
|
18
|
+
## Key Features
|
|
12
19
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
- β
Reranker support and evaluation tooling
|
|
20
|
-
- β
React dashboard for evaluation results
|
|
20
|
+
- **Plugin Contracts**: Runtime and CI verification of plugin interfaces (loader, embedder, retriever, llm).
|
|
21
|
+
- **CLI Support**: Easily run `ingest` and `query` commands using `.ragrc.json` configuration.
|
|
22
|
+
- **Test Fixtures**: Snapshot, fallback, and structured reranker validation.
|
|
23
|
+
- **Schema Enforcement**: `.ragrc.json` schema validation to catch config issues early.
|
|
24
|
+
- **Mock Repair Utilities**: Auto-fix for missing or broken mock implementations.
|
|
25
|
+
- **Modular Design**: Drop-in plugin support using custom class-based implementations.
|
|
21
26
|
|
|
22
|
-
|
|
27
|
+
## Benefits of This Modular Design
|
|
28
|
+
|
|
29
|
+
- **Extensibility**: Developers can inject their own loader, retriever, or LLM logic without modifying the core.
|
|
30
|
+
- **Testability**: Mocks and CI tools validate contract adherence for reliable test coverage.
|
|
31
|
+
- **Decoupling**: Each plugin can be independently implemented and swapped in via `.ragrc.json`.
|
|
32
|
+
- **CI Resilience**: The CI pipeline includes linting, contract verification, and test coverage enforcement.
|
|
23
33
|
|
|
24
34
|
## Installation
|
|
25
35
|
|
|
26
36
|
```bash
|
|
27
|
-
npm install @
|
|
37
|
+
npm install @devilsdev/rag-pipeline-utils
|
|
28
38
|
```
|
|
29
39
|
|
|
30
|
-
|
|
40
|
+
## Basic Usage
|
|
31
41
|
|
|
32
|
-
|
|
42
|
+
1. Create a `.ragrc.json` config:
|
|
33
43
|
|
|
34
|
-
```
|
|
35
|
-
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"loader": {
|
|
47
|
+
"pdf": "./src/mocks/pdf-loader.js"
|
|
48
|
+
},
|
|
49
|
+
"embedder": {
|
|
50
|
+
"openai": "./src/mocks/openai-embedder.js"
|
|
51
|
+
},
|
|
52
|
+
"retriever": {
|
|
53
|
+
"pinecone": "./src/mocks/pinecone-retriever.js"
|
|
54
|
+
},
|
|
55
|
+
"llm": {
|
|
56
|
+
"openai": "./src/mocks/openai-llm.js"
|
|
57
|
+
},
|
|
58
|
+
"namespace": "demo-namespace",
|
|
59
|
+
"pipeline": ["loader", "embedder", "retriever"]
|
|
60
|
+
}
|
|
61
|
+
```
|
|
36
62
|
|
|
37
|
-
|
|
38
|
-
loader: 'markdown',
|
|
39
|
-
embedder: 'openai',
|
|
40
|
-
retriever: 'pinecone',
|
|
41
|
-
llm: 'openai-gpt-4',
|
|
42
|
-
useReranker: true
|
|
43
|
-
});
|
|
63
|
+
2. Run an ingestion:
|
|
44
64
|
|
|
45
|
-
|
|
46
|
-
|
|
65
|
+
```bash
|
|
66
|
+
node bin/cli.js ingest ./docs/sample.pdf
|
|
47
67
|
```
|
|
48
68
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
## Testing
|
|
69
|
+
3. Run a query:
|
|
52
70
|
|
|
53
71
|
```bash
|
|
54
|
-
|
|
72
|
+
node bin/cli.js query "What is in the document?"
|
|
55
73
|
```
|
|
56
74
|
|
|
57
|
-
|
|
75
|
+
## Plugin Contracts
|
|
76
|
+
|
|
77
|
+
Each plugin must implement the following interface:
|
|
78
|
+
|
|
79
|
+
| Type | Required Methods |
|
|
80
|
+
| --------- | ------------------------------------------- |
|
|
81
|
+
| loader | `load(filePath)` |
|
|
82
|
+
| embedder | `embed(documents)`, `embedQuery(query)` |
|
|
83
|
+
| retriever | `store(vectors)`, `search(queryVector)` |
|
|
84
|
+
| llm | `ask(prompt)` |
|
|
85
|
+
|
|
86
|
+
## Folder Structure
|
|
87
|
+
|
|
88
|
+
```text
|
|
89
|
+
/project-root
|
|
90
|
+
βββ /src
|
|
91
|
+
β βββ /routes
|
|
92
|
+
β βββ /services
|
|
93
|
+
β βββ /utils
|
|
94
|
+
β βββ app.js
|
|
95
|
+
βββ /scripts
|
|
96
|
+
β βββ setup.js
|
|
97
|
+
β βββ ci-runner.js
|
|
98
|
+
β βββ repair-fixtures.js
|
|
99
|
+
βββ /__tests__
|
|
100
|
+
β βββ /fixtures
|
|
101
|
+
β βββ /unit
|
|
102
|
+
β βββ /integration
|
|
103
|
+
βββ /public
|
|
104
|
+
βββ README.md
|
|
105
|
+
βββ USE_CASES.md
|
|
106
|
+
βββ CHANGELOG.md
|
|
107
|
+
βββ .env.example
|
|
108
|
+
```
|
|
58
109
|
|
|
59
|
-
## CLI
|
|
60
110
|
|
|
61
|
-
```bash
|
|
62
|
-
rag-pipeline ingest ./docs/my.pdf --loader pdf
|
|
63
|
-
rag-pipeline query "Explain RAG pipelines" --llm openai-gpt-4
|
|
64
|
-
rag-pipeline evaluate ./fixtures/sample-eval-dataset.json
|
|
65
|
-
rag-pipeline rerank "Explain embeddings" --retriever pinecone
|
|
66
|
-
```
|
|
67
111
|
|
|
68
|
-
|
|
112
|
+
## Why Use This?
|
|
69
113
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"retriever": "pinecone",
|
|
75
|
-
"llm": "openai-gpt-4",
|
|
76
|
-
"useReranker": true
|
|
77
|
-
}
|
|
78
|
-
```
|
|
114
|
+
- **Developer Experience**: Fast iteration, full contract CI
|
|
115
|
+
- **Pluggable Design**: Swap in your stack (OpenAI, Pinecone, Langchain, etc.)
|
|
116
|
+
- **Minimal & Modular**: Clean separation of concerns
|
|
117
|
+
- **Prod-ready**: 100% test coverage, schema validation, CLI control
|
|
79
118
|
|
|
80
|
-
---
|
|
81
119
|
|
|
82
|
-
## Project Structure
|
|
83
120
|
|
|
84
|
-
|
|
85
|
-
/src
|
|
86
|
-
βββ core/ # Pipeline + registry
|
|
87
|
-
βββ loader/ # Loaders for md, html, csv, dir
|
|
88
|
-
βββ reranker/ # LLM-based context reranker
|
|
89
|
-
βββ evaluate/ # Scoring, batch QA evaluation
|
|
90
|
-
βββ utils/ # Logger, retry, schema
|
|
91
|
-
/bin/cli.js # CLI entrypoint
|
|
92
|
-
/__tests__/ # Unit, integration, snapshot tests
|
|
93
|
-
/public/ # Evaluation dashboard (React)
|
|
94
|
-
.github/workflows/ci.yml # CI config
|
|
95
|
-
```
|
|
121
|
+
## Use Cases
|
|
96
122
|
|
|
97
|
-
|
|
123
|
+
Explore real-world DevX-focused examples in [USE_CASES.md](./Use-Cases.md), including:
|
|
98
124
|
|
|
99
|
-
|
|
125
|
+
- Mock-driven plugin TDD
|
|
126
|
+
- CI-based interface validation
|
|
127
|
+
- Multivendor ingestion and search
|
|
128
|
+
- Runtime swap of LLM, retrievers, or embedders
|
|
129
|
+
- Bootstrap pipelines with auto-repairable defaults
|
|
100
130
|
|
|
101
|
-
```bash
|
|
102
|
-
node server.js
|
|
103
|
-
```
|
|
104
131
|
|
|
105
|
-
Visit: [http://localhost:3000](http://localhost:3000) β Visualizes metrics, BLEU/ROUGE, pass rate.
|
|
106
132
|
|
|
107
|
-
|
|
133
|
+
## Contributing
|
|
134
|
+
|
|
135
|
+
We welcome contributions via PRs, especially new mock providers, validation helpers, and runtime extensions. Please follow the test + CI conventions before submitting.
|
|
136
|
+
|
|
137
|
+
|
|
108
138
|
|
|
109
139
|
## License
|
|
110
140
|
|
|
111
|
-
|
|
141
|
+
This project is licensed under the **GNU GPL v3.0** License - see the [LICENSE](./LICENSE) file for details.
|
|
112
142
|
|
|
113
143
|
---
|
|
114
144
|
|
|
115
|
-
|
|
145
|
+
Built with β€οΈ by [Ali Kahwaji].
|
|
116
146
|
|
|
117
|
-
Ali Kahwaji β [@DevilsDev](https://github.com/DevilsDev)
|
package/Use-Cases.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# RAG Pipeline Utils β Developer-Focused Use Cases
|
|
2
|
+
|
|
3
|
+
> Modular, composable, and CI-verified RAG orchestration for modern AI applications.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Use Case 1: Pluggable Local RAG Stack for Prototyping
|
|
8
|
+
|
|
9
|
+
**Problem:** Traditional RAG tools force tight vendor dependencies.
|
|
10
|
+
|
|
11
|
+
**Solution:** Use mockable local plugin implementations to simulate loaders, embedders, retrievers, and LLMs.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @devilsdev/rag-pipeline-utils
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
// cli.js or app.js
|
|
19
|
+
import { PluginRegistry } from './src/core/plugin-registry.js';
|
|
20
|
+
import { loadRagConfig } from './src/config/load-config.js';
|
|
21
|
+
|
|
22
|
+
const config = loadRagConfig('.ragrc.json');
|
|
23
|
+
const loader = PluginRegistry.getPlugin('loader', 'pdf');
|
|
24
|
+
const docs = loader.load('./test.pdf');
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Benefits**
|
|
28
|
+
- Local plugin mocks with expected method contracts
|
|
29
|
+
- Reusable plugin templates (`pdf-loader.js`, `openai-embedder.js`)
|
|
30
|
+
- Dev-first DX: debug, snapshot, iterate without cloud costs
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Use Case 2: Declarative CLI RAG Pipelines (CI-Ready)
|
|
35
|
+
|
|
36
|
+
**Problem:** Hardcoded pipeline steps can't be validated or changed by non-engineers.
|
|
37
|
+
|
|
38
|
+
**Solution:** Define `.ragrc.json` once and reuse across environments.
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"loader": { "pdf": "./src/mocks/pdf-loader.js" },
|
|
43
|
+
"embedder": { "openai": "./src/mocks/openai-embedder.js" },
|
|
44
|
+
"retriever": { "pinecone": "./src/mocks/pinecone-retriever.js" },
|
|
45
|
+
"llm": { "openai": "./src/mocks/openai-llm.js" },
|
|
46
|
+
"namespace": "docs-poc",
|
|
47
|
+
"pipeline": ["loader", "embedder", "retriever"]
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
node ./bin/cli.js ingest ./docs/whitepaper.pdf
|
|
53
|
+
node ./bin/cli.js query "Whatβs the goal of this architecture?"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Benefits**
|
|
57
|
+
- Teams can standardize pipelines in source control
|
|
58
|
+
- Tests fail fast if structure or mocks drift
|
|
59
|
+
- Non-devs can operate pipelines via CLI
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Use Case 3: Mock-First TDD for Plugin Development
|
|
64
|
+
|
|
65
|
+
**Problem:** LLM, vector, and loader logic are often developed without tests.
|
|
66
|
+
|
|
67
|
+
**Solution:** Define contract-compliant mocks and CI-validate their structure before connecting to APIs.
|
|
68
|
+
|
|
69
|
+
```js
|
|
70
|
+
export default class CustomEmbedder {
|
|
71
|
+
embed(docs) { return docs.map(...); }
|
|
72
|
+
embedQuery(q) { return [...]; }
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Run full contract verification:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npm run ci
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Benefits**
|
|
83
|
+
- Every plugin is CI-verified for method presence
|
|
84
|
+
- Shared contracts enforce required interfaces
|
|
85
|
+
- Onboarding new devs? Just follow `pluginContracts.js`
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Use Case 4: Vendor-Neutral AI Data Pipelines
|
|
90
|
+
|
|
91
|
+
**Problem:** Every RAG stack is locked to OpenAI + Pinecone + Langchain.
|
|
92
|
+
|
|
93
|
+
**Solution:** Use this project to mix, match, or mock vector/LLM pairs:
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
"retriever": { "localstore": "./src/plugins/local-retriever.js" },
|
|
97
|
+
"llm": { "cohere": "./src/plugins/cohere-llm.js" }
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Benefits**
|
|
101
|
+
- Run multiple RAG pipelines in parallel (A/B testing, evals)
|
|
102
|
+
- Lower infra cost with offline/local plugin support
|
|
103
|
+
- Integrate with tools outside Langchain ecosystem
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## π Use Case 5: Plugin Engineering with Guardrails
|
|
108
|
+
|
|
109
|
+
**Problem:** Complex plugin systems break silently.
|
|
110
|
+
|
|
111
|
+
**Solution:** This framework has:
|
|
112
|
+
- Plugin method contract enforcement
|
|
113
|
+
- CLI test runner (`scripts/ci-runner.js`)
|
|
114
|
+
- Auto repair tool (`scripts/repair-fixtures.js`)
|
|
115
|
+
|
|
116
|
+
**DX Boost**
|
|
117
|
+
- One-line plugin repairs
|
|
118
|
+
- Validated schema structure
|
|
119
|
+
- Aligned to real-world developer workflows
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Cross References
|
|
124
|
+
|
|
125
|
+
- [README](./README.md) β Project overview, architecture, CLI and configuration details
|
|
126
|
+
- [pluginContracts.js](./src/core/plugin-contracts.js) β Interface contracts for loader, embedder, retriever, LLM
|
|
127
|
+
- [diagnostic-reporter.js](./src/utils/ci/diagnostic-reporter.js) β CI error helper
|
|
128
|
+
- [repair-fixtures.js](./scripts/repair-fixtures.js) β Auto-regeneration of mocks
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
Licensed under the **GPL-3.0 License** β see [LICENSE](./LICENSE) for full terms.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"base64":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAIAAADwyuo0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAGklEQVR4nGPILapfuW5vblF9blE9A4QD4QMApeANEwX0WNkAAAAASUVORK5CYII="}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"base64":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAT0lEQVR4nAFEALv/AIXNrxKW5b44TKykITGQkA0Atv/dK37FpoIVaGhbSqqbIQAPMjMPAAcXJAAHGTkXJjUQABw3QRQOJT0bFCA3HBUiNRZrJhOUbaRuqQAAAABJRU5ErkJggg=="}
|