@absolutejs/rag 0.0.28 → 0.0.29

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.
@@ -0,0 +1,515 @@
1
+ {
2
+ "contract": 1,
3
+ "identity": {
4
+ "accent": "#10b981",
5
+ "category": "ai",
6
+ "description": "Retrieval-augmented generation for AbsoluteJS: ingest documents, URLs, and uploads into a pluggable vector store (`rag/vector-store`), embed with any provider (`rag/embedding-provider`), search with hybrid vector + lexical retrieval, optionally rerank (`rag/reranker`), and mount the `ragChat` Elysia plugin for grounded answers with citations. Evaluation suites, sync sources, and admin surfaces included.",
7
+ "docsUrl": "https://github.com/absolutejs/rag",
8
+ "name": "@absolutejs/rag",
9
+ "tagline": "Answer questions from your own content."
10
+ },
11
+ "implements": [
12
+ {
13
+ "contract": "rag/vector-store",
14
+ "factory": "createInMemoryRAGStore",
15
+ "from": "@absolutejs/rag",
16
+ "settings": {
17
+ "type": "object",
18
+ "properties": {
19
+ "dimensions": {
20
+ "description": "Vector size used by the built-in fallback embedding. Match your embedding provider's output size.",
21
+ "maximum": 8192,
22
+ "minimum": 1,
23
+ "title": "Vector dimensions",
24
+ "type": "integer"
25
+ }
26
+ }
27
+ },
28
+ "title": "In memory (development only — content is lost on restart)",
29
+ "wiring": {
30
+ "code": "createInMemoryRAGStore(${settings})",
31
+ "imports": [
32
+ {
33
+ "from": "@absolutejs/rag",
34
+ "names": [
35
+ "createInMemoryRAGStore"
36
+ ]
37
+ }
38
+ ]
39
+ }
40
+ },
41
+ {
42
+ "contract": "rag/embedding-provider",
43
+ "factory": "openaiEmbeddings",
44
+ "from": "@absolutejs/rag",
45
+ "requires": {
46
+ "env": [
47
+ {
48
+ "description": "OpenAI API key",
49
+ "docsUrl": "https://platform.openai.com/api-keys",
50
+ "example": "sk-xxxxxxxxx",
51
+ "key": "OPENAI_API_KEY",
52
+ "secret": true
53
+ }
54
+ ]
55
+ },
56
+ "settings": {
57
+ "type": "object",
58
+ "properties": {
59
+ "defaultModel": {
60
+ "description": "Embedding model used when a request doesn't name one.",
61
+ "examples": [
62
+ "text-embedding-3-small"
63
+ ],
64
+ "title": "Embedding model",
65
+ "type": "string"
66
+ },
67
+ "dimensions": {
68
+ "description": "Vector size to request from the model. Must match your vector store's configured size.",
69
+ "maximum": 8192,
70
+ "minimum": 1,
71
+ "title": "Vector dimensions",
72
+ "type": "integer"
73
+ }
74
+ }
75
+ },
76
+ "title": "OpenAI embeddings",
77
+ "wiring": {
78
+ "code": "openaiEmbeddings({ apiKey: ${env.OPENAI_API_KEY} ?? \"\", ...${settings} })",
79
+ "imports": [
80
+ {
81
+ "from": "@absolutejs/rag",
82
+ "names": [
83
+ "openaiEmbeddings"
84
+ ]
85
+ }
86
+ ]
87
+ }
88
+ },
89
+ {
90
+ "contract": "rag/embedding-provider",
91
+ "factory": "geminiEmbeddings",
92
+ "from": "@absolutejs/rag",
93
+ "requires": {
94
+ "env": [
95
+ {
96
+ "description": "Google AI Studio API key for Gemini",
97
+ "docsUrl": "https://aistudio.google.com/apikey",
98
+ "example": "AIzaXXXXXXXX",
99
+ "key": "GEMINI_API_KEY",
100
+ "secret": true
101
+ }
102
+ ]
103
+ },
104
+ "settings": {
105
+ "type": "object",
106
+ "properties": {
107
+ "defaultModel": {
108
+ "description": "Embedding model used when a request doesn't name one.",
109
+ "examples": [
110
+ "gemini-embedding-001"
111
+ ],
112
+ "title": "Embedding model",
113
+ "type": "string"
114
+ },
115
+ "dimensions": {
116
+ "description": "Vector size to request from the model. Must match your vector store's configured size.",
117
+ "maximum": 8192,
118
+ "minimum": 1,
119
+ "title": "Vector dimensions",
120
+ "type": "integer"
121
+ }
122
+ }
123
+ },
124
+ "title": "Gemini embeddings",
125
+ "wiring": {
126
+ "code": "geminiEmbeddings({ apiKey: ${env.GEMINI_API_KEY} ?? \"\", ...${settings} })",
127
+ "imports": [
128
+ {
129
+ "from": "@absolutejs/rag",
130
+ "names": [
131
+ "geminiEmbeddings"
132
+ ]
133
+ }
134
+ ]
135
+ }
136
+ },
137
+ {
138
+ "contract": "rag/embedding-provider",
139
+ "factory": "ollamaEmbeddings",
140
+ "from": "@absolutejs/rag",
141
+ "settings": {
142
+ "type": "object",
143
+ "properties": {
144
+ "baseUrl": {
145
+ "description": "Where your Ollama server is reachable.",
146
+ "examples": [
147
+ "http://localhost:11434"
148
+ ],
149
+ "format": "uri",
150
+ "title": "Ollama server URL",
151
+ "type": "string"
152
+ },
153
+ "defaultModel": {
154
+ "description": "Embedding model used when a request doesn't name one.",
155
+ "examples": [
156
+ "nomic-embed-text"
157
+ ],
158
+ "title": "Embedding model",
159
+ "type": "string"
160
+ }
161
+ }
162
+ },
163
+ "title": "Ollama (runs on your own machine, no API key)",
164
+ "wiring": {
165
+ "code": "ollamaEmbeddings(${settings})",
166
+ "imports": [
167
+ {
168
+ "from": "@absolutejs/rag",
169
+ "names": [
170
+ "ollamaEmbeddings"
171
+ ]
172
+ }
173
+ ]
174
+ }
175
+ },
176
+ {
177
+ "contract": "rag/reranker",
178
+ "factory": "createHeuristicRAGReranker",
179
+ "from": "@absolutejs/rag",
180
+ "title": "Built-in heuristic (no API key, keyword overlap scoring)",
181
+ "wiring": {
182
+ "code": "createHeuristicRAGReranker()",
183
+ "imports": [
184
+ {
185
+ "from": "@absolutejs/rag",
186
+ "names": [
187
+ "createHeuristicRAGReranker"
188
+ ]
189
+ }
190
+ ]
191
+ }
192
+ },
193
+ {
194
+ "contract": "rag/reranker",
195
+ "factory": "createCohereRAGReranker",
196
+ "from": "@absolutejs/rag",
197
+ "requires": {
198
+ "env": [
199
+ {
200
+ "description": "Cohere API key",
201
+ "docsUrl": "https://dashboard.cohere.com/api-keys",
202
+ "key": "COHERE_API_KEY",
203
+ "secret": true
204
+ }
205
+ ]
206
+ },
207
+ "settings": {
208
+ "type": "object",
209
+ "properties": {
210
+ "defaultModel": {
211
+ "description": "Rerank model used when a request doesn't name one.",
212
+ "examples": [
213
+ "rerank-v3.5"
214
+ ],
215
+ "title": "Rerank model",
216
+ "type": "string"
217
+ }
218
+ }
219
+ },
220
+ "title": "Cohere reranker",
221
+ "wiring": {
222
+ "code": "createCohereRAGReranker({ apiKey: ${env.COHERE_API_KEY} ?? \"\", ...${settings} })",
223
+ "imports": [
224
+ {
225
+ "from": "@absolutejs/rag",
226
+ "names": [
227
+ "createCohereRAGReranker"
228
+ ]
229
+ }
230
+ ]
231
+ }
232
+ },
233
+ {
234
+ "contract": "rag/reranker",
235
+ "factory": "createVoyageRAGReranker",
236
+ "from": "@absolutejs/rag",
237
+ "requires": {
238
+ "env": [
239
+ {
240
+ "description": "Voyage AI API key",
241
+ "docsUrl": "https://dashboard.voyageai.com",
242
+ "key": "VOYAGE_API_KEY",
243
+ "secret": true
244
+ }
245
+ ]
246
+ },
247
+ "settings": {
248
+ "type": "object",
249
+ "properties": {
250
+ "defaultModel": {
251
+ "description": "Rerank model used when a request doesn't name one.",
252
+ "examples": [
253
+ "rerank-2"
254
+ ],
255
+ "title": "Rerank model",
256
+ "type": "string"
257
+ }
258
+ }
259
+ },
260
+ "title": "Voyage AI reranker",
261
+ "wiring": {
262
+ "code": "createVoyageRAGReranker({ apiKey: ${env.VOYAGE_API_KEY} ?? \"\", ...${settings} })",
263
+ "imports": [
264
+ {
265
+ "from": "@absolutejs/rag",
266
+ "names": [
267
+ "createVoyageRAGReranker"
268
+ ]
269
+ }
270
+ ]
271
+ }
272
+ },
273
+ {
274
+ "contract": "rag/reranker",
275
+ "factory": "createJinaRAGReranker",
276
+ "from": "@absolutejs/rag",
277
+ "requires": {
278
+ "env": [
279
+ {
280
+ "description": "Jina AI API key",
281
+ "docsUrl": "https://jina.ai/api-dashboard",
282
+ "key": "JINA_API_KEY",
283
+ "secret": true
284
+ }
285
+ ]
286
+ },
287
+ "settings": {
288
+ "type": "object",
289
+ "properties": {
290
+ "defaultModel": {
291
+ "description": "Rerank model used when a request doesn't name one.",
292
+ "examples": [
293
+ "jina-reranker-v2-base-multilingual"
294
+ ],
295
+ "title": "Rerank model",
296
+ "type": "string"
297
+ }
298
+ }
299
+ },
300
+ "title": "Jina AI reranker",
301
+ "wiring": {
302
+ "code": "createJinaRAGReranker({ apiKey: ${env.JINA_API_KEY} ?? \"\", ...${settings} })",
303
+ "imports": [
304
+ {
305
+ "from": "@absolutejs/rag",
306
+ "names": [
307
+ "createJinaRAGReranker"
308
+ ]
309
+ }
310
+ ]
311
+ }
312
+ }
313
+ ],
314
+ "requires": {
315
+ "peers": [
316
+ {
317
+ "name": "elysia",
318
+ "range": ">= 1.4.18",
319
+ "reason": "HTTP host for the ragChat routes"
320
+ }
321
+ ]
322
+ },
323
+ "settings": {
324
+ "type": "object",
325
+ "properties": {
326
+ "defaultCandidateMultiplier": {
327
+ "description": "How many extra candidates to fetch before reranking narrows them down. Higher finds more but costs more.",
328
+ "maximum": 20,
329
+ "minimum": 1,
330
+ "title": "Candidate multiplier",
331
+ "type": "integer"
332
+ },
333
+ "defaultModel": {
334
+ "description": "Embedding model requested when a search doesn't name one. Leave empty to use the embedding provider's default.",
335
+ "title": "Default embedding model",
336
+ "type": "string"
337
+ },
338
+ "defaultTopK": {
339
+ "description": "How many matching passages a search returns by default. Default is 5.",
340
+ "maximum": 100,
341
+ "minimum": 1,
342
+ "title": "Results per search",
343
+ "type": "integer"
344
+ }
345
+ }
346
+ },
347
+ "slots": {
348
+ "embedding": {
349
+ "configPath": "embedding",
350
+ "contract": "rag/embedding-provider",
351
+ "description": "Which AI service turns your text into search vectors. Without one, a deterministic fallback is used — fine for demos, not for real semantic search.",
352
+ "known": [
353
+ "@absolutejs/rag#openai",
354
+ "@absolutejs/rag#gemini",
355
+ "@absolutejs/rag#ollama"
356
+ ]
357
+ },
358
+ "rerank": {
359
+ "configPath": "rerank",
360
+ "contract": "rag/reranker",
361
+ "description": "Optional second pass that reorders search results by relevance before they are used.",
362
+ "known": [
363
+ "@absolutejs/rag#heuristic",
364
+ "@absolutejs/rag#cohere",
365
+ "@absolutejs/rag#voyage",
366
+ "@absolutejs/rag#jina"
367
+ ]
368
+ },
369
+ "store": {
370
+ "configPath": "store",
371
+ "contract": "rag/vector-store",
372
+ "description": "Where your content's search index lives",
373
+ "known": [
374
+ "@absolutejs/rag#memory",
375
+ "@absolutejs/rag-pinecone",
376
+ "@absolutejs/rag-postgres",
377
+ "@absolutejs/rag-sqlite"
378
+ ],
379
+ "required": true
380
+ }
381
+ },
382
+ "wiring": [
383
+ {
384
+ "description": "Create a searchable collection from a vector store and an embedding provider, then mount the chat routes.",
385
+ "id": "default",
386
+ "server": {
387
+ "code": "const ragCollection = createRAGCollection({\n\tembedding: ${slot.embedding},\n\tstore: ${slot.store},\n\t...${settings}\n});\n\n// Mount grounded chat + admin routes with: app.use(ragChat({ collection: ragCollection }))",
388
+ "imports": [
389
+ {
390
+ "from": "@absolutejs/rag",
391
+ "names": [
392
+ "createRAGCollection",
393
+ "ragChat"
394
+ ]
395
+ }
396
+ ],
397
+ "placement": "module-scope"
398
+ },
399
+ "title": "Create the RAG collection"
400
+ },
401
+ {
402
+ "description": "Same as the default recipe plus a reranking pass that reorders results by relevance before use.",
403
+ "id": "reranked",
404
+ "server": {
405
+ "code": "const ragCollection = createRAGCollection({\n\tembedding: ${slot.embedding},\n\trerank: ${slot.rerank},\n\tstore: ${slot.store},\n\t...${settings}\n});",
406
+ "imports": [
407
+ {
408
+ "from": "@absolutejs/rag",
409
+ "names": [
410
+ "createRAGCollection"
411
+ ]
412
+ }
413
+ ],
414
+ "placement": "module-scope"
415
+ },
416
+ "title": "Collection with reranking"
417
+ }
418
+ ],
419
+ "tools": {
420
+ "ingest_status": {
421
+ "annotations": {
422
+ "readOnlyHint": true
423
+ },
424
+ "description": "Report the vector store backing this collection: backend, vector mode, dimensions, and capabilities (persistence, native vector search, server-side filtering). Not every store reports status.",
425
+ "input": {
426
+ "type": "object",
427
+ "properties": {}
428
+ },
429
+ "kind": "runtime"
430
+ },
431
+ "ingest_text": {
432
+ "annotations": {
433
+ "idempotentHint": true
434
+ },
435
+ "description": "Add (or replace) one text document in the search index under a stable sourceId. Re-ingesting the same sourceId replaces its previous chunks, so it is safe to repeat.",
436
+ "input": {
437
+ "type": "object",
438
+ "required": [
439
+ "sourceId",
440
+ "text"
441
+ ],
442
+ "properties": {
443
+ "sourceId": {
444
+ "description": "Stable identifier for this document — reuse it to update, pass it to remove_source to delete.",
445
+ "minLength": 1,
446
+ "type": "string"
447
+ },
448
+ "text": {
449
+ "minLength": 1,
450
+ "type": "string"
451
+ },
452
+ "title": {
453
+ "type": "string"
454
+ }
455
+ }
456
+ },
457
+ "kind": "runtime"
458
+ },
459
+ "remove_source": {
460
+ "annotations": {
461
+ "destructiveHint": true,
462
+ "idempotentHint": true
463
+ },
464
+ "description": "Delete every indexed chunk previously ingested under a sourceId. Removing an unknown sourceId deletes nothing and succeeds.",
465
+ "input": {
466
+ "type": "object",
467
+ "required": [
468
+ "sourceId"
469
+ ],
470
+ "properties": {
471
+ "chunkCount": {
472
+ "description": "Chunk count from the original ingest — needed on stores that cannot delete by metadata filter.",
473
+ "minimum": 0,
474
+ "type": "integer"
475
+ },
476
+ "sourceId": {
477
+ "minLength": 1,
478
+ "type": "string"
479
+ }
480
+ }
481
+ },
482
+ "kind": "runtime"
483
+ },
484
+ "search_content": {
485
+ "annotations": {
486
+ "readOnlyHint": true
487
+ },
488
+ "description": "Search the indexed content and return the best-matching passages with scores, titles, and sources. Use this to ground answers in the site's own content.",
489
+ "input": {
490
+ "type": "object",
491
+ "required": [
492
+ "query"
493
+ ],
494
+ "properties": {
495
+ "query": {
496
+ "minLength": 1,
497
+ "type": "string"
498
+ },
499
+ "scoreThreshold": {
500
+ "description": "Drop results scoring below this value.",
501
+ "maximum": 1,
502
+ "minimum": 0,
503
+ "type": "number"
504
+ },
505
+ "topK": {
506
+ "maximum": 100,
507
+ "minimum": 1,
508
+ "type": "integer"
509
+ }
510
+ }
511
+ },
512
+ "kind": "runtime"
513
+ }
514
+ }
515
+ }
@@ -1,4 +1,19 @@
1
1
  // @bun
2
+ var __defProp = Object.defineProperty;
3
+ var __returnValue = (v) => v;
4
+ function __exportSetter(name, newValue) {
5
+ this[name] = __returnValue.bind(null, newValue);
6
+ }
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true,
12
+ configurable: true,
13
+ set: __exportSetter.bind(all, name)
14
+ });
15
+ };
16
+
2
17
  // src/quality/quality.ts
3
18
  import { mkdir, readFile } from "fs/promises";
4
19
 
@@ -11735,5 +11750,5 @@ export {
11735
11750
  buildCitationGroups
11736
11751
  };
11737
11752
 
11738
- //# debugId=6E3D7C908D19A9A964756E2164756E21
11753
+ //# debugId=9C08DC51B9E6188964756E2164756E21
11739
11754
  //# sourceMappingURL=ui.js.map