@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
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
slug: release-2-0
|
|
3
|
+
title: Release 2.0.0 – Plugin Contracts, CI Automation, Docs
|
|
4
|
+
authors: [ali]
|
|
5
|
+
tags: [release, changelog]
|
|
6
|
+
description: RAG Pipeline Utils v2.0.0 introduces plugin contract validation, full CI coverage, fixture repairs, and professional Docusaurus docs.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
We’re thrilled to announce the release of **RAG Pipeline Utils v2.0.0** — a fully modular and developer-focused toolkit for constructing, validating, and managing RAG (Retrieval-Augmented Generation) pipelines.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 🚀 Highlights in v2.0.0
|
|
14
|
+
|
|
15
|
+
### 🔌 Contract-Based Plugin Validation
|
|
16
|
+
|
|
17
|
+
- Enforces strict interfaces for all core plugin types:
|
|
18
|
+
- `loader.load()`
|
|
19
|
+
- `embedder.embed()` and `embedQuery()`
|
|
20
|
+
- `retriever.store()` and `search()`
|
|
21
|
+
- `llm.ask()`
|
|
22
|
+
- Includes auto-verification and CLI validation via `scripts/verify-fixture-mocks.js`
|
|
23
|
+
|
|
24
|
+
### 🧪 Enhanced CI & Git Hooks
|
|
25
|
+
|
|
26
|
+
- Full GitHub Actions integration:
|
|
27
|
+
- Lint, test, mock validation, release automation
|
|
28
|
+
- Local enforcement using **Husky** + **validate-changelog-version.js**
|
|
29
|
+
|
|
30
|
+
### 🧰 Fixture Repair & Auto-Mock Utilities
|
|
31
|
+
|
|
32
|
+
- Self-healing script: `scripts/repair-fixtures.js`
|
|
33
|
+
- Support for regenerating mocks that align with runtime requirements and CLI tests
|
|
34
|
+
|
|
35
|
+
### 📘 Developer Documentation
|
|
36
|
+
|
|
37
|
+
- Professionally published Docusaurus site:
|
|
38
|
+
- 📚 [Visit Docs](https://devilsdev.github.io/rag-pipeline-utils)
|
|
39
|
+
- 🧭 Usage, architecture, CLI, plugin extension, and release notes
|
|
40
|
+
- Blog support enabled for continuous release announcements
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## ✨ Why This Matters
|
|
45
|
+
|
|
46
|
+
This release marks a shift from traditional monolithic RAG stacks to a **fully composable, testable, and CI-validated** toolkit. It was built with long-term developer experience (DX) in mind, emphasizing:
|
|
47
|
+
|
|
48
|
+
- 📦 **Modularity**: Swap or add plugins without rewriting pipeline logic
|
|
49
|
+
- 🧪 **Test Confidence**: Never publish broken mocks or CI regressions again
|
|
50
|
+
- 🧠 **Scalability**: Suitable for both small prototypes and production pipelines
|
|
51
|
+
- 🛠 **Tooling First**: Includes everything from config loading to evaluation dashboards
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 📦 Install Now
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm install @devilsdev/rag-pipeline-utils
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
For upgrade guides, contract schemas, and real-world examples, check out the [official docs](https://devilsdev.github.io/rag-pipeline-utils/docs/Introduction).
|
|
64
|
+
|
|
65
|
+
🧠 Built for engineers who want **control, clarity, and composability** in their LLM workflows.
|
|
66
|
+
|
|
67
|
+
— *Ali Kahwaji & RAG Pipeline Utils Contributors*
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
slug: release-v2.0.2
|
|
3
|
+
title: ✨ Version v2.0.2 Released
|
|
4
|
+
authors: [ali]
|
|
5
|
+
tags: [release, changelog]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
RAG Pipeline Utils vv2.0.2 is now available on NPM!
|
|
9
|
+
|
|
10
|
+
#### Highlights
|
|
11
|
+
- 🚀 Auto-published blog from GitHub release
|
|
12
|
+
- 📦 Version bump: v2.0.2
|
|
13
|
+
- 📘 See CHANGELOG.md for full details
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
slug: architecture-overview
|
|
3
|
+
title: RAG Pipeline Architecture Overview
|
|
4
|
+
authors: [ali]
|
|
5
|
+
tags: [architecture, design, modular]
|
|
6
|
+
description: A deep dive into the architecture powering RAG Pipeline Utils — from plugin interfaces to flexible pipeline composition.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
Welcome to the first post in our deep dive blog series on **RAG Pipeline Utils** — a fully modular, testable, and production-grade framework for building retrieval-augmented generation pipelines.
|
|
10
|
+
|
|
11
|
+
## Why Modular RAG?
|
|
12
|
+
|
|
13
|
+
Most RAG tools are tightly coupled or opinionated. We built this utility to empower dev teams with:
|
|
14
|
+
|
|
15
|
+
- Swappable plugins for loaders, embedders, retrievers, LLMs
|
|
16
|
+
- CLI tools for evaluation & schema validation
|
|
17
|
+
- Docusaurus-based docs with versioned releases
|
|
18
|
+
- Full CI/CD and automated NPM releases
|
|
19
|
+
|
|
20
|
+
## Architecture Highlights
|
|
21
|
+
|
|
22
|
+
- `PluginRegistry`: Registers and resolves all components.
|
|
23
|
+
- `validateSchema`: Enforces `.ragrc.json` format across all pipelines.
|
|
24
|
+
- `mocks/`: Local test doubles for every plugin interface.
|
|
25
|
+
- `__tests__/`: Dual-layer coverage — unit + integration.
|
|
26
|
+
|
|
27
|
+
## Try It Now
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install @devilsdev/rag-pipeline-utils
|
|
31
|
+
npx rag-utils run --config .ragrc.json
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Stay tuned for future posts including CI validation, RAG evaluation tooling, and how to build your own dashboard for prompt scoring.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
slug: release-2-0-0
|
|
3
|
+
title: Release 2.0.0 — Modular RAG Toolkit
|
|
4
|
+
authors: ali
|
|
5
|
+
tags: [release, changelog, RAG, developer-tools]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
🚀 **Version 2.0.0** is now live on [npm](https://www.npmjs.com/package/@devilsdev/rag-pipeline-utils)!
|
|
9
|
+
|
|
10
|
+
This release introduces:
|
|
11
|
+
|
|
12
|
+
- ✅ Plugin contracts for loaders, embedders, retrievers, LLMs
|
|
13
|
+
- 🧪 Fixture mock verification + CLI validation
|
|
14
|
+
- 🧰 Auto-repair tooling for broken test mocks
|
|
15
|
+
- 📦 Seamless integration with `.ragrc.json` config fallback
|
|
16
|
+
- 📄 Docusaurus documentation & blog support
|
|
17
|
+
- 💡 Modern DX with versioned docs, coverage, CI hooks, changelogs
|
|
18
|
+
|
|
19
|
+
Explore docs → [devilsdev.github.io/rag-pipeline-utils](https://devilsdev.github.io/rag-pipeline-utils)
|
|
20
|
+
|
|
21
|
+
📌 Run `npm install @devilsdev/rag-pipeline-utils` to get started.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Prompt Engineering Best Practices for RAG"
|
|
3
|
+
slug: prompt-engineering-best-practices
|
|
4
|
+
authors: [ali]
|
|
5
|
+
tags: [prompt-engineering, design]
|
|
6
|
+
image: /img/social/prompt-engineering-card.png
|
|
7
|
+
description: "A deep dive into prompt optimization strategies for RAG pipelines using modular design."
|
|
8
|
+
---
|
|
9
|
+
Prompt engineering is a critical lever in maximizing the effectiveness of Retrieval-Augmented Generation (RAG) systems. In this article, we explore:
|
|
10
|
+
|
|
11
|
+
## Prompting in Modular RAG Pipelines
|
|
12
|
+
|
|
13
|
+
Your `rag-pipeline-utils` system allows swappable LLM backends and encourages prompt templates as part of the reranker or query orchestrator.
|
|
14
|
+
|
|
15
|
+
- Always define clear input/output expectations
|
|
16
|
+
- Leverage JSON or YAML-based structured prompts where applicable
|
|
17
|
+
- Evaluate with real examples using the CLI + evaluation framework
|
|
18
|
+
|
|
19
|
+
## What to Include in Prompts
|
|
20
|
+
|
|
21
|
+
- **Context injection**: retrieved chunks, metadata, source provenance
|
|
22
|
+
- **Task framing**: instruction-oriented for LLM consistency
|
|
23
|
+
- **Scoring heuristics**: if doing ranking, consider scoring guidelines
|
|
24
|
+
|
|
25
|
+
## Prompt as Plugin (Future Feature)
|
|
26
|
+
|
|
27
|
+
Eventually, we plan to support `promptTemplate` as a plugin type – enabling reusable prompt logic alongside `loader`, `retriever`, etc.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
Stay tuned for our upcoming prompt debugger dashboard, and follow [releases](/blog/tags/release) for versioned updates.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
slug: image-showcase
|
|
3
|
+
title: Blog Image Component Showcase
|
|
4
|
+
authors: [ali]
|
|
5
|
+
tags: [tutorials, design, image]
|
|
6
|
+
description: Demonstrating LQIP-powered blog images using the BlogImage component.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
import BlogImage from '@site/src/components/BlogImage';
|
|
10
|
+
|
|
11
|
+
This post demonstrates the reusable **`<BlogImage />`** component, which displays optimized blurred placeholders (LQIPs) for faster rendering.
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
<BlogImage srcKey="img_hero" alt="Hero demonstration" />
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Benefits Recap
|
|
20
|
+
|
|
21
|
+
- Blurred placeholder loading for faster perception
|
|
22
|
+
- Fallback to default cache when missing
|
|
23
|
+
- Ready for automation via `watch-images.js`
|
|
@@ -1,23 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
name:
|
|
3
|
-
title:
|
|
4
|
-
url: https://github.com/
|
|
5
|
-
image_url:
|
|
6
|
-
page: true
|
|
7
|
-
socials:
|
|
8
|
-
x: yangshunz
|
|
9
|
-
github: yangshun
|
|
10
|
-
|
|
11
|
-
slorber:
|
|
12
|
-
name: Sébastien Lorber
|
|
13
|
-
title: Docusaurus maintainer
|
|
14
|
-
url: https://sebastienlorber.com
|
|
15
|
-
image_url: https://github.com/slorber.png
|
|
16
|
-
page:
|
|
17
|
-
# customize the url of the author page at /blog/authors/<permalink>
|
|
18
|
-
permalink: '/all-sebastien-lorber-articles'
|
|
19
|
-
socials:
|
|
20
|
-
x: sebastienlorber
|
|
21
|
-
linkedin: sebastienlorber
|
|
22
|
-
github: slorber
|
|
23
|
-
newsletter: https://thisweekinreact.com
|
|
1
|
+
ali:
|
|
2
|
+
name: Ali Kahwaji
|
|
3
|
+
title: Creator & Maintainer of RAG Pipeline Utils
|
|
4
|
+
url: https://github.com/alikahwaji
|
|
5
|
+
image_url: /img/authors/ali.jpg
|
package/docs-site/blog/tags.yml
CHANGED
|
@@ -1,19 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
permalink: /facebook
|
|
4
|
-
description: Facebook tag description
|
|
1
|
+
# docs-site/blog/tags.yml
|
|
2
|
+
# Description: Central tag definitions for Docusaurus blog filtering and grouping
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
permalink: /
|
|
9
|
-
description: Hello tag description
|
|
4
|
+
- label: Release
|
|
5
|
+
slug: release
|
|
6
|
+
permalink: /blog/tags/release
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
permalink: /
|
|
14
|
-
description: Docusaurus tag description
|
|
8
|
+
- label: Architecture
|
|
9
|
+
slug: architecture
|
|
10
|
+
permalink: /blog/tags/architecture
|
|
15
11
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
permalink: /
|
|
19
|
-
|
|
12
|
+
- label: Prompt Engineering
|
|
13
|
+
slug: prompt-engineering
|
|
14
|
+
permalink: /blog/tags/prompt-engineering
|
|
15
|
+
|
|
16
|
+
- label: Evaluation
|
|
17
|
+
slug: evaluation
|
|
18
|
+
permalink: /blog/tags/evaluation
|
|
19
|
+
|
|
20
|
+
- label: Tutorials
|
|
21
|
+
slug: tutorials
|
|
22
|
+
permalink: /blog/tags/tutorials
|
|
23
|
+
|
|
24
|
+
- label: Changelog
|
|
25
|
+
slug: changelog
|
|
26
|
+
permalink: /blog/tags/changelog
|
|
27
|
+
|
|
28
|
+
- label: Design
|
|
29
|
+
slug: design
|
|
30
|
+
permalink: /blog/tags/design
|
|
@@ -4,7 +4,7 @@ This page outlines the internal architecture of the RAG pipeline utilities, emph
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Core Design Philosophy
|
|
8
8
|
|
|
9
9
|
The architecture adheres to enterprise-grade practices:
|
|
10
10
|
|
|
@@ -16,7 +16,7 @@ The architecture adheres to enterprise-grade practices:
|
|
|
16
16
|
|
|
17
17
|
---
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Layered Components
|
|
20
20
|
|
|
21
21
|
```
|
|
22
22
|
+-------------------------+
|
|
@@ -36,7 +36,7 @@ The architecture adheres to enterprise-grade practices:
|
|
|
36
36
|
|
|
37
37
|
---
|
|
38
38
|
|
|
39
|
-
##
|
|
39
|
+
## Core Interfaces
|
|
40
40
|
|
|
41
41
|
Each plugin is registered via the `PluginRegistry` and looked up by key.
|
|
42
42
|
|
|
@@ -65,7 +65,7 @@ interface Retriever {
|
|
|
65
65
|
|
|
66
66
|
---
|
|
67
67
|
|
|
68
|
-
##
|
|
68
|
+
## DAG Support
|
|
69
69
|
|
|
70
70
|
The `dag-engine.js` module supports chaining multiple components:
|
|
71
71
|
- Example: Summarize → Retrieve → Rerank → LLM
|
package/docs-site/docs/CLI.md
CHANGED
|
@@ -14,7 +14,7 @@ npx rag-pipeline <command>
|
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Commands
|
|
18
18
|
|
|
19
19
|
### `ingest`
|
|
20
20
|
```bash
|
|
@@ -42,7 +42,7 @@ rag-pipeline rerank "What is RAG?" --retriever pinecone
|
|
|
42
42
|
|
|
43
43
|
---
|
|
44
44
|
|
|
45
|
-
##
|
|
45
|
+
## `.ragrc.json` Config
|
|
46
46
|
|
|
47
47
|
Defaults can be set in a file:
|
|
48
48
|
```json
|
|
@@ -57,7 +57,7 @@ Defaults can be set in a file:
|
|
|
57
57
|
|
|
58
58
|
---
|
|
59
59
|
|
|
60
|
-
##
|
|
60
|
+
## Docker Usage
|
|
61
61
|
|
|
62
62
|
```bash
|
|
63
63
|
docker build -t rag-pipeline .
|
|
@@ -4,7 +4,7 @@ This module allows you to evaluate the quality of generated LLM responses in a R
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Objective
|
|
8
8
|
|
|
9
9
|
Quantify how well the pipeline performs on question-answer pairs using:
|
|
10
10
|
- **BLEU**: Precision on matching tokens
|
|
@@ -13,7 +13,7 @@ Quantify how well the pipeline performs on question-answer pairs using:
|
|
|
13
13
|
|
|
14
14
|
---
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## Dataset Format
|
|
17
17
|
|
|
18
18
|
Each entry in your JSON dataset should include:
|
|
19
19
|
|
|
@@ -28,20 +28,20 @@ Saved as: `sample-eval-dataset.json`
|
|
|
28
28
|
|
|
29
29
|
---
|
|
30
30
|
|
|
31
|
-
##
|
|
31
|
+
## CLI Evaluation
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
34
|
rag-pipeline evaluate ./fixtures/sample-eval-dataset.json
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
Outputs:
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
38
|
+
- Pass/fail per item
|
|
39
|
+
- BLEU/ROUGE scores
|
|
40
|
+
- Aggregated metrics
|
|
41
41
|
|
|
42
42
|
---
|
|
43
43
|
|
|
44
|
-
##
|
|
44
|
+
## Dashboard Visualization
|
|
45
45
|
|
|
46
46
|
Use the React dashboard under `/public`:
|
|
47
47
|
|
package/docs-site/docs/FAQ.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# FAQ
|
|
2
2
|
|
|
3
|
-
###
|
|
3
|
+
### Can I use this with my own vector database?
|
|
4
4
|
Yes! You can implement the `Retriever` interface and register it:
|
|
5
5
|
```ts
|
|
6
6
|
registry.register('retriever', 'mydb', new MyRetriever());
|
|
@@ -9,17 +9,17 @@ Then use it via CLI or `.ragrc.json`.
|
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
###
|
|
12
|
+
### Is streaming LLM response supported?
|
|
13
13
|
Yes. LLM runners can yield async output tokens. This is handled internally via `AsyncIterable` in compatible models.
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
-
###
|
|
17
|
+
### How do I evaluate performance?
|
|
18
18
|
Use `rag-pipeline evaluate dataset.json` or open the dashboard at `http://localhost:3000` to visualize BLEU/ROUGE and pass rates.
|
|
19
19
|
|
|
20
20
|
---
|
|
21
21
|
|
|
22
|
-
###
|
|
22
|
+
### What file types can I ingest?
|
|
23
23
|
Currently supported:
|
|
24
24
|
- `.pdf` (mocked)
|
|
25
25
|
- `.md`
|
|
@@ -29,7 +29,7 @@ Currently supported:
|
|
|
29
29
|
|
|
30
30
|
---
|
|
31
31
|
|
|
32
|
-
###
|
|
32
|
+
### Can I rerank results using a local model?
|
|
33
33
|
Yes, as long as your local LLM implements:
|
|
34
34
|
```ts
|
|
35
35
|
llm.generate(prompt, context): Promise<string>
|
|
@@ -38,7 +38,7 @@ Use it to power `LLMReranker`.
|
|
|
38
38
|
|
|
39
39
|
---
|
|
40
40
|
|
|
41
|
-
###
|
|
41
|
+
### How do I contribute?
|
|
42
42
|
Fork the repo → add your plugin or CLI feature → test → submit PR.
|
|
43
43
|
|
|
44
44
|
---
|
|
@@ -4,11 +4,11 @@ sidebar_position: 1
|
|
|
4
4
|
|
|
5
5
|
# Introduction
|
|
6
6
|
|
|
7
|
-
Welcome to **@
|
|
7
|
+
Welcome to **@DevilsDev/rag-pipeline-utils**, a modular Node.js toolkit for building scalable, pluggable Retrieval-Augmented Generation (RAG) systems.
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## What is RAG?
|
|
12
12
|
|
|
13
13
|
RAG combines information retrieval with large language models to enhance generation with factual grounding. It typically involves:
|
|
14
14
|
|
|
@@ -19,7 +19,7 @@ This project provides all the composable parts to build your own RAG pipeline.
|
|
|
19
19
|
|
|
20
20
|
---
|
|
21
21
|
|
|
22
|
-
##
|
|
22
|
+
## Why Use This Toolkit?
|
|
23
23
|
|
|
24
24
|
- **Plugin-based**: Swap in your own loaders, retrievers, LLMs
|
|
25
25
|
- **Streaming-ready**: Async-friendly, token-by-token output
|
|
@@ -29,7 +29,7 @@ This project provides all the composable parts to build your own RAG pipeline.
|
|
|
29
29
|
|
|
30
30
|
---
|
|
31
31
|
|
|
32
|
-
##
|
|
32
|
+
## Architecture
|
|
33
33
|
|
|
34
34
|
Each RAG pipeline includes:
|
|
35
35
|
|
|
@@ -43,13 +43,13 @@ The pipeline can be used via code or via CLI commands.
|
|
|
43
43
|
|
|
44
44
|
---
|
|
45
45
|
|
|
46
|
-
##
|
|
46
|
+
## Status
|
|
47
47
|
|
|
48
48
|
This project is:
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
49
|
+
- Production-ready
|
|
50
|
+
- Covered by unit/integration tests
|
|
51
|
+
- Compatible with Node.js `>=18`
|
|
52
|
+
- Published to npm under `DevilsDev`
|
|
53
53
|
|
|
54
54
|
---
|
|
55
55
|
|
|
@@ -4,7 +4,7 @@ The toolkit is fully modular. You can inject your own loaders, retrievers, embed
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Plugin Architecture
|
|
8
8
|
|
|
9
9
|
All plugins follow a strict interface pattern. Each is registered under a namespace using the plugin registry:
|
|
10
10
|
|
|
@@ -21,7 +21,7 @@ You can register plugins for:
|
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
24
|
-
##
|
|
24
|
+
## Loader Example
|
|
25
25
|
|
|
26
26
|
```ts
|
|
27
27
|
class MyMarkdownLoader {
|
|
@@ -39,7 +39,7 @@ registry.register('loader', 'md', new MyMarkdownLoader());
|
|
|
39
39
|
|
|
40
40
|
---
|
|
41
41
|
|
|
42
|
-
##
|
|
42
|
+
## Runtime Override
|
|
43
43
|
|
|
44
44
|
CLI and API will resolve plugin names from `pluginRegistry`. Use:
|
|
45
45
|
|
|
@@ -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
|
|