ragpack-js 0.1.0 → 1.0.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 +13 -5
- package/dist/index.cjs +12 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +12 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,13 +5,13 @@ TypeScript SDK for [RagPack](https://github.com/eozsahin1993/ragpack) — a self
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install ragpack
|
|
8
|
+
npm install ragpack-js
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Quick start
|
|
12
12
|
|
|
13
13
|
```ts
|
|
14
|
-
import { RagPack } from "ragpack";
|
|
14
|
+
import { RagPack } from "ragpack-js";
|
|
15
15
|
|
|
16
16
|
const client = new RagPack({
|
|
17
17
|
baseUrl: "http://localhost:9000",
|
|
@@ -24,7 +24,10 @@ const collection = await client.collections.create("my-docs");
|
|
|
24
24
|
// Ingest a file
|
|
25
25
|
await collection.ingest(file);
|
|
26
26
|
|
|
27
|
-
// Or ingest from a
|
|
27
|
+
// Or ingest from a URL
|
|
28
|
+
await collection.ingest({ uri: "https://example.com/docs/guide" });
|
|
29
|
+
|
|
30
|
+
// Or from S3
|
|
28
31
|
await collection.ingest({ uri: "s3://my-bucket/report.pdf" });
|
|
29
32
|
|
|
30
33
|
// Wait for ingestion to finish
|
|
@@ -67,13 +70,14 @@ Returns a `CollectionClient` scoped to that collection.
|
|
|
67
70
|
| Method | Description |
|
|
68
71
|
|-------------------------------------|------------------------------------------|
|
|
69
72
|
| `ingest(file, filename?)` | Upload a file directly |
|
|
70
|
-
| `ingest({ uri, mimeType? })` | Ingest from a
|
|
73
|
+
| `ingest({ uri, mimeType? })` | Ingest from a URL or S3 URI, MIME type auto-detected if omitted |
|
|
71
74
|
| `rag(options)` | Full RAG pipeline — retrieves chunks and returns an LLM answer |
|
|
72
75
|
| `findSimilar({ query, topK? })` | Semantic search without LLM, returns ranked chunks |
|
|
73
76
|
| `jobs.list()` | List ingestion jobs for this collection |
|
|
74
77
|
| `jobs.get(id)` | Get a single job by ID |
|
|
75
78
|
| `jobs.waitUntilComplete(id)` | Poll until job is `complete` or `failed` |
|
|
76
79
|
| `documents.list(options?)` | List indexed documents |
|
|
80
|
+
| `documents.rename(id, name)` | Set the display name of a document |
|
|
77
81
|
| `documents.delete(id)` | Delete a document and its chunks |
|
|
78
82
|
|
|
79
83
|
#### `rag(options)`
|
|
@@ -111,7 +115,7 @@ const prompts = await client.prompts.list();
|
|
|
111
115
|
All methods throw `RagPackError` on non-2xx responses:
|
|
112
116
|
|
|
113
117
|
```ts
|
|
114
|
-
import { RagPack, RagPackError } from "ragpack";
|
|
118
|
+
import { RagPack, RagPackError } from "ragpack-js";
|
|
115
119
|
|
|
116
120
|
try {
|
|
117
121
|
await collection.findSimilar({ query: "..." });
|
|
@@ -126,3 +130,7 @@ try {
|
|
|
126
130
|
|
|
127
131
|
- Node.js 18+
|
|
128
132
|
- A running RagPack backend ([setup guide](https://github.com/eozsahin1993/ragpack))
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
MIT
|
package/dist/index.cjs
CHANGED
|
@@ -118,6 +118,17 @@ var DocumentsResource = class {
|
|
|
118
118
|
);
|
|
119
119
|
return r.documents;
|
|
120
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Rename a document.
|
|
123
|
+
* @param id - The document ID.
|
|
124
|
+
* @param name - The new display name.
|
|
125
|
+
*/
|
|
126
|
+
rename(id, name) {
|
|
127
|
+
return this.req(`/collections/${this.slug}/documents/${id}`, {
|
|
128
|
+
method: "PATCH",
|
|
129
|
+
body: JSON.stringify({ name })
|
|
130
|
+
});
|
|
131
|
+
}
|
|
121
132
|
/**
|
|
122
133
|
* Delete a document and all its chunks from this collection.
|
|
123
134
|
* @param id - The document ID.
|
|
@@ -294,7 +305,7 @@ var EmbeddersResource = class {
|
|
|
294
305
|
}
|
|
295
306
|
/** List all configured embedding models and the server default. */
|
|
296
307
|
list() {
|
|
297
|
-
return this.req("/
|
|
308
|
+
return this.req("/embeddings");
|
|
298
309
|
}
|
|
299
310
|
};
|
|
300
311
|
|
package/dist/index.d.cts
CHANGED
|
@@ -39,6 +39,7 @@ interface Job {
|
|
|
39
39
|
collection_id: string;
|
|
40
40
|
file_uri: string;
|
|
41
41
|
mime_type: string;
|
|
42
|
+
display_name?: string;
|
|
42
43
|
status: "pending" | "processing" | "complete" | "failed";
|
|
43
44
|
error?: string;
|
|
44
45
|
created_at: string;
|
|
@@ -50,6 +51,7 @@ interface Document {
|
|
|
50
51
|
job_id: string;
|
|
51
52
|
file_uri: string;
|
|
52
53
|
mime_type: string;
|
|
54
|
+
name?: string;
|
|
53
55
|
chunk_count: number;
|
|
54
56
|
status: "ingesting" | "complete" | "failed";
|
|
55
57
|
error?: string;
|
|
@@ -144,6 +146,12 @@ declare class DocumentsResource {
|
|
|
144
146
|
limit?: number;
|
|
145
147
|
offset?: number;
|
|
146
148
|
}): Promise<Document[]>;
|
|
149
|
+
/**
|
|
150
|
+
* Rename a document.
|
|
151
|
+
* @param id - The document ID.
|
|
152
|
+
* @param name - The new display name.
|
|
153
|
+
*/
|
|
154
|
+
rename(id: string, name: string): Promise<Document>;
|
|
147
155
|
/**
|
|
148
156
|
* Delete a document and all its chunks from this collection.
|
|
149
157
|
* @param id - The document ID.
|
package/dist/index.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ interface Job {
|
|
|
39
39
|
collection_id: string;
|
|
40
40
|
file_uri: string;
|
|
41
41
|
mime_type: string;
|
|
42
|
+
display_name?: string;
|
|
42
43
|
status: "pending" | "processing" | "complete" | "failed";
|
|
43
44
|
error?: string;
|
|
44
45
|
created_at: string;
|
|
@@ -50,6 +51,7 @@ interface Document {
|
|
|
50
51
|
job_id: string;
|
|
51
52
|
file_uri: string;
|
|
52
53
|
mime_type: string;
|
|
54
|
+
name?: string;
|
|
53
55
|
chunk_count: number;
|
|
54
56
|
status: "ingesting" | "complete" | "failed";
|
|
55
57
|
error?: string;
|
|
@@ -144,6 +146,12 @@ declare class DocumentsResource {
|
|
|
144
146
|
limit?: number;
|
|
145
147
|
offset?: number;
|
|
146
148
|
}): Promise<Document[]>;
|
|
149
|
+
/**
|
|
150
|
+
* Rename a document.
|
|
151
|
+
* @param id - The document ID.
|
|
152
|
+
* @param name - The new display name.
|
|
153
|
+
*/
|
|
154
|
+
rename(id: string, name: string): Promise<Document>;
|
|
147
155
|
/**
|
|
148
156
|
* Delete a document and all its chunks from this collection.
|
|
149
157
|
* @param id - The document ID.
|
package/dist/index.js
CHANGED
|
@@ -91,6 +91,17 @@ var DocumentsResource = class {
|
|
|
91
91
|
);
|
|
92
92
|
return r.documents;
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Rename a document.
|
|
96
|
+
* @param id - The document ID.
|
|
97
|
+
* @param name - The new display name.
|
|
98
|
+
*/
|
|
99
|
+
rename(id, name) {
|
|
100
|
+
return this.req(`/collections/${this.slug}/documents/${id}`, {
|
|
101
|
+
method: "PATCH",
|
|
102
|
+
body: JSON.stringify({ name })
|
|
103
|
+
});
|
|
104
|
+
}
|
|
94
105
|
/**
|
|
95
106
|
* Delete a document and all its chunks from this collection.
|
|
96
107
|
* @param id - The document ID.
|
|
@@ -267,7 +278,7 @@ var EmbeddersResource = class {
|
|
|
267
278
|
}
|
|
268
279
|
/** List all configured embedding models and the server default. */
|
|
269
280
|
list() {
|
|
270
|
-
return this.req("/
|
|
281
|
+
return this.req("/embeddings");
|
|
271
282
|
}
|
|
272
283
|
};
|
|
273
284
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ragpack-js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "TypeScript client for the Ragpack self-hosted RAG engine",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"node": ">=18"
|
|
33
33
|
},
|
|
34
34
|
"type": "module",
|
|
35
|
-
"license": "
|
|
35
|
+
"license": "Apache-2.0",
|
|
36
36
|
"repository": {
|
|
37
37
|
"type": "git",
|
|
38
38
|
"url": "https://github.com/eozsahin1993/ragpack.git",
|