voyageai-cli 1.23.0 → 1.23.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "voyageai-cli",
3
- "version": "1.23.0",
3
+ "version": "1.23.1",
4
4
  "description": "CLI for Voyage AI embeddings, reranking, and MongoDB Atlas Vector Search",
5
5
  "bin": {
6
6
  "vai": "./src/cli.js"
@@ -25,8 +25,8 @@ function registerPing(program) {
25
25
  let apiKey;
26
26
  try {
27
27
  apiKey = requireApiKey();
28
- } catch {
29
- // requireApiKey calls process.exit, but just in case
28
+ } catch (err) {
29
+ console.error(err.message);
30
30
  process.exit(1);
31
31
  }
32
32
 
package/src/lib/api.js CHANGED
@@ -36,14 +36,12 @@ function requireApiKey() {
36
36
  const { getConfigValue } = require('./config');
37
37
  const key = process.env.VOYAGE_API_KEY || getConfigValue('apiKey');
38
38
  if (!key) {
39
- console.error('Error: VOYAGE_API_KEY is not set.');
40
- console.error('');
41
- console.error('Option 1: export VOYAGE_API_KEY="your-key-here"');
42
- console.error('Option 2: vai config set api-key <your-key>');
43
- console.error('');
44
- console.error('Get one from MongoDB Atlas → AI Models → Create model API key');
45
- console.error(' or Voyage AI platform → Dashboard → API Keys');
46
- process.exit(1);
39
+ const msg = 'VOYAGE_API_KEY is not set.\n\n' +
40
+ 'Option 1: export VOYAGE_API_KEY="your-key-here"\n' +
41
+ 'Option 2: vai config set api-key <your-key>\n\n' +
42
+ 'Get one from MongoDB Atlas > AI Models > Create model API key\n' +
43
+ ' or Voyage AI platform > Dashboard > API Keys';
44
+ throw new Error(msg);
47
45
  }
48
46
  return key;
49
47
  }