@elsium-ai/rag 0.1.6 → 0.2.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 +42 -0
- package/dist/index.js +1 -2
- package/package.json +2 -3
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# @elsium-ai/rag
|
|
2
|
+
|
|
3
|
+
RAG pipeline, document processing, embeddings, and vector stores for [ElsiumAI](https://github.com/elsium-ai/elsium-ai).
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@elsium-ai/rag)
|
|
6
|
+
[](https://github.com/elsium-ai/elsium-ai/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @elsium-ai/rag @elsium-ai/core
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## What's Inside
|
|
15
|
+
|
|
16
|
+
- **Document Loading** — Load documents from various sources
|
|
17
|
+
- **Chunking** — Split documents with configurable strategies (fixed-size, recursive, semantic)
|
|
18
|
+
- **Embeddings** — Generate embeddings with pluggable providers
|
|
19
|
+
- **Vector Search** — In-memory vector store with cosine similarity search
|
|
20
|
+
- **RAG Pipeline** — End-to-end retrieval-augmented generation
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { createRAGPipeline, createVectorStore, createChunker } from '@elsium-ai/rag'
|
|
26
|
+
|
|
27
|
+
const store = createVectorStore()
|
|
28
|
+
const chunker = createChunker({ strategy: 'recursive', chunkSize: 512 })
|
|
29
|
+
|
|
30
|
+
const chunks = chunker.chunk(document)
|
|
31
|
+
await store.add(chunks)
|
|
32
|
+
|
|
33
|
+
const results = await store.search('What is ElsiumAI?', { topK: 5 })
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Part of ElsiumAI
|
|
37
|
+
|
|
38
|
+
This package is the RAG layer of the [ElsiumAI](https://github.com/elsium-ai/elsium-ai) framework. See the [full documentation](https://github.com/elsium-ai/elsium-ai) for guides and examples.
|
|
39
|
+
|
|
40
|
+
## License
|
|
41
|
+
|
|
42
|
+
[MIT](https://github.com/elsium-ai/elsium-ai/blob/main/LICENSE)
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @bun
|
|
2
1
|
// ../core/src/errors.ts
|
|
3
2
|
class ElsiumError extends Error {
|
|
4
3
|
code;
|
|
@@ -89,7 +88,7 @@ class ElsiumError extends Error {
|
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
90
|
// ../core/src/utils.ts
|
|
92
|
-
import { randomBytes } from "crypto";
|
|
91
|
+
import { randomBytes } from "node:crypto";
|
|
93
92
|
function cryptoHex(bytes) {
|
|
94
93
|
return randomBytes(bytes).toString("hex");
|
|
95
94
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elsium-ai/rag",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "RAG pipeline, document processing, embeddings, and vector stores for ElsiumAI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Eric Utrera <ebutrera9103@gmail.com>",
|
|
@@ -22,14 +22,13 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"scripts": {
|
|
25
|
-
"build": "bun build ./src/index.ts --outdir ./dist --target
|
|
25
|
+
"build": "bun build ./src/index.ts --outdir ./dist --target node && bun x tsc -p tsconfig.build.json --emitDeclarationOnly",
|
|
26
26
|
"dev": "bun --watch src/index.ts"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@elsium-ai/core": "workspace:*"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"bun-types": "^1.3.0",
|
|
33
32
|
"typescript": "^5.7.0"
|
|
34
33
|
}
|
|
35
34
|
}
|