@memberjunction/ai 2.47.0 → 2.48.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiKeyDictionary.d.ts","sourceRoot":"","sources":["../../src/generic/apiKeyDictionary.ts"],"names":[],"mappings":"AAOA,
|
|
1
|
+
{"version":3,"file":"apiKeyDictionary.d.ts","sourceRoot":"","sources":["../../src/generic/apiKeyDictionary.ts"],"names":[],"mappings":"AAOA,qBAAa,SAAS;IAClB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAyB;IAG9D,SAAS,CAAC,MAAM,CAAC,cAAc,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAM;IAChE,SAAS,CAAC,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAKvD,SAAS,CAAC,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAKtD,SAAS,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAmB9C,SAAS,CAAC,6BAA6B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAK5E;AAOD,wBAAgB,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAMxD"}
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var AIAPIKeys_1;
|
|
9
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
3
|
exports.GetAIAPIKey = exports.AIAPIKeys = void 0;
|
|
11
4
|
const global_1 = require("@memberjunction/global");
|
|
12
|
-
|
|
5
|
+
class AIAPIKeys {
|
|
13
6
|
GetCachedAPIKey(AIDriverName) {
|
|
14
7
|
const normalizedKey = AIDriverName.toUpperCase();
|
|
15
|
-
return
|
|
8
|
+
return AIAPIKeys._cachedAPIKeys[normalizedKey];
|
|
16
9
|
}
|
|
17
10
|
SetCachedAPIKey(AIDriverName, value) {
|
|
18
11
|
const normalizedKey = AIDriverName.toUpperCase();
|
|
19
|
-
|
|
12
|
+
AIAPIKeys._cachedAPIKeys[normalizedKey] = value;
|
|
20
13
|
}
|
|
21
14
|
GetAPIKey(AIDriverName) {
|
|
22
15
|
const normalizedKey = AIDriverName.toUpperCase();
|
|
@@ -25,7 +18,7 @@ let AIAPIKeys = AIAPIKeys_1 = class AIAPIKeys {
|
|
|
25
18
|
return cached;
|
|
26
19
|
}
|
|
27
20
|
else {
|
|
28
|
-
const envKey =
|
|
21
|
+
const envKey = AIAPIKeys._apiKeyPrefix + normalizedKey;
|
|
29
22
|
const value = this.getEnvVariableCaseInsensitive(envKey);
|
|
30
23
|
if (value) {
|
|
31
24
|
this.SetCachedAPIKey(normalizedKey, value);
|
|
@@ -40,13 +33,10 @@ let AIAPIKeys = AIAPIKeys_1 = class AIAPIKeys {
|
|
|
40
33
|
const envKey = Object.keys(process.env).find(key => key.toUpperCase() === upperName);
|
|
41
34
|
return envKey ? process.env[envKey] : undefined;
|
|
42
35
|
}
|
|
43
|
-
}
|
|
36
|
+
}
|
|
44
37
|
exports.AIAPIKeys = AIAPIKeys;
|
|
45
38
|
AIAPIKeys._apiKeyPrefix = 'AI_VENDOR_API_KEY__';
|
|
46
39
|
AIAPIKeys._cachedAPIKeys = {};
|
|
47
|
-
exports.AIAPIKeys = AIAPIKeys = AIAPIKeys_1 = __decorate([
|
|
48
|
-
(0, global_1.RegisterClass)(AIAPIKeys, null, 1)
|
|
49
|
-
], AIAPIKeys);
|
|
50
40
|
function GetAIAPIKey(AIDriverName) {
|
|
51
41
|
const obj = global_1.MJGlobal.Instance.ClassFactory.CreateInstance(AIAPIKeys);
|
|
52
42
|
if (obj)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiKeyDictionary.js","sourceRoot":"","sources":["../../src/generic/apiKeyDictionary.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apiKeyDictionary.js","sourceRoot":"","sources":["../../src/generic/apiKeyDictionary.ts"],"names":[],"mappings":";;;AAAA,mDAAiE;AAOjE,MAAa,SAAS;IAKR,eAAe,CAAC,YAAoB;QAC1C,MAAM,aAAa,GAAG,YAAY,CAAC,WAAW,EAAE,CAAC;QACjD,OAAO,SAAS,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;IACnD,CAAC;IAES,eAAe,CAAC,YAAoB,EAAE,KAAa;QACzD,MAAM,aAAa,GAAG,YAAY,CAAC,WAAW,EAAE,CAAC;QACjD,SAAS,CAAC,cAAc,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC;IACpD,CAAC;IAEM,SAAS,CAAC,YAAoB;QACjC,MAAM,aAAa,GAAG,YAAY,CAAC,WAAW,EAAE,CAAC;QACjD,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;QACnD,IAAI,MAAM,EAAE,CAAC;YACT,OAAO,MAAM,CAAC;QAClB,CAAC;aACI,CAAC;YAEF,MAAM,MAAM,GAAG,SAAS,CAAC,aAAa,GAAG,aAAa,CAAC;YACvD,MAAM,KAAK,GAAG,IAAI,CAAC,6BAA6B,CAAC,MAAM,CAAC,CAAC;YACzD,IAAI,KAAK,EAAE,CAAC;gBACR,IAAI,CAAC,eAAe,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;gBAC3C,OAAO,KAAK,CAAC;YACjB,CAAC;;gBAEG,OAAO,SAAS,CAAC;QACzB,CAAC;IACL,CAAC;IAES,6BAA6B,CAAC,IAAY;QAChD,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACrC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,SAAS,CAAC,CAAC;QACrF,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACpD,CAAC;;AAtCL,8BAuCC;AAtC2B,uBAAa,GAAG,qBAAqB,CAAC;AAG7C,wBAAc,GAA8B,EAAE,CAAC;AA0CpE,SAAgB,WAAW,CAAC,YAAoB;IAC5C,MAAM,GAAG,GAAG,iBAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,cAAc,CAAY,SAAS,CAAC,CAAC;IAChF,IAAI,GAAG;QACH,OAAO,GAAG,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;;QAEnC,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;AACjE,CAAC;AAND,kCAMC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ai",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.48.0",
|
|
4
4
|
"description": "MemberJunction: AI Module - LLMs and other AI services wrapped and abstracted for use in MemberJunction",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"author": "MemberJunction.com",
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@memberjunction/global": "2.
|
|
18
|
+
"@memberjunction/global": "2.48.0",
|
|
19
19
|
"dotenv": "^16.4.1",
|
|
20
20
|
"rxjs": "^7.8.1",
|
|
21
21
|
"typeorm": "^0.3.20"
|