@devilsdev/rag-pipeline-utils 2.0.1 β 2.1.1
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 +20 -10
- package/.github/workflows/publish-release-blog.yml +8 -6
- package/.github/workflows/storybook-deploy.yml +33 -0
- package/.storybook/main.js +20 -0
- package/.storybook/preview.js +13 -0
- package/CHANGELOG.md +15 -0
- package/README.md +1 -1
- 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/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-v2.1.0.md +13 -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 +2 -2
- package/docs-site/blog/tags.yml +22 -19
- 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 +3 -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 +6 -1
- 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 +19 -3
- 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/docs/USE_CASES.md +0 -0
- /package/{USE_CASES.md β Use-Cases.md} +0 -0
|
@@ -0,0 +1,106 @@
|
|
|
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
CHANGED
|
@@ -4,7 +4,7 @@ This guide covers how to use `@yourorg/rag-pipeline-utils` programmatically via
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Installation
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
npm install @yourorg/rag-pipeline-utils
|
|
@@ -12,7 +12,7 @@ npm install @yourorg/rag-pipeline-utils
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## Programmatic API
|
|
16
16
|
|
|
17
17
|
Import and instantiate a RAG pipeline:
|
|
18
18
|
|
|
@@ -33,14 +33,14 @@ console.log(answer);
|
|
|
33
33
|
|
|
34
34
|
---
|
|
35
35
|
|
|
36
|
-
##
|
|
36
|
+
## Pipeline Methods
|
|
37
37
|
|
|
38
38
|
- `pipeline.ingest(path: string)` β Load, chunk, embed, and store vectors
|
|
39
39
|
- `pipeline.query(prompt: string)` β Retrieve context, rerank (optional), and call LLM
|
|
40
40
|
|
|
41
41
|
---
|
|
42
42
|
|
|
43
|
-
##
|
|
43
|
+
## Plugin Configuration
|
|
44
44
|
|
|
45
45
|
You can customize the pipeline by registering plugins:
|
|
46
46
|
|
|
@@ -51,7 +51,7 @@ registry.register('retriever', 'opensearch', new MyOpenSearchRetriever());
|
|
|
51
51
|
|
|
52
52
|
---
|
|
53
53
|
|
|
54
|
-
##
|
|
54
|
+
## Configuration via `.ragrc.json`
|
|
55
55
|
|
|
56
56
|
Create a JSON file at your root:
|
|
57
57
|
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: Use-Cases
|
|
3
|
+
title: Real-World Use Cases
|
|
4
|
+
sidebar_position: 5
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Real-World Applications of RAG Pipeline Utils
|
|
8
|
+
|
|
9
|
+
This project goes beyond traditional RAG tools β itβs a **developer-focused modular framework**. Here's how itβs used:
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
### 1. Customizable LLM Workflows
|
|
14
|
+
|
|
15
|
+
**Use Case:** A team wants to test three different retrievers (Pinecone, Weaviate, Redis) and switch LLMs dynamically during eval.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
rag-utils ingest sample.pdf --retriever pinecone --llm openai
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
### 2. Plugin-Based Evaluation Benchmarks
|
|
24
|
+
|
|
25
|
+
**Use Case:** You want to run BLEU/ROUGE scoring across prompt templates or documents using CLI:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
rag-utils evaluate --dataset tests/eval.json --llm anthropic
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
### 3. Internal LLM System for SaaS
|
|
34
|
+
|
|
35
|
+
**Use Case:** Embed RAG processing into a backend:
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
import { PluginRegistry, runPipeline } from 'rag-pipeline-utils';
|
|
39
|
+
|
|
40
|
+
const registry = new PluginRegistry();
|
|
41
|
+
registry.register('embedder', 'openai', new OpenAIEmbedder());
|
|
42
|
+
|
|
43
|
+
const output = await runPipeline({
|
|
44
|
+
loader: 'pdf',
|
|
45
|
+
retriever: 'pinecone',
|
|
46
|
+
llm: 'openai',
|
|
47
|
+
query: 'How does this work?'
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
### 4. GitHub + NPM Automation for ML Pipelines
|
|
54
|
+
|
|
55
|
+
**Use Case:** You want a release blog post + versioned package published automatically:
|
|
56
|
+
|
|
57
|
+
- Commit code
|
|
58
|
+
- Push to `main`
|
|
59
|
+
- GitHub Action triggers:
|
|
60
|
+
- Semantic release
|
|
61
|
+
- CHANGELOG update
|
|
62
|
+
- Blog post generation
|
|
63
|
+
- NPM publish
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
### Benefits
|
|
68
|
+
|
|
69
|
+
- **Pluggable** components via clean interfaces
|
|
70
|
+
- **CLI + programmatic** access for flexible DX
|
|
71
|
+
- **CI-validated** plugin contract enforcement
|
|
72
|
+
- **Docs-first** developer onboarding
|
|
73
|
+
- **Production-ready** for real ML teams
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
> Want to contribute your use case? PRs welcome on [GitHub](https://github.com/DevilsDev/rag-pipeline-utils).
|
|
@@ -12,6 +12,7 @@ export default {
|
|
|
12
12
|
tagline: 'Composable RAG pipelines with Node.js',
|
|
13
13
|
url: 'https://devilsdev.github.io',
|
|
14
14
|
baseUrl: '/rag-pipeline-utils/',
|
|
15
|
+
deploymentBranch: 'gh-pages',
|
|
15
16
|
onBrokenLinks: 'throw',
|
|
16
17
|
onBrokenMarkdownLinks: 'warn',
|
|
17
18
|
|
|
@@ -34,7 +35,8 @@ export default {
|
|
|
34
35
|
},
|
|
35
36
|
items: [
|
|
36
37
|
{ to: '/docs/Introduction', label: 'Docs', position: 'left' },
|
|
37
|
-
{
|
|
38
|
+
{ to: '/blog', label: 'Blog', position: 'left' },
|
|
39
|
+
{ href: 'https://github.com/DevilsDev/rag-pipeline-utils', label: 'GitHub', position: 'right' },
|
|
38
40
|
]
|
|
39
41
|
},
|
|
40
42
|
footer: {
|
|
@@ -45,7 +47,6 @@ export default {
|
|
|
45
47
|
|
|
46
48
|
organizationName: 'DevilsDev',
|
|
47
49
|
projectName: 'rag-pipeline-utils',
|
|
48
|
-
deploymentBranch: 'gh-pages',
|
|
49
50
|
|
|
50
51
|
presets: [
|
|
51
52
|
[
|