File size: 306 Bytes
f0743f4
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
const { getEnvironmentVariable } = require('@langchain/core/utils/env');

function getApiKey(envVar, override) {
  const key = getEnvironmentVariable(envVar);
  if (!key && !override) {
    throw new Error(`Missing ${envVar} environment variable.`);
  }
  return key;
}

module.exports = {
  getApiKey,
};