@devilsdev/rag-pipeline-utils 1.0.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/.dockerignore +14 -0
- package/.github/workflows/ci.yml +42 -0
- package/.github/workflows/release.yml +21 -0
- package/Dockerfile +22 -0
- package/LICENSE +674 -0
- package/README.md +116 -0
- package/__tests__/fixtures/sample-eval-dataset.json +15 -0
- package/__tests__/integration/cli/config-flow.test.js +44 -0
- package/__tests__/integration/config/load-config.test.js +52 -0
- package/__tests__/unit/core/plugin-registry.test.js +55 -0
- package/__tests__/unit/reranker/__snapshots__/reranker.snapshot.test.js.snap +15 -0
- package/__tests__/unit/reranker/llm-reranker.test.js +42 -0
- package/__tests__/unit/reranker/reranker.snapshot.test.js +17 -0
- package/bin/cli.js +168 -0
- package/docs-site/README.md +41 -0
- package/docs-site/blog/2019-05-28-first-blog-post.md +12 -0
- package/docs-site/blog/2019-05-29-long-blog-post.md +44 -0
- package/docs-site/blog/2021-08-01-mdx-blog-post.mdx +24 -0
- package/docs-site/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg +0 -0
- package/docs-site/blog/2021-08-26-welcome/index.md +29 -0
- package/docs-site/blog/authors.yml +23 -0
- package/docs-site/blog/tags.yml +19 -0
- package/docs-site/docs/Architecture.md +76 -0
- package/docs-site/docs/CLI.md +69 -0
- package/docs-site/docs/Evaluation.md +61 -0
- package/docs-site/docs/FAQ.md +50 -0
- package/docs-site/docs/Introduction.md +58 -0
- package/docs-site/docs/Plugins.md +61 -0
- package/docs-site/docs/Usage.md +72 -0
- package/docs-site/docusaurus.config.js +57 -0
- package/docs-site/package-lock.json +17914 -0
- package/docs-site/package.json +44 -0
- package/docs-site/sidebars.js +22 -0
- package/docs-site/src/components/HomepageFeatures/index.js +59 -0
- package/docs-site/src/components/HomepageFeatures/styles.module.css +58 -0
- package/docs-site/src/css/custom.css +81 -0
- package/docs-site/src/pages/index.js +37 -0
- package/docs-site/src/pages/index.module.css +23 -0
- package/docs-site/src/pages/markdown-page.md +7 -0
- package/docs-site/static/.nojekyll +0 -0
- package/docs-site/static/img/favicon.ico +0 -0
- package/docs-site/static/img/logo.png +0 -0
- package/docs-site/static/img/logo.svg +1539 -0
- package/docs-site/static/img/social-card.jpg +0 -0
- package/jest.config.js +14 -0
- package/package.json +65 -0
- package/public/index.html +0 -0
- package/public/results/sample-eval.json +0 -0
- package/public/src/App.jsx +57 -0
- package/release.config.js +23 -0
- package/server.js +31 -0
- package/src/config/load-config.js +35 -0
- package/src/config/validate-schema.js +49 -0
- package/src/core/create-pipeline.js +82 -0
- package/src/core/plugin-registry.js +61 -0
- package/src/dag/dag-engine.js +70 -0
- package/src/evaluate/evaluator.js +44 -0
- package/src/evaluate/scoring.js +74 -0
- package/src/loader/csv-loader.js +30 -0
- package/src/loader/directory-loader.js +38 -0
- package/src/loader/html-loader.js +57 -0
- package/src/loader/markdown-loader.js +58 -0
- package/src/reranker/llm-reranker.js +49 -0
- package/src/utils/logger.js +29 -0
- package/src/utils/retry.js +42 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
yangshun:
|
|
2
|
+
name: Yangshun Tay
|
|
3
|
+
title: Front End Engineer @ Facebook
|
|
4
|
+
url: https://github.com/yangshun
|
|
5
|
+
image_url: https://github.com/yangshun.png
|
|
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
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
facebook:
|
|
2
|
+
label: Facebook
|
|
3
|
+
permalink: /facebook
|
|
4
|
+
description: Facebook tag description
|
|
5
|
+
|
|
6
|
+
hello:
|
|
7
|
+
label: Hello
|
|
8
|
+
permalink: /hello
|
|
9
|
+
description: Hello tag description
|
|
10
|
+
|
|
11
|
+
docusaurus:
|
|
12
|
+
label: Docusaurus
|
|
13
|
+
permalink: /docusaurus
|
|
14
|
+
description: Docusaurus tag description
|
|
15
|
+
|
|
16
|
+
hola:
|
|
17
|
+
label: Hola
|
|
18
|
+
permalink: /hola
|
|
19
|
+
description: Hola tag description
|
|
@@ -0,0 +1,76 @@
|
|
|
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)
|
|
@@ -0,0 +1,69 @@
|
|
|
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)
|
|
@@ -0,0 +1,61 @@
|
|
|
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)
|
|
@@ -0,0 +1,50 @@
|
|
|
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)
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 1
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Introduction
|
|
6
|
+
|
|
7
|
+
Welcome to **@yourorg/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 `@yourorg`
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
Let’s get started!
|
|
57
|
+
|
|
58
|
+
Next → [Usage](./Usage.md)
|
|
@@ -0,0 +1,61 @@
|
|
|
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)
|
|
@@ -0,0 +1,72 @@
|
|
|
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)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version: 0.3.0
|
|
3
|
+
* Path: /docs-site/docusaurus.config.js
|
|
4
|
+
* Description: Final production config with cleaned branding and image setup
|
|
5
|
+
* Author: Ali Kahwaji
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// @ts-check
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: 'RAG Pipeline Utils',
|
|
12
|
+
tagline: 'Composable RAG pipelines with Node.js',
|
|
13
|
+
url: 'https://devilsdev.github.io',
|
|
14
|
+
baseUrl: '/rag-pipeline-utils/',
|
|
15
|
+
onBrokenLinks: 'throw',
|
|
16
|
+
onBrokenMarkdownLinks: 'warn',
|
|
17
|
+
|
|
18
|
+
// ✅ Final favicon and social card for branding
|
|
19
|
+
favicon: 'img/favicon.ico',
|
|
20
|
+
themeConfig: {
|
|
21
|
+
image: 'img/social-card.jpg',
|
|
22
|
+
navbar: {
|
|
23
|
+
title: 'RAG Utils',
|
|
24
|
+
logo: {
|
|
25
|
+
alt: '', // ✅ Clean alt to avoid raw rendering
|
|
26
|
+
src: '/img/logo.svg'
|
|
27
|
+
},
|
|
28
|
+
items: [
|
|
29
|
+
{ to: '/docs/Introduction', label: 'Docs', position: 'left' },
|
|
30
|
+
{ href: 'https://github.com/DevilsDev/rag-pipeline-utils', label: 'GitHub', position: 'right' }
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
footer: {
|
|
34
|
+
style: 'dark',
|
|
35
|
+
copyright: `© ${new Date().getFullYear()} Ali Kahwaji`
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
organizationName: 'DevilsDev',
|
|
40
|
+
projectName: 'rag-pipeline-utils',
|
|
41
|
+
deploymentBranch: 'gh-pages',
|
|
42
|
+
|
|
43
|
+
presets: [
|
|
44
|
+
[
|
|
45
|
+
'classic',
|
|
46
|
+
{
|
|
47
|
+
docs: {
|
|
48
|
+
sidebarPath: require.resolve('./sidebars.js'),
|
|
49
|
+
editUrl: 'https://github.com/DevilsDev/rag-pipeline-utils/edit/main/docs-site/'
|
|
50
|
+
},
|
|
51
|
+
theme: {
|
|
52
|
+
customCss: require.resolve('./src/css/custom.css')
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
]
|
|
57
|
+
};
|