@larkup/cli 0.1.19 → 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 +26 -41
- package/dist/analytics-store-JIRW4PQQ.js +13 -0
- package/dist/{chroma-GIDEKUIH.js → chroma-NWWTSRG6.js} +13 -20
- package/dist/chunk-6IFSA37D.js +8019 -0
- package/dist/chunk-NH7TTMXS.js +231 -0
- package/dist/index.js +4889 -3985
- package/dist/{lancedb-E2JLQERV.js → lancedb-ZXGPDC7O.js} +32 -8
- package/dist/{pinecone-YZHFLCKI.js → pinecone-5SGBRUV3.js} +13 -21
- package/dist/tool-registry-OAONPCI5.js +19 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,58 +1,43 @@
|
|
|
1
1
|
# Larkup CLI
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
Build, index, and serve a Retrieval-Augmented Generation (RAG) pipeline directly from your terminal.
|
|
3
|
+
Load data, build an index, chat, and deploy Larkup RAG servers from the terminal.
|
|
5
4
|
|
|
6
|
-
##
|
|
7
|
-
|
|
8
|
-
You can install the CLI globally via npm or run it via npx:
|
|
5
|
+
## Install
|
|
9
6
|
|
|
10
7
|
```bash
|
|
11
8
|
npm install -g @larkup/cli
|
|
12
|
-
# or
|
|
13
|
-
npx @larkup/cli
|
|
14
9
|
```
|
|
15
10
|
|
|
16
|
-
##
|
|
17
|
-
|
|
18
|
-
The CLI provides a set of commands to manage your RAG workspaces, configure vector stores, ingest documents, and query your data.
|
|
11
|
+
## Workflow
|
|
19
12
|
|
|
20
13
|
```bash
|
|
21
|
-
larkup
|
|
14
|
+
larkup init product-docs
|
|
15
|
+
larkup index ./knowledge
|
|
16
|
+
larkup generate
|
|
17
|
+
larkup serve
|
|
22
18
|
```
|
|
23
19
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- **`init [name]`**: Create a new RAG server (workspace project).
|
|
27
|
-
- **`config`**: Configure vector stores and embedding models for your active workspace.
|
|
28
|
-
- **`add-doc`**: Ingest documents (local files, URLs, or text) into your workspace.
|
|
29
|
-
- **`index`**: Process, chunk, and index your ingested documents into the configured vector database.
|
|
30
|
-
- **`serve`**: Spin up the generated RAG server locally for fast testing and API integration.
|
|
31
|
-
- **`query`**: Test retrieval quality by querying your indexed data directly from the terminal.
|
|
32
|
-
- **`chat`**: Start an interactive chat session with your RAG pipeline in the terminal.
|
|
33
|
-
- **`generate`**: Generate server configurations or boilerplate code.
|
|
34
|
-
- **`settings`**: View or update your global settings and environment variables.
|
|
35
|
-
|
|
36
|
-
### Managing Workspaces (Servers)
|
|
37
|
-
|
|
38
|
-
- **`use`**: Switch your active server/workspace context.
|
|
20
|
+
`index` accepts individual files or folders, including text, source code, CSV, JSON, PDF, and Word documents. It streams loading and indexing progress.
|
|
39
21
|
|
|
40
|
-
|
|
22
|
+
Use the dedicated media command for images, audio, and video:
|
|
41
23
|
|
|
42
24
|
```bash
|
|
43
|
-
|
|
44
|
-
larkup
|
|
45
|
-
|
|
46
|
-
# 2. Add documents to the project
|
|
47
|
-
larkup add-doc ./data/knowledge-base.txt
|
|
48
|
-
|
|
49
|
-
# 3. Index the documents into the vector store
|
|
50
|
-
larkup index
|
|
51
|
-
|
|
52
|
-
# 4. Start an interactive chat session with your data
|
|
53
|
-
larkup chat
|
|
25
|
+
larkup marketplace install video-audio
|
|
26
|
+
larkup media ./demo.mp4
|
|
54
27
|
```
|
|
55
28
|
|
|
56
|
-
##
|
|
57
|
-
|
|
58
|
-
|
|
29
|
+
## Commands
|
|
30
|
+
|
|
31
|
+
- `larkup index [sources...]` loads sources and builds the index.
|
|
32
|
+
- `larkup documents` manages and exports corpus documents.
|
|
33
|
+
- `larkup media [sources...]` processes image, audio, and video files.
|
|
34
|
+
- `larkup serve` runs the generated server.
|
|
35
|
+
- `larkup query <question>` retrieves relevant chunks.
|
|
36
|
+
- `larkup chat` starts an interactive terminal chat.
|
|
37
|
+
- `larkup marketplace` manages Marketplace Hub tools.
|
|
38
|
+
- `larkup deploy [target]` prepares Docker, Vercel, local, export, or agent targets.
|
|
39
|
+
- `larkup test` validates configuration, storage, or a deployed endpoint.
|
|
40
|
+
- `larkup open [target]` opens the Web UI or API reference.
|
|
41
|
+
- `larkup update` checks for and installs CLI releases.
|
|
42
|
+
|
|
43
|
+
Generated servers use `http://localhost:8080` by default. Run `larkup --help` or see the [CLI documentation](https://larkup.de/docs/developer/cli) for all options.
|
|
@@ -77,6 +77,15 @@ var ChromaAdapter = class {
|
|
|
77
77
|
}
|
|
78
78
|
this.collection = null;
|
|
79
79
|
}
|
|
80
|
+
async deleteByDocumentIds(documentIds) {
|
|
81
|
+
if (documentIds.length === 0) return;
|
|
82
|
+
try {
|
|
83
|
+
const collection = await this.getCollection();
|
|
84
|
+
await collection.delete({ where: { documentId: { $in: documentIds } } });
|
|
85
|
+
} catch (err) {
|
|
86
|
+
console.error("Failed to delete vectors by documentIds in Chroma:", err);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
80
89
|
// ── Upsert ─────────────────────────────────────────────────────────────────
|
|
81
90
|
async upsert(records) {
|
|
82
91
|
if (records.length === 0) return;
|
|
@@ -161,7 +170,7 @@ var ChromaAdapter = class {
|
|
|
161
170
|
}
|
|
162
171
|
async documentQuery(collection, queryText, topK) {
|
|
163
172
|
const result = await collection.get({
|
|
164
|
-
whereDocument: {
|
|
173
|
+
whereDocument: { $contains: queryText },
|
|
165
174
|
limit: topK,
|
|
166
175
|
include: ["documents", "metadatas"]
|
|
167
176
|
});
|
|
@@ -175,14 +184,7 @@ var ChromaAdapter = class {
|
|
|
175
184
|
return ids.map((id, i) => {
|
|
176
185
|
const meta = metadatas[i] ?? {};
|
|
177
186
|
const score = 1;
|
|
178
|
-
const {
|
|
179
|
-
title,
|
|
180
|
-
url,
|
|
181
|
-
source,
|
|
182
|
-
documentId,
|
|
183
|
-
chunkIndex,
|
|
184
|
-
...customMetadata
|
|
185
|
-
} = meta;
|
|
187
|
+
const { title, url, source, documentId, chunkIndex, ...customMetadata } = meta;
|
|
186
188
|
return {
|
|
187
189
|
id,
|
|
188
190
|
score,
|
|
@@ -204,14 +206,7 @@ var ChromaAdapter = class {
|
|
|
204
206
|
const meta = metadatas[i] ?? {};
|
|
205
207
|
const distance = distances[i] ?? 0;
|
|
206
208
|
const score = 1 / (1 + distance);
|
|
207
|
-
const {
|
|
208
|
-
title,
|
|
209
|
-
url,
|
|
210
|
-
source,
|
|
211
|
-
documentId,
|
|
212
|
-
chunkIndex,
|
|
213
|
-
...customMetadata
|
|
214
|
-
} = meta;
|
|
209
|
+
const { title, url, source, documentId, chunkIndex, ...customMetadata } = meta;
|
|
215
210
|
return {
|
|
216
211
|
id,
|
|
217
212
|
score,
|
|
@@ -236,9 +231,7 @@ var ChromaAdapter = class {
|
|
|
236
231
|
} catch (err) {
|
|
237
232
|
const msg = err.message ?? "";
|
|
238
233
|
if (msg.includes("401") || msg.includes("Unauthorized") || msg.includes("403") || msg.includes("Forbidden")) {
|
|
239
|
-
throw new Error(
|
|
240
|
-
"Invalid Chroma credentials. Please check your auth token or API key."
|
|
241
|
-
);
|
|
234
|
+
throw new Error("Invalid Chroma credentials. Please check your auth token or API key.");
|
|
242
235
|
}
|
|
243
236
|
if (msg.includes("ECONNREFUSED") || msg.includes("fetch failed")) {
|
|
244
237
|
throw new Error(
|