@cognigy/rest-api-client 0.16.0 → 0.18.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.
- package/CHANGELOG.md +12 -0
- package/build/GenericTusFn.js +6 -1
- package/build/GenericUploadFn.js +3 -5
- package/build/apigroups/ResourcesAPIGroup_2_0.js +12 -1
- package/build/connector/AxiosAdapter.js +35 -15
- package/build/shared/charts/createNodeDescriptor.js +5 -5
- package/build/shared/charts/descriptors/agentAssist/constants/constants.js +16 -1
- package/build/shared/charts/descriptors/agentAssist/helpers/agentAssistTranslator.helper.js +19 -0
- package/build/shared/charts/descriptors/agentAssist/helpers/getFontSizeFieldOptions.js +84 -0
- package/build/shared/charts/descriptors/agentAssist/helpers/getLanguageName.helper.js +33 -0
- package/build/shared/charts/descriptors/agentAssist/helpers/knowledgeSearch/answerExtraction.helper.js +59 -0
- package/build/shared/charts/descriptors/agentAssist/helpers/knowledgeSearch/configValidator.helper.js +20 -0
- package/build/shared/charts/descriptors/agentAssist/helpers/knowledgeSearch/errorHandler.helper.js +64 -0
- package/build/shared/charts/descriptors/agentAssist/helpers/knowledgeSearch/followUpDetection.helper.js +72 -0
- package/build/shared/charts/descriptors/agentAssist/helpers/knowledgeSearch/knowledgeSearch.helper.js +58 -0
- package/build/shared/charts/descriptors/agentAssist/helpers/sentiment.helper.js +7 -13
- package/build/shared/charts/descriptors/agentAssist/htmlTemplates/identityAssistTemplate.js +17 -18
- package/build/shared/charts/descriptors/agentAssist/htmlTemplates/knowledgeAssistTemplate.js +345 -152
- package/build/shared/charts/descriptors/agentAssist/htmlTemplates/nextActionWidgetTemplate.js +212 -80
- package/build/shared/charts/descriptors/agentAssist/htmlTemplates/sentimentAnalysisTemplate.js +11 -6
- package/build/shared/charts/descriptors/agentAssist/htmlTemplates/transcriptAssistTemplate.js +15 -13
- package/build/shared/charts/descriptors/agentAssist/identityAssist.js +87 -14
- package/build/shared/charts/descriptors/agentAssist/knowledgeAssist.js +192 -327
- package/build/shared/charts/descriptors/agentAssist/locales/cs.locale.js +11 -0
- package/build/shared/charts/descriptors/agentAssist/locales/de.locale.js +11 -0
- package/build/shared/charts/descriptors/agentAssist/locales/en.locale.js +11 -0
- package/build/shared/charts/descriptors/agentAssist/locales/es.locale.js +11 -0
- package/build/shared/charts/descriptors/agentAssist/locales/fr.locale.js +11 -0
- package/build/shared/charts/descriptors/agentAssist/locales/index.js +22 -0
- package/build/shared/charts/descriptors/agentAssist/locales/ja.locale.js +11 -0
- package/build/shared/charts/descriptors/agentAssist/locales/ko.locale.js +11 -0
- package/build/shared/charts/descriptors/agentAssist/locales/pt.locale.js +11 -0
- package/build/shared/charts/descriptors/agentAssist/nextActionAssist.js +485 -10
- package/build/shared/charts/descriptors/agentAssist/sentimentAssist.js +31 -8
- package/build/shared/charts/descriptors/agentAssist/setAgentAssistGrid.js +31 -16
- package/build/shared/charts/descriptors/agentAssist/transcriptAssist.js +40 -2
- package/build/shared/charts/descriptors/allFields.js +6 -0
- package/build/shared/charts/descriptors/analytics/requestRating.js +56 -2
- package/build/shared/charts/descriptors/index.js +1 -3
- package/build/shared/charts/descriptors/knowledgeSearch/searchExtractOutput.js +1 -1
- package/build/shared/charts/descriptors/logic/goTo.js +3 -3
- package/build/shared/charts/descriptors/message/question/optionalQuestion.js +1 -1
- package/build/shared/charts/descriptors/message/question/question.js +123 -2
- package/build/shared/charts/descriptors/message/question/utils/evaluateQuestionAnswer.js +44 -3
- package/build/shared/charts/descriptors/nlu/generativeSlotFiller/prompt.js +27 -7
- package/build/shared/charts/descriptors/nlu/index.js +1 -3
- package/build/shared/charts/descriptors/service/GPTPrompt.js +320 -22
- package/build/shared/charts/descriptors/service/LLMEntityExtract.js +274 -0
- package/build/shared/charts/descriptors/service/httpRequest.js +33 -1
- package/build/shared/charts/descriptors/service/index.js +3 -1
- package/build/shared/charts/descriptors/voice/mappers/setSessionConfig.mapper.js +35 -25
- package/build/shared/charts/descriptors/voice/mappers/transfer.mapper.js +15 -11
- package/build/shared/charts/descriptors/voice/nodes/play.js +8 -1
- package/build/shared/charts/descriptors/voice/nodes/sessionSpeechParameters.js +51 -75
- package/build/shared/charts/descriptors/voicegateway2/nodes/play.js +0 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +38 -71
- package/build/shared/charts/descriptors/voicegateway2/nodes/transfer.js +17 -25
- package/build/shared/charts/helpers/generativeAI/generativeAIPrompts.js +55 -0
- package/build/shared/helper/BaseContext.js +31 -0
- package/build/shared/interfaces/appsession/IAppSession.js +3 -0
- package/build/shared/interfaces/appsession/ISetAppState.js +3 -0
- package/build/shared/interfaces/appsession/index.js +3 -0
- package/build/shared/interfaces/fileStorage.js +6 -0
- package/build/shared/interfaces/generativeAI/IGenerativeAIModels.js +33 -2
- package/build/shared/interfaces/handover.js +2 -1
- package/build/shared/interfaces/messageAPI/endpoints.js +17 -2
- package/build/shared/interfaces/messageAPI/handover.js +9 -5
- package/build/shared/interfaces/nlu/nlu.js +3 -0
- package/build/shared/interfaces/resources/IAuditEvent.js +10 -9
- package/build/shared/interfaces/resources/ILargeLanguageModel.js +34 -20
- package/build/shared/interfaces/resources/IMilestone.js +50 -0
- package/build/shared/interfaces/resources/INodeDescriptorSet.js +85 -75
- package/build/shared/interfaces/resources/TResourceType.js +12 -5
- package/build/shared/interfaces/resources/TSocketChannelType.js +5 -1
- package/build/shared/interfaces/resources/settings/IGenerativeAISettings.js +4 -0
- package/build/shared/interfaces/restAPI/metrics/callCounter/v2.0/ICallCounterAggregatedValue_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/metrics/callCounter/v2.0/IGetCallCounterOrganisationRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/metrics/callCounter/v2.0/IGetCallCounterRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/metrics/callCounter/v2.0/index.js +3 -0
- package/build/shared/interfaces/restAPI/resources/milestone/v2.0/ICloneMilestoneRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/milestone/v2.0/ICreateMilestoneRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IDeleteMilestoneRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IIndexMilestonesRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IMilestoneIndexItem_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IMilestoneStepMetric_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IMilestoneStep_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IMilestone_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IReadMilestoneRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IUpdateMilestoneRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/milestone/v2.0/index.js +3 -0
- package/build/shared/interfaces/restAPI/resources/uploadResumable/v2.0/IUploadResumableRest_2_0.js +3 -1
- package/build/shared/interfaces/security/ICallCounterAggregatedValue.js +3 -0
- package/build/shared/interfaces/security/IPermission.js +5 -2
- package/build/shared/interfaces/security/IRole.js +6 -0
- package/build/shared/interfaces/security/index.js +2 -1
- package/build/shared/interfaces/trainer/ITrainerRecord.js +2 -0
- package/package.json +2 -2
- package/types/index.d.ts +1053 -169
- package/build/shared/charts/descriptors/nlu/extractAnswer.js +0 -115
|
@@ -8,6 +8,7 @@ const sentimentAnalysisTemplate_1 = require("./htmlTemplates/sentimentAnalysisTe
|
|
|
8
8
|
const prompt_1 = require("../nlu/generativeSlotFiller/prompt");
|
|
9
9
|
const constants_1 = require("./constants/constants");
|
|
10
10
|
const sentiment_helper_1 = require("./helpers/sentiment.helper");
|
|
11
|
+
const getFontSizeFieldOptions_1 = require("./helpers/getFontSizeFieldOptions");
|
|
11
12
|
/**
|
|
12
13
|
* Node name: "sentimentAssist"
|
|
13
14
|
*
|
|
@@ -39,24 +40,42 @@ exports.SENTIMENT_ASSIST = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
39
40
|
options: [
|
|
40
41
|
{
|
|
41
42
|
label: "UI__NODE_EDITOR__SENTIMENT_ASSIST__FIELDS__SENTIMENT_ANALYSIS_INPUT__OPTIONS__LAST_INPUT__LABEL",
|
|
42
|
-
value: "lastInput"
|
|
43
|
+
value: "lastInput",
|
|
43
44
|
},
|
|
44
45
|
{
|
|
45
46
|
label: "UI__NODE_EDITOR__SENTIMENT_ASSIST__FIELDS__SENTIMENT_ANALYSIS_INPUT__OPTIONS__LAST_TEN_INPUTS__LABEL",
|
|
46
|
-
value: "lastTenInputs"
|
|
47
|
+
value: "lastTenInputs",
|
|
47
48
|
},
|
|
48
|
-
]
|
|
49
|
-
}
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
key: "fontSize",
|
|
54
|
+
type: "select",
|
|
55
|
+
label: "UI__NODE_EDITOR__COPILOT__TILE_UI_PREFERENCES__FONT_SIZE",
|
|
56
|
+
description: "UI__NODE_EDITOR__COPILOT__TILE_UI_PREFERENCES__FONT_SIZE__INFO",
|
|
57
|
+
defaultValue: "text-sm",
|
|
58
|
+
params: {
|
|
59
|
+
options: getFontSizeFieldOptions_1.getFontSizeFieldOptions,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
sections: [
|
|
64
|
+
{
|
|
65
|
+
key: "uiPreferences",
|
|
66
|
+
label: "UI__NODE_EDITOR__COPILOT__TILE_UI_PREFERENCES__TITLE",
|
|
67
|
+
defaultCollapsed: true,
|
|
68
|
+
fields: ["fontSize"],
|
|
50
69
|
},
|
|
51
70
|
],
|
|
52
|
-
sections: [],
|
|
53
71
|
form: [
|
|
54
72
|
{ type: "field", key: "tileId" },
|
|
55
73
|
{ type: "field", key: "sentimentAnalysisInput" },
|
|
74
|
+
{ type: "section", key: "uiPreferences" },
|
|
56
75
|
].filter((element) => !!element),
|
|
57
76
|
function: async (params) => {
|
|
58
77
|
const { cognigy, config } = params;
|
|
59
|
-
const { api } = cognigy;
|
|
78
|
+
const { api, input } = cognigy;
|
|
60
79
|
const sentimentSelection = config.sentimentAnalysisInput;
|
|
61
80
|
try {
|
|
62
81
|
let prompt = "";
|
|
@@ -70,7 +89,11 @@ exports.SENTIMENT_ASSIST = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
70
89
|
}
|
|
71
90
|
const sentiment = await (0, sentiment_helper_1.sentimentAnalysis)(api, prompt);
|
|
72
91
|
const data = {
|
|
73
|
-
html: (0, sentimentAnalysisTemplate_1.default)(
|
|
92
|
+
html: (0, sentimentAnalysisTemplate_1.default)({
|
|
93
|
+
sentiment,
|
|
94
|
+
fontSize: config.fontSize,
|
|
95
|
+
input,
|
|
96
|
+
}),
|
|
74
97
|
};
|
|
75
98
|
cognigy.api.sendTileUpdateToAgentAssistWorkspace(Object.assign(Object.assign({}, params), { tile: {
|
|
76
99
|
id: config.tileId,
|
|
@@ -81,6 +104,6 @@ exports.SENTIMENT_ASSIST = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
81
104
|
catch (err) {
|
|
82
105
|
api.log("error", err);
|
|
83
106
|
}
|
|
84
|
-
}
|
|
107
|
+
},
|
|
85
108
|
});
|
|
86
109
|
//# sourceMappingURL=sentimentAssist.js.map
|
|
@@ -7,45 +7,45 @@ const sampleAgentAssistConfig = {
|
|
|
7
7
|
grid: {
|
|
8
8
|
columns: 5,
|
|
9
9
|
rows: 10,
|
|
10
|
-
gap: 5
|
|
10
|
+
gap: 5,
|
|
11
11
|
},
|
|
12
12
|
tiles: {
|
|
13
|
-
|
|
13
|
+
"customer-sentiment": {
|
|
14
14
|
x: 1,
|
|
15
15
|
y: 1,
|
|
16
16
|
rows: 3,
|
|
17
|
-
columns: 2
|
|
17
|
+
columns: 2,
|
|
18
18
|
},
|
|
19
|
-
|
|
19
|
+
"suggested-reply": {
|
|
20
20
|
x: 3,
|
|
21
21
|
y: 1,
|
|
22
22
|
rows: 3,
|
|
23
|
-
columns: 3
|
|
23
|
+
columns: 3,
|
|
24
24
|
},
|
|
25
25
|
profile: {
|
|
26
26
|
x: 1,
|
|
27
27
|
y: 4,
|
|
28
28
|
rows: 3,
|
|
29
|
-
columns: 2
|
|
29
|
+
columns: 2,
|
|
30
30
|
},
|
|
31
|
-
|
|
31
|
+
"user-history": {
|
|
32
32
|
x: 1,
|
|
33
33
|
y: 7,
|
|
34
34
|
rows: 4,
|
|
35
|
-
columns: 2
|
|
35
|
+
columns: 2,
|
|
36
36
|
},
|
|
37
37
|
chat: {
|
|
38
38
|
x: 3,
|
|
39
39
|
y: 4,
|
|
40
40
|
rows: 7,
|
|
41
|
-
columns: 3
|
|
42
|
-
}
|
|
43
|
-
}
|
|
41
|
+
columns: 3,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
44
|
};
|
|
45
45
|
const checkAgentAssistKeys = (config) => {
|
|
46
46
|
const { grid, tiles } = config;
|
|
47
47
|
const configKeys = Object.keys(config);
|
|
48
|
-
const validKeys = ["grid", "tiles"];
|
|
48
|
+
const validKeys = ["grid", "tiles", "background"];
|
|
49
49
|
const invalidKeys = configKeys.filter((key) => !validKeys.includes(key));
|
|
50
50
|
if (invalidKeys.length > 0 ||
|
|
51
51
|
configKeys.length > 2 ||
|
|
@@ -62,6 +62,7 @@ const checkAgentAssistKeys = (config) => {
|
|
|
62
62
|
return true;
|
|
63
63
|
};
|
|
64
64
|
const configKey = "agentAssistConfig";
|
|
65
|
+
const backgroundSelectorKey = "backgroundSelector";
|
|
65
66
|
/**
|
|
66
67
|
* Node name: "setAgentAssistGrid"
|
|
67
68
|
*
|
|
@@ -85,20 +86,34 @@ exports.SET_AGENT_ASSIST_GRID = (0, createNodeDescriptor_1.createNodeDescriptor)
|
|
|
85
86
|
params: {
|
|
86
87
|
required: true,
|
|
87
88
|
},
|
|
88
|
-
defaultValue: sampleAgentAssistConfig
|
|
89
|
+
defaultValue: sampleAgentAssistConfig,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
key: backgroundSelectorKey,
|
|
93
|
+
label: "UI__NODE_EDITOR__SET_AGENT_ASSIST_GRID__BACKGROUND_SELECTOR__LABEL",
|
|
94
|
+
type: "backgroundSelector",
|
|
95
|
+
description: "UI__NODE_EDITOR__SET_AGENT_ASSIST_GRID__BACKGROUND_SELECTOR__DESCRIPTION",
|
|
96
|
+
params: {
|
|
97
|
+
required: true,
|
|
98
|
+
},
|
|
99
|
+
defaultValue: "default",
|
|
89
100
|
},
|
|
90
101
|
],
|
|
91
102
|
sections: [],
|
|
92
|
-
form: [
|
|
103
|
+
form: [
|
|
104
|
+
{ type: "field", key: configKey },
|
|
105
|
+
{ type: "field", key: backgroundSelectorKey }
|
|
106
|
+
].filter((element) => !!element),
|
|
93
107
|
function: async (params) => {
|
|
94
108
|
const { cognigy, config } = params;
|
|
95
109
|
const { api } = cognigy;
|
|
96
110
|
const agentAssistConfig = config[configKey];
|
|
111
|
+
const background = config[backgroundSelectorKey];
|
|
97
112
|
if (!checkAgentAssistKeys(agentAssistConfig)) {
|
|
98
|
-
api.log("error", "A valid
|
|
113
|
+
api.log("error", "A valid AI Copilot configuration was not provided");
|
|
99
114
|
return;
|
|
100
115
|
}
|
|
101
|
-
cognigy.api.sendConfigUpdateToAgentAssistWorkspace(Object.assign(Object.assign({}, params), { agentAssistConfig }));
|
|
116
|
+
cognigy.api.sendConfigUpdateToAgentAssistWorkspace(Object.assign(Object.assign({}, params), { agentAssistConfig: Object.assign(Object.assign({}, agentAssistConfig), { background: background === null || background === void 0 ? void 0 : background.data }) }));
|
|
102
117
|
return;
|
|
103
118
|
},
|
|
104
119
|
});
|
|
@@ -6,6 +6,7 @@ const createNodeDescriptor_1 = require("../../createNodeDescriptor");
|
|
|
6
6
|
const transcriptAssistTemplate_1 = require("./htmlTemplates/transcriptAssistTemplate");
|
|
7
7
|
const constants_1 = require("./constants/constants");
|
|
8
8
|
const sentiment_helper_1 = require("./helpers/sentiment.helper");
|
|
9
|
+
const getFontSizeFieldOptions_1 = require("./helpers/getFontSizeFieldOptions");
|
|
9
10
|
/**
|
|
10
11
|
* Node name: "transcriptAssist"
|
|
11
12
|
*
|
|
@@ -37,11 +38,39 @@ exports.TRANSCRIPT_ASSIST = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
37
38
|
type: "toggle",
|
|
38
39
|
defaultValue: false,
|
|
39
40
|
},
|
|
41
|
+
{
|
|
42
|
+
key: "fontSize",
|
|
43
|
+
type: "select",
|
|
44
|
+
label: "UI__NODE_EDITOR__COPILOT__TILE_UI_PREFERENCES__FONT_SIZE",
|
|
45
|
+
description: "UI__NODE_EDITOR__COPILOT__TILE_UI_PREFERENCES__FONT_SIZE__INFO",
|
|
46
|
+
defaultValue: "text-sm",
|
|
47
|
+
params: {
|
|
48
|
+
options: getFontSizeFieldOptions_1.getFontSizeFieldOptions,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
key: "messageFontSize",
|
|
53
|
+
type: "select",
|
|
54
|
+
label: "UI__NODE_EDITOR__COPILOT__TILE_UI_PREFERENCES__FONT_SIZE",
|
|
55
|
+
description: "UI__NODE_EDITOR__COPILOT__TILE_UI_PREFERENCES__FONT_SIZE__INFO",
|
|
56
|
+
defaultValue: "text-sm",
|
|
57
|
+
params: {
|
|
58
|
+
options: getFontSizeFieldOptions_1.getFontSizeFieldOptions,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
sections: [
|
|
63
|
+
{
|
|
64
|
+
key: "uiPreferences",
|
|
65
|
+
label: "UI__NODE_EDITOR__COPILOT__TILE_UI_PREFERENCES__TITLE",
|
|
66
|
+
defaultCollapsed: true,
|
|
67
|
+
fields: ["fontSize", "messageFontSize"],
|
|
68
|
+
},
|
|
40
69
|
],
|
|
41
|
-
sections: [],
|
|
42
70
|
form: [
|
|
43
71
|
{ type: "field", key: "tileId" },
|
|
44
72
|
{ type: "field", key: "enableSentiment" },
|
|
73
|
+
{ type: "section", key: "uiPreferences" },
|
|
45
74
|
].filter((element) => !!element),
|
|
46
75
|
function: async (params) => {
|
|
47
76
|
const { cognigy, config } = params;
|
|
@@ -50,12 +79,21 @@ exports.TRANSCRIPT_ASSIST = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
50
79
|
let sentiment;
|
|
51
80
|
try {
|
|
52
81
|
const inputText = cognigy.input.text;
|
|
82
|
+
if (!inputText) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
53
85
|
if (sentimentEnabled) {
|
|
54
86
|
const prompt = `${constants_1.LAST_INPUT_PROMPT} ${inputText}`;
|
|
55
87
|
sentiment = await (0, sentiment_helper_1.sentimentAnalysis)(api, prompt);
|
|
56
88
|
}
|
|
57
89
|
const data = {
|
|
58
|
-
html: (0, transcriptAssistTemplate_1.default)(
|
|
90
|
+
html: (0, transcriptAssistTemplate_1.default)({
|
|
91
|
+
message: inputText,
|
|
92
|
+
assetsBaseURL: process.env.AGENT_ASSIST_WORKSPACE_FRONTEND_URL_WITH_PROTOCOL || "",
|
|
93
|
+
sentiment,
|
|
94
|
+
fontSize: config.fontSize,
|
|
95
|
+
messageFontSize: config.messageFontSize
|
|
96
|
+
}),
|
|
59
97
|
};
|
|
60
98
|
cognigy.api.sendTileUpdateToAgentAssistWorkspace(Object.assign(Object.assign({}, params), { tile: {
|
|
61
99
|
id: config.tileId,
|
|
@@ -31,6 +31,12 @@ exports.ALL_FIELDS = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
31
31
|
label: "Copilot Config",
|
|
32
32
|
description: "Create an Copilot Config using this JSON editor",
|
|
33
33
|
},
|
|
34
|
+
{
|
|
35
|
+
key: "backgroundSelector",
|
|
36
|
+
type: "backgroundSelector",
|
|
37
|
+
label: "Background Selector",
|
|
38
|
+
description: "Give the user the ability to select a background image or color",
|
|
39
|
+
},
|
|
34
40
|
{
|
|
35
41
|
key: "date",
|
|
36
42
|
type: "date",
|
|
@@ -21,37 +21,91 @@ exports.REQUEST_RATING = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
21
21
|
type: "text",
|
|
22
22
|
},
|
|
23
23
|
fields: [
|
|
24
|
+
{
|
|
25
|
+
key: "ratingScreenTitleText",
|
|
26
|
+
type: "cognigyText",
|
|
27
|
+
label: "UI__NODE_EDITOR__REQUEST_RATING__RATING_SCREEN_TITLE_TEXT__LABEL",
|
|
28
|
+
description: "UI__NODE_EDITOR__REQUEST_RATING__RATING_SCREEN_TITLE_TEXT__DESCRIPTION",
|
|
29
|
+
params: {
|
|
30
|
+
placeholder: "UI__NODE_EDITOR__REQUEST_RATING__RATING_SCREEN_TITLE_TEXT__PLACEHOLDER",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
24
33
|
{
|
|
25
34
|
key: "ratingTitleText",
|
|
26
35
|
type: "cognigyText",
|
|
27
36
|
label: "UI__NODE_EDITOR__REQUEST_RATING__RATING_TITLE_TEXT__LABEL",
|
|
28
37
|
description: "UI__NODE_EDITOR__REQUEST_RATING__RATING_TITLE_TEXT__DESCRIPTION",
|
|
38
|
+
params: {
|
|
39
|
+
placeholder: "UI__NODE_EDITOR__REQUEST_RATING__RATING_TITLE_TEXT__PLACEHOLDER",
|
|
40
|
+
},
|
|
29
41
|
},
|
|
30
42
|
{
|
|
31
43
|
key: "ratingCommentText",
|
|
32
44
|
type: "cognigyText",
|
|
33
45
|
label: "UI__NODE_EDITOR__REQUEST_RATING__RATING_COMMENT_TEXT__LABEL",
|
|
34
46
|
description: "UI__NODE_EDITOR__REQUEST_RATING__RATING_COMMENT_TEXT__DESCRIPTION",
|
|
47
|
+
params: {
|
|
48
|
+
placeholder: "UI__NODE_EDITOR__REQUEST_RATING__RATING_COMMENT_TEXT__PLACEHOLDER",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
key: "ratingSubmitButtonText",
|
|
53
|
+
type: "cognigyText",
|
|
54
|
+
label: "UI__NODE_EDITOR__REQUEST_RATING__RATING_SUBMIT_BUTTON_TEXT__LABEL",
|
|
55
|
+
description: "UI__NODE_EDITOR__REQUEST_RATING__RATING_SUBMIT_BUTTON_TEXT__DESCRIPTION",
|
|
56
|
+
params: {
|
|
57
|
+
placeholder: "UI__NODE_EDITOR__REQUEST_RATING__RATING_SUBMIT_BUTTON_TEXT__PLACEHOLDER",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
key: "ratingEventBannerText",
|
|
62
|
+
type: "cognigyText",
|
|
63
|
+
label: "UI__NODE_EDITOR__REQUEST_RATING__RATING_EVENT_BANNER_TEXT__LABEL",
|
|
64
|
+
description: "UI__NODE_EDITOR__REQUEST_RATING__RATING_EVENT_BANNER_TEXT__DESCRIPTION",
|
|
65
|
+
params: {
|
|
66
|
+
placeholder: "UI__NODE_EDITOR__REQUEST_RATING__RATING_EVENT_BANNER_TEXT__PLACEHOLDER",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
key: "ratingChatStatusMessage",
|
|
71
|
+
type: "cognigyText",
|
|
72
|
+
label: "UI__NODE_EDITOR__REQUEST_RATING__RATING_STATUS_MESSAGE__LABEL",
|
|
73
|
+
description: "UI__NODE_EDITOR__REQUEST_RATING__RATING_STATUS_MESSAGE__DESCRIPTION",
|
|
74
|
+
params: {
|
|
75
|
+
placeholder: "UI__NODE_EDITOR__REQUEST_RATING__RATING_STATUS_MESSAGE__PLACEHOLDER",
|
|
76
|
+
},
|
|
35
77
|
},
|
|
36
78
|
],
|
|
37
79
|
form: [
|
|
80
|
+
{ type: "field", key: "ratingScreenTitleText" },
|
|
38
81
|
{ type: "field", key: "ratingTitleText" },
|
|
39
82
|
{ type: "field", key: "ratingCommentText" },
|
|
83
|
+
{ type: "field", key: "ratingSubmitButtonText" },
|
|
84
|
+
{ type: "field", key: "ratingEventBannerText" },
|
|
85
|
+
{ type: "field", key: "ratingChatStatusMessage" },
|
|
40
86
|
],
|
|
41
|
-
tags: ["analytics", "rating"
|
|
87
|
+
tags: ["analytics", "rating"],
|
|
42
88
|
function: async ({ cognigy, config }) => {
|
|
43
89
|
const { api } = cognigy;
|
|
90
|
+
const ratingScreenTitleText = config.ratingScreenTitleText;
|
|
44
91
|
const ratingTitleText = config.ratingTitleText;
|
|
45
92
|
const ratingCommentText = config.ratingCommentText;
|
|
93
|
+
const ratingSubmitButtonText = config.ratingSubmitButtonText;
|
|
94
|
+
const ratingEventBannerText = config.ratingEventBannerText;
|
|
95
|
+
const ratingChatStatusMessage = config.ratingChatStatusMessage;
|
|
46
96
|
api.say("", {
|
|
47
97
|
_plugin: {
|
|
48
98
|
type: "request-rating",
|
|
49
99
|
data: {
|
|
100
|
+
ratingScreenTitleText,
|
|
50
101
|
ratingTitleText,
|
|
51
102
|
ratingCommentText,
|
|
103
|
+
ratingSubmitButtonText,
|
|
104
|
+
ratingEventBannerText,
|
|
105
|
+
ratingChatStatusMessage,
|
|
52
106
|
},
|
|
53
107
|
},
|
|
54
108
|
});
|
|
55
|
-
}
|
|
109
|
+
},
|
|
56
110
|
});
|
|
57
111
|
//# sourceMappingURL=requestRating.js.map
|
|
@@ -90,6 +90,7 @@ const nodes = [
|
|
|
90
90
|
service_1.GPT_PROMPT,
|
|
91
91
|
service_1.GPT_CONVERSATION,
|
|
92
92
|
service_1.GPT_CONVERSATION_SUMMARY,
|
|
93
|
+
service_1.LLM_ENTITY_EXTRACT,
|
|
93
94
|
service_1.TRIGGER_FUNCTION,
|
|
94
95
|
service_1.ON_SCHEDULED,
|
|
95
96
|
service_1.ON_SCHEDULING_ERROR,
|
|
@@ -131,9 +132,6 @@ if (process.env.FEATURE_USE_COGNIGY_LIVE_AGENT === "true") {
|
|
|
131
132
|
if (process.env.FEATURE_DISABLE_INSIGHTS !== "true") {
|
|
132
133
|
nodes.push(analytics_1.SET_RATING, analytics_1.REQUEST_RATING);
|
|
133
134
|
}
|
|
134
|
-
if (process.env.FEATURE_ENABLE_EXTRACT_ANSWER === "true") {
|
|
135
|
-
nodes.push(nlu_1.EXTRACT_ANSWER);
|
|
136
|
-
}
|
|
137
135
|
exports.cognigyBasicModule = (0, createNodeDescriptor_1.createExtension)({
|
|
138
136
|
nodes,
|
|
139
137
|
connections: [
|
|
@@ -738,7 +738,7 @@ New: `;
|
|
|
738
738
|
frequencyPenalty,
|
|
739
739
|
timeoutInMs: timeout,
|
|
740
740
|
useCase: "promptNode",
|
|
741
|
-
stream: outputMode === "stream",
|
|
741
|
+
stream: outputMode === "stream" && mode === "seo",
|
|
742
742
|
streamOnDataHandler: (text) => {
|
|
743
743
|
streamedOutput = true;
|
|
744
744
|
api.output(text, null);
|
|
@@ -135,11 +135,11 @@ exports.GO_TO = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
135
135
|
if (!api.checkThink(thisNodeId)) {
|
|
136
136
|
api.resetNextNodes();
|
|
137
137
|
api.setThinkMarker(config.flowNode.flow);
|
|
138
|
-
// We always set the next node, not only if executionMode is "wait",
|
|
139
|
-
// otherwise we would not go to the new flow if a default reply is triggered without continue after setting
|
|
140
|
-
await api.goToNode(config.flowNode);
|
|
141
138
|
// Check if execution is to wait at Node for Input
|
|
142
139
|
if (executionMode === "wait") {
|
|
140
|
+
// only set the next node if the execution mode is "wait",
|
|
141
|
+
// otherwise input after the goto node would again go to this node, and not to the start node
|
|
142
|
+
await api.goToNode(config.flowNode);
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
145
|
if (injectedText) {
|
|
@@ -346,7 +346,7 @@ exports.OPTIONAL_QUESTION = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
346
346
|
}
|
|
347
347
|
return;
|
|
348
348
|
}
|
|
349
|
-
const result = (0, evaluateQuestionAnswer_1.evaluateQuestionAnswer)({ cognigy, config });
|
|
349
|
+
const result = await (0, evaluateQuestionAnswer_1.evaluateQuestionAnswer)({ cognigy, config });
|
|
350
350
|
if (storeResultInContext && contextKey) {
|
|
351
351
|
// check whether contextKey is a deep query and set
|
|
352
352
|
// context storage location accordingly
|
|
@@ -78,6 +78,7 @@ var QuestionTypes;
|
|
|
78
78
|
QuestionTypes[QuestionTypes["ipv4"] = 20] = "ipv4";
|
|
79
79
|
QuestionTypes[QuestionTypes["creditcard"] = 21] = "creditcard";
|
|
80
80
|
QuestionTypes[QuestionTypes["phonenumber"] = 22] = "phonenumber";
|
|
81
|
+
QuestionTypes[QuestionTypes["llm_entity"] = 23] = "llm_entity";
|
|
81
82
|
})(QuestionTypes = exports.QuestionTypes || (exports.QuestionTypes = {}));
|
|
82
83
|
//#endregion Interfaces
|
|
83
84
|
exports.QUESTION = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
@@ -156,6 +157,10 @@ exports.QUESTION = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
156
157
|
label: "UI__NODE_EDITOR__MESSAGE__QUESTION__QUESTION__FIELDS_TYPE_OPTIONS__REGEX__LABEL",
|
|
157
158
|
value: "regex",
|
|
158
159
|
},
|
|
160
|
+
{
|
|
161
|
+
label: "UI__NODE_EDITOR__MESSAGE__QUESTION__QUESTION__FIELDS_TYPE_OPTIONS__LLM_ENTITY__LABEL",
|
|
162
|
+
value: "llm_entity"
|
|
163
|
+
},
|
|
159
164
|
{
|
|
160
165
|
label: "UI__NODE_EDITOR__MESSAGE__QUESTION__QUESTION__FIELDS_TYPE_OPTIONS__DATA__LABEL",
|
|
161
166
|
value: "data",
|
|
@@ -1370,6 +1375,97 @@ DO NOT talk about other topics. Do not offer general assistance.`,
|
|
|
1370
1375
|
value: "reconfirm"
|
|
1371
1376
|
}
|
|
1372
1377
|
},
|
|
1378
|
+
{
|
|
1379
|
+
key: "llmEntityExtractLLMProviderReferenceId",
|
|
1380
|
+
type: "llmSelect",
|
|
1381
|
+
label: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__LLM_SELECT__LABEL",
|
|
1382
|
+
defaultValue: "default",
|
|
1383
|
+
params: {
|
|
1384
|
+
required: true
|
|
1385
|
+
},
|
|
1386
|
+
condition: {
|
|
1387
|
+
key: "type",
|
|
1388
|
+
value: "llm_entity"
|
|
1389
|
+
}
|
|
1390
|
+
},
|
|
1391
|
+
{
|
|
1392
|
+
key: "entityName",
|
|
1393
|
+
type: "cognigyText",
|
|
1394
|
+
label: "UI__NODE_EDITOR__SERVICE__LLM_ENTITY_EXTRACT__FIELDS__ENTITY_NAME__LABEL",
|
|
1395
|
+
description: "UI__NODE_EDITOR__SERVICE__LLM_ENTITY_EXTRACT__FIELDS__ENTITY_NAME__DESCRIPTION",
|
|
1396
|
+
defaultValue: "customerID",
|
|
1397
|
+
params: {
|
|
1398
|
+
required: true
|
|
1399
|
+
},
|
|
1400
|
+
condition: {
|
|
1401
|
+
key: "type",
|
|
1402
|
+
value: "llm_entity"
|
|
1403
|
+
}
|
|
1404
|
+
},
|
|
1405
|
+
{
|
|
1406
|
+
key: "examples",
|
|
1407
|
+
type: "keyValuePairs",
|
|
1408
|
+
label: "UI__NODE_EDITOR__SERVICE__LLM_ENTITY_EXTRACT__FIELDS__EXAMPLES__LABEL",
|
|
1409
|
+
description: "UI__NODE_EDITOR__SERVICE__LLM_ENTITY_EXTRACT__FIELDS__EXAMPLES__DESCRIPTION",
|
|
1410
|
+
defaultValue: {
|
|
1411
|
+
"My ID is AB54EE, is that ok?": "AB54EE",
|
|
1412
|
+
"That would be ah bee see double 4 three": "ABC443",
|
|
1413
|
+
"I guess it's 49 A B 8 K": "49AB8K"
|
|
1414
|
+
},
|
|
1415
|
+
params: {
|
|
1416
|
+
keyLabel: "UI__NODE_EDITOR__SERVICE__LLM_ENTITY_EXTRACT__FIELDS__EXAMPLES__INPUT__KEY__LABEL",
|
|
1417
|
+
valueLabel: "UI__NODE_EDITOR__SERVICE__LLM_ENTITY_EXTRACT__FIELDS__EXAMPLES__INPUT__VALUE__LABEL"
|
|
1418
|
+
},
|
|
1419
|
+
condition: {
|
|
1420
|
+
key: "type",
|
|
1421
|
+
value: "llm_entity"
|
|
1422
|
+
}
|
|
1423
|
+
},
|
|
1424
|
+
{
|
|
1425
|
+
key: "entityDescription",
|
|
1426
|
+
type: "cognigyText",
|
|
1427
|
+
label: "UI__NODE_EDITOR__SERVICE__LLM_ENTITY_EXTRACT__FIELDS__ENTITY_DESCRIPTION__LABEL",
|
|
1428
|
+
description: "UI__NODE_EDITOR__SERVICE__LLM_ENTITY_EXTRACT__FIELDS__ENTITY_DESCRIPTION__DESCRIPTION",
|
|
1429
|
+
defaultValue: "a customer ID, which has 6 alphanumeric characters (e.g. ABC123).",
|
|
1430
|
+
params: {
|
|
1431
|
+
required: true
|
|
1432
|
+
},
|
|
1433
|
+
condition: {
|
|
1434
|
+
key: "type",
|
|
1435
|
+
value: "llm_entity"
|
|
1436
|
+
}
|
|
1437
|
+
},
|
|
1438
|
+
{
|
|
1439
|
+
key: "llmEntityExtractDescription",
|
|
1440
|
+
type: "description",
|
|
1441
|
+
label: " ",
|
|
1442
|
+
params: {
|
|
1443
|
+
text: "UI__NODE_EDITOR__SERVICE__LLM_ENTITY_EXTRACT__FIELDS__DESCRIPTION__TEXT",
|
|
1444
|
+
},
|
|
1445
|
+
condition: {
|
|
1446
|
+
key: "type",
|
|
1447
|
+
value: "llm_entity"
|
|
1448
|
+
}
|
|
1449
|
+
},
|
|
1450
|
+
{
|
|
1451
|
+
key: "llmentityTemperature",
|
|
1452
|
+
label: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__TEMPERATURE__LABEL",
|
|
1453
|
+
type: "slider",
|
|
1454
|
+
description: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__TEMPERATURE__DESCRIPTION",
|
|
1455
|
+
defaultValue: 0.7,
|
|
1456
|
+
params: {
|
|
1457
|
+
min: 0,
|
|
1458
|
+
max: 1,
|
|
1459
|
+
step: 0.1
|
|
1460
|
+
}
|
|
1461
|
+
},
|
|
1462
|
+
{
|
|
1463
|
+
key: "llmentityTimeout",
|
|
1464
|
+
label: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__TIMEOUT__LABEL",
|
|
1465
|
+
defaultValue: 5000,
|
|
1466
|
+
type: "number",
|
|
1467
|
+
description: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__TIMEOUT__DESCRIPTION",
|
|
1468
|
+
},
|
|
1373
1469
|
...(0, datepickerUtils_1.getDatePickerFields)({
|
|
1374
1470
|
"key": "type",
|
|
1375
1471
|
"value": "date"
|
|
@@ -1653,6 +1749,24 @@ DO NOT talk about other topics. Do not offer general assistance.`,
|
|
|
1653
1749
|
"cleanTextLocale"
|
|
1654
1750
|
],
|
|
1655
1751
|
},
|
|
1752
|
+
{
|
|
1753
|
+
key: "llmEntityExtractOptions",
|
|
1754
|
+
label: "UI__NODE_EDITOR__MESSAGE__QUESTION__QUESTION__SECTIONS__LLM_ENTITY_EXTRACT_OPTIONS__LABEL",
|
|
1755
|
+
defaultCollapsed: true,
|
|
1756
|
+
fields: [
|
|
1757
|
+
"llmEntityExtractLLMProviderReferenceId",
|
|
1758
|
+
"entityName",
|
|
1759
|
+
"entityDescription",
|
|
1760
|
+
"examples",
|
|
1761
|
+
"additionalValidation",
|
|
1762
|
+
"llmentityTemperature",
|
|
1763
|
+
"llmentityTimeout"
|
|
1764
|
+
],
|
|
1765
|
+
condition: {
|
|
1766
|
+
key: "type",
|
|
1767
|
+
value: "llm_entity"
|
|
1768
|
+
},
|
|
1769
|
+
},
|
|
1656
1770
|
...(0, datepickerUtils_1.getDatePickerSections)("Datepicker - ", {
|
|
1657
1771
|
"key": "type",
|
|
1658
1772
|
"value": "date"
|
|
@@ -1661,10 +1775,12 @@ DO NOT talk about other topics. Do not offer general assistance.`,
|
|
|
1661
1775
|
].filter(section => !!section),
|
|
1662
1776
|
form: [
|
|
1663
1777
|
{ type: "field", key: "type" },
|
|
1778
|
+
{ type: "field", key: "llmEntityExtractDescription" },
|
|
1664
1779
|
{ type: "field", key: "keyphraseTag" },
|
|
1665
1780
|
{ type: "field", key: "usePositiveOnly" },
|
|
1666
1781
|
{ type: "field", key: "regex" },
|
|
1667
1782
|
{ type: "field", key: "say" },
|
|
1783
|
+
{ type: "section", key: "llmEntityExtractOptions" },
|
|
1668
1784
|
{ type: "section", key: "context" },
|
|
1669
1785
|
{ type: "section", key: "reprompt" },
|
|
1670
1786
|
{ type: "section", key: "reconfirmation" },
|
|
@@ -1753,9 +1869,14 @@ DO NOT talk about other topics. Do not offer general assistance.`,
|
|
|
1753
1869
|
}
|
|
1754
1870
|
// if we're in a subsequent execution or we want to parse results
|
|
1755
1871
|
// immediately on entry, continue with evaluation
|
|
1756
|
-
let result = (0, evaluateQuestionAnswer_1.evaluateQuestionAnswer)({ cognigy, config }, overwriteAnswer);
|
|
1872
|
+
let result = await (0, evaluateQuestionAnswer_1.evaluateQuestionAnswer)({ cognigy, config }, overwriteAnswer);
|
|
1873
|
+
// set input.result, so we can use it for validation
|
|
1874
|
+
input.result = result;
|
|
1757
1875
|
// Verify that answer is valid based on some other conditions defined in the function
|
|
1758
1876
|
const isValid = (0, validateQuestionAnswer_1.validateQuestionAnswer)(cognigy, config);
|
|
1877
|
+
if (!isValid) {
|
|
1878
|
+
input.result = null;
|
|
1879
|
+
}
|
|
1759
1880
|
// compute how often this node was hit
|
|
1760
1881
|
const executionAmount = api.getExecutionAmount(nodeId);
|
|
1761
1882
|
// compute how long ago this node was hit
|
|
@@ -1792,7 +1913,7 @@ DO NOT talk about other topics. Do not offer general assistance.`,
|
|
|
1792
1913
|
// #region 0 CheckIfReconfirmationInProgress
|
|
1793
1914
|
if (api.getSystemContext("reconfirmationQuestionInProgress")) {
|
|
1794
1915
|
// if this is the case, we are now a YN question
|
|
1795
|
-
let res = (0, evaluateQuestionAnswer_1.evaluateQuestionAnswer)({
|
|
1916
|
+
let res = await (0, evaluateQuestionAnswer_1.evaluateQuestionAnswer)({
|
|
1796
1917
|
cognigy, config: {
|
|
1797
1918
|
"type": "yesNo"
|
|
1798
1919
|
}
|
|
@@ -3,12 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.evaluateQuestionAnswer = void 0;
|
|
4
4
|
/* Custom modules */
|
|
5
5
|
const getQuestionText_1 = require("./getQuestionText");
|
|
6
|
+
const generativeAIPrompts_1 = require("../../../../helpers/generativeAI/generativeAIPrompts");
|
|
7
|
+
const prompt_1 = require("../../../nlu/generativeSlotFiller/prompt");
|
|
6
8
|
/**
|
|
7
9
|
* Evaluates the answer of a question against its type
|
|
8
10
|
*/
|
|
9
|
-
function evaluateQuestionAnswer({ cognigy, config }, overwriteAnswer) {
|
|
10
|
-
var _a, _b, _c, _d, _e;
|
|
11
|
-
const { type,
|
|
11
|
+
async function evaluateQuestionAnswer({ cognigy, config }, overwriteAnswer) {
|
|
12
|
+
var _a, _b, _c, _d, _e, _f;
|
|
13
|
+
const { type, keyphraseTag, usePositiveOnly, regex: regexField, storeDetailedResults,
|
|
14
|
+
// for LLM Extract functionality
|
|
15
|
+
entityName, entityDescription, examples, llmEntityExtractLLMProviderReferenceId } = config;
|
|
12
16
|
const { api, input } = cognigy;
|
|
13
17
|
const answer = overwriteAnswer || input;
|
|
14
18
|
let result;
|
|
@@ -106,6 +110,43 @@ function evaluateQuestionAnswer({ cognigy, config }, overwriteAnswer) {
|
|
|
106
110
|
case "phonenumber":
|
|
107
111
|
result = api.matchPattern(type, answer.text, input.language);
|
|
108
112
|
break;
|
|
113
|
+
case "llm_entity":
|
|
114
|
+
const prompt = (0, generativeAIPrompts_1.getLLMEntityExtractPrompt)(entityName, entityDescription, examples, answer.text);
|
|
115
|
+
const options = {
|
|
116
|
+
prompt,
|
|
117
|
+
temperature: (config === null || config === void 0 ? void 0 : config.llmentityTemperature) || 0.7,
|
|
118
|
+
maxTokens: 1000,
|
|
119
|
+
timeoutInMs: (config === null || config === void 0 ? void 0 : config.llmentityTimeout) || 5000,
|
|
120
|
+
useCase: "promptNode",
|
|
121
|
+
detailedResults: true
|
|
122
|
+
};
|
|
123
|
+
if (llmEntityExtractLLMProviderReferenceId && llmEntityExtractLLMProviderReferenceId !== "default") {
|
|
124
|
+
options["llmProviderReferenceId"] = llmEntityExtractLLMProviderReferenceId;
|
|
125
|
+
}
|
|
126
|
+
options["chat"] = (0, prompt_1.createLastConversationChatObject)(cognigy.lastConversationEntries, (0, generativeAIPrompts_1.getLLMEntityExtractSystemMessage)(entityName, entityDescription, examples), 5, true);
|
|
127
|
+
try {
|
|
128
|
+
const response = await api.runGenerativeAIPrompt(options, "gptPromptNode");
|
|
129
|
+
// find the entity in the response
|
|
130
|
+
result = (_f = response === null || response === void 0 ? void 0 : response.result) === null || _f === void 0 ? void 0 : _f[entityName];
|
|
131
|
+
if (!result) {
|
|
132
|
+
try {
|
|
133
|
+
result = JSON.parse(`{"${entityName}": ${response.result}`)[entityName];
|
|
134
|
+
}
|
|
135
|
+
catch (err) {
|
|
136
|
+
try {
|
|
137
|
+
result = JSON.parse(response.result)[entityName];
|
|
138
|
+
}
|
|
139
|
+
catch (err) {
|
|
140
|
+
result = null;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
catch (err) {
|
|
146
|
+
api.log("error", `Error in evaluation of Question Node type LLM Entity Extract. Error was: ${err.message}`);
|
|
147
|
+
result = null;
|
|
148
|
+
}
|
|
149
|
+
break;
|
|
109
150
|
case "custom":
|
|
110
151
|
// the custom type is always true
|
|
111
152
|
result = true;
|