@absolutejs/rag 0.9.0 → 0.10.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 +10 -0
- package/README.md +15 -0
- package/changelog.json +21 -0
- package/dist/index.js +52 -1
- package/dist/index.js.map +5 -4
- package/dist/src/index.d.ts +1 -0
- package/dist/src/retrieval/quoteReferences.d.ts +13 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,16 @@ This file is generated by `absolute-changelog` from the entries in
|
|
|
6
6
|
`changelog/`. Edit an entry, not this file — and add new ones under
|
|
7
7
|
`changelog/unreleased/`.
|
|
8
8
|
|
|
9
|
+
## 0.10.0 — 2026-09-16
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **Encode retrieved original-text passages as request-scoped quote references and restore exact quotes without rewriting source text** (`createRAGQuoteReferences`)
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- **Accept AI 0.2 alongside existing compatible AI releases; validate retrieval against AI 0.2.0** (`ragChat`, `createRAGWorkflow`)
|
|
18
|
+
|
|
9
19
|
## 0.9.0 — 2026-09-16
|
|
10
20
|
|
|
11
21
|
### Breaking
|
package/README.md
CHANGED
|
@@ -110,3 +110,18 @@ saved-source recovery callback when appropriate. Providers without capacity
|
|
|
110
110
|
support require an explicit `contextPolicy: false` raw opt-out. Older supported
|
|
111
111
|
AI peers retain their previous behavior; upgrading RAG alone does not add the AI
|
|
112
112
|
0.1 capacity policy. No model-capacity numbers are defined in RAG.
|
|
113
|
+
|
|
114
|
+
### Reversible quote references
|
|
115
|
+
|
|
116
|
+
`createRAGQuoteReferences()` creates a request-scoped registry for compressing
|
|
117
|
+
already-verified original-text tool results. `encodeToolResult(json)` replaces
|
|
118
|
+
passage text with sentence entries `{ citation, text }`; `resolve(citation)`
|
|
119
|
+
restores the exact registered sentence. Repeated sentences reuse a reference,
|
|
120
|
+
and unknown references throw. Search and single-range read envelopes are
|
|
121
|
+
supported; unrecognized tool results pass through unchanged.
|
|
122
|
+
|
|
123
|
+
Keep the registry alive across prefetch, lookups and completion, then discard
|
|
124
|
+
it. Only encode server-owned original-text tool results. References are not
|
|
125
|
+
access controls or durable source IDs: reauthorize and validate restored quotes
|
|
126
|
+
against the originals before saving a result. This is opt-in; it does not change
|
|
127
|
+
the original-text tools, stored originals or their existing result format.
|
package/changelog.json
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
"contract": 1,
|
|
3
3
|
"name": "@absolutejs/rag",
|
|
4
4
|
"releases": [
|
|
5
|
+
{
|
|
6
|
+
"changes": [
|
|
7
|
+
{
|
|
8
|
+
"kind": "added",
|
|
9
|
+
"summary": "Encode retrieved original-text passages as request-scoped quote references and restore exact quotes without rewriting source text",
|
|
10
|
+
"symbols": [
|
|
11
|
+
"createRAGQuoteReferences"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"kind": "changed",
|
|
16
|
+
"summary": "Accept AI 0.2 alongside existing compatible AI releases; validate retrieval against AI 0.2.0",
|
|
17
|
+
"symbols": [
|
|
18
|
+
"ragChat",
|
|
19
|
+
"createRAGWorkflow"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"date": "2026-09-16",
|
|
24
|
+
"version": "0.10.0"
|
|
25
|
+
},
|
|
5
26
|
{
|
|
6
27
|
"changes": [
|
|
7
28
|
{
|
package/dist/index.js
CHANGED
|
@@ -36572,6 +36572,56 @@ var createRAGOriginalTextTools = (options) => {
|
|
|
36572
36572
|
}
|
|
36573
36573
|
};
|
|
36574
36574
|
};
|
|
36575
|
+
// src/retrieval/quoteReferences.ts
|
|
36576
|
+
var createRAGQuoteReferences = () => {
|
|
36577
|
+
const quotes = new Map;
|
|
36578
|
+
const references = new Map;
|
|
36579
|
+
const record2 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
36580
|
+
const encodePassage = (passage) => {
|
|
36581
|
+
if (!record2(passage) || typeof passage.text !== "string")
|
|
36582
|
+
return passage;
|
|
36583
|
+
const { text, ...metadata } = passage;
|
|
36584
|
+
const sentences = text.split(/(?<=[.!?])\s+(?=[A-Z])|\n+/u).filter((sentence) => sentence.trim());
|
|
36585
|
+
return {
|
|
36586
|
+
...metadata,
|
|
36587
|
+
sentences: sentences.map((sentence) => {
|
|
36588
|
+
let citation = references.get(sentence);
|
|
36589
|
+
if (!citation) {
|
|
36590
|
+
citation = `e${quotes.size + 1}`;
|
|
36591
|
+
references.set(sentence, citation);
|
|
36592
|
+
quotes.set(citation, sentence);
|
|
36593
|
+
}
|
|
36594
|
+
return { citation, text: sentence };
|
|
36595
|
+
})
|
|
36596
|
+
};
|
|
36597
|
+
};
|
|
36598
|
+
return {
|
|
36599
|
+
encodeToolResult: (serialized) => {
|
|
36600
|
+
let value;
|
|
36601
|
+
try {
|
|
36602
|
+
value = JSON.parse(serialized);
|
|
36603
|
+
} catch {
|
|
36604
|
+
return serialized;
|
|
36605
|
+
}
|
|
36606
|
+
if (!record2(value) || value.referenceOnly !== true)
|
|
36607
|
+
return serialized;
|
|
36608
|
+
if (Array.isArray(value.passages))
|
|
36609
|
+
return JSON.stringify({
|
|
36610
|
+
...value,
|
|
36611
|
+
passages: value.passages.map(encodePassage)
|
|
36612
|
+
});
|
|
36613
|
+
if (typeof value.text === "string")
|
|
36614
|
+
return JSON.stringify(encodePassage(value));
|
|
36615
|
+
return serialized;
|
|
36616
|
+
},
|
|
36617
|
+
resolve: (reference) => {
|
|
36618
|
+
const quote = quotes.get(reference);
|
|
36619
|
+
if (quote === undefined)
|
|
36620
|
+
throw new Error("Unknown retrieved quote reference");
|
|
36621
|
+
return quote;
|
|
36622
|
+
}
|
|
36623
|
+
};
|
|
36624
|
+
};
|
|
36575
36625
|
export {
|
|
36576
36626
|
addRAGEvaluationSuiteCase,
|
|
36577
36627
|
addRAGEvaluationSuiteCaseHardNegative,
|
|
@@ -36732,6 +36782,7 @@ export {
|
|
|
36732
36782
|
createRAGPresentationCueBenchmarkSnapshot,
|
|
36733
36783
|
createRAGPresentationCueBenchmarkSuite,
|
|
36734
36784
|
createRAGQueryTransform,
|
|
36785
|
+
createRAGQuoteReferences,
|
|
36735
36786
|
createRAGReranker,
|
|
36736
36787
|
createRAGSQLiteAnswerGroundingEvaluationHistoryStore,
|
|
36737
36788
|
createRAGSQLiteEvaluationHistoryStore,
|
|
@@ -36878,5 +36929,5 @@ export {
|
|
|
36878
36929
|
xaiEmbeddings
|
|
36879
36930
|
};
|
|
36880
36931
|
|
|
36881
|
-
//# debugId=
|
|
36932
|
+
//# debugId=2522635E4551C85B64756E2164756E21
|
|
36882
36933
|
//# sourceMappingURL=index.js.map
|