@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.
Files changed (99) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/GenericTusFn.js +6 -1
  3. package/build/GenericUploadFn.js +3 -5
  4. package/build/apigroups/ResourcesAPIGroup_2_0.js +12 -1
  5. package/build/connector/AxiosAdapter.js +35 -15
  6. package/build/shared/charts/createNodeDescriptor.js +5 -5
  7. package/build/shared/charts/descriptors/agentAssist/constants/constants.js +16 -1
  8. package/build/shared/charts/descriptors/agentAssist/helpers/agentAssistTranslator.helper.js +19 -0
  9. package/build/shared/charts/descriptors/agentAssist/helpers/getFontSizeFieldOptions.js +84 -0
  10. package/build/shared/charts/descriptors/agentAssist/helpers/getLanguageName.helper.js +33 -0
  11. package/build/shared/charts/descriptors/agentAssist/helpers/knowledgeSearch/answerExtraction.helper.js +59 -0
  12. package/build/shared/charts/descriptors/agentAssist/helpers/knowledgeSearch/configValidator.helper.js +20 -0
  13. package/build/shared/charts/descriptors/agentAssist/helpers/knowledgeSearch/errorHandler.helper.js +64 -0
  14. package/build/shared/charts/descriptors/agentAssist/helpers/knowledgeSearch/followUpDetection.helper.js +72 -0
  15. package/build/shared/charts/descriptors/agentAssist/helpers/knowledgeSearch/knowledgeSearch.helper.js +58 -0
  16. package/build/shared/charts/descriptors/agentAssist/helpers/sentiment.helper.js +7 -13
  17. package/build/shared/charts/descriptors/agentAssist/htmlTemplates/identityAssistTemplate.js +17 -18
  18. package/build/shared/charts/descriptors/agentAssist/htmlTemplates/knowledgeAssistTemplate.js +345 -152
  19. package/build/shared/charts/descriptors/agentAssist/htmlTemplates/nextActionWidgetTemplate.js +212 -80
  20. package/build/shared/charts/descriptors/agentAssist/htmlTemplates/sentimentAnalysisTemplate.js +11 -6
  21. package/build/shared/charts/descriptors/agentAssist/htmlTemplates/transcriptAssistTemplate.js +15 -13
  22. package/build/shared/charts/descriptors/agentAssist/identityAssist.js +87 -14
  23. package/build/shared/charts/descriptors/agentAssist/knowledgeAssist.js +192 -327
  24. package/build/shared/charts/descriptors/agentAssist/locales/cs.locale.js +11 -0
  25. package/build/shared/charts/descriptors/agentAssist/locales/de.locale.js +11 -0
  26. package/build/shared/charts/descriptors/agentAssist/locales/en.locale.js +11 -0
  27. package/build/shared/charts/descriptors/agentAssist/locales/es.locale.js +11 -0
  28. package/build/shared/charts/descriptors/agentAssist/locales/fr.locale.js +11 -0
  29. package/build/shared/charts/descriptors/agentAssist/locales/index.js +22 -0
  30. package/build/shared/charts/descriptors/agentAssist/locales/ja.locale.js +11 -0
  31. package/build/shared/charts/descriptors/agentAssist/locales/ko.locale.js +11 -0
  32. package/build/shared/charts/descriptors/agentAssist/locales/pt.locale.js +11 -0
  33. package/build/shared/charts/descriptors/agentAssist/nextActionAssist.js +485 -10
  34. package/build/shared/charts/descriptors/agentAssist/sentimentAssist.js +31 -8
  35. package/build/shared/charts/descriptors/agentAssist/setAgentAssistGrid.js +31 -16
  36. package/build/shared/charts/descriptors/agentAssist/transcriptAssist.js +40 -2
  37. package/build/shared/charts/descriptors/allFields.js +6 -0
  38. package/build/shared/charts/descriptors/analytics/requestRating.js +56 -2
  39. package/build/shared/charts/descriptors/index.js +1 -3
  40. package/build/shared/charts/descriptors/knowledgeSearch/searchExtractOutput.js +1 -1
  41. package/build/shared/charts/descriptors/logic/goTo.js +3 -3
  42. package/build/shared/charts/descriptors/message/question/optionalQuestion.js +1 -1
  43. package/build/shared/charts/descriptors/message/question/question.js +123 -2
  44. package/build/shared/charts/descriptors/message/question/utils/evaluateQuestionAnswer.js +44 -3
  45. package/build/shared/charts/descriptors/nlu/generativeSlotFiller/prompt.js +27 -7
  46. package/build/shared/charts/descriptors/nlu/index.js +1 -3
  47. package/build/shared/charts/descriptors/service/GPTPrompt.js +320 -22
  48. package/build/shared/charts/descriptors/service/LLMEntityExtract.js +274 -0
  49. package/build/shared/charts/descriptors/service/httpRequest.js +33 -1
  50. package/build/shared/charts/descriptors/service/index.js +3 -1
  51. package/build/shared/charts/descriptors/voice/mappers/setSessionConfig.mapper.js +35 -25
  52. package/build/shared/charts/descriptors/voice/mappers/transfer.mapper.js +15 -11
  53. package/build/shared/charts/descriptors/voice/nodes/play.js +8 -1
  54. package/build/shared/charts/descriptors/voice/nodes/sessionSpeechParameters.js +51 -75
  55. package/build/shared/charts/descriptors/voicegateway2/nodes/play.js +0 -1
  56. package/build/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +38 -71
  57. package/build/shared/charts/descriptors/voicegateway2/nodes/transfer.js +17 -25
  58. package/build/shared/charts/helpers/generativeAI/generativeAIPrompts.js +55 -0
  59. package/build/shared/helper/BaseContext.js +31 -0
  60. package/build/shared/interfaces/appsession/IAppSession.js +3 -0
  61. package/build/shared/interfaces/appsession/ISetAppState.js +3 -0
  62. package/build/shared/interfaces/appsession/index.js +3 -0
  63. package/build/shared/interfaces/fileStorage.js +6 -0
  64. package/build/shared/interfaces/generativeAI/IGenerativeAIModels.js +33 -2
  65. package/build/shared/interfaces/handover.js +2 -1
  66. package/build/shared/interfaces/messageAPI/endpoints.js +17 -2
  67. package/build/shared/interfaces/messageAPI/handover.js +9 -5
  68. package/build/shared/interfaces/nlu/nlu.js +3 -0
  69. package/build/shared/interfaces/resources/IAuditEvent.js +10 -9
  70. package/build/shared/interfaces/resources/ILargeLanguageModel.js +34 -20
  71. package/build/shared/interfaces/resources/IMilestone.js +50 -0
  72. package/build/shared/interfaces/resources/INodeDescriptorSet.js +85 -75
  73. package/build/shared/interfaces/resources/TResourceType.js +12 -5
  74. package/build/shared/interfaces/resources/TSocketChannelType.js +5 -1
  75. package/build/shared/interfaces/resources/settings/IGenerativeAISettings.js +4 -0
  76. package/build/shared/interfaces/restAPI/metrics/callCounter/v2.0/ICallCounterAggregatedValue_2_0.js +3 -0
  77. package/build/shared/interfaces/restAPI/metrics/callCounter/v2.0/IGetCallCounterOrganisationRest_2_0.js +3 -0
  78. package/build/shared/interfaces/restAPI/metrics/callCounter/v2.0/IGetCallCounterRest_2_0.js +3 -0
  79. package/build/shared/interfaces/restAPI/metrics/callCounter/v2.0/index.js +3 -0
  80. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/ICloneMilestoneRest_2_0.js +3 -0
  81. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/ICreateMilestoneRest_2_0.js +3 -0
  82. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IDeleteMilestoneRest_2_0.js +3 -0
  83. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IIndexMilestonesRest_2_0.js +3 -0
  84. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IMilestoneIndexItem_2_0.js +3 -0
  85. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IMilestoneStepMetric_2_0.js +3 -0
  86. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IMilestoneStep_2_0.js +3 -0
  87. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IMilestone_2_0.js +3 -0
  88. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IReadMilestoneRest_2_0.js +3 -0
  89. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IUpdateMilestoneRest_2_0.js +3 -0
  90. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/index.js +3 -0
  91. package/build/shared/interfaces/restAPI/resources/uploadResumable/v2.0/IUploadResumableRest_2_0.js +3 -1
  92. package/build/shared/interfaces/security/ICallCounterAggregatedValue.js +3 -0
  93. package/build/shared/interfaces/security/IPermission.js +5 -2
  94. package/build/shared/interfaces/security/IRole.js +6 -0
  95. package/build/shared/interfaces/security/index.js +2 -1
  96. package/build/shared/interfaces/trainer/ITrainerRecord.js +2 -0
  97. package/package.json +2 -2
  98. package/types/index.d.ts +1053 -169
  99. 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,8 +4,16 @@ 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, _k;
