@devilsdev/rag-pipeline-utils 2.1.7 → 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.
Files changed (148) hide show
  1. package/LICENSE +674 -674
  2. package/README.md +395 -186
  3. package/bin/cli.js +14 -62
  4. package/contracts/embedder-contract.json +52 -0
  5. package/contracts/llm-contract.json +36 -0
  6. package/contracts/loader-contract.json +43 -0
  7. package/contracts/retriever-contract.json +68 -0
  8. package/dist/index.cjs +67 -0
  9. package/dist/index.mjs +51 -0
  10. package/package.json +107 -21
  11. package/.codecov.yml +0 -21
  12. package/.dockerignore +0 -14
  13. package/.eslintignore +0 -5
  14. package/.eslintrc.json +0 -28
  15. package/.github/PROJECT_ROADMAP.md +0 -102
  16. package/.github/PULL_REQUEST_TEMPLATE.md +0 -8
  17. package/.github/release-template.md +0 -20
  18. package/.github/workflows/auto-release-note.yml +0 -73
  19. package/.github/workflows/ci.yml +0 -55
  20. package/.github/workflows/docs-ci.yml +0 -46
  21. package/.github/workflows/docs-deploy.yml +0 -64
  22. package/.github/workflows/enforce-release-review.yml +0 -50
  23. package/.github/workflows/generate-blog-post.yml +0 -44
  24. package/.github/workflows/post-release-generate-blog.yml +0 -71
  25. package/.github/workflows/publish-release-blog.yml +0 -47
  26. package/.github/workflows/release-sync.yml +0 -50
  27. package/.github/workflows/roadmap-label-sync.yml +0 -35
  28. package/.github/workflows/roadmap-labels.yml +0 -67
  29. package/.github/workflows/roadmap-sync.yml +0 -44
  30. package/.github/workflows/sync-roadmap.yml +0 -62
  31. package/.github/workflows/verify-blog-badge.yml +0 -50
  32. package/.husky/pre-commit +0 -6
  33. package/CHANGELOG.md +0 -131
  34. package/Dockerfile +0 -22
  35. package/Use-Cases.md +0 -134
  36. package/__tests__/fixtures/.ragrc.json +0 -8
  37. package/__tests__/fixtures/invalid-ragrc.json +0 -4
  38. package/__tests__/fixtures/sample-eval-dataset.json +0 -15
  39. package/__tests__/fixtures/sample.pdf +0 -1
  40. package/__tests__/fixtures/src/mocks/openai-embedder.js +0 -16
  41. package/__tests__/fixtures/src/mocks/openai-llm.js +0 -9
  42. package/__tests__/fixtures/src/mocks/pdf-loader.js +0 -17
  43. package/__tests__/fixtures/src/mocks/pinecone-retriever.js +0 -26
  44. package/__tests__/fixtures/valid-ragrc.json +0 -16
  45. package/__tests__/integration/cli/config-flow.test.js +0 -98
  46. package/__tests__/integration/config/load-config.test.js +0 -67
  47. package/__tests__/scripts/ensure-roadmap-labels.test.js +0 -64
  48. package/__tests__/unit/config/validate-schema.test.js +0 -121
  49. package/__tests__/unit/core/plugin-registry.test.js +0 -55
  50. package/__tests__/unit/reranker/__snapshots__/reranker.snapshot.test.js.snap +0 -15
  51. package/__tests__/unit/reranker/llm-reranker.test.js +0 -18
  52. package/__tests__/unit/reranker/reranker.enriched.test.js +0 -19
  53. package/__tests__/unit/reranker/reranker.fallback.test.js +0 -15
  54. package/__tests__/unit/reranker/reranker.snapshot.test.js +0 -15
  55. package/__tests__/unit/reranker/reranker.structured-output.test.js +0 -17
  56. package/codecov +0 -0
  57. package/codecov.SHA256SUM +0 -1
  58. package/codecov.SHA256SUM.sig +0 -16
  59. package/docs-site/README.md +0 -41
  60. package/docs-site/blog/2025-04-18-architecture-overview.md +0 -16
  61. package/docs-site/blog/2025-04-18-release-v2.1.1.md +0 -13
  62. package/docs-site/blog/2025-04-19-prompt-engineering-best-practices.md +0 -16
  63. package/docs-site/blog/2025-04-20-image-showcase.md +0 -14
  64. package/docs-site/blog/2025-04-20-release-2.1.1.md +0 -21
  65. package/docs-site/blog/2025-04-21-release-v2.1.3.md +0 -13
  66. package/docs-site/blog/2025-04-21-release-v2.1.4.md +0 -13
  67. package/docs-site/blog/2025-04-22-release-v2.1.5.md +0 -13
  68. package/docs-site/blog/2025-04-24-v2.1.6.md +0 -21
  69. package/docs-site/blog/authors.yml +0 -5
  70. package/docs-site/blog/tags.yml +0 -60
  71. package/docs-site/docs/Architecture.md +0 -76
  72. package/docs-site/docs/CLI.md +0 -69
  73. package/docs-site/docs/Evaluation.md +0 -61
  74. package/docs-site/docs/FAQ.md +0 -50
  75. package/docs-site/docs/Introduction.md +0 -58
  76. package/docs-site/docs/Plugins.md +0 -61
  77. package/docs-site/docs/Tutorials.md +0 -106
  78. package/docs-site/docs/Usage.md +0 -72
  79. package/docs-site/docs/Use-Cases.md +0 -77
  80. package/docs-site/docs/intro.mdx +0 -6
  81. package/docs-site/docusaurus.config.js +0 -88
  82. package/docs-site/package-lock.json +0 -17914
  83. package/docs-site/package.json +0 -47
  84. package/docs-site/sidebars.js +0 -39
  85. package/docs-site/src/components/HomepageFeatures/index.js +0 -56
  86. package/docs-site/src/components/HomepageFeatures/index.module.css +0 -57
  87. package/docs-site/src/components/HomepageHeader/index.js +0 -46
  88. package/docs-site/src/components/HomepageHeader/index.module.css +0 -77
  89. package/docs-site/src/css/custom.css +0 -104
  90. package/docs-site/src/pages/index.js +0 -20
  91. package/docs-site/src/pages/index.module.css +0 -23
  92. package/docs-site/src/pages/markdown-page.md +0 -7
  93. package/docs-site/static/.nojekyll +0 -0
  94. package/docs-site/static/img/authors/ali.jpg +0 -0
  95. package/docs-site/static/img/hero.jpg +0 -0
  96. package/docs-site/static/img/logo.png +0 -0
  97. package/docs-site/static/img/logo.svg +0 -6
  98. package/docs-site/static/img/social-card.jpg +0 -0
  99. package/jest.config.js +0 -24
  100. package/plugin.config.json +0 -14
  101. package/public/index.html +0 -0
  102. package/public/results/sample-eval.json +0 -0
  103. package/public/src/App.jsx +0 -57
  104. package/release.config.js +0 -36
  105. package/scripts/banner-injector.js +0 -102
  106. package/scripts/ci-runner.js +0 -51
  107. package/scripts/close-done-roadmap-issues.js +0 -65
  108. package/scripts/create-roadmap-issues.js +0 -47
  109. package/scripts/ensure-roadmap-labels.js +0 -73
  110. package/scripts/fix-mdx-blog-imports.js +0 -50
  111. package/scripts/fix-mdx-image-imports.js +0 -27
  112. package/scripts/generate-release-note.js +0 -110
  113. package/scripts/get-previous-tag.js +0 -40
  114. package/scripts/label-roadmap-issues.js +0 -125
  115. package/scripts/manual-test-checklist.md +0 -90
  116. package/scripts/repair-fixtures.js +0 -30
  117. package/scripts/setup.js +0 -31
  118. package/scripts/sync-labels.js +0 -71
  119. package/scripts/sync-roadmap-labels.js +0 -21
  120. package/scripts/tag-release.js +0 -64
  121. package/scripts/test-global-setup.js +0 -18
  122. package/scripts/validate-changelog-version.js +0 -48
  123. package/scripts/verify-fixture-mocks.js +0 -45
  124. package/scripts/verify-fixtures.js +0 -36
  125. package/server.js +0 -31
  126. package/src/config/load-config.js +0 -33
  127. package/src/config/load-plugin-config.js +0 -56
  128. package/src/config/validate-plugin-schema.js +0 -28
  129. package/src/config/validate-schema.js +0 -107
  130. package/src/core/create-pipeline.js +0 -96
  131. package/src/core/plugin-contracts.js +0 -21
  132. package/src/core/plugin-registry.js +0 -48
  133. package/src/dag/dag-engine.js +0 -70
  134. package/src/evaluate/evaluator.js +0 -44
  135. package/src/evaluate/scoring.js +0 -74
  136. package/src/loader/csv-loader.js +0 -30
  137. package/src/loader/directory-loader.js +0 -38
  138. package/src/loader/html-loader.js +0 -57
  139. package/src/loader/markdown-loader.js +0 -58
  140. package/src/mocks/openai-embedder.js +0 -30
  141. package/src/mocks/openai-llm.js +0 -18
  142. package/src/mocks/pdf-loader.js +0 -17
  143. package/src/mocks/pinecone-retriever.js +0 -25
  144. package/src/reranker/llm-reranker.js +0 -34
  145. package/src/utils/ci/diagnostic-reporter.js +0 -36
  146. package/src/utils/logger.js +0 -29
  147. package/src/utils/retry.js +0 -42
  148. package/src/utils/validate-plugin-contract.js +0 -36
