@cogitator-ai/rag 0.3.4 → 0.4.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/README.md +23 -6
- package/dist/rerankers/index.d.ts +1 -1
- package/dist/rerankers/index.d.ts.map +1 -1
- package/dist/rerankers/index.js +1 -1
- package/dist/rerankers/index.js.map +1 -1
- package/dist/rerankers/llm-reranker.d.ts +27 -0
- package/dist/rerankers/llm-reranker.d.ts.map +1 -1
- package/dist/rerankers/llm-reranker.js +33 -5
- package/dist/rerankers/llm-reranker.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -13,6 +13,8 @@ pnpm add papaparse # CSV loading
|
|
|
13
13
|
pnpm add pdf-parse # PDF loading
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
+
`@cogitator-ai/memory` (optional peer) provides the embedding services, vector stores (`InMemoryEmbeddingAdapter`, `PostgresAdapter`, `QdrantAdapter`) and `HybridSearch` used below; any `EmbeddingService` / `EmbeddingAdapter` implementation works. Website docs: [RAG](https://cogitator.app/docs/rag), [Loaders](https://cogitator.app/docs/rag/loaders), [Chunking](https://cogitator.app/docs/rag/chunking), [Retrieval](https://cogitator.app/docs/rag/retrieval), [Reranking](https://cogitator.app/docs/rag/reranking).
|
|
17
|
+
|
|
16
18
|
## Features
|
|
17
19
|
|
|
18
20
|
- **7 Document Loaders** — Text, Markdown, JSON, CSV, HTML, PDF, Web pages
|
|
@@ -46,10 +48,10 @@ const pipeline = new RAGPipelineBuilder()
|
|
|
46
48
|
.build();
|
|
47
49
|
|
|
48
50
|
// ingest documents from a file or directory
|
|
49
|
-
await pipeline.ingest('./docs');
|
|
51
|
+
const { documents, chunks } = await pipeline.ingest('./docs');
|
|
50
52
|
|
|
51
|
-
// query the knowledge base
|
|
52
|
-
const results = await pipeline.query('How does authentication work?');
|
|
53
|
+
// query the knowledge base (options override the configured retrieval for this call)
|
|
54
|
+
const results = await pipeline.query('How does authentication work?', { topK: 3 });
|
|
53
55
|
|
|
54
56
|
for (const r of results) {
|
|
55
57
|
console.log(`[${r.score.toFixed(3)}] ${r.source}: ${r.content.slice(0, 100)}...`);
|
|
@@ -90,13 +92,17 @@ const intranet = new WebLoader({
|
|
|
90
92
|
Responses are decompressed (gzip, deflate, br), decoded using the declared charset, and limited to `maxResponseBytes` (50MB by default). Non-text content types are rejected.
|
|
91
93
|
|
|
92
94
|
```typescript
|
|
93
|
-
import { MarkdownLoader, WebLoader, CSVLoader } from '@cogitator-ai/rag';
|
|
95
|
+
import { MarkdownLoader, WebLoader, CSVLoader, PDFLoader, JSONLoader } from '@cogitator-ai/rag';
|
|
94
96
|
|
|
95
97
|
const md = new MarkdownLoader({ stripFrontmatter: true });
|
|
96
98
|
const web = new WebLoader({ selector: 'article' });
|
|
97
99
|
const csv = new CSVLoader({ contentColumn: 'body', metadataColumns: ['title'] });
|
|
100
|
+
const pdf = new PDFLoader({ splitPages: true }); // one document per page
|
|
101
|
+
const json = new JSONLoader({ contentField: 'text' });
|
|
98
102
|
```
|
|
99
103
|
|
|
104
|
+
A pipeline has one loader; use `withChunker()` / `withRetriever()` on the builder to replace the chunker or retriever the config would create.
|
|
105
|
+
|
|
100
106
|
---
|
|
101
107
|
|
|
102
108
|
## Chunking Strategies
|
|
@@ -301,6 +307,17 @@ const pipeline = new RAGPipelineBuilder()
|
|
|
301
307
|
.build();
|
|
302
308
|
```
|
|
303
309
|
|
|
310
|
+
When the model's answer holds no ranking (a reasoning model that spent its token budget on reasoning returns empty content, for example) or `generateFn` throws, the reranker keeps the retrieval order and logs a warning. Pass `onError` to observe that fallback, or `strict: true` to make `rerank()` throw an `LLMRerankError` (with the raw answer in `response` and the original error in `cause`):
|
|
311
|
+
|
|
312
|
+
```typescript
|
|
313
|
+
const observed = new LLMReranker({
|
|
314
|
+
generateFn: (prompt) => llm.generate(prompt),
|
|
315
|
+
onError: (error, { query, response }) => logger.warn({ query, response }, error.message),
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
const strict = new LLMReranker({ generateFn: (prompt) => llm.generate(prompt), strict: true });
|
|
319
|
+
```
|
|
320
|
+
|
|
304
321
|
### Cohere Reranker
|
|
305
322
|
|
|
306
323
|
Uses the Cohere Rerank API (rerank-v3.5 by default).
|
|
@@ -347,7 +364,7 @@ const agent = new Agent({
|
|
|
347
364
|
});
|
|
348
365
|
```
|
|
349
366
|
|
|
350
|
-
`RAGTool` objects carry Zod parameter schemas and can be passed to `tool()` directly. `rag_search` falls back to the pipeline's configured `topK`/`threshold` when the model omits `limit`/`threshold`.
|
|
367
|
+
`RAGTool` objects carry Zod parameter schemas and can be passed to `tool()` directly; `createSearchTool(pipeline)` and `createIngestTool(pipeline, options)` build them one at a time. `rag_search` falls back to the pipeline's configured `topK`/`threshold` when the model omits `limit`/`threshold`.
|
|
351
368
|
|
|
352
369
|
**Security:** `rag_ingest` reads whatever source the model passes. When the tool is exposed to an LLM, restrict it with `allowedRoots` (paths are canonicalized, so `..` traversal and symlink escapes are rejected) and `allowUrls: false` if web ingestion is not needed. URL ingestion goes through the SSRF-protected `WebLoader` when the pipeline uses one.
|
|
353
370
|
|
|
@@ -366,7 +383,7 @@ console.log(stats.queriesProcessed);
|
|
|
366
383
|
|
|
367
384
|
## Examples
|
|
368
385
|
|
|
369
|
-
See [`examples/rag/`](
|
|
386
|
+
See [`examples/rag/`](https://github.com/cogitator-ai/Cogitator-AI/tree/main/examples/rag) for runnable examples:
|
|
370
387
|
|
|
371
388
|
- **01-basic-retrieval.ts** — Ingest documents and run semantic queries
|
|
372
389
|
- **02-chunking-strategies.ts** — Compare fixed, recursive, and semantic chunking
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { LLMReranker, type LLMRerankerConfig } from './llm-reranker.js';
|
|
1
|
+
export { LLMReranker, LLMRerankError, type LLMRerankerConfig, type LLMRerankFailureContext, } from './llm-reranker.js';
|
|
2
2
|
export { CohereReranker, type CohereRerankerConfig } from './cohere-reranker.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rerankers/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rerankers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,cAAc,EACd,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,GAC7B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/rerankers/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rerankers/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rerankers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,cAAc,GAGf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAA6B,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,9 +1,36 @@
|
|
|
1
1
|
import type { Reranker, RetrievalResult } from '@cogitator-ai/types';
|
|
2
|
+
/** What the reranker was doing when it failed. */
|
|
3
|
+
export interface LLMRerankFailureContext {
|
|
4
|
+
query: string;
|
|
5
|
+
/** The model's raw answer, or undefined when `generateFn` itself failed. */
|
|
6
|
+
response?: string;
|
|
7
|
+
}
|
|
2
8
|
export interface LLMRerankerConfig {
|
|
3
9
|
generateFn: (prompt: string) => Promise<string>;
|
|
10
|
+
/**
|
|
11
|
+
* Called when the model's answer cannot be turned into a ranking, or `generateFn` fails. The
|
|
12
|
+
* reranker then returns the results in retrieval order (unless `strict` is set) and does not
|
|
13
|
+
* log to the console.
|
|
14
|
+
*/
|
|
15
|
+
onError?: (error: LLMRerankError, context: LLMRerankFailureContext) => void;
|
|
16
|
+
/** Throw an `LLMRerankError` instead of falling back to the retrieval order. Defaults to false. */
|
|
17
|
+
strict?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** Reranking failed: the model gave no usable ranking, or `generateFn` threw (see `cause`). */
|
|
20
|
+
export declare class LLMRerankError extends Error {
|
|
21
|
+
/** The model's raw answer, when there was one. */
|
|
22
|
+
readonly response?: string | undefined;
|
|
23
|
+
readonly name = "LLMRerankError";
|
|
24
|
+
constructor(message: string,
|
|
25
|
+
/** The model's raw answer, when there was one. */
|
|
26
|
+
response?: string | undefined, options?: {
|
|
27
|
+
cause?: unknown;
|
|
28
|
+
});
|
|
4
29
|
}
|
|
5
30
|
export declare class LLMReranker implements Reranker {
|
|
6
31
|
private readonly generateFn;
|
|
32
|
+
private readonly onError?;
|
|
33
|
+
private readonly strict;
|
|
7
34
|
constructor(config: LLMRerankerConfig);
|
|
8
35
|
rerank(query: string, results: RetrievalResult[], topN?: number): Promise<RetrievalResult[]>;
|
|
9
36
|
private buildPrompt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm-reranker.d.ts","sourceRoot":"","sources":["../../src/rerankers/llm-reranker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAErE,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"llm-reranker.d.ts","sourceRoot":"","sources":["../../src/rerankers/llm-reranker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAErE,kDAAkD;AAClD,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,uBAAuB,KAAK,IAAI,CAAC;IAC5E,mGAAmG;IACnG,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,+FAA+F;AAC/F,qBAAa,cAAe,SAAQ,KAAK;IAKrC,kDAAkD;IAClD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM;IAL5B,SAAkB,IAAI,oBAAoB;gBAGxC,OAAO,EAAE,MAAM;IACf,kDAAkD;IACzC,QAAQ,CAAC,EAAE,MAAM,YAAA,EAC1B,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAIhC;AAID,qBAAa,WAAY,YAAW,QAAQ;IAC1C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsC;IACjE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAA+B;IACxD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;gBAErB,MAAM,EAAE,iBAAiB;IAM/B,MAAM,CACV,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,eAAe,EAAE,EAC1B,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,eAAe,EAAE,CAAC;IA0C7B,OAAO,CAAC,WAAW;IAenB,OAAO,CAAC,WAAW;CAqCpB"}
|
|
@@ -1,15 +1,30 @@
|
|
|
1
|
+
/** Reranking failed: the model gave no usable ranking, or `generateFn` threw (see `cause`). */
|
|
2
|
+
export class LLMRerankError extends Error {
|
|
3
|
+
response;
|
|
4
|
+
name = 'LLMRerankError';
|
|
5
|
+
constructor(message,
|
|
6
|
+
/** The model's raw answer, when there was one. */
|
|
7
|
+
response, options) {
|
|
8
|
+
super(message, options);
|
|
9
|
+
this.response = response;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
1
12
|
const MAX_DOCUMENTS_IN_PROMPT = 50;
|
|
2
13
|
export class LLMReranker {
|
|
3
14
|
generateFn;
|
|
15
|
+
onError;
|
|
16
|
+
strict;
|
|
4
17
|
constructor(config) {
|
|
5
18
|
this.generateFn = config.generateFn;
|
|
19
|
+
this.onError = config.onError;
|
|
20
|
+
this.strict = config.strict ?? false;
|
|
6
21
|
}
|
|
7
22
|
async rerank(query, results, topN) {
|
|
8
23
|
if (results.length === 0)
|
|
9
24
|
return [];
|
|
25
|
+
let response;
|
|
10
26
|
try {
|
|
11
|
-
|
|
12
|
-
const response = await this.generateFn(prompt);
|
|
27
|
+
response = await this.generateFn(this.buildPrompt(query, results));
|
|
13
28
|
const scores = this.parseScores(response, results.length);
|
|
14
29
|
const scored = results.map((result, i) => {
|
|
15
30
|
const entry = scores.find((s) => s.index === i);
|
|
@@ -23,7 +38,17 @@ export class LLMReranker {
|
|
|
23
38
|
return topN ? reranked.slice(0, topN) : reranked;
|
|
24
39
|
}
|
|
25
40
|
catch (error) {
|
|
26
|
-
|
|
41
|
+
const failure = error instanceof LLMRerankError
|
|
42
|
+
? error
|
|
43
|
+
: new LLMRerankError(`${response === undefined ? 'generateFn failed' : 'Reranking failed'}: ${error instanceof Error ? error.message : String(error)}`, response, { cause: error });
|
|
44
|
+
if (this.strict)
|
|
45
|
+
throw failure;
|
|
46
|
+
if (this.onError) {
|
|
47
|
+
this.onError(failure, { query, response });
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
console.warn('[LLMReranker] Reranking failed, returning original order:', failure);
|
|
51
|
+
}
|
|
27
52
|
const fallback = [...results];
|
|
28
53
|
return topN ? fallback.slice(0, topN) : fallback;
|
|
29
54
|
}
|
|
@@ -42,9 +67,12 @@ export class LLMReranker {
|
|
|
42
67
|
].join('\n');
|
|
43
68
|
}
|
|
44
69
|
parseScores(response, count) {
|
|
70
|
+
if (typeof response !== 'string' || response.trim() === '') {
|
|
71
|
+
throw new LLMRerankError('The model returned an empty response (a reasoning model may have spent its token budget on reasoning)', response);
|
|
72
|
+
}
|
|
45
73
|
const candidates = response.match(/\[[\s\S]*?\]/g);
|
|
46
74
|
if (!candidates)
|
|
47
|
-
throw new
|
|
75
|
+
throw new LLMRerankError('No JSON array found in the response', response);
|
|
48
76
|
for (let i = candidates.length - 1; i >= 0; i--) {
|
|
49
77
|
try {
|
|
50
78
|
const parsed = JSON.parse(candidates[i]);
|
|
@@ -63,7 +91,7 @@ export class LLMReranker {
|
|
|
63
91
|
continue;
|
|
64
92
|
}
|
|
65
93
|
}
|
|
66
|
-
throw new
|
|
94
|
+
throw new LLMRerankError('No JSON array of { index, score } objects found in the response', response);
|
|
67
95
|
}
|
|
68
96
|
}
|
|
69
97
|
//# sourceMappingURL=llm-reranker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm-reranker.js","sourceRoot":"","sources":["../../src/rerankers/llm-reranker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"llm-reranker.js","sourceRoot":"","sources":["../../src/rerankers/llm-reranker.ts"],"names":[],"mappings":"AAqBA,+FAA+F;AAC/F,MAAM,OAAO,cAAe,SAAQ,KAAK;IAM5B;IALO,IAAI,GAAG,gBAAgB,CAAC;IAE1C,YACE,OAAe;IACf,kDAAkD;IACzC,QAAiB,EAC1B,OAA6B;QAE7B,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAHf,aAAQ,GAAR,QAAQ,CAAS;IAI5B,CAAC;CACF;AAED,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAEnC,MAAM,OAAO,WAAW;IACL,UAAU,CAAsC;IAChD,OAAO,CAAgC;IACvC,MAAM,CAAU;IAEjC,YAAY,MAAyB;QACnC,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QACpC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,KAAK,CA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AAQ,CACT,CAAC;IACJ,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cogitator-ai/rag",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Retrieval Augmented Generation for Cogitator AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"node": ">=22.12.0"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@cogitator-ai/types": "0.
|
|
21
|
+
"@cogitator-ai/types": "0.30.0",
|
|
22
22
|
"nanoid": "^6.0.1",
|
|
23
23
|
"zod": "^4.6.5"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@cogitator-ai/memory": ">=0.
|
|
26
|
+
"@cogitator-ai/memory": ">=0.11.1"
|
|
27
27
|
},
|
|
28
28
|
"peerDependenciesMeta": {
|
|
29
29
|
"@cogitator-ai/memory": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"pdf-parse": "^2.4.5"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@cogitator-ai/memory": "0.
|
|
39
|
+
"@cogitator-ai/memory": "0.11.1",
|
|
40
40
|
"@types/papaparse": "^5.3.15",
|
|
41
41
|
"typescript": "^6.0.3",
|
|
42
42
|
"vitest": "^5.0.3"
|