7
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
8
8
  let voiceSettings = {};
9
+ if (config.sttVendor === 'none') {
10
+ delete config.sttVendor;
11
+ delete config.sttLabel;
12
+ }
13
+ if (config.ttsVendor === 'none') {
14
+ delete config.ttsVendor;
15
+ delete config.ttsLabel;
16
+ }
9
17
  if (typeof config.bargeInOnDtmf === 'boolean' || typeof config.bargeInOnSpeech === 'boolean') {
10
18
  voiceSettings.bargeIn = {
11
19
  bargeInEnable: false,
@@ -32,6 +40,8 @@ function voiceConfigParamsToVoiceSettings(config, api) {
32
40
  if (config.sttHints && config.sttHints.length) {
33
41
  hints = [...hints, ...config.sttHints];
34
42
  }
43
+ const deepgramEndpointing = (_d = config.deepgramEndpointing) !== null && _d !== void 0 ? _d : true;
44
+ const deepgramShortUtterance = deepgramEndpointing ? false : true;
35
45
  // stt (recognizer)
36
46
  voiceSettings.stt = {
37
47
  sttVendor: config.sttVendor,
@@ -42,27 +52,22 @@ function voiceConfigParamsToVoiceSettings(config, api) {
42
52
  config.sttDisablePunctuation !== null
43
53
  ? !config.sttDisablePunctuation
44
54
  : undefined,
45
- googleModel: (_d = config.googleModel) !== null && _d !== void 0 ? _d : undefined,
46
- deepgramEnpointing: (_e = config.deepgramEndpointing) !== null && _e !== void 0 ? _e : undefined,
47
- deepgramEndpointingValue: (_f = config.deepgramEndpointingValue) !== null && _f !== void 0 ? _f : undefined,
48
- sttDeepgramModel: (_g = config.sttDeepgramModel) !== null && _g !== void 0 ? _g : undefined,
49
- sttDeepgramTier: (_h = config.sttDeepgramTier) !== null && _h !== void 0 ? _h : undefined,
50
- deepgramSmartFormatting: (_j = config.deepgramSmartFormatting) !== null && _j !== void 0 ? _j : undefined
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,
51
62
  };
52
63
  // tts (synthesizer)
53
64
  voiceSettings.tts = {
54
65
  ttsVendor: config.ttsVendor,
55
66
  ttsLanguage: config.ttsLanguage,
56
67
  ttsVoice: config.ttsVoice,
57
- azureServiceEndpoint: config.azureTtsDeploymentId,
58
68
  ttsDisableCache: config.ttsDisableCache,
59
69
  ttsLabel: config.ttsLabel,
60
70
  };
61
- if (config.ttsVendor === "microsoft") {
62
- if (config.azureTtsDeploymentId) {
63
- voiceSettings.tts.azureServiceEndpoint = config.azureTtsDeploymentId;
64
- }
65
- }
66
71
  if (config.sttVendor === "microsoft") {
67
72
  if (config.recognizeLanguagesAzure) {
68
73
  voiceSettings.stt.altLanguages = [];
@@ -87,6 +92,9 @@ function voiceConfigParamsToVoiceSettings(config, api) {
87
92
  });
88
93
  }
89
94
  }
95
+ if (config.ttsVendor === "elevenlabs") {
96
+ voiceSettings.tts.ttsModel = config.ttsModel;
97
+ }
90
98
  // userNoInput
91
99
  voiceSettings.userNoInput = {
92
100
  userNoInputMode: config.userNoInputMode,
@@ -100,7 +108,7 @@ function voiceConfigParamsToVoiceSettings(config, api) {
100
108
  dtmfInterDigitTimeout: config.dtmfInterDigitTimeout,
101
109
  dtmfMaxDigits: config.dtmfMaxDigits,
102
110
  dtmfMinDigits: config.dtmfMinDigits,
103
- dtmfSubmitDigit: (_k = config.dtmfSubmitDigit) === null || _k === void 0 ? void 0 : _k.trim(),
111
+ dtmfSubmitDigit: (_j = config.dtmfSubmitDigit) === null || _j === void 0 ? void 0 : _j.trim(),
104
112
  };
105
113
  if (config === null || config === void 0 ? void 0 : config.dtmfEnable) {
106
114
  if (voiceSettings.dtmf.dtmfSubmitDigit &&
@@ -136,16 +144,12 @@ function voiceConfigParamsToVoiceSettings(config, api) {
136
144
  }
137
145
  }
138
146
  // Azure configurations
139
- if ((config.sttVendor === "microsoft" && config.azureSttContextId) ||
140
- (config.sttVendor === "microsoft" && config.azureTtsDeploymentId)) {
147
+ if ((config.sttVendor === "microsoft" && config.azureSttContextId)) {
141
148
  voiceSettings.azureConfig = {
142
149
  azureSttContextId: config.azureSttContextId
143
150
  ? config.azureSttContextId.trim()
144
151
  : undefined,
145
- azureEnableAudioLogging: config.azureEnableAudioLogging || undefined,
146
- azureTtsDeploymentId: config.azureTtsDeploymentId
147
- ? config.azureTtsDeploymentId.trim()
148
- : undefined,
152
+ azureEnableAudioLogging: config.azureEnableAudioLogging || undefined
149
153
  };
150
154
  }
151
155
  return (0, strip_nulls_1.stripNulls)(voiceSettings);
@@ -176,7 +180,7 @@ exports.setSessionConfig = {
176
180
  }
177
181
  },
178
182
  handleVGInput(voiceSettings, sessionParams, api) {
179
- var _a, _b, _c;
183
+ var _a, _b;
180
184
  const { bargeIn, continuousAsr, stt, tts, userNoInput, dtmf, vad, azureConfig, } = voiceSettings;
181
185
  const user = {};
182
186
  const synthesizer = {};
@@ -200,12 +204,13 @@ exports.setSessionConfig = {
200
204
  }
201
205
  }
202
206
  if (recognizer && recognizer.vendor === 'deepgram') {
207
+ recognizer.model = stt.sttDeepgramModel;
203
208
  recognizer.deepgramOptions = {};
204
- recognizer.deepgramOptions.endpointing = stt.deepgramEnpointing ? stt.deepgramEndpointingValue : false;
209
+ recognizer.deepgramOptions.endpointing = stt.deepgramEndpointing ? stt.deepgramEndpointingValue : false;
205
210
  recognizer.deepgramOptions.punctuate = stt.sttDisablePunctuation;
206
- recognizer.deepgramOptions.tier = (_a = stt.sttDeepgramTier) !== null && _a !== void 0 ? _a : undefined;
207
- recognizer.deepgramOptions.model = (_b = stt.sttDeepgramModel) !== null && _b !== void 0 ? _b : undefined;
208
- recognizer.deepgramOptions.smartFormatting = (_c = stt.deepgramSmartFormatting) !== null && _c !== void 0 ? _c : false;
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;
209
214
  }
210
215
  }
211
216
  if (vad) {
@@ -222,6 +227,11 @@ exports.setSessionConfig = {
222
227
  synthesizer.voice = tts.ttsVoice;
223
228
  synthesizer.azureServiceEndpoint = tts.azureServiceEndpoint ? tts.azureServiceEndpoint : "";
224
229
  synthesizer.label = tts.ttsLabel;
230
+ if (tts.ttsModel) {
231
+ synthesizer.options = {
232
+ model_id: tts.ttsModel
233
+ };
234
+ }
225
235
  }
226
236
  //verify if there are No User Input Configs to set
227
237
  if (userNoInput) {
@@ -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, sttDeepgramTier, sttDeepgramModel, sttDisablePunctuation, deepgramEndpointing, deepgramEndpointingValue, deepgramSmartFormatting) {
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, sttDeepgramTier, sttDeepgramModel, sttDisablePunctuation, deepgramEndpointing, deepgramEndpointingValue, deepgramSmartFormatting);
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, sttDeepgramTier, sttDeepgramModel, sttDisablePunctuation, deepgramEndpointing, deepgramEndpointingValue, deepgramSmartFormatting) {
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: {
@@ -97,7 +97,7 @@ exports.transfer = {
97
97
  transcribeVerb.channel = 2;
98
98
  break;
99
99
  }
100
- if (sttVendor) {
100
+ if (sttVendor !== 'none') {
101
101
  recognizer.vendor = sttVendor;
102
102
  recognizer.language = sttLanguage;
103
103
  recognizer.punctuation = !sttDisablePunctuation;
@@ -105,17 +105,17 @@ 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,
113
113
  smartFormatting: deepgramSmartFormatting !== null && deepgramSmartFormatting !== void 0 ? deepgramSmartFormatting : false
114
114
  };
115
115
  }
116
- }
117
- if (sttLabel) {
118
- recognizer.label = sttLabel;
116
+ if (sttLabel) {
117
+ recognizer.label = sttLabel;
118
+ }
119
119
  }
120
120
  }
121
121
  if (Object.keys(transcribeVerb).length > 0) {
@@ -158,7 +158,7 @@ exports.transfer = {
158
158
  return payload;
159
159
  },
160
160
  handleAudioCodesInput(transferParam, endpointType = "audioCodes") {
161
- const { transferReason, transferTarget, useTransferSipHeaders, transferSipHeaders, transferNotifications, transferNotificationsHangupMS, transferReferredByURL } = transferParam;
161
+ const { transferReason, transferTarget, useTransferSipHeaders, transferSipHeaders, transferNotifications, transferNotificationsHangupMS, transferReferredByURL, referredBy } = transferParam;
162
162
  const activities = {
163
163
  "type": "event",
164
164
  "name": "transfer",
@@ -171,6 +171,10 @@ exports.transfer = {
171
171
  activities.activityParams["transferReferredByURL"] = transferReferredByURL;
172
172
  }
173
173
  ;
174
+ if (referredBy) {
175
+ activities.activityParams["transferReferredByURL"] = referredBy;
176
+ }
177
+ ;
174
178
  if (useTransferSipHeaders) {
175
179
  activities.activityParams["transferSipHeaders"] = transferSipHeaders;
176
180
  }
@@ -192,8 +196,8 @@ exports.transfer = {
192
196
  }
193
197
  };
194
198
  const prepareTransferParams = (transferParam) => {
195
- const { transferReason, dialMusic, dialTranscriptionWebhook } = transferParam;
196
- return Object.assign(Object.assign({}, transferParam), { transferReason: transferReason === null || transferReason === void 0 ? void 0 : transferReason.trim(), dialMusic: dialMusic === null || dialMusic === void 0 ? void 0 : dialMusic.trim(), dialTranscriptionWebhook: dialTranscriptionWebhook === null || dialTranscriptionWebhook === void 0 ? void 0 : dialTranscriptionWebhook.trim() });
199
+ const { transferReason, dialMusic, dialTranscriptionWebhook, referredBy } = transferParam;
200
+ return Object.assign(Object.assign({}, transferParam), { transferReason: transferReason === null || transferReason === void 0 ? void 0 : transferReason.trim(), dialMusic: dialMusic === null || dialMusic === void 0 ? void 0 : dialMusic.trim(), dialTranscriptionWebhook: dialTranscriptionWebhook === null || dialTranscriptionWebhook === void 0 ? void 0 : dialTranscriptionWebhook.trim(), referredBy: referredBy === null || referredBy === void 0 ? void 0 : referredBy.trim() });
197
201
  };
198
202
  exports.prepareTransferParams = prepareTransferParams;
199
203
  //# sourceMappingURL=transfer.mapper.js.map
@@ -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: ["sttVendor", "sttDeepgramTier", "sttHints", "enableAdvancedSTTConfig", "azureSttContextId", "azureEnableAudioLogging", "googleModel"],
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