@cognigy/rest-api-client 0.17.0 → 0.19.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 (191) 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/AdministrationAPIGroup_2_0.js +3 -1
  5. package/build/apigroups/MetricsAPIGroup_2_0.js +5 -0
  6. package/build/apigroups/ResourcesAPIGroup_2_0.js +21 -7
  7. package/build/connector/AxiosAdapter.js +35 -15
  8. package/build/shared/charts/createNodeDescriptor.js +5 -5
  9. package/build/shared/charts/descriptors/agentAssist/constants/constants.js +16 -1
  10. package/build/shared/charts/descriptors/agentAssist/helpers/agentAssistTranslator.helper.js +19 -0
  11. package/build/shared/charts/descriptors/agentAssist/helpers/determineMetadata.js +15 -0
  12. package/build/shared/charts/descriptors/agentAssist/helpers/getFontSizeFieldOptions.js +84 -0
  13. package/build/shared/charts/descriptors/agentAssist/helpers/getLanguageName.helper.js +33 -0
  14. package/build/shared/charts/descriptors/agentAssist/helpers/knowledgeSearch/answerExtraction.helper.js +59 -0
  15. package/build/shared/charts/descriptors/agentAssist/helpers/knowledgeSearch/configValidator.helper.js +20 -0
  16. package/build/shared/charts/descriptors/agentAssist/helpers/knowledgeSearch/errorHandler.helper.js +64 -0
  17. package/build/shared/charts/descriptors/agentAssist/helpers/knowledgeSearch/followUpDetection.helper.js +72 -0
  18. package/build/shared/charts/descriptors/agentAssist/helpers/knowledgeSearch/knowledgeSearch.helper.js +58 -0
  19. package/build/shared/charts/descriptors/agentAssist/helpers/sentiment.helper.js +7 -13
  20. package/build/shared/charts/descriptors/agentAssist/htmlTemplates/identityAssistTemplate.js +17 -18
  21. package/build/shared/charts/descriptors/agentAssist/htmlTemplates/knowledgeAssistTemplate.js +330 -153
  22. package/build/shared/charts/descriptors/agentAssist/htmlTemplates/nextActionWidgetTemplate.js +212 -80
  23. package/build/shared/charts/descriptors/agentAssist/htmlTemplates/sentimentAnalysisTemplate.js +11 -6
  24. package/build/shared/charts/descriptors/agentAssist/htmlTemplates/transcriptAssistTemplate.js +15 -13
  25. package/build/shared/charts/descriptors/agentAssist/identityAssist.js +88 -15
  26. package/build/shared/charts/descriptors/agentAssist/knowledgeAssist.js +192 -327
  27. package/build/shared/charts/descriptors/agentAssist/locales/cs.locale.js +11 -0
  28. package/build/shared/charts/descriptors/agentAssist/locales/de.locale.js +11 -0
  29. package/build/shared/charts/descriptors/agentAssist/locales/en.locale.js +11 -0
  30. package/build/shared/charts/descriptors/agentAssist/locales/es.locale.js +11 -0
  31. package/build/shared/charts/descriptors/agentAssist/locales/fr.locale.js +11 -0
  32. package/build/shared/charts/descriptors/agentAssist/locales/index.js +22 -0
  33. package/build/shared/charts/descriptors/agentAssist/locales/ja.locale.js +11 -0
  34. package/build/shared/charts/descriptors/agentAssist/locales/ko.locale.js +11 -0
  35. package/build/shared/charts/descriptors/agentAssist/locales/pt.locale.js +11 -0
  36. package/build/shared/charts/descriptors/agentAssist/nextActionAssist.js +484 -10
  37. package/build/shared/charts/descriptors/agentAssist/sentimentAssist.js +32 -9
  38. package/build/shared/charts/descriptors/agentAssist/setAdaptiveCardTile.js +2 -0
  39. package/build/shared/charts/descriptors/agentAssist/setAgentAssistGrid.js +2 -1
  40. package/build/shared/charts/descriptors/agentAssist/setHtmlTile.js +5 -3
  41. package/build/shared/charts/descriptors/agentAssist/setIframeTile.js +5 -3
  42. package/build/shared/charts/descriptors/agentAssist/setSecureFormsTile.js +2 -2
  43. package/build/shared/charts/descriptors/agentAssist/transcriptAssist.js +42 -3
  44. package/build/shared/charts/descriptors/analytics/activateProfile.js +1 -0
  45. package/build/shared/charts/descriptors/analytics/blindMode.js +2 -0
  46. package/build/shared/charts/descriptors/analytics/completeGoal.js +1 -0
  47. package/build/shared/charts/descriptors/analytics/deactivateProfile.js +1 -0
  48. package/build/shared/charts/descriptors/analytics/deleteProfile.js +1 -0
  49. package/build/shared/charts/descriptors/analytics/index.js +3 -1
  50. package/build/shared/charts/descriptors/analytics/mergeProfile.js +1 -0
  51. package/build/shared/charts/descriptors/analytics/overwriteAnalytics.js +9 -0
  52. package/build/shared/charts/descriptors/analytics/requestRating.js +56 -2
  53. package/build/shared/charts/descriptors/analytics/setRating.js +4 -2
  54. package/build/shared/charts/descriptors/analytics/trackMilestone.js +95 -0
  55. package/build/shared/charts/descriptors/analytics/updateProfile.js +1 -0
  56. package/build/shared/charts/descriptors/apps/initAppSession.js +1 -0
  57. package/build/shared/charts/descriptors/apps/setAdaptiveCardAppState.js +35 -10
  58. package/build/shared/charts/descriptors/apps/setHtmlAppState.js +25 -2
  59. package/build/shared/charts/descriptors/apps/utils/getXAppsOverlaySettings.js +54 -0
  60. package/build/shared/charts/descriptors/connectionNodes/documentParserProviders/azureAIDocumentIntelligenceConnection.js +12 -0
  61. package/build/shared/charts/descriptors/connectionNodes/documentParserProviders/index.js +13 -0
  62. package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/awsBedrockProviderConnection.js +12 -0
  63. package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/azureOpenAIProviderConnection.js +4 -3
  64. package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/azureOpenAIProviderConnectionV2.js +3 -3
  65. package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/azureOpenAIProviderOauth2Connection.js +14 -0
  66. package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/index.js +16 -8
  67. package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/openAIProviderConnection.js +3 -3
  68. package/build/shared/charts/descriptors/data/addToContext.js +7 -0
  69. package/build/shared/charts/descriptors/data/copyDataToContext.js +3 -0
  70. package/build/shared/charts/descriptors/data/copySlotsToContext.js +3 -0
  71. package/build/shared/charts/descriptors/data/debugMessage.js +73 -0
  72. package/build/shared/charts/descriptors/data/index.js +3 -1
  73. package/build/shared/charts/descriptors/data/removeFromContext.js +9 -1
  74. package/build/shared/charts/descriptors/data/resetContext.js +1 -0
  75. package/build/shared/charts/descriptors/index.js +8 -4
  76. package/build/shared/charts/descriptors/knowledgeSearch/searchExtractOutput.js +36 -11
  77. package/build/shared/charts/descriptors/logic/resetState.js +1 -0
  78. package/build/shared/charts/descriptors/logic/setState.js +2 -1
  79. package/build/shared/charts/descriptors/logic/setTranslation.js +3 -1
  80. package/build/shared/charts/descriptors/logic/switchLocale.js +1 -0
  81. package/build/shared/charts/descriptors/logic/think.js +3 -1
  82. package/build/shared/charts/descriptors/logic/thinkV2.js +2 -0
  83. package/build/shared/charts/descriptors/message/question/optionalQuestion.js +1 -1
  84. package/build/shared/charts/descriptors/message/question/question.js +173 -7
  85. package/build/shared/charts/descriptors/message/question/utils/evaluateQuestionAnswer.js +44 -3
  86. package/build/shared/charts/descriptors/message/question/utils/validateQuestionAnswer.js +4 -2
  87. package/build/shared/charts/descriptors/nlu/cleanText.js +1 -0
  88. package/build/shared/charts/descriptors/nlu/fuzzySearch.js +23 -1
  89. package/build/shared/charts/descriptors/nlu/generativeSlotFiller/prompt.js +45 -19
  90. package/build/shared/charts/descriptors/nlu/index.js +1 -3
  91. package/build/shared/charts/descriptors/service/GPTPrompt.js +362 -29
  92. package/build/shared/charts/descriptors/service/LLMEntityExtract.js +283 -0
  93. package/build/shared/charts/descriptors/service/handoverV2.js +84 -1
  94. package/build/shared/charts/descriptors/service/httpRequest.js +68 -3
  95. package/build/shared/charts/descriptors/service/index.js +3 -1
  96. package/build/shared/charts/descriptors/voice/mappers/setSessionConfig.mapper.js +110 -27
  97. package/build/shared/charts/descriptors/voice/mappers/transfer.mapper.js +4 -4
  98. package/build/shared/charts/descriptors/voice/nodes/bargeIn.js +2 -0
  99. package/build/shared/charts/descriptors/voice/nodes/continuousAsr.js +2 -0
  100. package/build/shared/charts/descriptors/voice/nodes/dtmf.js +2 -0
  101. package/build/shared/charts/descriptors/voice/nodes/muteSpeechInput.js +1 -0
  102. package/build/shared/charts/descriptors/voice/nodes/noUserInput.js +2 -0
  103. package/build/shared/charts/descriptors/voice/nodes/play.js +8 -1
  104. package/build/shared/charts/descriptors/voice/nodes/sessionSpeechParameters.js +46 -45
  105. package/build/shared/charts/descriptors/voice/nodes/transfer.js +2 -0
  106. package/build/shared/charts/descriptors/voicegateway2/nodes/dtmf.js +2 -0
  107. package/build/shared/charts/descriptors/voicegateway2/nodes/hangup.js +2 -0
  108. package/build/shared/charts/descriptors/voicegateway2/nodes/muteSpeechInput.js +3 -0
  109. package/build/shared/charts/descriptors/voicegateway2/nodes/play.js +1 -1
  110. package/build/shared/charts/descriptors/voicegateway2/nodes/record.js +1 -0
  111. package/build/shared/charts/descriptors/voicegateway2/nodes/refer.js +1 -0
  112. package/build/shared/charts/descriptors/voicegateway2/nodes/sendMetadata.js +1 -0
  113. package/build/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +329 -47
  114. package/build/shared/charts/descriptors/voicegateway2/nodes/transfer.js +27 -31
  115. package/build/shared/charts/descriptors/voicegateway2/utils/helper.js +2 -2
  116. package/build/shared/charts/helpers/generativeAI/generativeAIPrompts.js +55 -0
  117. package/build/shared/charts/helpers/generativeAI/rephraseSentenceWithAi.js +4 -2
  118. package/build/shared/constants.js +10 -1
  119. package/build/shared/handoverClients/interfaces/THandoverEventType.js +1 -0
  120. package/build/shared/helper/logFullConfigToDebugMode.js +30 -0
  121. package/build/shared/helper/nlu/textCleaner.js +3 -1
  122. package/build/shared/interfaces/IOrganisation.js +1 -0
  123. package/build/shared/interfaces/IProfile.js +1 -0
  124. package/build/shared/interfaces/IProfileSchema.js +3 -0
  125. package/build/shared/interfaces/analytics/IAnalyticsSourceData.js +20 -20
  126. package/build/shared/interfaces/{restAPI/resources/journey/v2.0/IJourneyProgress_2_0.js → analytics/IMilestoneAnalytics.js} +1 -1
  127. package/build/shared/interfaces/{restAPI/resources/journey/v2.0/IJourney_2_0.js → appsession/IAppSession.js} +1 -1
  128. package/build/shared/interfaces/{restAPI/resources/journey/v2.0/IJourneyStep_2_0.js → appsession/ISetAppState.js} +1 -1
  129. package/build/shared/interfaces/appsession/ISetAppStateOptions.js +3 -0
  130. package/build/shared/interfaces/appsession/ISetAppStateOverlaySettings.js +3 -0
  131. package/build/shared/interfaces/appsession/ISetAppStateOverlaySettingsMetaData.js +3 -0
  132. package/build/shared/interfaces/debugEvents/TDebugEventMessagePayload.js +3 -0
  133. package/build/shared/interfaces/debugEvents/TDebugEventType.js +2 -0
  134. package/build/shared/interfaces/fileStorage.js +6 -0
  135. package/build/shared/interfaces/generativeAI/IGenerativeAIModels.js +45 -52
  136. package/build/shared/interfaces/handover.js +44 -2
  137. package/build/shared/interfaces/license.js +3 -2
  138. package/build/shared/interfaces/license.js.map +1 -1
  139. package/build/shared/interfaces/messageAPI/endpoints.js +17 -2
  140. package/build/shared/interfaces/messageAPI/handover.js +25 -2
  141. package/build/shared/interfaces/nlu/nlu.js +3 -0
  142. package/build/shared/interfaces/resources/IAuditEvent.js +10 -9
  143. package/build/shared/interfaces/resources/IConnection.js +1 -0
  144. package/build/shared/interfaces/resources/IEndpoint.js +1 -2
  145. package/build/shared/interfaces/resources/ILargeLanguageModel.js +56 -21
  146. package/build/shared/interfaces/resources/IMilestone.js +50 -0
  147. package/build/shared/interfaces/resources/INodeDescriptorSet.js +96 -75
  148. package/build/shared/interfaces/resources/TResourceType.js +12 -5
  149. package/build/shared/interfaces/resources/knowledgeStore/IKnowledgeSource.js +1 -1
  150. package/build/shared/interfaces/resources/settings/IAgentSettings.js +12 -7
  151. package/build/shared/interfaces/resources/settings/IGenerativeAISettings.js +8 -0
  152. package/build/shared/interfaces/resources/settings/IKnowledgeAISettings.js +18 -0
  153. package/build/shared/interfaces/resources/settings/index.js +4 -1
  154. package/build/shared/interfaces/restAPI/administration/organisations/v2.0/IReadCollectionsToBeDeletedRest_2_0.js +0 -1
  155. package/build/shared/interfaces/restAPI/administration/organisations/v2.0/IReadOrganisationKnowledgeChunksCountRest_2_0.js +3 -0
  156. package/build/shared/interfaces/restAPI/operations/index.js +3 -0
  157. package/build/shared/interfaces/restAPI/operations/nlu/v2.0/IGenerateNluScoresRest_2_0.js +57 -0
  158. package/build/shared/interfaces/restAPI/operations/nlu/v2.0/index.js +3 -0
  159. package/build/shared/interfaces/restAPI/resources/largeLanguageModel/v2.0/IAvailableModelsForLLMProvider_2_0 .js +18 -0
  160. package/build/shared/interfaces/restAPI/resources/largeLanguageModel/v2.0/IGetAvailableModelsForLLMRest_2_0 .js +3 -0
  161. package/build/shared/interfaces/restAPI/resources/{journey/v2.0/IJourneyIndexItem_2_0.js → milestone/v2.0/ICloneMilestoneRest_2_0.js} +1 -1
  162. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/ICreateMilestoneRest_2_0.js +3 -0
  163. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IDeleteMilestoneRest_2_0.js +3 -0
  164. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IIndexMilestonesRest_2_0.js +3 -0
  165. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IMilestoneIndexItem_2_0.js +3 -0
  166. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IMilestoneStepMetric_2_0.js +3 -0
  167. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IMilestoneStep_2_0.js +3 -0
  168. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IMilestone_2_0.js +3 -0
  169. package/build/shared/interfaces/restAPI/resources/{journey/v2.0/IIndexJourneysRest_2_0.js → milestone/v2.0/IReadMilestoneRest_2_0.js} +1 -1
  170. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IUpdateMilestoneRest_2_0.js +3 -0
  171. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/index.js +3 -0
  172. package/build/shared/interfaces/restAPI/resources/uploadResumable/v2.0/IUploadResumableRest_2_0.js +3 -1
  173. package/build/shared/interfaces/security/IPermission.js +4 -2
  174. package/build/shared/interfaces/security/IRole.js +2 -0
  175. package/build/shared/interfaces/security/ISystemCapabilities.js +3 -0
  176. package/build/shared/interfaces/security/index.js +1 -1
  177. package/build/shared/interfaces/trainer/ITrainerRecord.js +2 -2
  178. package/build/shared/interfaces/user.js +1 -1
  179. package/package.json +2 -2
  180. package/types/index.d.ts +2194 -957
  181. package/build/shared/charts/descriptors/nlu/extractAnswer.js +0 -115
  182. package/build/shared/interfaces/journeys/IJourney.js +0 -83
  183. package/build/shared/interfaces/journeys/IJourneyProgress.js +0 -40
  184. package/build/shared/interfaces/journeys/IJourneyTrackEvent.js +0 -35
  185. package/build/shared/interfaces/journeys/index.js +0 -14
  186. package/build/shared/interfaces/restAPI/resources/journey/v2.0/IJourneyTrackEvents_2_0.js +0 -3
  187. package/build/shared/interfaces/restAPI/resources/journey/v2.0/IReadJourneyProgressRest_2_0.js +0 -3
  188. package/build/shared/interfaces/restAPI/resources/journey/v2.0/IReadJourneyRest_2_0.js +0 -3
  189. package/build/shared/interfaces/restAPI/resources/journey/v2.0/ITrackJourneyEventRest_2_0.js +0 -3
  190. package/build/shared/interfaces/restAPI/resources/journey/v2.0/IUpdateSelectedJourneyRest_2_0.js +0 -3
  191. /package/build/shared/interfaces/{restAPI/resources/journey/v2.0 → appsession}/index.js +0 -0
