@memberjunction/server 1.0.1 → 1.0.3
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/build.log.json +3 -0
- package/dist/entitySubclasses/userViewEntity.server.d.ts +2 -1
- package/dist/entitySubclasses/userViewEntity.server.d.ts.map +1 -1
- package/dist/entitySubclasses/userViewEntity.server.js +14 -5
- package/dist/entitySubclasses/userViewEntity.server.js.map +1 -1
- package/package.json +13 -12
- package/src/entitySubclasses/userViewEntity.server.ts +22 -7
- package/src/generated/generated.ts +18796 -18796
package/build.log.json
CHANGED
|
@@ -2,7 +2,8 @@ import { EntityInfo } from "@memberjunction/core";
|
|
|
2
2
|
import { AIModelEntity, UserViewEntityExtended } from '@memberjunction/core-entities';
|
|
3
3
|
export declare class UserViewEntity_Server extends UserViewEntityExtended {
|
|
4
4
|
protected get SmartFilterImplemented(): boolean;
|
|
5
|
-
protected
|
|
5
|
+
protected get AIModelName(): string;
|
|
6
|
+
protected GetAIModel(): Promise<AIModelEntity>;
|
|
6
7
|
GenerateSmartFilterWhereClause(prompt: string, entityInfo: EntityInfo): Promise<{
|
|
7
8
|
whereClause: string;
|
|
8
9
|
userExplanation: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userViewEntity.server.d.ts","sourceRoot":"","sources":["../../src/entitySubclasses/userViewEntity.server.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,UAAU,EAAsB,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"userViewEntity.server.d.ts","sourceRoot":"","sources":["../../src/entitySubclasses/userViewEntity.server.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,UAAU,EAAsB,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AAMrF,qBACa,qBAAsB,SAAQ,sBAAsB;IAI7D,cAAuB,sBAAsB,IAAI,OAAO,CAEvD;IAMD,SAAS,KAAK,WAAW,IAAI,MAAM,CAElC;cAMe,UAAU,IAAI,OAAO,CAAC,aAAa,CAAC;IAWvC,8BAA8B,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,CAAA;KAAC,CAAC;IAuErI,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM;CAwE3D"}
|
|
@@ -12,20 +12,26 @@ const core_1 = require("@memberjunction/core");
|
|
|
12
12
|
const core_entities_1 = require("@memberjunction/core-entities");
|
|
13
13
|
const ai_1 = require("@memberjunction/ai");
|
|
14
14
|
const aiengine_1 = require("@memberjunction/aiengine");
|
|
15
|
+
const ai_openai_1 = require("@memberjunction/ai-openai");
|
|
16
|
+
(0, ai_openai_1.LoadOpenAILLM)();
|
|
15
17
|
let UserViewEntity_Server = class UserViewEntity_Server extends core_entities_1.UserViewEntityExtended {
|
|
16
18
|
get SmartFilterImplemented() {
|
|
17
19
|
return true;
|
|
18
20
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
get AIModelName() {
|
|
22
|
+
return 'gpt-4';
|
|
23
|
+
}
|
|
24
|
+
async GetAIModel() {
|
|
25
|
+
await aiengine_1.AIEngine.LoadAIMetadata(this.ContextCurrentUser);
|
|
26
|
+
const model = aiengine_1.AIEngine.Models.find(m => m.Name.trim().toLowerCase() === this.AIModelName.trim().toLowerCase());
|
|
21
27
|
return model;
|
|
22
28
|
}
|
|
23
29
|
async GenerateSmartFilterWhereClause(prompt, entityInfo) {
|
|
24
30
|
try {
|
|
25
|
-
const model = this.GetAIModel();
|
|
31
|
+
const model = await this.GetAIModel();
|
|
26
32
|
const llm = global_1.MJGlobal.Instance.ClassFactory.CreateInstance(ai_1.BaseLLM, model.DriverClass, (0, ai_1.GetAIAPIKey)(model.DriverClass));
|
|
27
33
|
const chatParams = {
|
|
28
|
-
model:
|
|
34
|
+
model: this.AIModelName,
|
|
29
35
|
messages: [
|
|
30
36
|
{
|
|
31
37
|
role: 'system',
|
|
@@ -42,7 +48,10 @@ let UserViewEntity_Server = class UserViewEntity_Server extends core_entities_1.
|
|
|
42
48
|
const llmResponse = result.data.choices[0].message.content;
|
|
43
49
|
if (llmResponse) {
|
|
44
50
|
try {
|
|
45
|
-
const
|
|
51
|
+
const cleansed = (0, global_1.CleanJSON)(llmResponse);
|
|
52
|
+
if (!cleansed)
|
|
53
|
+
throw new Error('Invalid JSON response from AI: ' + llmResponse);
|
|
54
|
+
const parsed = JSON.parse(cleansed);
|
|
46
55
|
if (parsed.whereClause && parsed.whereClause.length > 0) {
|
|
47
56
|
const trimmed = parsed.whereClause.trim();
|
|
48
57
|
let ret = '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userViewEntity.server.js","sourceRoot":"","sources":["../../src/entitySubclasses/userViewEntity.server.ts"],"names":[],"mappings":";;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"userViewEntity.server.js","sourceRoot":"","sources":["../../src/entitySubclasses/userViewEntity.server.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mDAA4E;AAC5E,+CAAkF;AAClF,iEAAqF;AACrF,2CAAsE;AACtE,uDAAoD;AACpD,yDAA0D;AAC1D,IAAA,yBAAa,GAAE,CAAC;AAGT,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,sCAAsB;IAI7D,IAAuB,sBAAsB;QACzC,OAAO,IAAI,CAAC;IAChB,CAAC;IAMD,IAAc,WAAW;QACrB,OAAO,OAAO,CAAC;IACnB,CAAC;IAMS,KAAK,CAAC,UAAU;QACtB,MAAM,mBAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QACvD,MAAM,KAAK,GAAG,mBAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAA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AC,GAAG,CAAE,EAAE,CAAA;gBACnB,CAAC;;oBAEG,OAAO,EAAE,CAAC;YAClB,CAAC;;gBAEG,OAAO,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAChB,EAAE,CAAA;QAEM,OAAO,YAAY,GAAG,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAgD,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG;sHACV,CAAC;IACnH,CAAC;CACJ,CAAA;AA9KY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,sBAAa,EAAC,iBAAU,EAAE,YAAY,EAAE,CAAC,CAAC;GAC9B,qBAAqB,CA8KjC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "MemberJunction: This project provides API access via GraphQL to the common data store.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -21,17 +21,18 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@apollo/server": "^4.9.1",
|
|
23
23
|
"@graphql-tools/utils": "^10.0.1",
|
|
24
|
-
"@memberjunction/ai": "^1.0.
|
|
25
|
-
"@memberjunction/
|
|
26
|
-
"@memberjunction/
|
|
27
|
-
"@memberjunction/core
|
|
28
|
-
"@memberjunction/
|
|
29
|
-
"@memberjunction/data-context
|
|
30
|
-
"@memberjunction/
|
|
31
|
-
"@memberjunction/
|
|
32
|
-
"@memberjunction/
|
|
33
|
-
"@memberjunction/
|
|
34
|
-
"@memberjunction/
|
|
24
|
+
"@memberjunction/ai": "^1.0.3",
|
|
25
|
+
"@memberjunction/ai-openai": "^1.0.3",
|
|
26
|
+
"@memberjunction/aiengine": "^1.0.3",
|
|
27
|
+
"@memberjunction/core": "^1.0.3",
|
|
28
|
+
"@memberjunction/core-entities": "^1.0.3",
|
|
29
|
+
"@memberjunction/data-context": "^1.0.3",
|
|
30
|
+
"@memberjunction/data-context-server": "^1.0.3",
|
|
31
|
+
"@memberjunction/global": "^1.0.3",
|
|
32
|
+
"@memberjunction/storage": "^1.0.3",
|
|
33
|
+
"@memberjunction/queue": "^1.0.3",
|
|
34
|
+
"@memberjunction/sqlserver-dataprovider": "^1.0.3",
|
|
35
|
+
"@memberjunction/skip-types": "^1.0.3",
|
|
35
36
|
"@types/cors": "^2.8.13",
|
|
36
37
|
"@types/jsonwebtoken": "^8.5.9",
|
|
37
38
|
"@types/node": "^18.11.14",
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { MJGlobal, RegisterClass } from "@memberjunction/global";
|
|
1
|
+
import { CleanJSON, MJGlobal, RegisterClass } from "@memberjunction/global";
|
|
2
2
|
import { BaseEntity, EntityInfo, LogError, Metadata } from "@memberjunction/core";
|
|
3
3
|
import { AIModelEntity, UserViewEntityExtended } from '@memberjunction/core-entities'
|
|
4
4
|
import { BaseLLM, ChatParams, GetAIAPIKey } from "@memberjunction/ai";
|
|
5
5
|
import { AIEngine } from "@memberjunction/aiengine";
|
|
6
|
+
import { LoadOpenAILLM } from "@memberjunction/ai-openai";
|
|
7
|
+
LoadOpenAILLM(); // this is to prevent tree shaking since the openai package is not directly used and rather instantiated dynamically in the LoadOpenAILLM function. Since no static code path exists tree shaking can result in this class being optimized out
|
|
6
8
|
|
|
7
9
|
@RegisterClass(BaseEntity, 'User Views', 3) // high priority to ensure this is used ahead of the UserViewEntityExtended in the @memberjunction/core-entities package (which has priority of 2)
|
|
8
10
|
export class UserViewEntity_Server extends UserViewEntityExtended {
|
|
@@ -14,11 +16,20 @@ export class UserViewEntity_Server extends UserViewEntityExtended {
|
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
|
-
* Default implementation simply
|
|
19
|
+
* Default implementation simply returns 'gpt-4'. If you want to override this to use a different model you can override this method in your subclass and return the model you want to use.
|
|
18
20
|
* @returns
|
|
19
21
|
*/
|
|
20
|
-
protected
|
|
21
|
-
|
|
22
|
+
protected get AIModelName(): string {
|
|
23
|
+
return 'gpt-4';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Default implementation simply grabs the first AI model that matches GetAIModelName().
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
protected async GetAIModel(): Promise<AIModelEntity> {
|
|
31
|
+
await AIEngine.LoadAIMetadata(this.ContextCurrentUser); // most of the time this is already loaded, but just in case it isn't we will load it here
|
|
32
|
+
const model = AIEngine.Models.find(m => m.Name.trim().toLowerCase() === this.AIModelName.trim().toLowerCase())
|
|
22
33
|
return model;
|
|
23
34
|
}
|
|
24
35
|
|
|
@@ -29,11 +40,11 @@ export class UserViewEntity_Server extends UserViewEntityExtended {
|
|
|
29
40
|
*/
|
|
30
41
|
public async GenerateSmartFilterWhereClause(prompt: string, entityInfo: EntityInfo): Promise<{whereClause: string, userExplanation: string}> {
|
|
31
42
|
try {
|
|
32
|
-
const model = this.GetAIModel();
|
|
43
|
+
const model = await this.GetAIModel();
|
|
33
44
|
const llm = MJGlobal.Instance.ClassFactory.CreateInstance<BaseLLM>(BaseLLM, model.DriverClass, GetAIAPIKey(model.DriverClass));
|
|
34
45
|
|
|
35
46
|
const chatParams: ChatParams = {
|
|
36
|
-
model:
|
|
47
|
+
model: this.AIModelName,
|
|
37
48
|
messages: [
|
|
38
49
|
{
|
|
39
50
|
role: 'system',
|
|
@@ -51,7 +62,11 @@ export class UserViewEntity_Server extends UserViewEntityExtended {
|
|
|
51
62
|
if (llmResponse) {
|
|
52
63
|
// try to parse it as JSON
|
|
53
64
|
try {
|
|
54
|
-
const
|
|
65
|
+
const cleansed = CleanJSON(llmResponse);
|
|
66
|
+
if (!cleansed)
|
|
67
|
+
throw new Error('Invalid JSON response from AI: ' + llmResponse);
|
|
68
|
+
|
|
69
|
+
const parsed = JSON.parse(cleansed);
|
|
55
70
|
if (parsed.whereClause && parsed.whereClause.length > 0) {
|
|
56
71
|
// we have the where clause. Sometimes the LLM prefixes it with WHERE and somtimes not, we need to strip WHERE if it is there
|
|
57
72
|
const trimmed = parsed.whereClause.trim();
|