voyageai-cli 1.12.1 → 1.13.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 +3 -3
- package/demo-readme.gif +0 -0
- package/package.json +1 -1
- package/.github/workflows/ci.yml +0 -22
- package/CONTRIBUTING.md +0 -81
- package/demo.gif +0 -0
- package/demo.tape +0 -39
- package/scripts/record-demo.sh +0 -63
- package/test/commands/about.test.js +0 -23
- package/test/commands/benchmark.test.js +0 -319
- package/test/commands/completions.test.js +0 -166
- package/test/commands/config.test.js +0 -35
- package/test/commands/demo.test.js +0 -46
- package/test/commands/embed.test.js +0 -42
- package/test/commands/explain.test.js +0 -207
- package/test/commands/ingest.test.js +0 -261
- package/test/commands/models.test.js +0 -132
- package/test/commands/ping.test.js +0 -172
- package/test/commands/playground.test.js +0 -137
- package/test/commands/rerank.test.js +0 -32
- package/test/commands/similarity.test.js +0 -79
- package/test/commands/store.test.js +0 -26
- package/test/fixtures/sample.csv +0 -6
- package/test/fixtures/sample.json +0 -7
- package/test/fixtures/sample.jsonl +0 -5
- package/test/fixtures/sample.txt +0 -5
- package/test/lib/api.test.js +0 -133
- package/test/lib/banner.test.js +0 -44
- package/test/lib/catalog.test.js +0 -99
- package/test/lib/config.test.js +0 -124
- package/test/lib/explanations.test.js +0 -141
- package/test/lib/format.test.js +0 -75
- package/test/lib/input.test.js +0 -48
- package/test/lib/math.test.js +0 -43
- package/test/lib/ui.test.js +0 -79
- package/voyageai-cli-playground.png +0 -0
- package/voyageai-cli.png +0 -0
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# voyageai-cli
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<img src="https://raw.githubusercontent.com/mrlynn/voyageai-cli/main/
|
|
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
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)
|
|
8
8
|
|
|
9
|
-
CLI for [Voyage AI](https://www.mongodb.com/docs/voyageai/) embeddings, reranking, and [MongoDB Atlas Vector Search](https://www.mongodb.com/docs/atlas/atlas-vector-search/). Pure Node.js — no Python required.
|
|
9
|
+
CLI for [Voyage AI](https://www.mongodb.com/docs/voyageai/) embeddings, reranking, and [MongoDB Atlas Vector Search](https://www.mongodb.com/docs/atlas/atlas-vector-search/). Embed text, benchmark models, compare quantization tradeoffs, and search — all from the terminal. Pure Node.js — no Python required.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
**16 commands · 201 tests · Interactive playground · Quantization benchmarks**
|
|
12
12
|
|
|
13
13
|
> **⚠️ Disclaimer:** This is an independent, community-built tool. It is **not** an official product of MongoDB, Inc. or Voyage AI. It is not supported, endorsed, or maintained by either company. For official documentation, support, and products, visit:
|
|
14
14
|
> - **MongoDB:** [mongodb.com](https://www.mongodb.com) | [MongoDB Atlas](https://www.mongodb.com/atlas) | [Support](https://support.mongodb.com)
|
package/demo-readme.gif
ADDED
|
Binary file
|
package/package.json
CHANGED
package/.github/workflows/ci.yml
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [main]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [main]
|
|
8
|
-
workflow_dispatch:
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
test:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
strategy:
|
|
14
|
-
matrix:
|
|
15
|
-
node-version: [18, 20, 22]
|
|
16
|
-
steps:
|
|
17
|
-
- uses: actions/checkout@v4
|
|
18
|
-
- uses: actions/setup-node@v4
|
|
19
|
-
with:
|
|
20
|
-
node-version: ${{ matrix.node-version }}
|
|
21
|
-
- run: npm ci
|
|
22
|
-
- run: npm test
|
package/CONTRIBUTING.md
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
# Contributing to voyageai-cli
|
|
2
|
-
|
|
3
|
-
Thanks for your interest in contributing! Here's how to get started.
|
|
4
|
-
|
|
5
|
-
## Development Setup
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
git clone https://github.com/mrlynn/voyageai-cli.git
|
|
9
|
-
cd voyageai-cli
|
|
10
|
-
npm install
|
|
11
|
-
npm link # makes `vai` available globally for testing
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Running Tests
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
npm test
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Tests use Node.js built-in test runner (`node:test`). No external test framework needed.
|
|
21
|
-
|
|
22
|
-
## Project Structure
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
src/
|
|
26
|
-
├── cli.js # Entry point
|
|
27
|
-
├── commands/ # One file per command
|
|
28
|
-
│ ├── embed.js
|
|
29
|
-
│ ├── rerank.js
|
|
30
|
-
│ ├── store.js
|
|
31
|
-
│ ├── search.js
|
|
32
|
-
│ ├── index.js
|
|
33
|
-
│ ├── models.js
|
|
34
|
-
│ ├── ping.js
|
|
35
|
-
│ ├── config.js
|
|
36
|
-
│ └── demo.js
|
|
37
|
-
└── lib/ # Shared utilities
|
|
38
|
-
├── api.js # Voyage AI API client
|
|
39
|
-
├── mongo.js # MongoDB connection
|
|
40
|
-
├── catalog.js # Model catalog
|
|
41
|
-
├── config.js # Config file management
|
|
42
|
-
├── format.js # Table formatting
|
|
43
|
-
├── input.js # Text input resolution
|
|
44
|
-
├── ui.js # Colors, spinners, output helpers
|
|
45
|
-
└── banner.js # ASCII banner
|
|
46
|
-
test/
|
|
47
|
-
├── commands/ # Command tests
|
|
48
|
-
└── lib/ # Library tests
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Adding a New Command
|
|
52
|
-
|
|
53
|
-
1. Create `src/commands/mycommand.js` exporting a `registerMyCommand(program)` function
|
|
54
|
-
2. Register it in `src/cli.js`
|
|
55
|
-
3. Add tests in `test/commands/mycommand.test.js`
|
|
56
|
-
4. Update README.md with usage examples
|
|
57
|
-
|
|
58
|
-
## Code Style
|
|
59
|
-
|
|
60
|
-
- CommonJS (`require`/`module.exports`)
|
|
61
|
-
- `'use strict';` at the top of every file
|
|
62
|
-
- JSDoc comments on exported functions
|
|
63
|
-
- `parseInt(x, 10)` — always include radix
|
|
64
|
-
- Errors go to stderr (`console.error`)
|
|
65
|
-
- Support `--json` and `--quiet` flags on all commands
|
|
66
|
-
- No colors or spinners in `--json` mode
|
|
67
|
-
|
|
68
|
-
## Pull Requests
|
|
69
|
-
|
|
70
|
-
- Create a feature branch from `main`
|
|
71
|
-
- Include tests for new functionality
|
|
72
|
-
- Run `npm test` before submitting
|
|
73
|
-
- Write clear commit messages
|
|
74
|
-
|
|
75
|
-
## Reporting Issues
|
|
76
|
-
|
|
77
|
-
Open an issue at https://github.com/mrlynn/voyageai-cli/issues with:
|
|
78
|
-
- Node.js version (`node --version`)
|
|
79
|
-
- OS and version
|
|
80
|
-
- Steps to reproduce
|
|
81
|
-
- Expected vs actual behavior
|
package/demo.gif
DELETED
|
Binary file
|
package/demo.tape
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# VHS demo tape for voyageai-cli
|
|
2
|
-
# Run: vhs demo.tape
|
|
3
|
-
# Requires: VOYAGE_API_KEY set in environment
|
|
4
|
-
|
|
5
|
-
Output demo.gif
|
|
6
|
-
|
|
7
|
-
Set FontSize 16
|
|
8
|
-
Set Width 900
|
|
9
|
-
Set Height 600
|
|
10
|
-
Set Theme "Catppuccin Mocha"
|
|
11
|
-
Set Padding 20
|
|
12
|
-
|
|
13
|
-
# Show version
|
|
14
|
-
Type "vai --version"
|
|
15
|
-
Enter
|
|
16
|
-
Sleep 1.5s
|
|
17
|
-
|
|
18
|
-
# List embedding models
|
|
19
|
-
Type "vai models --type embedding"
|
|
20
|
-
Enter
|
|
21
|
-
Sleep 3s
|
|
22
|
-
|
|
23
|
-
# Generate an embedding
|
|
24
|
-
Type 'vai embed "What is MongoDB Atlas?"'
|
|
25
|
-
Enter
|
|
26
|
-
Sleep 4s
|
|
27
|
-
|
|
28
|
-
# Explain embeddings (first few lines)
|
|
29
|
-
Type "vai explain embeddings"
|
|
30
|
-
Enter
|
|
31
|
-
Sleep 4s
|
|
32
|
-
|
|
33
|
-
# Compare similarity
|
|
34
|
-
Type 'vai similarity "MongoDB is great" "MongoDB Atlas is amazing"'
|
|
35
|
-
Enter
|
|
36
|
-
Sleep 4s
|
|
37
|
-
|
|
38
|
-
# Pause at end to show results
|
|
39
|
-
Sleep 2s
|
package/scripts/record-demo.sh
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Record a demo GIF for voyageai-cli
|
|
3
|
-
# Requires: VOYAGE_API_KEY environment variable
|
|
4
|
-
#
|
|
5
|
-
# Usage:
|
|
6
|
-
# ./scripts/record-demo.sh # Uses vhs (preferred)
|
|
7
|
-
# ./scripts/record-demo.sh asciinema # Uses asciinema instead
|
|
8
|
-
#
|
|
9
|
-
# Output:
|
|
10
|
-
# demo.gif (vhs) or demo.cast (asciinema)
|
|
11
|
-
|
|
12
|
-
set -euo pipefail
|
|
13
|
-
cd "$(dirname "$0")/.."
|
|
14
|
-
|
|
15
|
-
METHOD="${1:-vhs}"
|
|
16
|
-
|
|
17
|
-
if [ "$METHOD" = "vhs" ]; then
|
|
18
|
-
if ! command -v vhs &>/dev/null; then
|
|
19
|
-
echo "❌ vhs not found. Install: brew install charmbracelet/tap/vhs"
|
|
20
|
-
echo " Or run: ./scripts/record-demo.sh asciinema"
|
|
21
|
-
exit 1
|
|
22
|
-
fi
|
|
23
|
-
|
|
24
|
-
if [ -z "${VOYAGE_API_KEY:-}" ]; then
|
|
25
|
-
echo "⚠️ VOYAGE_API_KEY not set. Commands that call the API will fail."
|
|
26
|
-
echo " Set it: export VOYAGE_API_KEY=your-key"
|
|
27
|
-
exit 1
|
|
28
|
-
fi
|
|
29
|
-
|
|
30
|
-
echo "🎬 Recording demo with vhs..."
|
|
31
|
-
vhs demo.tape
|
|
32
|
-
echo "✅ Demo GIF saved to demo.gif"
|
|
33
|
-
|
|
34
|
-
elif [ "$METHOD" = "asciinema" ]; then
|
|
35
|
-
if ! command -v asciinema &>/dev/null; then
|
|
36
|
-
echo "❌ asciinema not found. Install: brew install asciinema"
|
|
37
|
-
exit 1
|
|
38
|
-
fi
|
|
39
|
-
|
|
40
|
-
CAST_FILE="demo.cast"
|
|
41
|
-
echo "🎬 Recording demo with asciinema..."
|
|
42
|
-
echo " Run the following commands, then press Ctrl-D when done:"
|
|
43
|
-
echo ""
|
|
44
|
-
echo " vai --version"
|
|
45
|
-
echo " vai models --type embedding"
|
|
46
|
-
echo ' vai embed "What is MongoDB Atlas?"'
|
|
47
|
-
echo " vai explain embeddings"
|
|
48
|
-
echo ' vai similarity "MongoDB is great" "MongoDB Atlas is amazing"'
|
|
49
|
-
echo ""
|
|
50
|
-
|
|
51
|
-
asciinema rec "$CAST_FILE"
|
|
52
|
-
echo "✅ Recording saved to $CAST_FILE"
|
|
53
|
-
echo ""
|
|
54
|
-
echo "Convert to GIF with agg or svg-term-cli:"
|
|
55
|
-
echo " agg $CAST_FILE demo.gif"
|
|
56
|
-
echo " # or"
|
|
57
|
-
echo " npx svg-term-cli --in $CAST_FILE --out demo.svg --window"
|
|
58
|
-
|
|
59
|
-
else
|
|
60
|
-
echo "Unknown method: $METHOD"
|
|
61
|
-
echo "Usage: $0 [vhs|asciinema]"
|
|
62
|
-
exit 1
|
|
63
|
-
fi
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const { describe, it } = require('node:test');
|
|
4
|
-
const assert = require('node:assert/strict');
|
|
5
|
-
const { Command } = require('commander');
|
|
6
|
-
const { registerAbout } = require('../../src/commands/about');
|
|
7
|
-
|
|
8
|
-
describe('about command', () => {
|
|
9
|
-
it('registers correctly on a program', () => {
|
|
10
|
-
const program = new Command();
|
|
11
|
-
registerAbout(program);
|
|
12
|
-
const aboutCmd = program.commands.find(c => c.name() === 'about');
|
|
13
|
-
assert.ok(aboutCmd, 'about command should be registered');
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('has --json option', () => {
|
|
17
|
-
const program = new Command();
|
|
18
|
-
registerAbout(program);
|
|
19
|
-
const aboutCmd = program.commands.find(c => c.name() === 'about');
|
|
20
|
-
const optionNames = aboutCmd.options.map(o => o.long);
|
|
21
|
-
assert.ok(optionNames.includes('--json'), 'should have --json option');
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const { describe, it } = require('node:test');
|
|
4
|
-
const assert = require('node:assert/strict');
|
|
5
|
-
const { Command } = require('commander');
|
|
6
|
-
const { registerBenchmark } = require('../../src/commands/benchmark');
|
|
7
|
-
|
|
8
|
-
describe('benchmark command', () => {
|
|
9
|
-
it('registers as benchmark with bench alias', () => {
|
|
10
|
-
const program = new Command();
|
|
11
|
-
registerBenchmark(program);
|
|
12
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
13
|
-
assert.ok(benchCmd, 'benchmark command should be registered');
|
|
14
|
-
assert.ok(benchCmd.aliases().includes('bench'), 'should have "bench" alias');
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('has embed subcommand', () => {
|
|
18
|
-
const program = new Command();
|
|
19
|
-
registerBenchmark(program);
|
|
20
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
21
|
-
const embedSub = benchCmd.commands.find(c => c.name() === 'embed');
|
|
22
|
-
assert.ok(embedSub, 'embed subcommand should be registered');
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('embed has --models option', () => {
|
|
26
|
-
const program = new Command();
|
|
27
|
-
registerBenchmark(program);
|
|
28
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
29
|
-
const embedSub = benchCmd.commands.find(c => c.name() === 'embed');
|
|
30
|
-
const optionNames = embedSub.options.map(o => o.long);
|
|
31
|
-
assert.ok(optionNames.includes('--models'), 'should have --models option');
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('embed has --rounds option', () => {
|
|
35
|
-
const program = new Command();
|
|
36
|
-
registerBenchmark(program);
|
|
37
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
38
|
-
const embedSub = benchCmd.commands.find(c => c.name() === 'embed');
|
|
39
|
-
const optionNames = embedSub.options.map(o => o.long);
|
|
40
|
-
assert.ok(optionNames.includes('--rounds'), 'should have --rounds option');
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('embed has --input option for custom text', () => {
|
|
44
|
-
const program = new Command();
|
|
45
|
-
registerBenchmark(program);
|
|
46
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
47
|
-
const embedSub = benchCmd.commands.find(c => c.name() === 'embed');
|
|
48
|
-
const optionNames = embedSub.options.map(o => o.long);
|
|
49
|
-
assert.ok(optionNames.includes('--input'), 'should have --input option');
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('embed has --file option', () => {
|
|
53
|
-
const program = new Command();
|
|
54
|
-
registerBenchmark(program);
|
|
55
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
56
|
-
const embedSub = benchCmd.commands.find(c => c.name() === 'embed');
|
|
57
|
-
const optionNames = embedSub.options.map(o => o.long);
|
|
58
|
-
assert.ok(optionNames.includes('--file'), 'should have --file option');
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('embed has --json and --quiet options', () => {
|
|
62
|
-
const program = new Command();
|
|
63
|
-
registerBenchmark(program);
|
|
64
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
65
|
-
const embedSub = benchCmd.commands.find(c => c.name() === 'embed');
|
|
66
|
-
const optionNames = embedSub.options.map(o => o.long);
|
|
67
|
-
assert.ok(optionNames.includes('--json'), 'should have --json option');
|
|
68
|
-
assert.ok(optionNames.includes('--quiet'), 'should have --quiet option');
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it('embed has --dimensions option', () => {
|
|
72
|
-
const program = new Command();
|
|
73
|
-
registerBenchmark(program);
|
|
74
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
75
|
-
const embedSub = benchCmd.commands.find(c => c.name() === 'embed');
|
|
76
|
-
const optionNames = embedSub.options.map(o => o.long);
|
|
77
|
-
assert.ok(optionNames.includes('--dimensions'), 'should have --dimensions option');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('has rerank subcommand', () => {
|
|
81
|
-
const program = new Command();
|
|
82
|
-
registerBenchmark(program);
|
|
83
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
84
|
-
const rerankSub = benchCmd.commands.find(c => c.name() === 'rerank');
|
|
85
|
-
assert.ok(rerankSub, 'rerank subcommand should be registered');
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('rerank has --models and --rounds options', () => {
|
|
89
|
-
const program = new Command();
|
|
90
|
-
registerBenchmark(program);
|
|
91
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
92
|
-
const rerankSub = benchCmd.commands.find(c => c.name() === 'rerank');
|
|
93
|
-
const optionNames = rerankSub.options.map(o => o.long);
|
|
94
|
-
assert.ok(optionNames.includes('--models'), 'should have --models option');
|
|
95
|
-
assert.ok(optionNames.includes('--rounds'), 'should have --rounds option');
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it('rerank has --query option', () => {
|
|
99
|
-
const program = new Command();
|
|
100
|
-
registerBenchmark(program);
|
|
101
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
102
|
-
const rerankSub = benchCmd.commands.find(c => c.name() === 'rerank');
|
|
103
|
-
const optionNames = rerankSub.options.map(o => o.long);
|
|
104
|
-
assert.ok(optionNames.includes('--query'), 'should have --query option');
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it('rerank has --documents-file and --top-k options', () => {
|
|
108
|
-
const program = new Command();
|
|
109
|
-
registerBenchmark(program);
|
|
110
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
111
|
-
const rerankSub = benchCmd.commands.find(c => c.name() === 'rerank');
|
|
112
|
-
const optionNames = rerankSub.options.map(o => o.long);
|
|
113
|
-
assert.ok(optionNames.includes('--documents-file'), 'should have --documents-file option');
|
|
114
|
-
assert.ok(optionNames.includes('--top-k'), 'should have --top-k option');
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('has similarity subcommand', () => {
|
|
118
|
-
const program = new Command();
|
|
119
|
-
registerBenchmark(program);
|
|
120
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
121
|
-
const simSub = benchCmd.commands.find(c => c.name() === 'similarity');
|
|
122
|
-
assert.ok(simSub, 'similarity subcommand should be registered');
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
it('similarity has --models, --query, --file, --top-k options', () => {
|
|
126
|
-
const program = new Command();
|
|
127
|
-
registerBenchmark(program);
|
|
128
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
129
|
-
const simSub = benchCmd.commands.find(c => c.name() === 'similarity');
|
|
130
|
-
const optionNames = simSub.options.map(o => o.long);
|
|
131
|
-
assert.ok(optionNames.includes('--models'), 'should have --models');
|
|
132
|
-
assert.ok(optionNames.includes('--query'), 'should have --query');
|
|
133
|
-
assert.ok(optionNames.includes('--file'), 'should have --file');
|
|
134
|
-
assert.ok(optionNames.includes('--top-k'), 'should have --top-k');
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it('has cost subcommand', () => {
|
|
138
|
-
const program = new Command();
|
|
139
|
-
registerBenchmark(program);
|
|
140
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
141
|
-
const costSub = benchCmd.commands.find(c => c.name() === 'cost');
|
|
142
|
-
assert.ok(costSub, 'cost subcommand should be registered');
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
it('cost has --models, --tokens, --volumes options', () => {
|
|
146
|
-
const program = new Command();
|
|
147
|
-
registerBenchmark(program);
|
|
148
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
149
|
-
const costSub = benchCmd.commands.find(c => c.name() === 'cost');
|
|
150
|
-
const optionNames = costSub.options.map(o => o.long);
|
|
151
|
-
assert.ok(optionNames.includes('--models'), 'should have --models');
|
|
152
|
-
assert.ok(optionNames.includes('--tokens'), 'should have --tokens');
|
|
153
|
-
assert.ok(optionNames.includes('--volumes'), 'should have --volumes');
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
it('has batch subcommand', () => {
|
|
157
|
-
const program = new Command();
|
|
158
|
-
registerBenchmark(program);
|
|
159
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
160
|
-
const batchSub = benchCmd.commands.find(c => c.name() === 'batch');
|
|
161
|
-
assert.ok(batchSub, 'batch subcommand should be registered');
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
it('batch has --model, --batch-sizes, --rounds options', () => {
|
|
165
|
-
const program = new Command();
|
|
166
|
-
registerBenchmark(program);
|
|
167
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
168
|
-
const batchSub = benchCmd.commands.find(c => c.name() === 'batch');
|
|
169
|
-
const optionNames = batchSub.options.map(o => o.long);
|
|
170
|
-
assert.ok(optionNames.includes('--model'), 'should have --model');
|
|
171
|
-
assert.ok(optionNames.includes('--batch-sizes'), 'should have --batch-sizes');
|
|
172
|
-
assert.ok(optionNames.includes('--rounds'), 'should have --rounds');
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
it('all subcommands have --json output option', () => {
|
|
176
|
-
const program = new Command();
|
|
177
|
-
registerBenchmark(program);
|
|
178
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
179
|
-
|
|
180
|
-
for (const sub of benchCmd.commands) {
|
|
181
|
-
if (sub.name() === 'help') continue;
|
|
182
|
-
const optionNames = sub.options.map(o => o.long);
|
|
183
|
-
assert.ok(optionNames.includes('--json'), `${sub.name()} should have --json option`);
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
it('all subcommands have --quiet option', () => {
|
|
188
|
-
const program = new Command();
|
|
189
|
-
registerBenchmark(program);
|
|
190
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
191
|
-
|
|
192
|
-
for (const sub of benchCmd.commands) {
|
|
193
|
-
if (sub.name() === 'help') continue;
|
|
194
|
-
const optionNames = sub.options.map(o => o.long);
|
|
195
|
-
assert.ok(optionNames.includes('--quiet'), `${sub.name()} should have --quiet option`);
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
it('embed defaults models to voyage-4-large,voyage-4,voyage-4-lite', () => {
|
|
200
|
-
const program = new Command();
|
|
201
|
-
registerBenchmark(program);
|
|
202
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
203
|
-
const embedSub = benchCmd.commands.find(c => c.name() === 'embed');
|
|
204
|
-
const modelsOpt = embedSub.options.find(o => o.long === '--models');
|
|
205
|
-
assert.equal(modelsOpt.defaultValue, 'voyage-4-large,voyage-4,voyage-4-lite');
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
it('rerank defaults models to rerank-2.5,rerank-2.5-lite', () => {
|
|
209
|
-
const program = new Command();
|
|
210
|
-
registerBenchmark(program);
|
|
211
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
212
|
-
const rerankSub = benchCmd.commands.find(c => c.name() === 'rerank');
|
|
213
|
-
const modelsOpt = rerankSub.options.find(o => o.long === '--models');
|
|
214
|
-
assert.equal(modelsOpt.defaultValue, 'rerank-2.5,rerank-2.5-lite');
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
it('cost defaults volumes to 100,1000,10000,100000', () => {
|
|
218
|
-
const program = new Command();
|
|
219
|
-
registerBenchmark(program);
|
|
220
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
221
|
-
const costSub = benchCmd.commands.find(c => c.name() === 'cost');
|
|
222
|
-
const volOpt = costSub.options.find(o => o.long === '--volumes');
|
|
223
|
-
assert.equal(volOpt.defaultValue, '100,1000,10000,100000');
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
it('embed has --save option', () => {
|
|
227
|
-
const program = new Command();
|
|
228
|
-
registerBenchmark(program);
|
|
229
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
230
|
-
const embedSub = benchCmd.commands.find(c => c.name() === 'embed');
|
|
231
|
-
const optionNames = embedSub.options.map(o => o.long);
|
|
232
|
-
assert.ok(optionNames.includes('--save'), 'should have --save option');
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
it('rerank has --save option', () => {
|
|
236
|
-
const program = new Command();
|
|
237
|
-
registerBenchmark(program);
|
|
238
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
239
|
-
const rerankSub = benchCmd.commands.find(c => c.name() === 'rerank');
|
|
240
|
-
const optionNames = rerankSub.options.map(o => o.long);
|
|
241
|
-
assert.ok(optionNames.includes('--save'), 'should have --save option');
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
it('has asymmetric subcommand', () => {
|
|
245
|
-
const program = new Command();
|
|
246
|
-
registerBenchmark(program);
|
|
247
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
248
|
-
const asymSub = benchCmd.commands.find(c => c.name() === 'asymmetric');
|
|
249
|
-
assert.ok(asymSub, 'asymmetric subcommand should be registered');
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
it('asymmetric has --doc-model and --query-models options', () => {
|
|
253
|
-
const program = new Command();
|
|
254
|
-
registerBenchmark(program);
|
|
255
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
256
|
-
const asymSub = benchCmd.commands.find(c => c.name() === 'asymmetric');
|
|
257
|
-
const optionNames = asymSub.options.map(o => o.long);
|
|
258
|
-
assert.ok(optionNames.includes('--doc-model'), 'should have --doc-model');
|
|
259
|
-
assert.ok(optionNames.includes('--query-models'), 'should have --query-models');
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
it('asymmetric defaults doc-model to voyage-4-large', () => {
|
|
263
|
-
const program = new Command();
|
|
264
|
-
registerBenchmark(program);
|
|
265
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
266
|
-
const asymSub = benchCmd.commands.find(c => c.name() === 'asymmetric');
|
|
267
|
-
const opt = asymSub.options.find(o => o.long === '--doc-model');
|
|
268
|
-
assert.equal(opt.defaultValue, 'voyage-4-large');
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
it('has quantization subcommand with quant alias', () => {
|
|
272
|
-
const program = new Command();
|
|
273
|
-
registerBenchmark(program);
|
|
274
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
275
|
-
const quantSub = benchCmd.commands.find(c => c.name() === 'quantization');
|
|
276
|
-
assert.ok(quantSub, 'quantization subcommand should be registered');
|
|
277
|
-
assert.ok(quantSub.aliases().includes('quant'), 'should have "quant" alias');
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
it('quantization has --model, --dtypes, --query options', () => {
|
|
281
|
-
const program = new Command();
|
|
282
|
-
registerBenchmark(program);
|
|
283
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
284
|
-
const quantSub = benchCmd.commands.find(c => c.name() === 'quantization');
|
|
285
|
-
const optionNames = quantSub.options.map(o => o.long);
|
|
286
|
-
assert.ok(optionNames.includes('--model'), 'should have --model');
|
|
287
|
-
assert.ok(optionNames.includes('--dtypes'), 'should have --dtypes');
|
|
288
|
-
assert.ok(optionNames.includes('--query'), 'should have --query');
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
it('quantization defaults dtypes to float,int8,ubinary', () => {
|
|
292
|
-
const program = new Command();
|
|
293
|
-
registerBenchmark(program);
|
|
294
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
295
|
-
const quantSub = benchCmd.commands.find(c => c.name() === 'quantization');
|
|
296
|
-
const dtypesOpt = quantSub.options.find(o => o.long === '--dtypes');
|
|
297
|
-
assert.equal(dtypesOpt.defaultValue, 'float,int8,ubinary');
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
it('quantization has --dimensions, --save, --file options', () => {
|
|
301
|
-
const program = new Command();
|
|
302
|
-
registerBenchmark(program);
|
|
303
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
304
|
-
const quantSub = benchCmd.commands.find(c => c.name() === 'quantization');
|
|
305
|
-
const optionNames = quantSub.options.map(o => o.long);
|
|
306
|
-
assert.ok(optionNames.includes('--dimensions'), 'should have --dimensions');
|
|
307
|
-
assert.ok(optionNames.includes('--save'), 'should have --save');
|
|
308
|
-
assert.ok(optionNames.includes('--file'), 'should have --file');
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
it('batch defaults batch-sizes to 1,5,10,25,50', () => {
|
|
312
|
-
const program = new Command();
|
|
313
|
-
registerBenchmark(program);
|
|
314
|
-
const benchCmd = program.commands.find(c => c.name() === 'benchmark');
|
|
315
|
-
const batchSub = benchCmd.commands.find(c => c.name() === 'batch');
|
|
316
|
-
const sizesOpt = batchSub.options.find(o => o.long === '--batch-sizes');
|
|
317
|
-
assert.equal(sizesOpt.defaultValue, '1,5,10,25,50');
|
|
318
|
-
});
|
|
319
|
-
});
|