@@ -0,0 +1,283 @@
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
+ (0, prompt_1.writeLLMDebugLogs)("LLM Entity Extract", prompt, response, debugLogTokenCount, debugLogRequestAndCompletion, cognigy);
232
+ // find the entity in the response
233
+ let result = (_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a[entityName];
234
+ if (!result) {
235
+ try {
236
+ result = JSON.parse(`{"${entityName}": ${response.result}`)[entityName];
237
+ }
238
+ catch (err) {
239
+ try {
240
+ result = JSON.parse(response.result)[entityName];
241
+ ;
242
+ }
243
+ catch (err) {
244
+ result = null;
245
+ }
246
+ }
247
+ }
248
+ if (storeLocation === "context") {
249
+ api.addToContext(contextKey, result, "simple");
250
+ if (result) {
251
+ api.logDebugMessage(`context.${contextKey} = '${result}'`);
252
+ }
253
+ }
254
+ else if (storeLocation === "input") {
255
+ // @ts-ignore
256
+ api.addToInput(inputKey, result);
257
+ if (result) {
258
+ api.logDebugMessage(`input.${inputKey} = '${result}'`);
259
+ }
260
+ }
261
+ if (!result) {
262
+ api.logDebugMessage(`UI__DEBUG_MODE__LLM_ENTITY_EXTRACT__MESSAGE`);
263
+ }
264
+ }
265
+ catch (error) {
266
+ const errorDetails = {
267
+ name: error.name,
268
+ code: error.code,
269
+ message: error.message || ((_b = error.originalErrorDetails) === null || _b === void 0 ? void 0 : _b.message),
270
+ };
271
+ api.logDebugError(errorDetails);
272
+ if (storeLocation === "context") {
273
+ api.addToContext(contextKey, { error: errorDetails }, "simple");
274
+ }
275
+ else {
276
+ // @ts-ignore
277
+ api.addToInput(inputKey, { error: errorDetails });
278
+ }
279
+ throw error;
280
+ }
281
+ }
282
+ });
283
+ //# sourceMappingURL=LLMEntityExtract.js.map
@@ -235,6 +235,77 @@ exports.HANDOVER_V2 = (0, createNodeDescriptor_1.createNodeDescriptor)({
235
235
  label: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__SEND_ON_ACTIVE_EVENT__LABEL",
236
236
  description: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__SEND_ON_ACTIVE_EVENT__DESCRIPTION",
237
237
  },
238
+ {
239
+ key: "getQueuePosition",
240
+ type: "toggle",
241
+ label: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__LIVE_AGENT_GET_QUEUE_POSITION__LABEL",
242
+ description: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__LIVE_AGENT_GET_QUEUE_POSITION__DESCRIPTION",
243
+ defaultValue: false,
244
+ },
245
+ {
246
+ key: "updateIntervalQueuePosition",
247
+ type: "number",
248
+ label: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__LIVE_AGENT_UPDATE_INTERVAL__LABEL",
249
+ description: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__LIVE_AGENT_UPDATE_INTERVAL__DESCRIPTION",
250
+ condition: {
251
+ key: "getQueuePosition",
252
+ value: true
253
+ },
254
+ },
255
+ {
256
+ key: "getEstimatedWaitTime",
257
+ type: "toggle",
258
+ label: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__LIVE_AGENT_GET_ESTIMATED_WAIT_TIME__LABEL",
259
+ description: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__LIVE_AGENT_GET_ESTIMATED_WAIT_TIME__DESCRIPTION",
260
+ defaultValue: false,
261
+ },
262
+ {
263
+ key: "updateIntervalEstimatedWaitTime",
264
+ type: "number",
265
+ label: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__LIVE_AGENT_UPDATE_INTERVAL__LABEL",
266
+ description: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__LIVE_AGENT_UPDATE_INTERVAL__DESCRIPTION",
267
+ condition: {
268
+ key: "getEstimatedWaitTime",
269
+ value: true
270
+ },
271
+ },
272
+ {
273
+ key: "alternativeUpdate",
274
+ type: "toggle",
275
+ label: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__LIVE_AGENT_ALTERNATIVE_UPDATE__LABEL",
276
+ description: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__LIVE_AGENT_ALTERNATIVE_UPDATE__DESCRIPTION",
277
+ defaultValue: false,
278
+ },
279
+ {
280
+ key: "maximumQueuePosition",
281
+ type: "number",
282
+ label: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__LIVE_AGENT_MAXIMUM_QUEUE_POSITION__LABEL",
283
+ description: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__LIVE_AGENT_MAXIMUM_QUEUE_POSITION__DESCRIPTION",
284
+ condition: {
285
+ key: "alternativeUpdate",
286
+ value: true,
287
+ },
288
+ },
289
+ {
290
+ key: "maximumEstimatedWaitTime",
291
+ type: "number",
292
+ label: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__LIVE_AGENT_MAXIMUM_ESTIMATED_WAIT_TIME__LABEL",
293
+ description: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__LIVE_AGENT_MAXIMUM_ESTIMATED_WAIT_TIME__DESCRIPTION",
294
+ condition: {
295
+ key: "alternativeUpdate",
296
+ value: true,
297
+ },
298
+ },
299
+ {
300
+ key: "alternativeText",
301
+ type: "cognigyText",
302
+ label: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__LIVE_AGENT_ALTERNATIVE_TEXT__LABEL",
303
+ description: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__LIVE_AGENT_ALTERNATIVE_TEXT__DESCRIPTION",
304
+ condition: {
305
+ key: "alternativeUpdate",
306
+ value: true,
307
+ },
308
+ },
238
309
  ],
