@devilsdev/rag-pipeline-utils 2.1.5 → 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 -179
- 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 +108 -22
- 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/changelog-auto-commit.yml +0 -37
- package/.github/workflows/ci.yml +0 -53
- package/.github/workflows/docs-ci.yml +0 -46
- package/.github/workflows/docs-deploy.yml +0 -55
- package/.github/workflows/enforce-release-review.yml +0 -47
- 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/.husky/pre-commit +0 -6
- package/CHANGELOG.md +0 -97
- 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/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 -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,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)
|
|
@@ -1,77 +0,0 @@
|
|
|
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).
|
package/docs-site/docs/intro.mdx
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Version: 0.4.0
|
|
3
|
-
* Path: /docs-site/docusaurus.config.js
|
|
4
|
-
* Description: Tailwind integration, sticky navbar, and dark/light toggle support
|
|
5
|
-
* Author: Ali Kahwaji
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// @ts-check
|
|
9
|
-
|
|
10
|
-
export default {
|
|
11
|
-
title: 'RAG Pipeline Utils',
|
|
12
|
-
tagline: 'Composable pipelines for LLMs',
|
|
13
|
-
url: 'https://devilsdev.github.io',
|
|
14
|
-
baseUrl: '/rag-pipeline-utils/',
|
|
15
|
-
deploymentBranch: 'gh-pages',
|
|
16
|
-
onBrokenLinks: 'warn',
|
|
17
|
-
onBrokenMarkdownLinks: 'warn',
|
|
18
|
-
|
|
19
|
-
favicon: 'img/favicon.ico',
|
|
20
|
-
|
|
21
|
-
themeConfig: {
|
|
22
|
-
metadata: [
|
|
23
|
-
{ name: 'keywords', content: 'rag, llm, langchain, pipeline, openai, nodejs' },
|
|
24
|
-
{ name: 'author', content: 'Ali Kahwaji' },
|
|
25
|
-
{ name: 'theme-color', content: '#3EF4B6' }
|
|
26
|
-
],
|
|
27
|
-
// ✅ OpenGraph / Twitter image
|
|
28
|
-
image: 'img/social-card.jpg',
|
|
29
|
-
|
|
30
|
-
// ✅ Color mode toggle support
|
|
31
|
-
colorMode: {
|
|
32
|
-
defaultMode: 'light',
|
|
33
|
-
disableSwitch: false,
|
|
34
|
-
respectPrefersColorScheme: true
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
// ✅ Sticky header
|
|
38
|
-
navbar: {
|
|
39
|
-
title: 'RAG Utils',
|
|
40
|
-
hideOnScroll: false,
|
|
41
|
-
logo: {
|
|
42
|
-
alt: '',
|
|
43
|
-
src: '/img/logo.svg'
|
|
44
|
-
},
|
|
45
|
-
items: [
|
|
46
|
-
{ to: '/docs/Introduction', label: 'Docs', position: 'left' },
|
|
47
|
-
{ to: '/blog', label: 'Blog', position: 'left' },
|
|
48
|
-
{
|
|
49
|
-
href: 'https://github.com/DevilsDev/rag-pipeline-utils',
|
|
50
|
-
label: 'GitHub',
|
|
51
|
-
position: 'right'
|
|
52
|
-
}
|
|
53
|
-
]
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
footer: {
|
|
57
|
-
style: 'dark',
|
|
58
|
-
copyright: `© ${new Date().getFullYear()} Ali Kahwaji`
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
organizationName: 'DevilsDev',
|
|
63
|
-
projectName: 'rag-pipeline-utils',
|
|
64
|
-
|
|
65
|
-
presets: [
|
|
66
|
-
[
|
|
67
|
-
'classic',
|
|
68
|
-
{
|
|
69
|
-
docs: {
|
|
70
|
-
sidebarPath: require.resolve('./sidebars.js'),
|
|
71
|
-
editUrl:
|
|
72
|
-
'https://github.com/DevilsDev/rag-pipeline-utils/edit/main/docs-site/'
|
|
73
|
-
},
|
|
74
|
-
blog: {
|
|
75
|
-
showReadingTime: true,
|
|
76
|
-
blogSidebarTitle: 'All Posts',
|
|
77
|
-
blogSidebarCount: 'ALL',
|
|
78
|
-
onUntruncatedBlogPosts: 'ignore',
|
|
79
|
-
editUrl:
|
|
80
|
-
'https://github.com/DevilsDev/rag-pipeline-utils/edit/main/docs-site/blog/'
|
|
81
|
-
},
|
|
82
|
-
theme: {
|
|
83
|
-
customCss: require.resolve('./src/css/custom.css')
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
]
|
|
87
|
-
]
|
|
88
|
-
};
|