voyageai-cli 1.19.0 → 1.20.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 +158 -23
- package/package.json +7 -1
- package/src/cli.js +2 -0
- package/src/commands/app.js +155 -0
- package/src/commands/completions.js +19 -6
- package/src/commands/eval.js +353 -32
- package/src/commands/playground.js +45 -0
- package/src/lib/explanations.js +264 -0
- package/src/playground/icons/dark/128.png +0 -0
- package/src/playground/icons/dark/16.png +0 -0
- package/src/playground/icons/dark/256.png +0 -0
- package/src/playground/icons/dark/32.png +0 -0
- package/src/playground/icons/dark/64.png +0 -0
- package/src/playground/icons/glyphs/Bulb.svg +5 -0
- package/src/playground/icons/glyphs/Config.svg +3 -0
- package/src/playground/icons/glyphs/Gauge.svg +4 -0
- package/src/playground/icons/glyphs/InfoWithCircle.svg +3 -0
- package/src/playground/icons/glyphs/LightningBolt.svg +3 -0
- package/src/playground/icons/glyphs/MagnifyingGlass.svg +3 -0
- package/src/playground/icons/glyphs/MultiDirectionArrow.svg +6 -0
- package/src/playground/icons/light/128.png +0 -0
- package/src/playground/icons/light/16.png +0 -0
- package/src/playground/icons/light/256.png +0 -0
- package/src/playground/icons/light/32.png +0 -0
- package/src/playground/icons/light/64.png +0 -0
- package/src/playground/index.html +3067 -248
- package/NOTICE +0 -23
- package/demo-readme.gif +0 -0
package/README.md
CHANGED
|
@@ -4,21 +4,130 @@
|
|
|
4
4
|
<img src="https://raw.githubusercontent.com/mrlynn/voyageai-cli/main/demo-readme.gif" alt="voyageai-cli demo" width="800" />
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
|
-
[](https://github.com/mrlynn/voyageai-cli/actions/workflows/ci.yml) [](https://www.npmjs.com/package/voyageai-cli) [](https://opensource.org/licenses/MIT) [](https://nodejs.org)
|
|
7
|
+
[](https://github.com/mrlynn/voyageai-cli/actions/workflows/ci.yml) [](https://www.npmjs.com/package/voyageai-cli) [](https://opensource.org/licenses/MIT) [](https://nodejs.org) [](https://github.com/mrlynn/voyageai-cli/releases)
|
|
8
8
|
|
|
9
|
-
The fastest path from documents to semantic search. Chunk files, generate [Voyage AI](https://www.mongodb.com/docs/voyageai/) embeddings, store in [MongoDB Atlas](https://www.mongodb.com/docs/atlas/atlas-vector-search/), and query with two-stage retrieval —
|
|
10
|
-
|
|
11
|
-
**21 commands · 312 tests · 5 chunking strategies · End-to-end RAG pipeline**
|
|
9
|
+
The fastest path from documents to semantic search. Chunk files, generate [Voyage AI](https://www.mongodb.com/docs/voyageai/) embeddings, store in [MongoDB Atlas](https://www.mongodb.com/docs/atlas/atlas-vector-search/), and query with two-stage retrieval — from the terminal, your browser, or a desktop app.
|
|
12
10
|
|
|
13
11
|
> **⚠️ Disclaimer:** This is an independent, community-built tool — **not** an official product of MongoDB, Inc. or Voyage AI. See [Disclaimer](#disclaimer) for details.
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Three Ways to Use It
|
|
16
|
+
|
|
17
|
+
<table>
|
|
18
|
+
<tr>
|
|
19
|
+
<td align="center" width="33%">
|
|
20
|
+
<h3>🖥️ CLI</h3>
|
|
21
|
+
<code>vai</code><br/><br/>
|
|
22
|
+
22 commands · 5 chunking strategies<br/>
|
|
23
|
+
End-to-end RAG pipeline from your terminal<br/><br/>
|
|
24
|
+
<code>npm install -g voyageai-cli</code>
|
|
25
|
+
</td>
|
|
26
|
+
<td align="center" width="33%">
|
|
27
|
+
<h3>🌐 Web Playground</h3>
|
|
28
|
+
<code>vai playground</code><br/><br/>
|
|
29
|
+
7 interactive tabs for embedding,<br/>
|
|
30
|
+
comparing, searching, and benchmarking<br/><br/>
|
|
31
|
+
<em>Launches in your browser</em>
|
|
32
|
+
</td>
|
|
33
|
+
<td align="center" width="33%">
|
|
34
|
+
<h3>💻 Desktop App</h3>
|
|
35
|
+
Standalone Electron app<br/><br/>
|
|
36
|
+
Secure keychain storage, dark/light themes,<br/>
|
|
37
|
+
MongoDB LeafyGreen design system<br/><br/>
|
|
38
|
+
<a href="https://github.com/mrlynn/voyageai-cli/releases">Download from GitHub Releases</a>
|
|
39
|
+
</td>
|
|
40
|
+
</tr>
|
|
41
|
+
</table>
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Table of Contents
|
|
46
|
+
|
|
47
|
+
- [Desktop App](#desktop-app)
|
|
48
|
+
- [Web Playground](#web-playground)
|
|
49
|
+
- [CLI — Quick Start](#cli--quick-start)
|
|
50
|
+
- [Install](#install)
|
|
51
|
+
- [5-Minute RAG Pipeline](#5-minute-rag-pipeline)
|
|
52
|
+
- [Project Config](#project-config)
|
|
53
|
+
- [Core Workflow](#core-workflow)
|
|
54
|
+
- [Individual Commands](#individual-commands)
|
|
55
|
+
- [Models & Benchmarks](#models--benchmarks)
|
|
56
|
+
- [Benchmarking Your Data](#benchmarking-your-data)
|
|
57
|
+
- [Learn](#learn)
|
|
58
|
+
- [Environment & Auth](#environment--auth)
|
|
59
|
+
- [Shell Completions](#shell-completions)
|
|
60
|
+
- [All Commands](#all-commands)
|
|
61
|
+
- [Screenshots](#screenshots)
|
|
62
|
+
- [Requirements](#requirements)
|
|
63
|
+
- [Author](#author)
|
|
64
|
+
- [Disclaimer](#disclaimer)
|
|
65
|
+
- [License](#license)
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Desktop App
|
|
70
|
+
|
|
71
|
+
A standalone desktop application built with Electron and the MongoDB LeafyGreen design system. Everything the CLI and playground can do — in a native app experience.
|
|
72
|
+
|
|
73
|
+
[](https://github.com/mrlynn/voyageai-cli/releases)
|
|
74
|
+
|
|
75
|
+
### Key Features
|
|
76
|
+
|
|
77
|
+
- **🔐 Secure API Key Storage** — Stores your Voyage AI API key and MongoDB URI in the OS keychain (macOS Keychain, Windows Credential Vault, Linux Secret Service). No plaintext config files.
|
|
78
|
+
- **🎨 Dark & Light Themes** — Full theme support with automatic system detection, built on MongoDB's LeafyGreen design tokens.
|
|
79
|
+
- **🍃 MongoDB LeafyGreen UI** — Native MongoDB look & feel with LeafyGreen components and iconography throughout.
|
|
80
|
+
- **📱 Sidebar Navigation** — Clean, collapsible sidebar for quick access to all features: Embed, Compare, Search, Benchmark, Explore, Settings, and more.
|
|
81
|
+
- **⚡ All Playground Features** — Every tab from the web playground, plus desktop-native conveniences like system tray integration.
|
|
82
|
+
|
|
83
|
+
### Installation
|
|
84
|
+
|
|
85
|
+
Download the latest release for your platform from [GitHub Releases](https://github.com/mrlynn/voyageai-cli/releases):
|
|
86
|
+
|
|
87
|
+
| Platform | Download |
|
|
88
|
+
|----------|----------|
|
|
89
|
+
| macOS (Apple Silicon) | `.dmg` |
|
|
90
|
+
| macOS (Intel) | `.dmg` |
|
|
91
|
+
| Windows | `.exe` installer |
|
|
92
|
+
| Linux | `.AppImage` / `.deb` |
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Web Playground
|
|
97
|
+
|
|
98
|
+
An interactive, browser-based interface for exploring Voyage AI embeddings without writing code. Ships with the CLI — just run:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
vai playground
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Your default browser opens with a full-featured UI organized into **7 tabs**:
|
|
105
|
+
|
|
106
|
+
| Tab | What It Does |
|
|
107
|
+
|-----|-------------|
|
|
108
|
+
| **Embed** | Generate embeddings for any text, inspect vectors, adjust dimensions and models |
|
|
109
|
+
| **Compare** | Side-by-side similarity comparison of two or more texts with cosine similarity scores |
|
|
110
|
+
| **Search** | Connect to MongoDB Atlas and run vector similarity searches with filters and reranking |
|
|
111
|
+
| **Benchmark** | Compare model latency, cost, and quality across the Voyage 4 family on your own data |
|
|
112
|
+
| **Explore** | Visualize embedding spaces with dimensionality reduction (PCA/t-SNE) and clustering |
|
|
113
|
+
| **About** | Project info, links, and version details |
|
|
114
|
+
| **Settings** | Configure API keys, MongoDB URI, default model, and preferences |
|
|
115
|
+
|
|
116
|
+
The playground connects to the same backend as the CLI. Any API keys or MongoDB URIs you've configured via `vai config` are available automatically.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## CLI — Quick Start
|
|
121
|
+
|
|
122
|
+
**22 commands · 312 tests · 5 chunking strategies · End-to-end RAG pipeline**
|
|
123
|
+
|
|
124
|
+
### Install
|
|
16
125
|
|
|
17
126
|
```bash
|
|
18
127
|
npm install -g voyageai-cli
|
|
19
128
|
```
|
|
20
129
|
|
|
21
|
-
|
|
130
|
+
### 5-Minute RAG Pipeline
|
|
22
131
|
|
|
23
132
|
Go from a folder of documents to a searchable vector database:
|
|
24
133
|
|
|
@@ -39,7 +148,7 @@ vai query "How do I configure replica sets?" --db myapp --collection knowledge
|
|
|
39
148
|
|
|
40
149
|
That's it. Documents chunked, embedded with `voyage-4-large`, stored in Atlas with metadata, vector index created, and searchable with reranking.
|
|
41
150
|
|
|
42
|
-
|
|
151
|
+
### Project Config
|
|
43
152
|
|
|
44
153
|
Stop typing `--db myapp --collection docs` on every command:
|
|
45
154
|
|
|
@@ -64,9 +173,9 @@ Creates `.vai.json` with your defaults — model, database, collection, chunking
|
|
|
64
173
|
}
|
|
65
174
|
```
|
|
66
175
|
|
|
67
|
-
|
|
176
|
+
### Core Workflow
|
|
68
177
|
|
|
69
|
-
|
|
178
|
+
#### `vai pipeline` — Chunk → embed → store
|
|
70
179
|
|
|
71
180
|
The end-to-end command. Takes files or directories, chunks them, embeds in batches, stores in MongoDB Atlas.
|
|
72
181
|
|
|
@@ -86,7 +195,7 @@ vai pipeline ./docs/ --strategy markdown --chunk-size 1024 --overlap 100
|
|
|
86
195
|
|
|
87
196
|
Supports: `.txt`, `.md`, `.html`, `.json`, `.jsonl`, `.pdf` (optional `pdf-parse` dependency). Auto-detects markdown files for heading-aware chunking.
|
|
88
197
|
|
|
89
|
-
|
|
198
|
+
#### `vai query` — Search + rerank
|
|
90
199
|
|
|
91
200
|
Two-stage retrieval in one command: embed query → vector search → rerank → results.
|
|
92
201
|
|
|
@@ -101,7 +210,7 @@ vai query "auth setup" --no-rerank
|
|
|
101
210
|
vai query "performance tuning" --filter '{"category": "guides"}' --top-k 10
|
|
102
211
|
```
|
|
103
212
|
|
|
104
|
-
|
|
213
|
+
#### `vai chunk` — Document chunking
|
|
105
214
|
|
|
106
215
|
Standalone chunking for when you need control over the pipeline.
|
|
107
216
|
|
|
@@ -118,7 +227,7 @@ vai chunk ./docs/ --dry-run
|
|
|
118
227
|
|
|
119
228
|
Five strategies: `fixed`, `sentence`, `paragraph`, `recursive` (default), `markdown`.
|
|
120
229
|
|
|
121
|
-
|
|
230
|
+
#### `vai estimate` — Cost estimator
|
|
122
231
|
|
|
123
232
|
Compare symmetric vs. asymmetric embedding strategies before committing.
|
|
124
233
|
|
|
@@ -128,7 +237,7 @@ vai estimate --docs 10M --queries 100M --months 12
|
|
|
128
237
|
|
|
129
238
|
Shows cost breakdown for every Voyage 4 model combination, including asymmetric retrieval (embed docs with `voyage-4-large`, query with `voyage-4-lite` — same quality, fraction of the cost).
|
|
130
239
|
|
|
131
|
-
|
|
240
|
+
### Individual Commands
|
|
132
241
|
|
|
133
242
|
For when you need fine-grained control:
|
|
134
243
|
|
|
@@ -158,7 +267,7 @@ vai index create --db myapp --collection docs --field embedding
|
|
|
158
267
|
vai index list --db myapp --collection docs
|
|
159
268
|
```
|
|
160
269
|
|
|
161
|
-
|
|
270
|
+
### Models & Benchmarks
|
|
162
271
|
|
|
163
272
|
```bash
|
|
164
273
|
# List models with architecture and shared space info
|
|
@@ -168,7 +277,7 @@ vai models --wide
|
|
|
168
277
|
vai models --benchmarks
|
|
169
278
|
```
|
|
170
279
|
|
|
171
|
-
|
|
280
|
+
#### Voyage 4 Family
|
|
172
281
|
|
|
173
282
|
| Model | Architecture | Price/1M tokens | RTEB Score | Best For |
|
|
174
283
|
|-------|-------------|----------------|------------|----------|
|
|
@@ -179,7 +288,7 @@ vai models --benchmarks
|
|
|
179
288
|
|
|
180
289
|
**Shared embedding space:** All Voyage 4 models produce compatible embeddings. Embed docs with `voyage-4-large`, query with `voyage-4-lite` — no re-vectorization needed.
|
|
181
290
|
|
|
182
|
-
|
|
291
|
+
#### Competitive Landscape (RTEB NDCG@10)
|
|
183
292
|
|
|
184
293
|
| Model | Score |
|
|
185
294
|
|-------|-------|
|
|
@@ -192,7 +301,7 @@ vai models --benchmarks
|
|
|
192
301
|
|
|
193
302
|
Also available: `voyage-code-3` (code), `voyage-finance-2` (finance), `voyage-law-2` (legal), `rerank-2.5` / `rerank-2.5-lite`.
|
|
194
303
|
|
|
195
|
-
|
|
304
|
+
### Benchmarking Your Data
|
|
196
305
|
|
|
197
306
|
Published benchmarks measure average quality across standardized datasets. `vai benchmark` measures what matters for **your** use case:
|
|
198
307
|
|
|
@@ -213,7 +322,7 @@ vai benchmark quantization --model voyage-4-large --dtypes float,int8,ubinary
|
|
|
213
322
|
vai benchmark cost --tokens 500 --volumes 100,1000,10000,100000
|
|
214
323
|
```
|
|
215
324
|
|
|
216
|
-
|
|
325
|
+
### Learn
|
|
217
326
|
|
|
218
327
|
Interactive explanations of key concepts:
|
|
219
328
|
|
|
@@ -230,7 +339,7 @@ vai explain models # How to choose the right model
|
|
|
230
339
|
|
|
231
340
|
17 topics covering embeddings, reranking, vector search, RAG, and more.
|
|
232
341
|
|
|
233
|
-
|
|
342
|
+
### Environment & Auth
|
|
234
343
|
|
|
235
344
|
| Variable | Required For | Description |
|
|
236
345
|
|----------|-------------|-------------|
|
|
@@ -245,7 +354,7 @@ echo "your-key" | vai config set api-key --stdin
|
|
|
245
354
|
vai config set mongodb-uri "mongodb+srv://..."
|
|
246
355
|
```
|
|
247
356
|
|
|
248
|
-
|
|
357
|
+
### Shell Completions
|
|
249
358
|
|
|
250
359
|
```bash
|
|
251
360
|
# Bash
|
|
@@ -256,9 +365,9 @@ mkdir -p ~/.zsh/completions
|
|
|
256
365
|
vai completions zsh > ~/.zsh/completions/_vai
|
|
257
366
|
```
|
|
258
367
|
|
|
259
|
-
Covers all
|
|
368
|
+
Covers all 22 commands, subcommands, flags, model names, and explain topics.
|
|
260
369
|
|
|
261
|
-
|
|
370
|
+
### All Commands
|
|
262
371
|
|
|
263
372
|
| Command | Description |
|
|
264
373
|
|---------|-------------|
|
|
@@ -283,6 +392,28 @@ Covers all 21 commands, subcommands, flags, model names, and explain topics.
|
|
|
283
392
|
| `vai demo` | Guided walkthrough |
|
|
284
393
|
| `vai completions` | Shell completion scripts |
|
|
285
394
|
| `vai about` | About this tool |
|
|
395
|
+
| `vai version` | Print version |
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
## Screenshots
|
|
400
|
+
|
|
401
|
+
### Desktop App — Dark Theme
|
|
402
|
+

|
|
403
|
+
|
|
404
|
+
### Desktop App — Settings
|
|
405
|
+

|
|
406
|
+
|
|
407
|
+
### Desktop App — Light Theme
|
|
408
|
+

|
|
409
|
+
|
|
410
|
+
### Search & Reranking
|
|
411
|
+

|
|
412
|
+
|
|
413
|
+
### Benchmark
|
|
414
|
+

|
|
415
|
+
|
|
416
|
+
---
|
|
286
417
|
|
|
287
418
|
## Requirements
|
|
288
419
|
|
|
@@ -290,6 +421,10 @@ Covers all 21 commands, subcommands, flags, model names, and explain topics.
|
|
|
290
421
|
- [MongoDB Atlas](https://www.mongodb.com/atlas) account (free tier works)
|
|
291
422
|
- [Voyage AI model API key](https://www.mongodb.com/docs/voyageai/management/api-keys/) (created in Atlas)
|
|
292
423
|
|
|
424
|
+
## Author
|
|
425
|
+
|
|
426
|
+
Built by [Michael Lynn](https://github.com/mrlynn), Principal Staff Developer Advocate at [MongoDB](https://www.mongodb.com).
|
|
427
|
+
|
|
293
428
|
## Disclaimer
|
|
294
429
|
|
|
295
430
|
This is a community tool and is not affiliated with, endorsed by, or supported by MongoDB, Inc. or Voyage AI. All trademarks belong to their respective owners.
|
|
@@ -300,4 +435,4 @@ For official documentation and support:
|
|
|
300
435
|
|
|
301
436
|
## License
|
|
302
437
|
|
|
303
|
-
MIT
|
|
438
|
+
[MIT](LICENSE) © [Michael Lynn](https://github.com/mrlynn)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "voyageai-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.0",
|
|
4
4
|
"description": "CLI for Voyage AI embeddings, reranking, and MongoDB Atlas Vector Search",
|
|
5
5
|
"bin": {
|
|
6
6
|
"vai": "./src/cli.js"
|
|
@@ -19,6 +19,12 @@
|
|
|
19
19
|
],
|
|
20
20
|
"author": "Michael Lynn",
|
|
21
21
|
"license": "MIT",
|
|
22
|
+
"files": [
|
|
23
|
+
"src/",
|
|
24
|
+
"README.md",
|
|
25
|
+
"CHANGELOG.md",
|
|
26
|
+
"LICENSE"
|
|
27
|
+
],
|
|
22
28
|
"repository": {
|
|
23
29
|
"type": "git",
|
|
24
30
|
"url": "https://github.com/mrlynn/voyageai-cli"
|
package/src/cli.js
CHANGED
|
@@ -26,6 +26,7 @@ const { registerChunk } = require('./commands/chunk');
|
|
|
26
26
|
const { registerQuery } = require('./commands/query');
|
|
27
27
|
const { registerPipeline } = require('./commands/pipeline');
|
|
28
28
|
const { registerEval } = require('./commands/eval');
|
|
29
|
+
const { registerApp } = require('./commands/app');
|
|
29
30
|
const { registerAbout } = require('./commands/about');
|
|
30
31
|
const { showBanner, showQuickStart, getVersion } = require('./lib/banner');
|
|
31
32
|
|
|
@@ -57,6 +58,7 @@ registerChunk(program);
|
|
|
57
58
|
registerQuery(program);
|
|
58
59
|
registerPipeline(program);
|
|
59
60
|
registerEval(program);
|
|
61
|
+
registerApp(program);
|
|
60
62
|
registerAbout(program);
|
|
61
63
|
|
|
62
64
|
// Append disclaimer to all help output
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { execSync, spawn } = require('child_process');
|
|
4
|
+
const https = require('https');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Fetch JSON from a URL (Node built-in https).
|
|
10
|
+
* Returns a Promise that resolves with the parsed JSON.
|
|
11
|
+
*/
|
|
12
|
+
function fetchJSON(url) {
|
|
13
|
+
return new Promise((resolve, reject) => {
|
|
14
|
+
const options = {
|
|
15
|
+
headers: { 'User-Agent': 'voyageai-cli' },
|
|
16
|
+
};
|
|
17
|
+
https.get(url, options, (res) => {
|
|
18
|
+
// Follow redirects
|
|
19
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
20
|
+
return fetchJSON(res.headers.location).then(resolve, reject);
|
|
21
|
+
}
|
|
22
|
+
if (res.statusCode !== 200) {
|
|
23
|
+
return reject(new Error(`GitHub API returned status ${res.statusCode}`));
|
|
24
|
+
}
|
|
25
|
+
let data = '';
|
|
26
|
+
res.on('data', (chunk) => (data += chunk));
|
|
27
|
+
res.on('end', () => {
|
|
28
|
+
try { resolve(JSON.parse(data)); }
|
|
29
|
+
catch (e) { reject(e); }
|
|
30
|
+
});
|
|
31
|
+
}).on('error', reject);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Open a URL in the default browser (cross-platform, no dependencies).
|
|
37
|
+
*/
|
|
38
|
+
function openInBrowser(url) {
|
|
39
|
+
const plat = process.platform;
|
|
40
|
+
if (plat === 'darwin') spawn('open', [url], { stdio: 'ignore', detached: true }).unref();
|
|
41
|
+
else if (plat === 'win32') spawn('cmd', ['/c', 'start', url], { stdio: 'ignore', detached: true }).unref();
|
|
42
|
+
else spawn('xdg-open', [url], { stdio: 'ignore', detached: true }).unref();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Register the app command — launches the Electron desktop app.
|
|
47
|
+
* @param {import('commander').Command} program
|
|
48
|
+
*/
|
|
49
|
+
function registerApp(program) {
|
|
50
|
+
program
|
|
51
|
+
.command('app')
|
|
52
|
+
.description('Launch the Voyage AI Playground desktop app (Electron)')
|
|
53
|
+
.option('--install', 'Install Electron dependencies first')
|
|
54
|
+
.option('--dev', 'Run in development mode with DevTools')
|
|
55
|
+
.option('--download', 'Download the latest desktop app release for your platform')
|
|
56
|
+
.option('--version', 'Print the app/CLI version')
|
|
57
|
+
.action(async (opts) => {
|
|
58
|
+
// --version: print version and exit
|
|
59
|
+
if (opts.version) {
|
|
60
|
+
const pkg = require(path.join(__dirname, '..', '..', 'package.json'));
|
|
61
|
+
console.log(`voyageai-cli v${pkg.version}`);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// --download: fetch latest GitHub release and open download URL
|
|
66
|
+
if (opts.download) {
|
|
67
|
+
const releaseUrl = 'https://api.github.com/repos/mrlynn/voyageai-cli/releases/latest';
|
|
68
|
+
try {
|
|
69
|
+
console.log('🔍 Checking for the latest desktop app release...');
|
|
70
|
+
const release = await fetchJSON(releaseUrl);
|
|
71
|
+
|
|
72
|
+
const extMap = { darwin: '.dmg', win32: '.exe', linux: '.AppImage' };
|
|
73
|
+
const ext = extMap[process.platform];
|
|
74
|
+
|
|
75
|
+
const asset = ext && release.assets
|
|
76
|
+
? release.assets.find((a) => a.name.endsWith(ext))
|
|
77
|
+
: null;
|
|
78
|
+
|
|
79
|
+
if (asset) {
|
|
80
|
+
console.log(`\n✅ Found release: ${release.tag_name || release.name}`);
|
|
81
|
+
console.log(`📦 Asset: ${asset.name}`);
|
|
82
|
+
console.log(`🔗 ${asset.browser_download_url}\n`);
|
|
83
|
+
console.log('Opening download in your browser...');
|
|
84
|
+
openInBrowser(asset.browser_download_url);
|
|
85
|
+
} else {
|
|
86
|
+
console.log(
|
|
87
|
+
"No desktop app release found for your platform. Run 'vai playground' for the web version."
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
} catch (err) {
|
|
91
|
+
console.error(
|
|
92
|
+
"No desktop app release found. Run 'vai playground' for the web version."
|
|
93
|
+
);
|
|
94
|
+
if (process.env.DEBUG) console.error(err);
|
|
95
|
+
}
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const electronDir = path.join(__dirname, '..', '..', 'electron');
|
|
99
|
+
const electronPkg = path.join(electronDir, 'package.json');
|
|
100
|
+
|
|
101
|
+
if (!fs.existsSync(electronPkg)) {
|
|
102
|
+
console.error('❌ Electron app not found. Expected at:', electronDir);
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Check if electron is installed
|
|
107
|
+
const nodeModules = path.join(electronDir, 'node_modules', 'electron');
|
|
108
|
+
if (!fs.existsSync(nodeModules) || opts.install) {
|
|
109
|
+
console.log('📦 Installing Electron dependencies...');
|
|
110
|
+
try {
|
|
111
|
+
execSync('npm install', { cwd: electronDir, stdio: 'inherit' });
|
|
112
|
+
} catch (err) {
|
|
113
|
+
console.error('❌ Failed to install dependencies:', err.message);
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Find the electron binary
|
|
119
|
+
let electronBin;
|
|
120
|
+
let useNpx = false;
|
|
121
|
+
try {
|
|
122
|
+
electronBin = require(path.join(electronDir, 'node_modules', 'electron'));
|
|
123
|
+
} catch {
|
|
124
|
+
// Fallback: try npx
|
|
125
|
+
useNpx = true;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
console.log('🧭 Launching Voyage AI Playground...');
|
|
129
|
+
|
|
130
|
+
let bin, args;
|
|
131
|
+
if (useNpx) {
|
|
132
|
+
bin = 'npx';
|
|
133
|
+
args = ['electron', electronDir];
|
|
134
|
+
} else {
|
|
135
|
+
bin = electronBin;
|
|
136
|
+
args = [electronDir];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (opts.dev) args.push('--dev');
|
|
140
|
+
const child = spawn(bin, args, {
|
|
141
|
+
cwd: electronDir,
|
|
142
|
+
stdio: 'inherit',
|
|
143
|
+
env: { ...process.env },
|
|
144
|
+
detached: process.platform !== 'win32',
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// Detach — don't block the terminal
|
|
148
|
+
child.unref();
|
|
149
|
+
|
|
150
|
+
// Give it a moment to start, then exit CLI
|
|
151
|
+
setTimeout(() => process.exit(0), 500);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
module.exports = { registerApp };
|
|
@@ -19,7 +19,7 @@ _vai_completions() {
|
|
|
19
19
|
prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
20
20
|
|
|
21
21
|
# Top-level commands
|
|
22
|
-
commands="embed rerank store search index models ping config demo explain similarity ingest estimate init chunk query pipeline eval completions help"
|
|
22
|
+
commands="embed rerank store search index models ping config demo explain similarity ingest estimate init chunk query pipeline eval app completions help"
|
|
23
23
|
|
|
24
24
|
# Subcommands
|
|
25
25
|
local index_subs="create list delete"
|
|
@@ -91,7 +91,7 @@ _vai_completions() {
|
|
|
91
91
|
return 0
|
|
92
92
|
;;
|
|
93
93
|
explain)
|
|
94
|
-
COMPREPLY=( \$(compgen -W "embeddings reranking vector-search rag cosine-similarity two-stage-retrieval input-type models api-keys api-access batch-processing --help" -- "\$cur") )
|
|
94
|
+
COMPREPLY=( \$(compgen -W "embeddings reranking vector-search rag cosine-similarity two-stage-retrieval input-type models api-keys api-access batch-processing quantization benchmarking mixture-of-experts shared-embedding-space rteb-benchmarks voyage-4-nano rerank-eval --help" -- "\$cur") )
|
|
95
95
|
return 0
|
|
96
96
|
;;
|
|
97
97
|
similarity)
|
|
@@ -123,7 +123,11 @@ _vai_completions() {
|
|
|
123
123
|
return 0
|
|
124
124
|
;;
|
|
125
125
|
eval)
|
|
126
|
-
COMPREPLY=( \$(compgen -W "--test-set --db --collection --index --field --model --dimensions --limit --k-values --rerank --no-rerank --rerank-model --text-field --id-field --compare --json --quiet --help" -- "\$cur") )
|
|
126
|
+
COMPREPLY=( \$(compgen -W "--test-set --mode --db --collection --index --field --model --models --dimensions --limit --k-values --rerank --no-rerank --rerank-model --top-k --text-field --id-field --compare --json --quiet --help" -- "\$cur") )
|
|
127
|
+
return 0
|
|
128
|
+
;;
|
|
129
|
+
app)
|
|
130
|
+
COMPREPLY=( \$(compgen -W "--install --dev --help" -- "\$cur") )
|
|
127
131
|
return 0
|
|
128
132
|
;;
|
|
129
133
|
completions)
|
|
@@ -201,7 +205,8 @@ _vai() {
|
|
|
201
205
|
'chunk:Chunk documents for embedding'
|
|
202
206
|
'query:Search + rerank in one shot'
|
|
203
207
|
'pipeline:Chunk, embed, and store documents'
|
|
204
|
-
'eval:Evaluate retrieval quality (MRR, NDCG, recall)'
|
|
208
|
+
'eval:Evaluate retrieval & reranking quality (MRR, NDCG, recall)'
|
|
209
|
+
'app:Launch the desktop app (Electron)'
|
|
205
210
|
'completions:Generate shell completion scripts'
|
|
206
211
|
'help:Display help for command'
|
|
207
212
|
)
|
|
@@ -210,7 +215,7 @@ _vai() {
|
|
|
210
215
|
models=(voyage-4-large voyage-4 voyage-4-lite voyage-code-3 voyage-finance-2 voyage-law-2 voyage-multimodal-3.5 rerank-2.5 rerank-2.5-lite)
|
|
211
216
|
|
|
212
217
|
local -a explain_topics
|
|
213
|
-
explain_topics=(embeddings reranking vector-search rag cosine-similarity two-stage-retrieval input-type models api-keys api-access batch-processing)
|
|
218
|
+
explain_topics=(embeddings reranking vector-search rag cosine-similarity two-stage-retrieval input-type models api-keys api-access batch-processing quantization benchmarking mixture-of-experts shared-embedding-space rteb-benchmarks voyage-4-nano rerank-eval)
|
|
214
219
|
|
|
215
220
|
_arguments -C \\
|
|
216
221
|
'(-V --version)'{-V,--version}'[output the version number]' \\
|
|
@@ -483,23 +488,31 @@ _vai() {
|
|
|
483
488
|
eval)
|
|
484
489
|
_arguments \\
|
|
485
490
|
'--test-set[JSONL test set file]:file:_files' \\
|
|
491
|
+
'--mode[Evaluation mode]:mode:(retrieval rerank)' \\
|
|
486
492
|
'--db[Database name]:database:' \\
|
|
487
493
|
'--collection[Collection name]:collection:' \\
|
|
488
494
|
'--index[Vector search index]:index:' \\
|
|
489
495
|
'--field[Embedding field]:field:' \\
|
|
490
|
-
'(-m --model)'{-m,--model}'[Embedding model]:model:(\$models)' \\
|
|
496
|
+
'(-m --model)'{-m,--model}'[Embedding/rerank model]:model:(\$models)' \\
|
|
497
|
+
'--models[Compare multiple rerank models]:models:' \\
|
|
491
498
|
'(-d --dimensions)'{-d,--dimensions}'[Output dimensions]:dims:' \\
|
|
492
499
|
'(-l --limit)'{-l,--limit}'[Search candidates]:limit:' \\
|
|
493
500
|
'(-k --k-values)'{-k,--k-values}'[K values for metrics]:values:' \\
|
|
494
501
|
'--rerank[Enable reranking]' \\
|
|
495
502
|
'--no-rerank[Skip reranking]' \\
|
|
496
503
|
'--rerank-model[Reranking model]:model:' \\
|
|
504
|
+
'--top-k[Top-K results from reranker]:k:' \\
|
|
497
505
|
'--text-field[Document text field]:field:' \\
|
|
498
506
|
'--id-field[Document ID field]:field:' \\
|
|
499
507
|
'--compare[Compare configs]:configs:' \\
|
|
500
508
|
'--json[JSON output]' \\
|
|
501
509
|
'(-q --quiet)'{-q,--quiet}'[Suppress non-essential output]'
|
|
502
510
|
;;
|
|
511
|
+
app)
|
|
512
|
+
_arguments \\
|
|
513
|
+
'--install[Install Electron dependencies]' \\
|
|
514
|
+
'--dev[Run in development mode]'
|
|
515
|
+
;;
|
|
503
516
|
completions)
|
|
504
517
|
_arguments \\
|
|
505
518
|
'1:shell:(bash zsh)'
|