@cognigy/rest-api-client 0.17.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 +6 -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 +330 -153
- 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/transcriptAssist.js +40 -2
- 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/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 +28 -12
- 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 +17 -13
- package/build/shared/charts/descriptors/voice/mappers/transfer.mapper.js +4 -4
- package/build/shared/charts/descriptors/voice/nodes/play.js +8 -1
- package/build/shared/charts/descriptors/voice/nodes/sessionSpeechParameters.js +44 -45
- package/build/shared/charts/descriptors/voicegateway2/nodes/play.js +0 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +31 -39
- package/build/shared/charts/descriptors/voicegateway2/nodes/transfer.js +17 -25
- package/build/shared/charts/helpers/generativeAI/generativeAIPrompts.js +55 -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 +32 -3
- package/build/shared/interfaces/handover.js +2 -1
- package/build/shared/interfaces/messageAPI/endpoints.js +15 -2
- package/build/shared/interfaces/messageAPI/handover.js +5 -1
- 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 +84 -75
- package/build/shared/interfaces/resources/TResourceType.js +12 -5
- package/build/shared/interfaces/resources/settings/IGenerativeAISettings.js +4 -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/IPermission.js +4 -2
- package/build/shared/interfaces/security/index.js +1 -1
- package/package.json +2 -2
- package/types/index.d.ts +938 -285
- package/build/shared/charts/descriptors/nlu/extractAnswer.js +0 -115
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LLM_ENTITY_EXTRACT = void 0;
|
|
4
|
+
/* Custom modules */
|
|
5
|
+
const createNodeDescriptor_1 = require("../../createNodeDescriptor");
|
|
6
|
+
const prompt_1 = require("../nlu/generativeSlotFiller/prompt");
|
|
7
|
+
const generativeAIPrompts_1 = require("../../helpers/generativeAI/generativeAIPrompts");
|
|
8
|
+
exports.LLM_ENTITY_EXTRACT = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
9
|
+
type: "llmEntityExtract",
|
|
10
|
+
defaultLabel: "LLM Entity Extract",
|
|
11
|
+
summary: "UI__NODE_EDITOR__SERVICE__LLM_ENTITY_EXTRACT__DESCRIPTION",
|
|
12
|
+
fields: [
|
|
13
|
+
{
|
|
14
|
+
key: "llmProviderReferenceId",
|
|
15
|
+
type: "llmSelect",
|
|
16
|
+
label: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__LLM_SELECT__LABEL",
|
|
17
|
+
defaultValue: "default",
|
|
18
|
+
params: {
|
|
19
|
+
required: true
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
key: "entityName",
|
|
24
|
+
type: "cognigyText",
|
|
25
|
+
label: "UI__NODE_EDITOR__SERVICE__LLM_ENTITY_EXTRACT__FIELDS__ENTITY_NAME__LABEL",
|
|
26
|
+
description: "UI__NODE_EDITOR__SERVICE__LLM_ENTITY_EXTRACT__FIELDS__ENTITY_NAME__DESCRIPTION",
|
|
27
|
+
defaultValue: "customerID",
|
|
28
|
+
params: {
|
|
29
|
+
required: true
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
key: "examples",
|
|
34
|
+
type: "keyValuePairs",
|
|
35
|
+
label: "UI__NODE_EDITOR__SERVICE__LLM_ENTITY_EXTRACT__FIELDS__EXAMPLES__LABEL",
|
|
36
|
+
description: "UI__NODE_EDITOR__SERVICE__LLM_ENTITY_EXTRACT__FIELDS__EXAMPLES__DESCRIPTION",
|
|
37
|
+
defaultValue: {
|
|
38
|
+
"My ID is AB54EE, is that ok?": "AB54EE",
|
|
39
|
+
"That would be ah bee see double 4 three": "ABC443",
|
|
40
|
+
"I guess it's 49 A B 8 K": "49AB8K"
|
|
41
|
+
},
|
|
42
|
+
params: {
|
|
43
|
+
keyLabel: "UI__NODE_EDITOR__SERVICE__LLM_ENTITY_EXTRACT__FIELDS__EXAMPLES__INPUT__KEY__LABEL",
|
|
44
|
+
valueLabel: "UI__NODE_EDITOR__SERVICE__LLM_ENTITY_EXTRACT__FIELDS__EXAMPLES__INPUT__VALUE__LABEL"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
key: "entityDescription",
|
|
49
|
+
type: "cognigyText",
|
|
50
|
+
label: "UI__NODE_EDITOR__SERVICE__LLM_ENTITY_EXTRACT__FIELDS__ENTITY_DESCRIPTION__LABEL",
|
|
51
|
+
description: "UI__NODE_EDITOR__SERVICE__LLM_ENTITY_EXTRACT__FIELDS__ENTITY_DESCRIPTION__DESCRIPTION",
|
|
52
|
+
defaultValue: "a customer ID, which has 6 alphanumeric characters (e.g. ABC123).",
|
|
53
|
+
params: {
|
|
54
|
+
required: true
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
key: "temperature",
|
|
59
|
+
label: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__TEMPERATURE__LABEL",
|
|
60
|
+
type: "slider",
|
|
61
|
+
description: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__TEMPERATURE__DESCRIPTION",
|
|
62
|
+
defaultValue: 0.7,
|
|
63
|
+
params: {
|
|
64
|
+
min: 0,
|
|
65
|
+
max: 1,
|
|
66
|
+
step: 0.1
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
key: "timeout",
|
|
71
|
+
label: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__TIMEOUT__LABEL",
|
|
72
|
+
defaultValue: 5000,
|
|
73
|
+
type: "number",
|
|
74
|
+
description: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__TIMEOUT__DESCRIPTION",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
key: "storeLocation",
|
|
78
|
+
type: "select",
|
|
79
|
+
label: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__STORE_LOCATION__LABEL",
|
|
80
|
+
description: "UI__NODE_EDITOR__SERVICE__LLM_ENTITY_EXTRACT__SECTIONS__STORAGE__DESCRIPTION",
|
|
81
|
+
defaultValue: "input",
|
|
82
|
+
params: {
|
|
83
|
+
options: [
|
|
84
|
+
{
|
|
85
|
+
label: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__STORE_LOCATION__OPTIONS__INPUT__LABEL",
|
|
86
|
+
value: "input"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
label: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__STORE_LOCATION__OPTIONS__CONTEXT__LABEL",
|
|
90
|
+
value: "context"
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
required: true
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
key: "inputKey",
|
|
98
|
+
type: "cognigyText",
|
|
99
|
+
label: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__INPUT_KEY__LABEL",
|
|
100
|
+
defaultValue: "extractedEntity",
|
|
101
|
+
condition: {
|
|
102
|
+
key: "storeLocation",
|
|
103
|
+
value: "input",
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
key: "contextKey",
|
|
108
|
+
type: "cognigyText",
|
|
109
|
+
label: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__CONTEXT_KEY__LABEL",
|
|
110
|
+
defaultValue: "extractedEntity",
|
|
111
|
+
condition: {
|
|
112
|
+
key: "storeLocation",
|
|
113
|
+
value: "context",
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
key: "debugLogTokenCount",
|
|
118
|
+
label: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__DEBUGLOGTOKENCOUNT__LABEL",
|
|
119
|
+
type: "toggle",
|
|
120
|
+
description: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__DEBUGLOGTOKENCOUNT__DESCRIPTION",
|
|
121
|
+
defaultValue: false
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
key: "debugLogRequestAndCompletion",
|
|
125
|
+
label: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__DEBUGLOGREQUESTANDCOMPLETION__LABEL",
|
|
126
|
+
type: "toggle",
|
|
127
|
+
description: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__DEBUGLOGREQUESTANDCOMPLETION__DESCRIPTION",
|
|
128
|
+
defaultValue: false
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
key: "debugDescription",
|
|
132
|
+
type: "description",
|
|
133
|
+
label: " ",
|
|
134
|
+
params: {
|
|
135
|
+
text: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__DEBUG_DESCRIPTION__TEXT"
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
key: "responseFormat",
|
|
140
|
+
type: "select",
|
|
141
|
+
label: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__RESPONSE_FORMAT__LABEL",
|
|
142
|
+
description: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__RESPONSE_FORMAT__DESCRIPTION",
|
|
143
|
+
defaultValue: "default",
|
|
144
|
+
params: {
|
|
145
|
+
options: [
|
|
146
|
+
{
|
|
147
|
+
label: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__RESPONSE_FORMAT__OPTIONS__DEFAULT__LABEL",
|
|
148
|
+
value: "default"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
label: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__RESPONSE_FORMAT__OPTIONS__TEXT__LABEL",
|
|
152
|
+
value: "text"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
label: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__RESPONSE_FORMAT__OPTIONS__JSON__LABEL",
|
|
156
|
+
value: "json_object"
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
sections: [
|
|
163
|
+
{
|
|
164
|
+
key: "advanced",
|
|
165
|
+
label: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__SECTIONS__ADVANCED__LABEL",
|
|
166
|
+
defaultCollapsed: true,
|
|
167
|
+
fields: [
|
|
168
|
+
"temperature",
|
|
169
|
+
"timeout",
|
|
170
|
+
"responseFormat"
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
key: "storage",
|
|
175
|
+
label: "UI__NODE_EDITOR__SERVICE__LLM_ENTITY_EXTRACT__SECTIONS__STORAGE__LABEL",
|
|
176
|
+
defaultCollapsed: true,
|
|
177
|
+
fields: [
|
|
178
|
+
"storeLocation",
|
|
179
|
+
"inputKey",
|
|
180
|
+
"contextKey",
|
|
181
|
+
]
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
key: "debugging",
|
|
185
|
+
label: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__SECTIONS__DEBUGGING__LABEL",
|
|
186
|
+
defaultCollapsed: true,
|
|
187
|
+
fields: [
|
|
188
|
+
"debugDescription",
|
|
189
|
+
"debugLogTokenCount",
|
|
190
|
+
"debugLogRequestAndCompletion"
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
form: [
|
|
195
|
+
{ type: "field", key: "llmProviderReferenceId" },
|
|
196
|
+
{ type: "field", key: "entityName" },
|
|
197
|
+
{ type: "field", key: "entityDescription" },
|
|
198
|
+
{ type: "field", key: "examples" },
|
|
199
|
+
{ type: "section", key: "advanced" },
|
|
200
|
+
{ type: "section", key: "storage" },
|
|
201
|
+
{ type: "section", key: "debugging" }
|
|
202
|
+
],
|
|
203
|
+
appearance: {},
|
|
204
|
+
tags: ["service", "llm", "gpt", "generative ai", "openai", "azure", "prompt", "entity", "extract"],
|
|
205
|
+
function: async ({ cognigy, config }) => {
|
|
206
|
+
var _a, _b;
|
|
207
|
+
const { api, input } = cognigy;
|
|
208
|
+
const { temperature, storeLocation, contextKey, inputKey, timeout, debugLogTokenCount, debugLogRequestAndCompletion, llmProviderReferenceId, entityName, entityDescription, examples, responseFormat } = config;
|
|
209
|
+
// check if entityName is a valid JSON key and only contains alphanumeric characters and underscores
|
|
210
|
+
if (!entityName.match(/^[a-zA-Z0-9_]+$/)) {
|
|
211
|
+
throw new Error("The entity name must only contain alphanumeric characters and underscores.");
|
|
212
|
+
}
|
|
213
|
+
try {
|
|
214
|
+
const prompt = (0, generativeAIPrompts_1.getLLMEntityExtractPrompt)(entityName, entityDescription, examples, input.text);
|
|
215
|
+
const options = {
|
|
216
|
+
prompt,
|
|
217
|
+
temperature,
|
|
218
|
+
maxTokens: 1000,
|
|
219
|
+
timeoutInMs: timeout,
|
|
220
|
+
useCase: "promptNode",
|
|
221
|
+
detailedResults: true
|
|
222
|
+
};
|
|
223
|
+
if (responseFormat && responseFormat !== "default") {
|
|
224
|
+
options["responseFormat"] = responseFormat;
|
|
225
|
+
}
|
|
226
|
+
if (llmProviderReferenceId && llmProviderReferenceId !== "default") {
|
|
227
|
+
options["llmProviderReferenceId"] = llmProviderReferenceId;
|
|
228
|
+
}
|
|
229
|
+
options["chat"] = (0, prompt_1.createLastConversationChatObject)(cognigy.lastConversationEntries, (0, generativeAIPrompts_1.getLLMEntityExtractSystemMessage)(entityName, entityDescription, examples), 3, true);
|
|
230
|
+
const response = await api.runGenerativeAIPrompt(options, "gptPromptNode");
|
|
231
|
+
// if we're in adminconsole, process debugging options
|
|
232
|
+
input.channel === "adminconsole" && (0, prompt_1.writeLLMDebugLogs)("LLM Entity Extract", prompt, response, debugLogTokenCount, debugLogRequestAndCompletion, cognigy);
|
|
233
|
+
// find the entity in the response
|
|
234
|
+
let result = (_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a[entityName];
|
|
235
|
+
if (!result) {
|
|
236
|
+
try {
|
|
237
|
+
result = JSON.parse(`{"${entityName}": ${response.result}`)[entityName];
|
|
238
|
+
}
|
|
239
|
+
catch (err) {
|
|
240
|
+
try {
|
|
241
|
+
result = JSON.parse(response.result)[entityName];
|
|
242
|
+
;
|
|
243
|
+
}
|
|
244
|
+
catch (err) {
|
|
245
|
+
result = null;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (storeLocation === "context") {
|
|
250
|
+
api.addToContext(contextKey, result, "simple");
|
|
251
|
+
}
|
|
252
|
+
else if (storeLocation === "input") {
|
|
253
|
+
// @ts-ignore
|
|
254
|
+
api.addToInput(inputKey, result);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
catch (error) {
|
|
258
|
+
const errorDetails = {
|
|
259
|
+
name: error.name,
|
|
260
|
+
code: error.code,
|
|
261
|
+
message: error.message || ((_b = error.originalErrorDetails) === null || _b === void 0 ? void 0 : _b.message),
|
|
262
|
+
};
|
|
263
|
+
if (storeLocation === "context") {
|
|
264
|
+
api.addToContext(contextKey, { error: errorDetails }, "simple");
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
// @ts-ignore
|
|
268
|
+
api.addToInput(inputKey, { error: errorDetails });
|
|
269
|
+
}
|
|
270
|
+
throw error;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
//# sourceMappingURL=LLMEntityExtract.js.map
|
|
@@ -308,6 +308,36 @@ exports.HTTP_REQUEST = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
308
308
|
value: true
|
|
309
309
|
}
|
|
310
310
|
},
|
|
311
|
+
{
|
|
312
|
+
key: "timeout",
|
|
313
|
+
type: "number",
|
|
314
|
+
label: "UI__NODE_EDITOR__SERVICE__HTTP_REQUEST__FIELDS__TIMEOUT__LABEL",
|
|
315
|
+
description: "UI__NODE_EDITOR__SERVICE__HTTP_REQUEST__FIELDS__TIMEOUT__DESCRIPTION",
|
|
316
|
+
defaultValue: 8000,
|
|
317
|
+
params: {
|
|
318
|
+
min: 2000,
|
|
319
|
+
max: 30000 // 30 sec
|
|
320
|
+
},
|
|
321
|
+
condition: {
|
|
322
|
+
key: "async",
|
|
323
|
+
value: true
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
key: "retryAttempts",
|
|
328
|
+
type: "number",
|
|
329
|
+
label: "UI__NODE_EDITOR__SERVICE__HTTP_REQUEST__FIELDS__RETRY_ATTEMPTS__LABEL",
|
|
330
|
+
description: "UI__NODE_EDITOR__SERVICE__HTTP_REQUEST__FIELDS__RETRY_ATTEMPTS__DESCRIPTION",
|
|
331
|
+
defaultValue: 0,
|
|
332
|
+
params: {
|
|
333
|
+
min: 0,
|
|
334
|
+
max: 3
|
|
335
|
+
},
|
|
336
|
+
condition: {
|
|
337
|
+
key: "async",
|
|
338
|
+
value: true
|
|
339
|
+
}
|
|
340
|
+
},
|
|
311
341
|
{
|
|
312
342
|
key: "storeResponseHeaders",
|
|
313
343
|
type: "toggle",
|
|
@@ -419,8 +449,10 @@ exports.HTTP_REQUEST = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
419
449
|
defaultCollapsed: true,
|
|
420
450
|
fields: [
|
|
421
451
|
"async",
|
|
452
|
+
"timeout",
|
|
453
|
+
"retryAttempts",
|
|
422
454
|
"cache",
|
|
423
|
-
"cacheExpiry"
|
|
455
|
+
"cacheExpiry",
|
|
424
456
|
]
|
|
425
457
|
},
|
|
426
458
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GPT_CONVERSATION_SUMMARY = exports.GPT_CONVERSATION = exports.HANDOVER_INACTIVITY_TIMER = exports.CLOSE_HANDOVER = exports.GPT_PROMPT = exports.ON_SCHEDULING_ERROR = exports.ON_SCHEDULED = exports.TRIGGER_FUNCTION = exports.HTTP_CONNECTION_OAUTH2 = exports.HTTP_CONNECTION_APIKEYXKEY = exports.HTTP_CONNECTION_APIKEYAUTHKEY = exports.HTTP_CONNECTION_BASIC = exports.HTTP_REQUEST = exports.CHECK_AGENT_AVAILABILITY = exports.HANDOVER_V2 = exports.HANDOVER = void 0;
|
|
3
|
+
exports.LLM_ENTITY_EXTRACT = exports.GPT_CONVERSATION_SUMMARY = exports.GPT_CONVERSATION = exports.HANDOVER_INACTIVITY_TIMER = exports.CLOSE_HANDOVER = exports.GPT_PROMPT = exports.ON_SCHEDULING_ERROR = exports.ON_SCHEDULED = exports.TRIGGER_FUNCTION = exports.HTTP_CONNECTION_OAUTH2 = exports.HTTP_CONNECTION_APIKEYXKEY = exports.HTTP_CONNECTION_APIKEYAUTHKEY = exports.HTTP_CONNECTION_BASIC = exports.HTTP_REQUEST = exports.CHECK_AGENT_AVAILABILITY = exports.HANDOVER_V2 = exports.HANDOVER = void 0;
|
|
4
4
|
var handover_1 = require("./handover");
|
|
5
5
|
Object.defineProperty(exports, "HANDOVER", { enumerable: true, get: function () { return handover_1.HANDOVER; } });
|
|
6
6
|
var handoverV2_1 = require("./handoverV2");
|
|
@@ -31,4 +31,6 @@ var GPTConversation_1 = require("./GPTConversation");
|
|
|
31
31
|
Object.defineProperty(exports, "GPT_CONVERSATION", { enumerable: true, get: function () { return GPTConversation_1.GPT_CONVERSATION; } });
|
|
32
32
|
var conversationSummary_1 = require("./conversationSummary");
|
|
33
33
|
Object.defineProperty(exports, "GPT_CONVERSATION_SUMMARY", { enumerable: true, get: function () { return conversationSummary_1.GPT_CONVERSATION_SUMMARY; } });
|
|
34
|
+
var LLMEntityExtract_1 = require("./LLMEntityExtract");
|
|
35
|
+
Object.defineProperty(exports, "LLM_ENTITY_EXTRACT", { enumerable: true, get: function () { return LLMEntityExtract_1.LLM_ENTITY_EXTRACT; } });
|
|
34
36
|
//# sourceMappingURL=index.js.map
|
|
@@ -4,7 +4,7 @@ exports.setSessionConfig = exports.vg2PayloadToActivityParams = exports.voiceCon
|
|
|
4
4
|
const strip_nulls_1 = require("../../voicegateway2/utils/strip-nulls");
|
|
5
5
|
const helper_1 = require("../utils/helper");
|
|
6
6
|
function voiceConfigParamsToVoiceSettings(config, api) {
|
|
7
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
|
7
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
8
8
|
let voiceSettings = {};
|
|
9
9
|
if (config.sttVendor === 'none') {
|
|
10
10
|
delete config.sttVendor;
|
|
@@ -40,6 +40,8 @@ function voiceConfigParamsToVoiceSettings(config, api) {
|
|
|
40
40
|
if (config.sttHints && config.sttHints.length) {
|
|
41
41
|
hints = [...hints, ...config.sttHints];
|
|
42
42
|
}
|
|
43
|
+
const deepgramEndpointing = (_d = config.deepgramEndpointing) !== null && _d !== void 0 ? _d : true;
|
|
44
|
+
const deepgramShortUtterance = deepgramEndpointing ? false : true;
|
|
43
45
|
// stt (recognizer)
|
|
44
46
|
voiceSettings.stt = {
|
|
45
47
|
sttVendor: config.sttVendor,
|
|
@@ -50,12 +52,13 @@ function voiceConfigParamsToVoiceSettings(config, api) {
|
|
|
50
52
|
config.sttDisablePunctuation !== null
|
|
51
53
|
? !config.sttDisablePunctuation
|
|
52
54
|
: undefined,
|
|
53
|
-
googleModel: (
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
deepgramSmartFormatting: (
|
|
55
|
+
googleModel: (_e = config.googleModel) !== null && _e !== void 0 ? _e : undefined,
|
|
56
|
+
/* by default we enable endpointing - it is only undefined via SAP */
|
|
57
|
+
deepgramEndpointing,
|
|
58
|
+
deepgramEndpointingValue: (_f = config.deepgramEndpointingValue) !== null && _f !== void 0 ? _f : 250,
|
|
59
|
+
sttDeepgramModel: (_g = config.sttDeepgramModel) !== null && _g !== void 0 ? _g : "nova-2",
|
|
60
|
+
deepgramSmartFormatting: (_h = config.deepgramSmartFormatting) !== null && _h !== void 0 ? _h : undefined,
|
|
61
|
+
deepgramShortUtterance,
|
|
59
62
|
};
|
|
60
63
|
// tts (synthesizer)
|
|
61
64
|
voiceSettings.tts = {
|
|
@@ -105,7 +108,7 @@ function voiceConfigParamsToVoiceSettings(config, api) {
|
|
|
105
108
|
dtmfInterDigitTimeout: config.dtmfInterDigitTimeout,
|
|
106
109
|
dtmfMaxDigits: config.dtmfMaxDigits,
|
|
107
110
|
dtmfMinDigits: config.dtmfMinDigits,
|
|
108
|
-
dtmfSubmitDigit: (
|
|
111
|
+
dtmfSubmitDigit: (_j = config.dtmfSubmitDigit) === null || _j === void 0 ? void 0 : _j.trim(),
|
|
109
112
|
};
|
|
110
113
|
if (config === null || config === void 0 ? void 0 : config.dtmfEnable) {
|
|
111
114
|
if (voiceSettings.dtmf.dtmfSubmitDigit &&
|
|
@@ -177,7 +180,7 @@ exports.setSessionConfig = {
|
|
|
177
180
|
}
|
|
178
181
|
},
|
|
179
182
|
handleVGInput(voiceSettings, sessionParams, api) {
|
|
180
|
-
var _a, _b
|
|
183
|
+
var _a, _b;
|
|
181
184
|
const { bargeIn, continuousAsr, stt, tts, userNoInput, dtmf, vad, azureConfig, } = voiceSettings;
|
|
182
185
|
const user = {};
|
|
183
186
|
const synthesizer = {};
|
|
@@ -201,12 +204,13 @@ exports.setSessionConfig = {
|
|
|
201
204
|
}
|
|
202
205
|
}
|
|
203
206
|
if (recognizer && recognizer.vendor === 'deepgram') {
|
|
207
|
+
recognizer.model = stt.sttDeepgramModel;
|
|
204
208
|
recognizer.deepgramOptions = {};
|
|
205
|
-
recognizer.deepgramOptions.endpointing = stt.
|
|
209
|
+
recognizer.deepgramOptions.endpointing = stt.deepgramEndpointing ? stt.deepgramEndpointingValue : false;
|
|
206
210
|
recognizer.deepgramOptions.punctuate = stt.sttDisablePunctuation;
|
|
207
|
-
recognizer.deepgramOptions.
|
|
208
|
-
recognizer.deepgramOptions.model = (
|
|
209
|
-
recognizer.deepgramOptions.smartFormatting = (
|
|
211
|
+
recognizer.deepgramOptions.shortUtterance = stt.deepgramShortUtterance;
|
|
212
|
+
recognizer.deepgramOptions.model = (_a = stt.sttDeepgramModel) !== null && _a !== void 0 ? _a : undefined;
|
|
213
|
+
recognizer.deepgramOptions.smartFormatting = (_b = stt.deepgramSmartFormatting) !== null && _b !== void 0 ? _b : false;
|
|
210
214
|
}
|
|
211
215
|
}
|
|
212
216
|
if (vad) {
|
|
@@ -7,7 +7,7 @@ const path_1 = require("path");
|
|
|
7
7
|
const helper_1 = require("../../../descriptors/voicegateway2/utils/helper");
|
|
8
8
|
const helper_2 = require("../utils/helper");
|
|
9
9
|
exports.transfer = {
|
|
10
|
-
handleInput(endpointType, params, isGenericNode, recognitionChannel, sttVendor, sttLanguage, googleModel,
|
|
10
|
+
handleInput(endpointType, params, isGenericNode, recognitionChannel, sttVendor, sttLanguage, googleModel, sttDeepgramModel, sttDisablePunctuation, deepgramEndpointing, deepgramEndpointingValue, deepgramSmartFormatting) {
|
|
11
11
|
try {
|
|
12
12
|
switch (endpointType) {
|
|
13
13
|
case "bandwidth":
|
|
@@ -26,14 +26,14 @@ exports.transfer = {
|
|
|
26
26
|
return this.handleAudioCodesInput((0, exports.prepareTransferParams)(params), endpointType);
|
|
27
27
|
case "voiceGateway2":
|
|
28
28
|
default:
|
|
29
|
-
return this.handleVGInput((0, exports.prepareTransferParams)(params), recognitionChannel, sttVendor, sttLanguage, googleModel,
|
|
29
|
+
return this.handleVGInput((0, exports.prepareTransferParams)(params), recognitionChannel, sttVendor, sttLanguage, googleModel, sttDeepgramModel, sttDisablePunctuation, deepgramEndpointing, deepgramEndpointingValue, deepgramSmartFormatting);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
catch (error) {
|
|
33
33
|
throw Error(error.message);
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
|
-
handleVGInput(transferParam, recognitionChannel, sttVendor, sttLanguage, googleModel,
|
|
36
|
+
handleVGInput(transferParam, recognitionChannel, sttVendor, sttLanguage, googleModel, sttDeepgramModel, sttDisablePunctuation, deepgramEndpointing, deepgramEndpointingValue, deepgramSmartFormatting) {
|
|
37
37
|
const { transferType, transferTarget, transferReason, referredBy, useTransferSipHeaders, transferSipHeaders, dialMusic, dialTranscriptionWebhook, dialCallerId, amdEnabled, amdRedirectOnMachineDetected, amdRedirectText, dialTimeout, sttLabel } = transferParam;
|
|
38
38
|
const payload = {
|
|
39
39
|
_voiceGateway2: {
|
|
@@ -105,8 +105,8 @@ exports.transfer = {
|
|
|
105
105
|
recognizer.model = googleModel;
|
|
106
106
|
}
|
|
107
107
|
if (recognizer.vendor === 'deepgram') {
|
|
108
|
+
recognizer.model = sttDeepgramModel;
|
|
108
109
|
recognizer.deepgramOptions = {
|
|
109
|
-
tier: sttDeepgramTier,
|
|
110
110
|
model: sttDeepgramModel,
|
|
111
111
|
punctuate: !sttDisablePunctuation,
|
|
112
112
|
endpointing: deepgramEndpointing ? deepgramEndpointingValue : false,
|
|
@@ -51,7 +51,14 @@ exports.PLAY = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
51
51
|
key: "params_stt",
|
|
52
52
|
label: "UI__NODE_EDITOR__PLAY__SECTIONS__STT__LABEL",
|
|
53
53
|
defaultCollapsed: true,
|
|
54
|
-
fields: [
|
|
54
|
+
fields: [
|
|
55
|
+
"sttVendor",
|
|
56
|
+
"sttHints",
|
|
57
|
+
"enableAdvancedSTTConfig",
|
|
58
|
+
"azureSttContextId",
|
|
59
|
+
"azureEnableAudioLogging",
|
|
60
|
+
"googleModel"
|
|
61
|
+
],
|
|
55
62
|
condition: {
|
|
56
63
|
key: "setActivityParams",
|
|
57
64
|
value: true
|
|
@@ -8,22 +8,6 @@ const setSessionConfig_mapper_1 = require("../mappers/setSessionConfig.mapper");
|
|
|
8
8
|
const design_1 = require("../utils/design");
|
|
9
9
|
const vgConstants_1 = require("../utils/vgConstants");
|
|
10
10
|
exports.voiceConfigFields = [
|
|
11
|
-
{
|
|
12
|
-
key: "sttVendor",
|
|
13
|
-
type: "sttSelect",
|
|
14
|
-
label: "_unused_",
|
|
15
|
-
description: "_unused_",
|
|
16
|
-
defaultValue: "",
|
|
17
|
-
params: {
|
|
18
|
-
languageKey: "config.sttLanguage"
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
key: "sttLanguage",
|
|
23
|
-
type: "sttSelect",
|
|
24
|
-
defaultValue: "",
|
|
25
|
-
label: "_unused_",
|
|
26
|
-
},
|
|
27
11
|
{
|
|
28
12
|
key: "sttHints",
|
|
29
13
|
type: "textArray",
|
|
@@ -97,32 +81,12 @@ exports.voiceConfigFields = [
|
|
|
97
81
|
]
|
|
98
82
|
}
|
|
99
83
|
},
|
|
100
|
-
{
|
|
101
|
-
key: "sttDeepgramTier",
|
|
102
|
-
type: "sttTierModelSelect",
|
|
103
|
-
label: "_unused_",
|
|
104
|
-
description: "_unused_",
|
|
105
|
-
defaultValue: "base",
|
|
106
|
-
params: {
|
|
107
|
-
languageKey: "config.sttDeepgramModel",
|
|
108
|
-
},
|
|
109
|
-
condition: {
|
|
110
|
-
key: "sttVendor",
|
|
111
|
-
value: "deepgram"
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
key: "sttDeepgramModel",
|
|
116
|
-
type: "sttTierModelSelect",
|
|
117
|
-
defaultValue: "general",
|
|
118
|
-
label: "_unused_",
|
|
119
|
-
},
|
|
120
84
|
{
|
|
121
85
|
key: "deepgramEndpointing",
|
|
122
86
|
type: "toggle",
|
|
123
87
|
label: "UI__NODE_EDITOR__VOICEGATEWAY2__SET_SESSION_CONFIG__DEEPGRAM_ENDPOINTING__LABEL",
|
|
124
88
|
description: "UI__NODE_EDITOR__VOICEGATEWAY2__SET_SESSION_CONFIG__DEEPGRAM_ENDPOINTING__DESCRIPTION",
|
|
125
|
-
defaultValue:
|
|
89
|
+
defaultValue: true,
|
|
126
90
|
condition: {
|
|
127
91
|
key: "sttVendor",
|
|
128
92
|
value: "deepgram"
|
|
@@ -133,7 +97,7 @@ exports.voiceConfigFields = [
|
|
|
133
97
|
type: "number",
|
|
134
98
|
label: "UI__NODE_EDITOR__VOICEGATEWAY2__SET_SESSION_CONFIG__DEEPGRAM_ENDPOINTING_TIME__LABEL",
|
|
135
99
|
description: "UI__NODE_EDITOR__VOICEGATEWAY2__SET_SESSION_CONFIG__DEEPGRAM_ENDPOINTING_TIME__DESCRIPTION",
|
|
136
|
-
defaultValue:
|
|
100
|
+
defaultValue: 250,
|
|
137
101
|
params: {
|
|
138
102
|
min: 10,
|
|
139
103
|
max: 1000
|
|
@@ -167,7 +131,11 @@ exports.voiceConfigFields = [
|
|
|
167
131
|
type: "toggle",
|
|
168
132
|
label: "UI__NODE_EDITOR__ENABLE_ADVANCED_STT_CONFIG__LABEL",
|
|
169
133
|
description: "UI__NODE_EDITOR__ENABLE_ADVANCED_STT_CONFIG__DESCRIPTION",
|
|
170
|
-
defaultValue: false
|
|
134
|
+
defaultValue: false,
|
|
135
|
+
condition: {
|
|
136
|
+
key: "sttVendor",
|
|
137
|
+
value: "microsoft"
|
|
138
|
+
}
|
|
171
139
|
},
|
|
172
140
|
{
|
|
173
141
|
key: "azureSttContextId",
|
|
@@ -256,10 +224,10 @@ exports.voiceConfigFields = [
|
|
|
256
224
|
},
|
|
257
225
|
{
|
|
258
226
|
key: "ttsVendor",
|
|
259
|
-
defaultValue: "",
|
|
260
227
|
type: "ttsSelect",
|
|
261
228
|
label: "_unused_",
|
|
262
229
|
description: "_unused_",
|
|
230
|
+
defaultValue: "",
|
|
263
231
|
params: {
|
|
264
232
|
modelKey: "config.ttsModel",
|
|
265
233
|
languageKey: "config.ttsLanguage",
|
|
@@ -269,21 +237,53 @@ exports.voiceConfigFields = [
|
|
|
269
237
|
{
|
|
270
238
|
key: "ttsModel",
|
|
271
239
|
type: "ttsSelect",
|
|
240
|
+
label: "_unused_",
|
|
241
|
+
description: "_unused_",
|
|
272
242
|
defaultValue: "",
|
|
273
|
-
label: "_unused_"
|
|
274
243
|
},
|
|
275
244
|
{
|
|
276
245
|
key: "ttsVoice",
|
|
277
246
|
type: "ttsSelect",
|
|
247
|
+
label: "_unused_",
|
|
248
|
+
description: "_unused_",
|
|
278
249
|
defaultValue: "",
|
|
279
|
-
label: "_unused_"
|
|
280
250
|
},
|
|
281
251
|
{
|
|
282
252
|
key: "ttsLanguage",
|
|
283
253
|
type: "ttsSelect",
|
|
254
|
+
label: "_unused_",
|
|
255
|
+
description: "_unused_",
|
|
256
|
+
defaultValue: "",
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
key: "sttVendor",
|
|
260
|
+
type: "sttSelect",
|
|
261
|
+
label: "_unused_",
|
|
262
|
+
description: "_unused_",
|
|
284
263
|
defaultValue: "",
|
|
285
|
-
|
|
286
|
-
|
|
264
|
+
params: {
|
|
265
|
+
languageKey: "config.sttLanguage",
|
|
266
|
+
modelKey: "config.sttDeepgramModel",
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
key: "sttLanguage",
|
|
271
|
+
type: "sttSelect",
|
|
272
|
+
label: "_unused_",
|
|
273
|
+
description: "_unused_",
|
|
274
|
+
defaultValue: "",
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
key: "sttDeepgramModel",
|
|
278
|
+
type: "sttSelect",
|
|
279
|
+
label: "_unused_",
|
|
280
|
+
description: "_unused_",
|
|
281
|
+
defaultValue: "",
|
|
282
|
+
condition: {
|
|
283
|
+
key: "sttVendor",
|
|
284
|
+
value: "deepgram"
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
287
|
];
|
|
288
288
|
exports.SESSION_SPEECH_PARAMETERS = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
289
289
|
type: "sessionSpeechParameters",
|
|
@@ -301,7 +301,6 @@ exports.SESSION_SPEECH_PARAMETERS = (0, createNodeDescriptor_1.createNodeDescrip
|
|
|
301
301
|
defaultCollapsed: true,
|
|
302
302
|
fields: [
|
|
303
303
|
"sttVendor",
|
|
304
|
-
"sttDeepgramTier",
|
|
305
304
|
"deepgramEndpointing",
|
|
306
305
|
"deepgramEndpointingValue",
|
|
307
306
|
"deepgramSmartFormatting",
|