239
310
  sections: [
240
311
  {
@@ -266,7 +337,19 @@ exports.HANDOVER_V2 = (0, createNodeDescriptor_1.createNodeDescriptor)({
266
337
  constants_1.COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS.LIVE_AGENT_PRIORITY,
267
338
  constants_1.COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS.AGENT_ASSIST_INIT_MESSAGE,
268
339
  constants_1.COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS.ALLOW_AGENT_INJECT,
269
- ]
340
+ ...(process.env.FEATURE_USE_QUEUE_UPDATE_EVENTS === "true"
341
+ ? [
342
+ constants_1.COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS.GET_QUEUE_POSITION,
343
+ constants_1.COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS.UPDATE_INTERVAL_QUEUE_POSITION,
344
+ constants_1.COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS.GET_ESTIMATED_WAIT_TIME,
345
+ constants_1.COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS.UPDATE_INTERVAL_ESTIMATED_WAIT_TIME,
346
+ constants_1.COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS.ALTERNATIVE_UPDATE,
347
+ constants_1.COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS.MAXIMUM_QUEUE_POSITION,
348
+ constants_1.COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS.MAXIMUM_ESTIMATED_WAIT_TIME,
349
+ constants_1.COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS.ALTERNATIVE_TEXT,
350
+ ]
351
+ : [])
352
+ ],
270
353
  },
271
354
  {
272
355
  key: "chatwootSettings",
@@ -234,6 +234,10 @@ exports.HTTP_REQUEST = (0, createNodeDescriptor_1.createNodeDescriptor)({
234
234
  value: "apiKeyXKey"
235
235
  }
236
236
  ]
237
+ },
238
+ resetOption: {
239
+ lookupValue: "none",
240
+ fieldsToReset: ["basicConnection", "apiKeyAuthKeyConnection", "apiKeyXKeyConnection", "oAuth2Connection"]
237
241
  }
238
242
  },
