mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
14 lines
306 B
JavaScript
14 lines
306 B
JavaScript
|
|
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,
|
||
|
|
};
|