@larkup-rag/client-js 1.0.0 → 1.0.1
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 +59 -0
- package/package.json +15 -12
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Larkup RAG JavaScript SDK
|
|
2
|
+
|
|
3
|
+
The official JavaScript/TypeScript client for the **Larkup RAG** platform.
|
|
4
|
+
|
|
5
|
+
This SDK provides a convenient interface to connect your Node.js or browser applications to a running Larkup RAG server. It abstracts away the API layer so you can focus on building your AI agents and applications.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Install the SDK via npm, yarn, or pnpm:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @larkup-rag/client-js
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
Initialize the `LarkupRAGClient` with the URL of your running Larkup RAG server.
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { LarkupRAGClient } from "@larkup-rag/client-js";
|
|
21
|
+
|
|
22
|
+
// Initialize the client
|
|
23
|
+
const client = new LarkupRAGClient({
|
|
24
|
+
baseUrl: "http://localhost:4567", // Replace with your deployed server URL
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
async function main() {
|
|
28
|
+
// 1. Query the RAG Pipeline
|
|
29
|
+
const queryResponse = await client.query({
|
|
30
|
+
query: "What is Larkup?",
|
|
31
|
+
topK: 5
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
console.log("Retrieved Documents:", queryResponse.hits);
|
|
35
|
+
|
|
36
|
+
// 2. Add Documents to the Pipeline
|
|
37
|
+
await client.documents.add({
|
|
38
|
+
content: "Larkup is building a new learning system for the AI Era.",
|
|
39
|
+
metadata: { source: "manual-entry" }
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// 3. Trigger Indexing
|
|
43
|
+
await client.index();
|
|
44
|
+
console.log("Documents indexed successfully.");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
main();
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Features
|
|
51
|
+
|
|
52
|
+
- **Querying**: Easily execute semantic searches against your vector store.
|
|
53
|
+
- **Data Ingestion**: Add text, URLs, and files programmatically.
|
|
54
|
+
- **Indexing**: Trigger ETL pipelines to chunk and embed documents on the fly.
|
|
55
|
+
- **TypeScript Support**: Full type safety out-of-the-box.
|
|
56
|
+
|
|
57
|
+
## Documentation
|
|
58
|
+
|
|
59
|
+
For full API reference and advanced usage, visit the [Larkup Documentation](https://larkup.de/docs).
|
package/package.json
CHANGED
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@larkup-rag/client-js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
4
7
|
"description": "JavaScript/TypeScript SDK for Larkup RAG servers",
|
|
5
|
-
"main": "./dist/index.
|
|
6
|
-
"module": "./dist/index.
|
|
8
|
+
"main": "./dist/index.cjs",
|
|
9
|
+
"module": "./dist/index.js",
|
|
7
10
|
"types": "./dist/index.d.ts",
|
|
8
11
|
"type": "module",
|
|
9
12
|
"exports": {
|
|
10
13
|
".": {
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"require": "./dist/index.cjs",
|
|
16
|
+
"import": "./dist/index.js"
|
|
14
17
|
}
|
|
15
18
|
},
|
|
16
19
|
"files": [
|
|
17
20
|
"dist"
|
|
18
21
|
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
24
|
+
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
25
|
+
"test": "vitest run"
|
|
26
|
+
},
|
|
19
27
|
"devDependencies": {
|
|
20
28
|
"@types/node": "^26.0.0",
|
|
21
29
|
"tsup": "^8.5.1",
|
|
22
30
|
"typescript": "^5.7.3",
|
|
23
31
|
"vitest": "^1.6.1"
|
|
24
|
-
},
|
|
25
|
-
"scripts": {
|
|
26
|
-
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
27
|
-
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
28
|
-
"test": "vitest run"
|
|
29
32
|
}
|
|
30
|
-
}
|
|
33
|
+
}
|