@devilsdev/rag-pipeline-utils 2.5.0 → 2.6.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/CHANGELOG.md +86 -0
- package/README.md +1 -1
- package/dist/index.cjs +1484 -147
- package/dist/index.d.ts +49 -0
- package/dist/index.mjs +1 -1
- package/dist/testing.cjs +2 -0
- package/dist/testing.d.ts +1 -0
- package/dist/testing.mjs +5 -0
- package/dist/types/adapters/ai-sdk.d.ts +53 -0
- package/dist/types/cache/component-keys.d.ts +7 -0
- package/dist/types/cache/memory-cache.d.ts +54 -0
- package/dist/types/cache/pipeline-cache.d.ts +66 -0
- package/dist/types/cache/redis-cache.d.ts +46 -0
- package/dist/types/connectors/anthropic-connector.d.ts +7 -2
- package/dist/types/connectors/cohere-connector.d.ts +7 -2
- package/dist/types/connectors/local-embedder.d.ts +9 -0
- package/dist/types/connectors/memory-retriever.d.ts +8 -0
- package/dist/types/connectors/ollama-connector.d.ts +7 -2
- package/dist/types/connectors/openai-connector.d.ts +16 -1
- package/dist/types/core/create-pipeline.d.ts +8 -0
- package/dist/types/core/plugin-registry.d.ts +136 -0
- package/dist/types/core/stage-contracts.d.ts +36 -0
- package/dist/types/core/validate-plugin.d.ts +45 -0
- package/dist/types/evaluate/semantic-similarity.d.ts +14 -0
- package/dist/types/grounding/check-answer.d.ts +101 -0
- package/dist/types/retrieval/file-vector-store.d.ts +12 -0
- package/dist/types/testing.d.ts +168 -0
- package/package.json +22 -7
- package/src/adapters/ai-sdk.js +215 -0
- package/src/cache/component-keys.js +38 -0
- package/src/cache/memory-cache.js +87 -0
- package/src/cache/pipeline-cache.js +260 -0
- package/src/cache/redis-cache.js +83 -0
- package/src/cli/commands/ai.js +17 -12
- package/src/cli/commands/plugin-hub.js +18 -13
- package/src/cli/enhanced-cli-commands.js +45 -29
- package/src/cli/handlers/query-handler.js +174 -11
- package/src/cli/services/instrument.js +83 -0
- package/src/cli/services/rag-service.js +51 -12
- package/src/cli/wizard/init-wizard.js +2 -17
- package/src/config/enhanced-ragrc-schema.js +0 -2
- package/src/config/validate-schema.js +4 -1
- package/src/connectors/anthropic-connector.js +22 -2
- package/src/connectors/cohere-connector.js +20 -2
- package/src/connectors/local-embedder.js +20 -0
- package/src/connectors/memory-retriever.js +18 -0
- package/src/connectors/ollama-connector.js +29 -2
- package/src/connectors/openai-connector.js +49 -4
- package/src/core/create-pipeline.js +112 -15
- package/src/core/performance/parallel-processor.js +62 -1
- package/src/core/plugin-registry.js +42 -19
- package/src/core/stage-contracts.js +36 -0
- package/src/core/validate-plugin.js +85 -0
- package/src/debug/execution-tracer.js +14 -4
- package/src/dev/dev-server.js +8 -1
- package/src/dev/hot-reload.js +4 -3
- package/src/enterprise/sso-integration.js +4 -3
- package/src/evaluate/semantic-similarity.js +79 -0
- package/src/grounding/check-answer.js +173 -0
- package/src/index.js +22 -0
- package/src/loader/csv-loader.js +3 -2
- package/src/loader/html-loader.js +3 -1
- package/src/loader/markdown-loader.js +3 -2
- package/src/retrieval/file-vector-store.js +30 -1
- package/src/security/jwt-validator.js +5 -4
- package/src/testing.js +254 -0
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,90 @@ Older history (pre-2.4.0) is preserved in the
|
|
|
9
9
|
[GitHub releases](https://github.com/DevilsDev/rag-pipeline-utils/releases)
|
|
10
10
|
page.
|
|
11
11
|
|
|
12
|
+
## [Unreleased]
|
|
13
|
+
|
|
14
|
+
## [2.6.0] - 2026-10-29
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- **`OpenAIConnector` `baseURL`** for OpenAI-compatible APIs (Groq,
|
|
19
|
+
Together, the Hugging Face router, vLLM, LM Studio, Ollama's `/v1`
|
|
20
|
+
endpoint). With a custom `baseURL` the key is never read from
|
|
21
|
+
`OPENAI_API_KEY`, so an OpenAI key is not sent to another provider; pass
|
|
22
|
+
`apiKey`, or omit it for local servers that need none.
|
|
23
|
+
- **`validatePlugin(stage, plugin, { registry })`** returns
|
|
24
|
+
`{ valid, errors, warnings }` for a plugin without throwing, for use in
|
|
25
|
+
plugin tests. `registry: true` also applies the rules
|
|
26
|
+
`pluginRegistry.register()` enforces.
|
|
27
|
+
- **`ParallelEmbedder` `mode`** (`'auto'`, `'batch'`, `'single'`).
|
|
28
|
+
- **`checkAnswer({ question, answer, sources })`** checks an answer from any
|
|
29
|
+
framework (LangChain, LlamaIndex, Mastra, the AI SDK, your own code)
|
|
30
|
+
against its sources: `grounded`, `groundedness`, the `unsupported`
|
|
31
|
+
sentences, per-sentence `citations` and `evaluation` scores. Sources may be
|
|
32
|
+
strings, `{ id, content }`, LangChain Documents or LlamaIndex nodes;
|
|
33
|
+
`normalizeSources` is exported for the conversion alone.
|
|
34
|
+
- **Caching**: `createRagPipeline({ cache })` caches query embeddings,
|
|
35
|
+
retrieval results and answers (`true`, a store, or per layer with time to
|
|
36
|
+
live). `MemoryCache` (LRU and TTL) and `RedisCache` (node-redis or
|
|
37
|
+
ioredis) are included; any `get`/`set` store works. A layer caches only
|
|
38
|
+
when its component identifies itself (`getCacheKey(role)` or `cacheKey`;
|
|
39
|
+
all built-ins do), retrieval is keyed by the store's state and the query
|
|
40
|
+
vector, answers by the exact documents and generation options, and
|
|
41
|
+
answers are not cached when the temperature is above 0. Retrieval is
|
|
42
|
+
cached before `filterResults` and the reranker, so guardrail ACLs run on
|
|
43
|
+
every request. Nothing from a failed, aborted or timed-out run, or from an
|
|
44
|
+
unfinished stream, is stored. Results carry `cache` per layer and the
|
|
45
|
+
pipeline has `cacheStats()`.
|
|
46
|
+
- **`@devilsdev/rag-pipeline-utils/testing`**: deterministic, offline test
|
|
47
|
+
helpers. `HashEmbedder`, `EchoLLM` (answers with the top document or a set
|
|
48
|
+
answer, records every call, streams), `fixtures.documents` and
|
|
49
|
+
`createTestPipeline()`. Shares classes with the main entry and is not
|
|
50
|
+
loaded by it.
|
|
51
|
+
- **`computeSemanticSimilarity(answer, reference, { embedder })`**: cosine
|
|
52
|
+
similarity of the two embeddings, 0 to 1. `checkAnswer` adds it as
|
|
53
|
+
`evaluation.scores.semanticSimilarity` when given a `referenceAnswer` and
|
|
54
|
+
an `embedder`.
|
|
55
|
+
- **`rag-pipeline query`** options: `--trace` (time per stage), `--explain`
|
|
56
|
+
(passage scores, and the passages supporting each answer sentence, with
|
|
57
|
+
unsupported sentences flagged), `--stats` (latency, estimated tokens and
|
|
58
|
+
cost), `--streaming` and `--timeout <ms>`; global `--quiet`. `--json`
|
|
59
|
+
includes trace, stats and explanation when asked.
|
|
60
|
+
- **`createAiSdkAdapter({ ai, embeddingModel, languageModel })`** wraps
|
|
61
|
+
Vercel AI SDK models as an `embedder` and an `llm` for
|
|
62
|
+
`createRagPipeline()`, with streaming, `embedMany` batching and the run's
|
|
63
|
+
`AbortSignal`. You pass the AI SDK functions, so it is not a dependency and
|
|
64
|
+
works with AI SDK 5, 6 and 7 from ESM or CommonJS. The RAG system prompt
|
|
65
|
+
is sent as both `instructions` (AI SDK 7) and `system` (5 and 6). Tested
|
|
66
|
+
against AI SDK 6 and 7 with their mock models.
|
|
67
|
+
|
|
68
|
+
### Changed
|
|
69
|
+
|
|
70
|
+
- **Faster CLI.** Commands load only their own dependencies: `--help`
|
|
71
|
+
takes about 0.5 s and `query` about 0.5 s instead of about 3.6 s. Loading
|
|
72
|
+
the CLI drops from 1281 modules and 93 packages to 55 and 13. The HTML,
|
|
73
|
+
Markdown and CSV loaders load `jsdom`, `marked` and `csv-parse` when they
|
|
74
|
+
read a file.
|
|
75
|
+
- **Faster import.** `require('@devilsdev/rag-pipeline-utils')` takes about
|
|
76
|
+
125 ms instead of about 515 ms and loads 31 modules from 9 packages
|
|
77
|
+
instead of 245 from 54 (published bundle, Node 22). `axios`,
|
|
78
|
+
`jsonwebtoken`, `ajv` and `chokidar` now load when the feature that needs
|
|
79
|
+
them is first used (the Anthropic, Cohere and Ollama connectors,
|
|
80
|
+
`JWTValidator`, plugin registration and config validation, hot reload).
|
|
81
|
+
The shared `pluginRegistry` loads its contracts on first use; registries
|
|
82
|
+
created with `new PluginRegistry()` still load them in the constructor.
|
|
83
|
+
|
|
84
|
+
### Fixed
|
|
85
|
+
|
|
86
|
+
- **`ExecutionTracer.exportTraces('json')`** threw "circular structure"
|
|
87
|
+
with the default `captureOutputs: true`: traces stored the live result,
|
|
88
|
+
which carries the trace. Traces now store JSON snapshots, which also keeps
|
|
89
|
+
later changes to a result out of its recorded trace.
|
|
90
|
+
- **`ParallelEmbedder`** failed with the built-in connectors, which embed
|
|
91
|
+
one string at a time, because it always called `embed(batch)` with an
|
|
92
|
+
array. In the default `'auto'` mode it now embeds texts one by one for
|
|
93
|
+
those connectors and uses `embedBatch(texts)` when an embedder has it;
|
|
94
|
+
other embedders are still called with the array.
|
|
95
|
+
|
|
12
96
|
## [2.5.0] - 2026-10-28
|
|
13
97
|
|
|
14
98
|
### Added
|
|
@@ -468,6 +552,8 @@ First public release on the 2.4 line, introducing the v2.4 feature set.
|
|
|
468
552
|
For release notes prior to v2.4.0, see
|
|
469
553
|
[github.com/DevilsDev/rag-pipeline-utils/releases](https://github.com/DevilsDev/rag-pipeline-utils/releases).
|
|
470
554
|
|
|
555
|
+
[2.6.0]: https://github.com/DevilsDev/rag-pipeline-utils/releases/tag/v2.6.0
|
|
556
|
+
[2.5.0]: https://github.com/DevilsDev/rag-pipeline-utils/releases/tag/v2.5.0
|
|
471
557
|
[2.4.5]: https://github.com/DevilsDev/rag-pipeline-utils/releases/tag/v2.4.5
|
|
472
558
|
[2.4.4]: https://github.com/DevilsDev/rag-pipeline-utils/releases/tag/v2.4.4
|
|
473
559
|
[2.4.3]: https://github.com/DevilsDev/rag-pipeline-utils/releases/tag/v2.4.3
|
package/README.md
CHANGED
|
@@ -469,7 +469,7 @@ They are still exported from the main entry in 2.5 with a one-time deprecation w
|
|
|
469
469
|
- [CLI reference](https://devilsdev.github.io/rag-pipeline-utils/docs/CLI)
|
|
470
470
|
- [API reference](https://devilsdev.github.io/rag-pipeline-utils/docs/API-Reference)
|
|
471
471
|
- [Evaluation guide](https://devilsdev.github.io/rag-pipeline-utils/docs/Evaluation)
|
|
472
|
-
- [Examples](examples/): basic pipeline, OpenAI with Pinecone, and a deployable Fastify service
|
|
472
|
+
- [Examples](examples/): basic pipeline, OpenAI with Pinecone, and a deployable Fastify service ([run the basic pipeline in your browser](https://stackblitz.com/github/DevilsDev/rag-pipeline-utils/tree/main/examples/basic-pipeline))
|
|
473
473
|
- [Changelog](CHANGELOG.md) and [benchmarks methodology](BENCHMARKS.md)
|
|
474
474
|
|
|
475
475
|
## Security
|