@voltx/rag 0.1.0 → 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/dist/index.d.mts CHANGED
@@ -45,7 +45,7 @@ declare class CharacterSplitter implements TextSplitter {
45
45
  declare class RAGPipeline {
46
46
  private config;
47
47
  constructor(config: RAGPipelineConfig);
48
- /** Ingest a document: load → split → embed → store */
48
+ /** Ingest a document: load → split → embed (batch) → store */
49
49
  ingest(source: string): Promise<number>;
50
50
  /** Query: embed question → search vector store → return sources */
51
51
  query(question: string, topK?: number): Promise<RAGQueryResult>;
package/dist/index.d.ts CHANGED
@@ -45,7 +45,7 @@ declare class CharacterSplitter implements TextSplitter {
45
45
  declare class RAGPipeline {
46
46
  private config;
47
47
  constructor(config: RAGPipelineConfig);
48
- /** Ingest a document: load → split → embed → store */
48
+ /** Ingest a document: load → split → embed (batch) → store */
49
49
  ingest(source: string): Promise<number>;
50
50
  /** Query: embed question → search vector store → return sources */
51
51
  query(question: string, topK?: number): Promise<RAGQueryResult>;
package/dist/index.js CHANGED
@@ -77,21 +77,19 @@ var RAGPipeline = class {
77
77
  constructor(config) {
78
78
  this.config = config;
79
79
  }
80
- /** Ingest a document: load → split → embed → store */
80
+ /** Ingest a document: load → split → embed (batch) → store */
81
81
  async ingest(source) {
82
82
  const { loader, splitter = new CharacterSplitter(), embedder, vectorStore } = this.config;
83
83
  const text = loader ? await loader.load(source) : source;
84
84
  const chunks = splitter.split(text);
85
- const docs = [];
86
- for (const chunk of chunks) {
87
- const embedding = await embedder.embed(chunk.content);
88
- docs.push({
89
- id: chunk.id,
90
- content: chunk.content,
91
- embedding,
92
- metadata: chunk.metadata
93
- });
94
- }
85
+ const texts = chunks.map((c) => c.content);
86
+ const embeddings = await embedder.embedBatch(texts);
87
+ const docs = chunks.map((chunk, i) => ({
88
+ id: chunk.id,
89
+ content: chunk.content,
90
+ embedding: embeddings[i],
91
+ metadata: chunk.metadata
92
+ }));
95
93
  await vectorStore.upsert(docs);
96
94
  return docs.length;
97
95
  }
package/dist/index.mjs CHANGED
@@ -50,21 +50,19 @@ var RAGPipeline = class {
50
50
  constructor(config) {
51
51
  this.config = config;
52
52
  }
53
- /** Ingest a document: load → split → embed → store */
53
+ /** Ingest a document: load → split → embed (batch) → store */
54
54
  async ingest(source) {
55
55
  const { loader, splitter = new CharacterSplitter(), embedder, vectorStore } = this.config;
56
56
  const text = loader ? await loader.load(source) : source;
57
57
  const chunks = splitter.split(text);
58
- const docs = [];
59
- for (const chunk of chunks) {
60
- const embedding = await embedder.embed(chunk.content);
61
- docs.push({
62
- id: chunk.id,
63
- content: chunk.content,
64
- embedding,
65
- metadata: chunk.metadata
66
- });
67
- }
58
+ const texts = chunks.map((c) => c.content);
59
+ const embeddings = await embedder.embedBatch(texts);
60
+ const docs = chunks.map((chunk, i) => ({
61
+ id: chunk.id,
62
+ content: chunk.content,
63
+ embedding: embeddings[i],
64
+ metadata: chunk.metadata
65
+ }));
68
66
  await vectorStore.upsert(docs);
69
67
  return docs.length;
70
68
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltx/rag",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "VoltX RAG pipeline primitives — document loading, chunking, embedding, retrieval",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -14,8 +14,8 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
- "@voltx/core": "0.1.0",
18
- "@voltx/db": "0.1.0"
17
+ "@voltx/db": "0.2.0",
18
+ "@voltx/core": "0.2.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "tsup": "^8.0.0",