@@ -1,13 +0,0 @@
1
- ---
2
- slug: release-v2.1.3
3
- title: ✨ Version v2.1.3 Released
4
- authors: [ali]
5
- tags: [release, changelog]
6
- ---
7
-
8
- RAG Pipeline Utils vv2.1.3 is now available on NPM!
9
-
10
- #### Highlights
11
- - 🚀 Auto-published blog from GitHub Release
12
- - 📦 Version bump: v2.1.3
13
- - 📘 See CHANGELOG.md for full details
@@ -1,13 +0,0 @@
1
- ---
2
- slug: release-v2.1.4
3
- title: ✨ Version v2.1.4 Released
4
- authors: [ali]
5
- tags: [release, changelog]
6
- ---
7
-
8
- RAG Pipeline Utils vv2.1.4 is now available on NPM!
9
-
10
- #### Highlights
11
- - 🚀 Auto-published blog from GitHub Release
12
- - 📦 Version bump: v2.1.4
13
- - 📘 See CHANGELOG.md for full details
@@ -1,13 +0,0 @@
1
- ---
2
- slug: release-v2.1.5
3
- title: ✨ Version v2.1.5 Released
4
- authors: [ali]
5
- tags: [release, changelog]
6
- ---
7
-
8
- RAG Pipeline Utils vv2.1.5 is now available on NPM!
9
-
10
- #### Highlights
11
- - 🚀 Auto-published blog from GitHub Release
12
- - 📦 Version bump: v2.1.5
13
- - 📘 See CHANGELOG.md for full details
@@ -1,21 +0,0 @@
1
- ---
2
- slug: release-v2.1.6
3
- title: "🚀 Version v2.1.6 Released"
4
- authors: [ali]
5
- tags: [release, changelog]
6
- ---
7
-
8
- RAG Pipeline Utils **v2.1.6** is now available on NPM!
9
-
10
- ## 🔧 Changes
11
-
12
- - chore: remove legacy changelog workflow and finalize blog badge
13
- - ci(workflows): add blog badge verification workflow
14
- - ci(workflows): add blog badge verification workflow
15
- - ci(workflows): add blog badge verification workflow
16
- - docs(blog): add release post for v2.1.5
17
-
18
- ## 🔗 Resources
19
-
20
- - GitHub Compare: [v2.1.5...v2.1.6](https://github.com/DevilsDev/rag-pipeline-utils/compare/v2.1.5...v2.1.6)
21
- - View full [CHANGELOG.md](../../CHANGELOG.md)
@@ -1,5 +0,0 @@
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
@@ -1,60 +0,0 @@
1
- # docs-site/blog/tags.yml
2
- # Description: Central tag definitions for Docusaurus blog filtering and grouping
3
-
4
- release:
5
- label: Release
6
- permalink: /blog/tags/release
7
-
8
- architecture:
9
- label: Architecture
10
- permalink: /blog/tags/architecture
11
-
12
- prompt-engineering:
13
- label: Prompt Engineering
14
- permalink: /blog/tags/prompt-engineering
15
-
16
- evaluation:
17
- label: Evaluation
18
- permalink: /blog/tags/evaluation
19
-
20
- tutorials:
21
- label: Tutorials
22
- permalink: /blog/tags/tutorials
23
-
24
- changelog:
25
- label: Changelog
26
- permalink: /blog/tags/changelog
27
-
28
- design:
29
- label: Design
30
- permalink: /blog/tags/design
31
-
32
- rag:
33
- label: RAG
34
- permalink: /blog/tags/rag
35
-
36
- developer-tools:
37
- label: Developer Tools
38
- permalink: /blog/tags/developer-tools
39
-
40
- modular:
41
- label: Modular
42
- permalink: /blog/tags/modular
43
-
44
- image:
45
- label: Image
46
- permalink: /blog/tags/image
47
-
48
- facebook:
49
- label: Facebook
50
- permalink: /blog/tags/facebook
51
-
52
- hello:
53
- label: Hello
54
- permalink: /blog/tags/hello
55
-
56
- docusaurus:
57
- label: Docusaurus
58
- permalink: /blog/tags/docusaurus
59
-
60
-
@@ -1,76 +0,0 @@
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)
@@ -1,69 +0,0 @@
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)
@@ -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)
@@ -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.
@@ -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)