@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,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Version: 1.0.0
|
|
3
|
-
* Description: Enhanced CI diagnostics for plugin mock verification
|
|
4
|
-
* Author: Ali Kahwaji
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import path from 'path';
|
|
8
|
-
import chalk from 'chalk';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Pretty prints CI validation errors and guidance
|
|
12
|
-
* @param {Array<{ file: string, missing: string[] }>} failures
|
|
13
|
-
*/
|
|
14
|
-
export function reportPluginValidationFailures(failures) {
|
|
15
|
-
if (!failures.length) return;
|
|
16
|
-
|
|
17
|
-
console.log(`\n${chalk.redBright.bold('❌ Plugin Mock Validation Failed')}`);
|
|
18
|
-
|
|
19
|
-
failures.forEach(({ file, missing }) => {
|
|
20
|
-
const fileName = path.basename(file);
|
|
21
|
-
console.log(
|
|
22
|
-
`${chalk.red(` ✖ ${fileName}`)} ${chalk.gray(`missing: ${missing.join(', ')}`)}`
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
// Add method-level fix hints
|
|
26
|
-
missing.forEach(method => {
|
|
27
|
-
const pluginType = fileName.split('.')[0].split('-')[1] || 'unknown';
|
|
28
|
-
console.error(` → Fix: implement method ${chalk.cyan(`${method}()`)} for plugin type ${chalk.yellow(pluginType)}`);
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
console.log(`\n${chalk.yellowBright('Recommended Fixes:')}`);
|
|
33
|
-
console.log(' • Implement all required methods defined in /src/core/plugin-contracts.js');
|
|
34
|
-
console.log(` • Re-run: ${chalk.cyan('npm run ci')} to confirm validation`);
|
|
35
|
-
console.log(` • Optionally use: ${chalk.cyan('scripts/repair-fixtures.js')} to auto-repair mocks\n`);
|
|
36
|
-
}
|
package/src/utils/logger.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Version: 0.1.0
|
|
3
|
-
* Path: /src/utils/logger.js
|
|
4
|
-
* Description: Centralized structured logger using Pino
|
|
5
|
-
* Author: Ali Kahwaji
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import pino from 'pino';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Create a structured JSON logger instance with sensible defaults.
|
|
12
|
-
* Output can be redirected or formatted in dev/prod contexts.
|
|
13
|
-
*/
|
|
14
|
-
const logger = pino({
|
|
15
|
-
name: 'rag-pipeline-utils',
|
|
16
|
-
level: process.env.LOG_LEVEL || 'info',
|
|
17
|
-
transport: process.env.NODE_ENV === 'development' ? {
|
|
18
|
-
target: 'pino-pretty',
|
|
19
|
-
options: {
|
|
20
|
-
colorize: true,
|
|
21
|
-
translateTime: 'SYS:standard',
|
|
22
|
-
ignore: 'pid,hostname'
|
|
23
|
-
}
|
|
24
|
-
} : undefined
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
export { logger };
|
|
28
|
-
|
|
29
|
-
|
package/src/utils/retry.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Version: 0.1.0
|
|
3
|
-
* Path: /src/utils/retry.js
|
|
4
|
-
* Description: Generic retry wrapper with exponential backoff for async operations
|
|
5
|
-
* Author: Ali Kahwaji
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { logger } from './logger.js';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Retry wrapper for async functions with exponential backoff
|
|
12
|
-
*
|
|
13
|
-
* @param {Function} fn - The async function to retry
|
|
14
|
-
* @param {Object} options
|
|
15
|
-
* @param {number} [options.retries=3] - Number of retry attempts
|
|
16
|
-
* @param {number} [options.initialDelay=300] - Initial delay in ms
|
|
17
|
-
* @param {string} [options.label] - Optional label for logging context
|
|
18
|
-
* @returns {Promise<*>} - The resolved result of the function
|
|
19
|
-
* @throws {Error} - The final error if all retries fail
|
|
20
|
-
*/
|
|
21
|
-
export async function withRetry(fn, { retries = 3, initialDelay = 300, label = 'operation' } = {}) {
|
|
22
|
-
let attempt = 0;
|
|
23
|
-
let delay = initialDelay;
|
|
24
|
-
|
|
25
|
-
while (attempt <= retries) {
|
|
26
|
-
try {
|
|
27
|
-
if (attempt > 0) {
|
|
28
|
-
logger.warn({ attempt, label }, `Retrying ${label} (attempt ${attempt})`);
|
|
29
|
-
}
|
|
30
|
-
return await fn();
|
|
31
|
-
} catch (err) {
|
|
32
|
-
attempt++;
|
|
33
|
-
if (attempt > retries) {
|
|
34
|
-
logger.error({ label, error: err.message }, `Failed ${label} after ${retries} retries`);
|
|
35
|
-
throw err;
|
|
36
|
-
}
|
|
37
|
-
await new Promise(resolve => setTimeout(resolve, delay));
|
|
38
|
-
delay *= 2; // Exponential backoff
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Version: 1.0.0
|
|
3
|
-
* Description: Type-safe plugin contract validator for runtime safety
|
|
4
|
-
* Author: Ali Kahwaji
|
|
5
|
-
* File: /src/utils/validate-plugin-contract.js
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { pluginContracts } from '../core/plugin-contracts.js';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Validates that a plugin instance implements all required methods.
|
|
12
|
-
* @param {string} type - Plugin type (e.g. 'loader', 'embedder')
|
|
13
|
-
* @param {object} instance - Instantiated plugin module
|
|
14
|
-
* @param {string} filePath - Path to plugin (used in error reporting)
|
|
15
|
-
* @throws {Error} if any required method is missing or not a function
|
|
16
|
-
*/
|
|
17
|
-
export function validatePluginContract(type, instance, filePath) {
|
|
18
|
-
const expectedMethods = pluginContracts[type];
|
|
19
|
-
if (!expectedMethods) {
|
|
20
|
-
throw new Error(`[validatePluginContract] Unknown plugin type: ${type}`);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const missing = expectedMethods.filter(method =>
|
|
24
|
-
typeof instance[method] !== 'function'
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
if (missing.length > 0) {
|
|
28
|
-
throw new Error(
|
|
29
|
-
`[validatePluginContract] Plugin '${filePath}' is missing required methods for '${type}': ${missing.join(', ')}`
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Optionally wraps plugin instance with a Proxy for method usage auditing (see enforcePluginProxy)
|
|
36
|
-
*/
|