239
243
  {
@@ -308,6 +312,36 @@ exports.HTTP_REQUEST = (0, createNodeDescriptor_1.createNodeDescriptor)({
308
312
  value: true
309
313
  }
310
314
  },
315
+ {
316
+ key: "timeout",
317
+ type: "number",
318
+ label: "UI__NODE_EDITOR__SERVICE__HTTP_REQUEST__FIELDS__TIMEOUT__LABEL",
319
+ description: "UI__NODE_EDITOR__SERVICE__HTTP_REQUEST__FIELDS__TIMEOUT__DESCRIPTION",
320
+ defaultValue: 8000,
321
+ params: {
322
+ min: 2000,
323
+ max: 30000 // 30 sec
324
+ },
325
+ condition: {
326
+ key: "async",
327
+ value: true
328
+ }
329
+ },
330
+ {
331
+ key: "retryAttempts",
332
+ type: "number",
333
+ label: "UI__NODE_EDITOR__SERVICE__HTTP_REQUEST__FIELDS__RETRY_ATTEMPTS__LABEL",
334
+ description: "UI__NODE_EDITOR__SERVICE__HTTP_REQUEST__FIELDS__RETRY_ATTEMPTS__DESCRIPTION",
335
+ defaultValue: 0,
336
+ params: {
337
+ min: 0,
338
+ max: 3
339
+ },
340
+ condition: {
341
+ key: "async",
342
+ value: true
343
+ }
344
+ },
311
345
  {
312
346
  key: "storeResponseHeaders",
313
347
  type: "toggle",
@@ -346,6 +380,34 @@ exports.HTTP_REQUEST = (0, createNodeDescriptor_1.createNodeDescriptor)({
346
380
  ]
347
381
  }
348
382
  },
383
+ {
384
+ key: "debugLogging",
385
+ type: "select",
386
+ label: "UI__NODE_EDITOR__SERVICE__HTTP_REQUEST__FIELDS__DEBUG_LOGGING__LABEL",
387
+ description: "UI__NODE_EDITOR__SERVICE__HTTP_REQUEST__FIELDS__DEBUG_LOGGING__DESCRIPTION",
388
+ defaultValue: "none",
389
+ params: {
390
+ required: true,
391
+ options: [
392
+ {
393
+ label: "UI__NODE_EDITOR__SERVICE__HTTP_REQUEST__FIELDS__DEBUG_LOGGING__OPTIONS__NONE__LABEL",
394
+ value: "none"
395
+ },
396
+ {
397
+ label: "UI__NODE_EDITOR__SERVICE__HTTP_REQUEST__FIELDS__DEBUG_LOGGING__OPTIONS__REQUEST__LABEL",
398
+ value: "request"
399
+ },
400
+ {
401
+ label: "UI__NODE_EDITOR__SERVICE__HTTP_REQUEST__FIELDS__DEBUG_LOGGING__OPTIONS__RESPONSE__LABEL",
402
+ value: "response"
403
+ },
404
+ {
405
+ label: "UI__NODE_EDITOR__SERVICE__HTTP_REQUEST__FIELDS__DEBUG_LOGGING__OPTIONS__FULL__LABEL",
406
+ value: "full"
407
+ }
408
+ ]
409
+ }
410
+ },
349
411
  {
350
412
  key: "abortOnError",
351
413
  type: "toggle",
@@ -364,7 +426,7 @@ exports.HTTP_REQUEST = (0, createNodeDescriptor_1.createNodeDescriptor)({
364
426
  key: "errorLogging",
365
427
  value: "full"
366
428
  }
367
- },
429
+ }
368
430
  ],
369
431
  sections: [
370
432
  {
@@ -419,8 +481,10 @@ exports.HTTP_REQUEST = (0, createNodeDescriptor_1.createNodeDescriptor)({
419
481
  defaultCollapsed: true,
420
482
  fields: [
421
483
  "async",
484
+ "timeout",
485
+ "retryAttempts",
422
486
  "cache",
423
- "cacheExpiry"
487
+ "cacheExpiry",
424
488
  ]
425
489
  },
426
490
  {
@@ -438,7 +502,8 @@ exports.HTTP_REQUEST = (0, createNodeDescriptor_1.createNodeDescriptor)({
438
502
  fields: [
439
503
  "errorLogging",
440
504
  "logWarning",
441
- "abortOnError"
505
+ "abortOnError",
506
+ "debugLogging"
442
507
  ]
443
508
  }
444
509
  ],
@@ -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