@cognigy/rest-api-client 0.19.0 → 0.20.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 (118) hide show
  1. package/build/RestAPIClient.js +7 -0
  2. package/build/apigroups/AdministrationAPIGroup_2_0.js +6 -1
  3. package/build/apigroups/JWTAuthAPIGroup_2_0.js +12 -0
  4. package/build/apigroups/ResourcesAPIGroup_2_0.js +19 -8
  5. package/build/apigroups/index.js +3 -1
  6. package/build/shared/charts/descriptors/agentAssist/index.js +3 -1
  7. package/build/shared/charts/descriptors/agentAssist/sendData.js +74 -0
  8. package/build/shared/charts/descriptors/analytics/addMemory.js +51 -0
  9. package/build/shared/charts/descriptors/analytics/completeGoal.js +4 -3
  10. package/build/shared/charts/descriptors/analytics/helper.js +20 -0
  11. package/build/shared/charts/descriptors/analytics/index.js +5 -3
  12. package/build/shared/charts/descriptors/analytics/{trackMilestone.js → trackGoal.js} +32 -25
  13. package/build/shared/charts/descriptors/data/copySlotsToContext.js +1 -1
  14. package/build/shared/charts/descriptors/index.js +14 -2
  15. package/build/shared/charts/descriptors/knowledgeSearch/knowledgeSearchV2.js +1 -1
  16. package/build/shared/charts/descriptors/knowledgeSearch/searchExtractOutput.js +26 -16
  17. package/build/shared/charts/descriptors/logic/disableSlotFillers.js +1 -1
  18. package/build/shared/charts/descriptors/logic/enableSlotFillers.js +1 -1
  19. package/build/shared/charts/descriptors/logic/thinkV2.js +111 -4
  20. package/build/shared/charts/descriptors/nlu/cleanText.js +1 -1
  21. package/build/shared/charts/descriptors/nlu/executeCognigyNLU.js +1 -1
  22. package/build/shared/charts/descriptors/nlu/fuzzySearch.js +1 -1
  23. package/build/shared/charts/descriptors/nlu/generativeSlotFiller/generativeSlotFiller.js +1 -1
  24. package/build/shared/charts/descriptors/nlu/generativeSlotFiller/generativeSlotFillerFallback.js +1 -1
  25. package/build/shared/charts/descriptors/nlu/generativeSlotFiller/generativeSlotFillerSuccess.js +1 -1
  26. package/build/shared/charts/descriptors/nlu/generativeSlotFiller/prompt.js +4 -5
  27. package/build/shared/charts/descriptors/nlu/matchPattern.js +1 -1
  28. package/build/shared/charts/descriptors/nlu/regexSlotFiller.js +1 -1
  29. package/build/shared/charts/descriptors/service/GPTConversation.js +1 -1
  30. package/build/shared/charts/descriptors/service/GPTPrompt.js +26 -32
  31. package/build/shared/charts/descriptors/service/LLMEntityExtract.js +1 -1
  32. package/build/shared/charts/descriptors/service/aiAgent/aiAgentHandover.js +92 -0
  33. package/build/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +1146 -0
  34. package/build/shared/charts/descriptors/service/aiAgent/aiAgentJobDefault.js +31 -0
  35. package/build/shared/charts/descriptors/service/aiAgent/aiAgentJobTool.js +139 -0
  36. package/build/shared/charts/descriptors/service/aiAgent/aiAgentToolAnswer.js +120 -0
  37. package/build/shared/charts/descriptors/service/aiAgent/helper.js +222 -0
  38. package/build/shared/charts/descriptors/service/handoverV2.js +68 -13
  39. package/build/shared/charts/descriptors/service/index.js +11 -1
  40. package/build/shared/charts/descriptors/transcripts/addTranscriptStep.js +413 -0
  41. package/build/shared/charts/descriptors/transcripts/getTranscript.js +104 -0
  42. package/build/shared/charts/descriptors/transcripts/index.js +8 -0
  43. package/build/shared/charts/descriptors/voice/mappers/base.mapper.js +20 -0
  44. package/build/shared/charts/descriptors/voice/mappers/setSessionConfig.mapper.js +183 -107
  45. package/build/shared/charts/descriptors/voice/mappers/transfer.mapper.js +6 -9
  46. package/build/shared/charts/descriptors/voice/nodes/continuousAsr.js +3 -4
  47. package/build/shared/charts/descriptors/voicegateway/nodes/callRecording.js +8 -1
  48. package/build/shared/charts/descriptors/voicegateway/nodes/handover.js +4 -2
  49. package/build/shared/charts/descriptors/voicegateway/nodes/hangup.js +4 -2
  50. package/build/shared/charts/descriptors/voicegateway/nodes/helper/utils.js +14 -0
  51. package/build/shared/charts/descriptors/voicegateway/nodes/playURL.js +4 -5
  52. package/build/shared/charts/descriptors/voicegateway/nodes/sendMessage.js +8 -1
  53. package/build/shared/charts/descriptors/voicegateway/nodes/sendMetaData.js +7 -3
  54. package/build/shared/charts/descriptors/voicegateway/nodes/setSessionParams.js +8 -1
  55. package/build/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +15 -4
  56. package/build/shared/charts/descriptors/voicegateway2/nodes/transfer.js +15 -3
  57. package/build/shared/constants.js +7 -1
  58. package/build/shared/handoverClients/interfaces/THandoverEventType.js +1 -0
  59. package/build/shared/helper/logFullConfigToDebugMode.js +1 -1
  60. package/build/shared/helper/nlu/textCleaner.js +1 -1
  61. package/build/shared/interfaces/{restAPI/resources/milestone/v2.0/IMilestoneStep_2_0.js → IEndpointSettings.js} +1 -1
  62. package/build/shared/interfaces/IProfile.js +1 -0
  63. package/build/shared/interfaces/IProfileSchema.js +1 -0
  64. package/build/shared/interfaces/analytics/IAnalyticsSourceData.js +22 -20
  65. package/build/shared/interfaces/{restAPI/resources/milestone/v2.0/IMilestone_2_0.js → analytics/IGoalAnalytics.js} +1 -1
  66. package/build/shared/interfaces/generativeAI/IGenerativeAIModels.js +19 -2
  67. package/build/shared/interfaces/generativeAI/tools.js +3 -0
  68. package/build/shared/interfaces/handover.js +3 -1
  69. package/build/shared/interfaces/messageAPI/endpoints.js +6 -1
  70. package/build/shared/interfaces/messageAPI/handover.js +2 -0
  71. package/build/shared/interfaces/resources/IAiAgent.js +52 -0
  72. package/build/shared/interfaces/resources/IAuditEvent.js +2 -1
  73. package/build/shared/interfaces/resources/IEndpoint.js +2 -1
  74. package/build/shared/interfaces/resources/{IMilestone.js → IGoal.js} +14 -14
  75. package/build/shared/interfaces/resources/ILargeLanguageModel.js +29 -2
  76. package/build/shared/interfaces/resources/INodeDescriptorSet.js +4 -1
  77. package/build/shared/interfaces/resources/TResourceType.js +16 -8
  78. package/build/shared/interfaces/resources/settings/IGenerativeAISettings.js +5 -1
  79. package/build/shared/interfaces/restAPI/{resources/milestone/v2.0/ICloneMilestoneRest_2_0.js → administration/user/v2.0/IGetPinnedResources_2_0.js} +1 -1
  80. package/build/shared/interfaces/restAPI/administration/user/v2.0/IPinResourceRest_2_0.js +3 -0
  81. package/build/shared/interfaces/restAPI/resources/aiAgent/v2.0/IAiAgentHiringTemplate_2_0.js +32 -0
  82. package/build/shared/interfaces/restAPI/resources/aiAgent/v2.0/IAiAgent_2_0.js +3 -0
  83. package/build/shared/interfaces/restAPI/resources/aiAgent/v2.0/ICreateAiAgentRest_2_0.js +3 -0
  84. package/build/shared/interfaces/restAPI/resources/aiAgent/v2.0/IDeleteAiAgentRest_2_0.js +3 -0
  85. package/build/shared/interfaces/restAPI/resources/aiAgent/v2.0/IGetAiAgentHiringTemplates_2_0.js +3 -0
  86. package/build/shared/interfaces/restAPI/resources/aiAgent/v2.0/IHireAiAgent_2_0.js +3 -0
  87. package/build/shared/interfaces/restAPI/resources/aiAgent/v2.0/IIndexAiAgentRest_2_0.js +3 -0
  88. package/build/shared/interfaces/restAPI/resources/aiAgent/v2.0/IReadAiAgentRest_2_0.js +3 -0
  89. package/build/shared/interfaces/restAPI/resources/aiAgent/v2.0/IUpdateAiAgentRest_2_0.js +3 -0
  90. package/build/shared/interfaces/restAPI/resources/{milestone/v2.0/ICreateMilestoneRest_2_0.js → aiAgent/v2.0/IValidateAiAgentNameRest_2_0.js} +1 -1
  91. package/build/shared/interfaces/restAPI/resources/goal/v2.0/ICloneGoalRest_2_0.js +3 -0
  92. package/build/shared/interfaces/{analytics/IMilestoneAnalytics.js → restAPI/resources/goal/v2.0/ICreateGoalRest_2_0.js} +1 -1
  93. package/build/shared/interfaces/restAPI/resources/goal/v2.0/IDeleteGoalRest_2_0.js +3 -0
  94. package/build/shared/interfaces/restAPI/resources/goal/v2.0/IGoalIndexItem_2_0.js +3 -0
  95. package/build/shared/interfaces/restAPI/resources/goal/v2.0/IGoalStepMetric_2_0.js +3 -0
  96. package/build/shared/interfaces/restAPI/resources/goal/v2.0/IGoalStep_2_0.js +3 -0
  97. package/build/shared/interfaces/restAPI/resources/goal/v2.0/IGoal_2_0.js +3 -0
  98. package/build/shared/interfaces/restAPI/resources/goal/v2.0/IIndexGoalsRest_2_0.js +3 -0
  99. package/build/shared/interfaces/restAPI/resources/goal/v2.0/IReadGoalRest_2_0.js +3 -0
  100. package/build/shared/interfaces/restAPI/resources/goal/v2.0/IUpdateGoalRest_2_0.js +3 -0
  101. package/build/shared/interfaces/security/IPermission.js +6 -2
  102. package/build/shared/interfaces/security/IPinnedResource.js +3 -0
  103. package/build/shared/interfaces/security/index.js +1 -1
  104. package/build/shared/interfaces/transcripts/transcripts.js +33 -0
  105. package/package.json +1 -1
  106. package/types/index.d.ts +931 -224
  107. package/build/shared/interfaces/license.js.map +0 -1
  108. package/build/shared/interfaces/restAPI/resources/knowledgeSearchIndex/v2.0/ICreateKnowledgeSearchIndexRest_2_0.js +0 -3
  109. package/build/shared/interfaces/restAPI/resources/knowledgeSearchIndex/v2.0/IDeleteKnowledgeSearchIndexRest_2_0.js +0 -3
  110. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IDeleteMilestoneRest_2_0.js +0 -3
  111. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IIndexMilestonesRest_2_0.js +0 -3
  112. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IMilestoneIndexItem_2_0.js +0 -3
  113. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IMilestoneStepMetric_2_0.js +0 -3
  114. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IReadMilestoneRest_2_0.js +0 -3
  115. package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IUpdateMilestoneRest_2_0.js +0 -3
  116. package/build/test.js +0 -27
  117. /package/build/shared/interfaces/restAPI/resources/{knowledgeSearchIndex → aiAgent}/v2.0/index.js +0 -0
  118. /package/build/shared/interfaces/restAPI/resources/{milestone → goal}/v2.0/index.js +0 -0
@@ -10,6 +10,7 @@ const AdministrationAPIGroup_2_0_1 = require("./apigroups/AdministrationAPIGroup
10
10
  const AdministrationAPIGroup_2_1_1 = require("./apigroups/AdministrationAPIGroup_2_1");
11
11
  const ExternalAPIGroup_2_0_1 = require("./apigroups/ExternalAPIGroup_2_0");
12
12
  const InsightsAPIGroup_2_0_1 = require("./apigroups/InsightsAPIGroup_2_0");
13
+ const JWTAuthAPIGroup_2_0_1 = require("./apigroups/JWTAuthAPIGroup_2_0");
13
14
  const AnalyticsAPIGroup_2_0_1 = require("./apigroups/AnalyticsAPIGroup_2_0");
14
15
  const ManagementAPIGroup_2_0_1 = require("./apigroups/ManagementAPIGroup_2_0");
15
16
  const MetricsAPIGroup_2_0_1 = require("./apigroups/MetricsAPIGroup_2_0");
@@ -48,6 +49,12 @@ exports.RestAPIClient = function (config) {
48
49
  plugins.push(InsightsAPIGroup_2_0_1.InsightsAPIGroup_2_0);
49
50
  break;
50
51
  }
52
+ switch (config.versions.jwt) {
53
+ default:
54
+ case "2.0":
55
+ plugins.push(JWTAuthAPIGroup_2_0_1.JWTAuthAPIGroup_2_0);
56
+ break;
57
+ }
51
58
  switch (config.versions.metrics) {
52
59
  default:
53
60
  case "2.0":
@@ -115,7 +115,12 @@ function AdministrationAPIGroup_2_0(instance) {
115
115
  setupVoiceGatewayAccount: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/new/v2.0/organisations/voicegateway/account", "POST", self)(args, options),
116
116
  readVoiceGatewayAccount: (options) => (0, GenericAPIFn_1.GenericAPIFn)("/new/v2.0/organisations/voicegateway/account", "GET", self)(undefined, options),
117
117
  readOrganisationPolicies: (options) => (0, GenericAPIFn_1.GenericAPIFn)("/new/v2.0/organisations/policy", "GET", self)(undefined, options),
118
- readOrganisationKnowledgeChunksCount: (options) => (0, GenericAPIFn_1.GenericAPIFn)("/new/v2.0/organisations/chunkcount", "GET", self)(undefined, options)
118
+ readOrganisationKnowledgeChunksCount: (options) => (0, GenericAPIFn_1.GenericAPIFn)("/new/v2.0/organisations/chunkcount", "GET", self)(undefined, options),
119
+ pinResourceMe: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/new/v2.0/users/me/pin", "POST", self)(args, options),
120
+ getPinnedResourcesMe: (_a, options) => {
121
+ var { resourceType } = _a, args = __rest(_a, ["resourceType"]);
122
+ return (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/users/me/pinned?${(0, query_1.stringifyQuery)({ resourceType })}`, "GET", self)(args, options);
123
+ }
119
124
  };
120
125
  }
121
126
  exports.AdministrationAPIGroup_2_0 = AdministrationAPIGroup_2_0;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JWTAuthAPIGroup_2_0 = void 0;
4
+ const GenericAPIFn_1 = require("../GenericAPIFn");
5
+ function JWTAuthAPIGroup_2_0(instance) {
6
+ const self = instance;
7
+ return {
8
+ collaborationJWT: (options) => (0, GenericAPIFn_1.GenericAPIFn)("/jwt/collaboration", "POST", self)(undefined, options)
9
+ };
10
+ }
11
+ exports.JWTAuthAPIGroup_2_0 = JWTAuthAPIGroup_2_0;
12
+ //# sourceMappingURL=JWTAuthAPIGroup_2_0.js.map
@@ -177,14 +177,14 @@ const ResourcesAPIGroup_2_0 = (instance) => {
177
177
  return (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/endpoints/${endpointId}`, "PATCH", self)(args, options);
178
178
  },
179
179
  deleteEndpoint: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/endpoints/${args.endpointId}`, "DELETE", self)(undefined, options),
180
- indexMilestones: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/milestones?${(0, query_1.stringifyQuery)(args)}`, "GET", self)(undefined, options),
181
- createMilestone: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/new/v2.0/milestones", "POST", self)(args, options),
182
- readMilestone: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/milestones/${args.milestoneId}`, "GET", self)(undefined, options),
183
- updateMilestone: (_a, options) => {
184
- var { milestoneId } = _a, args = __rest(_a, ["milestoneId"]);
185
- return (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/milestones/${milestoneId}`, "PATCH", self)(args, options);
186
- },
187
- deleteMilestone: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/milestones/${args.milestoneId}`, "DELETE", self)(undefined, options),
180
+ indexGoals: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/goals?${(0, query_1.stringifyQuery)(args)}`, "GET", self)(undefined, options),
181
+ createGoal: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/new/v2.0/goals", "POST", self)(args, options),
182
+ readGoal: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/goals/${args.goalId}`, "GET", self)(undefined, options),
183
+ updateGoal: (_a, options) => {
184
+ var { goalId } = _a, args = __rest(_a, ["goalId"]);
185
+ return (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/goals/${goalId}`, "PATCH", self)(args, options);
186
+ },
187
+ deleteGoal: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/goals/${args.goalId}`, "DELETE", self)(undefined, options),
188
188
  indexPlaybooks: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/playbooks?${(0, query_1.stringifyQuery)(args)}`, "GET", self)(undefined, options),
189
189
  batchPlaybooks: (_a, options) => {
190
190
  var { projectId } = _a, args = __rest(_a, ["projectId"]);
@@ -537,6 +537,17 @@ const ResourcesAPIGroup_2_0 = (instance) => {
537
537
  return (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/aicopilotconfigs/${configId}`, "PATCH", self)(args, options);
538
538
  },
539
539
  deleteAgentAssistConfig: ({ configId }, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/aicopilotconfigs/${configId}`, "DELETE", self)(undefined, options),
540
+ createAiAgent: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/new/beta/aiagents", "POST", self)(args, options),
541
+ indexAiAgents: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/new/beta/aiagents?${(0, query_1.stringifyQuery)(args)}`, "GET", self)(undefined, options),
542
+ readAiAgent: ({ aiAgentId }, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/new/beta/aiagents/${aiAgentId}`, "GET", self)(undefined, options),
543
+ updateAiAgent: (_a, options) => {
544
+ var { aiAgentId } = _a, args = __rest(_a, ["aiAgentId"]);
545
+ return (0, GenericAPIFn_1.GenericAPIFn)(`/new/beta/aiagents/${aiAgentId}`, "PATCH", self)(args, options);
546
+ },
547
+ deleteAiAgent: ({ aiAgentId }, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/new/beta/aiagents/${aiAgentId}`, "DELETE", self)(undefined, options),
548
+ validateAiAgentName: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/new/beta/aiagents/validatename", "POST", self)(args, options),
549
+ getAiAgentHiringTemplates: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/new/beta/aiagents/hire/templates", "GET", self)(args, options),
550
+ hireAiAgent: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/new/beta/aiagents/hire", "POST", self)(args, options),
540
551
  generateNodeOutput(_a, options) {
541
552
  var { flowId } = _a, args = __rest(_a, ["flowId"]);
542
553
  return (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/flows/${flowId}/chart/nodes/output/generate`, "POST", self)(args, options);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AnalyticsAPIGroup_2_0 = exports.SessionsAPIGroup_2_0 = exports.ResourcesAPIGroup_2_0 = exports.ManagementAPIGroup_2_0 = exports.MetricsAPIGroup_2_0 = exports.InsightsAPIGroup_2_0 = exports.ExternalAPIGroup_2_0 = exports.AdministrationAPIGroup_2_1 = exports.AdministrationAPIGroup_2_0 = void 0;
3
+ exports.AnalyticsAPIGroup_2_0 = exports.SessionsAPIGroup_2_0 = exports.ResourcesAPIGroup_2_0 = exports.ManagementAPIGroup_2_0 = exports.MetricsAPIGroup_2_0 = exports.JWTAuthAPIGroup_2_0 = exports.InsightsAPIGroup_2_0 = exports.ExternalAPIGroup_2_0 = exports.AdministrationAPIGroup_2_1 = exports.AdministrationAPIGroup_2_0 = void 0;
4
4
  // AdministrationAPIGroup;
5
5
  var AdministrationAPIGroup_2_0_1 = require("./AdministrationAPIGroup_2_0");
6
6
  Object.defineProperty(exports, "AdministrationAPIGroup_2_0", { enumerable: true, get: function () { return AdministrationAPIGroup_2_0_1.AdministrationAPIGroup_2_0; } });
@@ -10,6 +10,8 @@ var ExternalAPIGroup_2_0_1 = require("./ExternalAPIGroup_2_0");
10
10
  Object.defineProperty(exports, "ExternalAPIGroup_2_0", { enumerable: true, get: function () { return ExternalAPIGroup_2_0_1.ExternalAPIGroup_2_0; } });
11
11
  var InsightsAPIGroup_2_0_1 = require("./InsightsAPIGroup_2_0");
12
12
  Object.defineProperty(exports, "InsightsAPIGroup_2_0", { enumerable: true, get: function () { return InsightsAPIGroup_2_0_1.InsightsAPIGroup_2_0; } });
13
+ var JWTAuthAPIGroup_2_0_1 = require("./JWTAuthAPIGroup_2_0");
14
+ Object.defineProperty(exports, "JWTAuthAPIGroup_2_0", { enumerable: true, get: function () { return JWTAuthAPIGroup_2_0_1.JWTAuthAPIGroup_2_0; } });
13
15
  var MetricsAPIGroup_2_0_1 = require("./MetricsAPIGroup_2_0");
14
16
  Object.defineProperty(exports, "MetricsAPIGroup_2_0", { enumerable: true, get: function () { return MetricsAPIGroup_2_0_1.MetricsAPIGroup_2_0; } });
15
17
  var ManagementAPIGroup_2_0_1 = require("./ManagementAPIGroup_2_0");
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KNOWLEDGE_ASSIST = exports.IDENTITY_ASSIST = exports.TRANSCRIPT_ASSIST = exports.SENTIMENT_ASSIST = exports.NEXT_ACTION_ASSIST = exports.SET_SECURE_FORMS_TILE = exports.SET_AGENT_ASSIST_GRID = exports.SET_ADAPTIVE_CARD_TILE = exports.SET_HTML_TILE = exports.SET_IFRAME_TILE = void 0;
3
+ exports.KNOWLEDGE_ASSIST = exports.IDENTITY_ASSIST = exports.TRANSCRIPT_ASSIST = exports.SENTIMENT_ASSIST = exports.NEXT_ACTION_ASSIST = exports.SET_SECURE_FORMS_TILE = exports.SET_AGENT_ASSIST_GRID = exports.SET_ADAPTIVE_CARD_TILE = exports.SEND_TILE_DATA = exports.SET_HTML_TILE = exports.SET_IFRAME_TILE = void 0;
4
4
  var setIframeTile_1 = require("./setIframeTile");
5
5
  Object.defineProperty(exports, "SET_IFRAME_TILE", { enumerable: true, get: function () { return setIframeTile_1.SET_IFRAME_TILE; } });
6
6
  var setHtmlTile_1 = require("./setHtmlTile");
7
7
  Object.defineProperty(exports, "SET_HTML_TILE", { enumerable: true, get: function () { return setHtmlTile_1.SET_HTML_TILE; } });
8
+ var sendData_1 = require("./sendData");
9
+ Object.defineProperty(exports, "SEND_TILE_DATA", { enumerable: true, get: function () { return sendData_1.SEND_TILE_DATA; } });
8
10
  var setAdaptiveCardTile_1 = require("./setAdaptiveCardTile");
9
11
  Object.defineProperty(exports, "SET_ADAPTIVE_CARD_TILE", { enumerable: true, get: function () { return setAdaptiveCardTile_1.SET_ADAPTIVE_CARD_TILE; } });
10
12
  var setAgentAssistGrid_1 = require("./setAgentAssistGrid");
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SEND_TILE_DATA = void 0;
4
+ /* Custom modules */
5
+ const createNodeDescriptor_1 = require("../../createNodeDescriptor");
6
+ const determineMetadata_1 = require("./helpers/determineMetadata");
7
+ const jsonKey = "json";
8
+ /**
9
+ * Node name: "sendData"
10
+ *
11
+ * Purpose:
12
+ * Send data to a tile in the Agent Assist Workspace
13
+ */
14
+ exports.SEND_TILE_DATA = (0, createNodeDescriptor_1.createNodeDescriptor)({
15
+ type: "sendData",
16
+ defaultLabel: "Copilot: Send Data",
17
+ summary: "UI__NODE_EDITOR__SEND_TILE_DATA__SUMMARY",
18
+ appearance: {
19
+ showIcon: false,
20
+ },
21
+ tags: ["agentAssist"],
22
+ fields: [
23
+ {
24
+ key: "tileId",
25
+ label: "UI__NODE_EDITOR__SEND_TILE_DATA__TILE_ID__LABEL",
26
+ type: "cognigyText",
27
+ description: "UI__NODE_EDITOR__SEND_TILE_DATA__TILE_ID__DESCRIPTION",
28
+ defaultValue: "html-tile",
29
+ params: {
30
+ required: true,
31
+ },
32
+ },
33
+ {
34
+ key: jsonKey,
35
+ label: "UI__NODE_EDITOR__SEND_TILE_DATA__JSON__LABEL",
36
+ type: "json",
37
+ description: "UI__NODE_EDITOR__SEND_TILE_DATA__JSON__DESCRIPTION",
38
+ defaultValue: "{}",
39
+ },
40
+ ],
41
+ sections: [],
42
+ form: [
43
+ { type: "field", key: "tileId" },
44
+ { type: "field", key: "json" },
45
+ ].filter((element) => !!element),
46
+ function: async (params) => {
47
+ const { cognigy, config } = params;
48
+ const { api } = cognigy;
49
+ const jsonData = config[jsonKey];
50
+ if (!config.json || config.json.length === 0) {
51
+ api.log("error", "Please provide JSON data in the JSON Data field");
52
+ return;
53
+ }
54
+ try {
55
+ const data = Object.assign({}, (0, determineMetadata_1.determineMetadata)(jsonData));
56
+ cognigy.api.sendTileUpdateToAgentAssistWorkspace(Object.assign(Object.assign({}, params), { tile: {
57
+ id: config.tileId,
58
+ type: "sendTileData",
59
+ data,
60
+ } }));
61
+ api.logDebugMessage("Successfully sent data to the Agent Assist Workspace");
62
+ }
63
+ catch (error) {
64
+ if (error instanceof SyntaxError) {
65
+ api.logDebugError("Please provide a valid JSON in the JSON Data field", "Copilot: Send Tile Data Error");
66
+ }
67
+ else {
68
+ api.logDebugError(error, "Copilot: Send Tile Data Error");
69
+ }
70
+ }
71
+ return;
72
+ },
73
+ });
74
+ //# sourceMappingURL=sendData.js.map
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ADD_MEMORY = void 0;
4
+ /* Custom modules */
5
+ const createNodeDescriptor_1 = require("../../createNodeDescriptor");
6
+ exports.ADD_MEMORY = (0, createNodeDescriptor_1.createNodeDescriptor)({
7
+ type: "addMemory",
8
+ defaultLabel: "Add Memory",
9
+ summary: "UI__NODE_EDITOR__ADD_MEMORY__SUMMARY",
10
+ appearance: {
11
+ showIcon: false
12
+ },
13
+ fields: [
14
+ {
15
+ key: "memory",
16
+ type: "cognigyText",
17
+ label: "UI__NODE_EDITOR__ADD_MEMORY__MEMORY__LABEL",
18
+ description: "UI__NODE_EDITOR__ADD_MEMORY__MEMORY__DESCRIPTION",
19
+ params: {
20
+ required: true
21
+ },
22
+ },
23
+ ],
24
+ preview: {
25
+ key: "memory",
26
+ type: "text"
27
+ },
28
+ tags: ["analytics", "profile"],
29
+ function: async ({ cognigy, config }) => {
30
+ var _a, _b;
31
+ const { memory: memoryText } = config;
32
+ const { api } = cognigy;
33
+ if (memoryText) {
34
+ let memoryToAdd;
35
+ if (typeof memoryText === 'string') {
36
+ memoryToAdd = memoryText;
37
+ }
38
+ else if (typeof memoryText === 'object') {
39
+ // Convert object to JSON string
40
+ memoryToAdd = JSON.stringify(memoryText);
41
+ }
42
+ else {
43
+ // Convert other types (number, boolean, etc.) to string
44
+ memoryToAdd = String(memoryText);
45
+ }
46
+ await ((_a = api.addContactMemory) === null || _a === void 0 ? void 0 : _a.call(api, memoryToAdd));
47
+ (_b = api.logDebugMessage) === null || _b === void 0 ? void 0 : _b.call(api, `UI__DEBUG_MODE__ADD_MEMORY__MESSAGE\n'${memoryToAdd}'`);
48
+ }
49
+ }
50
+ });
51
+ //# sourceMappingURL=addMemory.js.map
@@ -12,8 +12,8 @@ const createNodeDescriptor_1 = require("../../createNodeDescriptor");
12
12
  */
13
13
  exports.COMPLETE_GOAL = (0, createNodeDescriptor_1.createNodeDescriptor)({
14
14
  type: "completeGoal",
15
- defaultLabel: "Complete Goal",
16
- summary: 'UI__NODE_EDITOR__COMPLETE_GOAL__SUMMARY',
15
+ defaultLabel: "Complete Task",
16
+ summary: "UI__NODE_EDITOR__COMPLETE_GOAL__SUMMARY",
17
17
  appearance: {
18
18
  showIcon: false
19
19
  },
@@ -33,12 +33,13 @@ exports.COMPLETE_GOAL = (0, createNodeDescriptor_1.createNodeDescriptor)({
33
33
  },
34
34
  tags: ["analytics", "profile"],
35
35
  function: async ({ cognigy, config }) => {
36
+ var _a;
36
37
  const { goal } = config;
37
38
  const { input, api } = cognigy;
38
39
  if (goal) {
39
40
  api.completeGoal(goal);
40
41
  input.completedGoals.push(goal);
41
- api.logDebugMessage(`Goal: ${goal}`);
42
+ (_a = api.logDebugMessage) === null || _a === void 0 ? void 0 : _a.call(api, `Goal: ${goal}`);
42
43
  }
43
44
  }
44
45
  });
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateUniqueMemoryId = void 0;
4
+ /**
5
+ * Generates a unique ID for a profile memory entry.
6
+ *
7
+ * This function creates a unique identifier by combining a truncated
8
+ * base-36 encoded timestamp with a random base-36 string.
9
+ *
10
+ * @returns {string} A alphanumeric 6-character unique ID for a profile memory entry.
11
+ */
12
+ const generateUniqueMemoryId = () => {
13
+ const timestamp = Date.now();
14
+ const timestampPart = timestamp.toString(36).slice(-4);
15
+ const randomPart = Math.random().toString(36).substring(2, 4);
16
+ const combined = (timestampPart + randomPart).slice(0, 6);
17
+ return combined.padStart(6, '0');
18
+ };
19
+ exports.generateUniqueMemoryId = generateUniqueMemoryId;
20
+ //# sourceMappingURL=helper.js.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TRACK_MILESTONE = exports.REQUEST_RATING = exports.SET_RATING = exports.OVERWRITE_ANALYTICS = exports.BLIND_MODE = exports.UPDATE_PROFILE = exports.MERGE_PROFILE = exports.DELETE_PROFILE = exports.DEACTIVATE_PROFILE = exports.COMPLETE_GOAL = exports.ACTIVATE_PROFILE = void 0;
3
+ exports.TRACK_GOAL = exports.REQUEST_RATING = exports.SET_RATING = exports.OVERWRITE_ANALYTICS = exports.BLIND_MODE = exports.ADD_MEMORY = exports.UPDATE_PROFILE = exports.MERGE_PROFILE = exports.DELETE_PROFILE = exports.DEACTIVATE_PROFILE = exports.COMPLETE_GOAL = exports.ACTIVATE_PROFILE = void 0;
4
4
  var activateProfile_1 = require("./activateProfile");
5
5
  Object.defineProperty(exports, "ACTIVATE_PROFILE", { enumerable: true, get: function () { return activateProfile_1.ACTIVATE_PROFILE; } });
6
6
  var completeGoal_1 = require("./completeGoal");
@@ -13,6 +13,8 @@ var mergeProfile_1 = require("./mergeProfile");
13
13
  Object.defineProperty(exports, "MERGE_PROFILE", { enumerable: true, get: function () { return mergeProfile_1.MERGE_PROFILE; } });
14
14
  var updateProfile_1 = require("./updateProfile");
15
15
  Object.defineProperty(exports, "UPDATE_PROFILE", { enumerable: true, get: function () { return updateProfile_1.UPDATE_PROFILE; } });
16
+ var addMemory_1 = require("./addMemory");
17
+ Object.defineProperty(exports, "ADD_MEMORY", { enumerable: true, get: function () { return addMemory_1.ADD_MEMORY; } });
16
18
  var blindMode_1 = require("./blindMode");
17
19
  Object.defineProperty(exports, "BLIND_MODE", { enumerable: true, get: function () { return blindMode_1.BLIND_MODE; } });
18
20
  var overwriteAnalytics_1 = require("./overwriteAnalytics");
@@ -21,6 +23,6 @@ var setRating_1 = require("./setRating");
21
23
  Object.defineProperty(exports, "SET_RATING", { enumerable: true, get: function () { return setRating_1.SET_RATING; } });
22
24
  var requestRating_1 = require("./requestRating");
23
25
  Object.defineProperty(exports, "REQUEST_RATING", { enumerable: true, get: function () { return requestRating_1.REQUEST_RATING; } });
24
- var trackMilestone_1 = require("./trackMilestone");
25
- Object.defineProperty(exports, "TRACK_MILESTONE", { enumerable: true, get: function () { return trackMilestone_1.TRACK_MILESTONE; } });
26
+ var trackGoal_1 = require("./trackGoal");
27
+ Object.defineProperty(exports, "TRACK_GOAL", { enumerable: true, get: function () { return trackGoal_1.TRACK_GOAL; } });
26
28
  //# sourceMappingURL=index.js.map
@@ -1,31 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TRACK_MILESTONE = void 0;
3
+ exports.TRACK_GOAL = void 0;
4
4
  /* Custom modules */
5
5
  const createNodeDescriptor_1 = require("../../createNodeDescriptor");
6
6
  /* Npm modules */
7
7
  const uuid_1 = require("uuid");
8
8
  /**
9
- * Node name: 'trackMilestone'
9
+ * Node name: 'trackGoal'
10
10
  *
11
11
  * Purpose:
12
- * Track a milestone with steps
13
- * @param milestoneReferenceId the reference id of the milestone to track
12
+ * Track a goal with steps
13
+ * @param goalReferenceId the reference id of the goal to track
14
14
  */
15
- exports.TRACK_MILESTONE = (0, createNodeDescriptor_1.createNodeDescriptor)({
16
- type: "trackMilestone",
17
- defaultLabel: "Track Milestone",
18
- summary: 'UI__NODE_EDITOR__TRACK_MILESTONE__SUMMARY',
15
+ exports.TRACK_GOAL = (0, createNodeDescriptor_1.createNodeDescriptor)({
16
+ type: "trackGoal",
17
+ defaultLabel: "Track Goal",
18
+ summary: 'UI__NODE_EDITOR__TRACK_GOAL__SUMMARY',
19
19
  appearance: {
20
20
  showIcon: false
21
21
  },
22
22
  fields: [
23
23
  {
24
- key: "milestone",
25
- type: "milestoneAndStepsSelect",
26
- label: "UI__NODE_EDITOR__MILESTONES__CHOOSE_MILESTONE__LABEL",
24
+ key: "goal",
25
+ type: "goalAndStepsSelect",
26
+ label: "UI__NODE_EDITOR__Goals__CHOOSE_GOAL__LABEL",
27
27
  defaultValue: {
28
- milestoneReferenceId: "",
28
+ goalReferenceId: "",
29
29
  stepIds: []
30
30
  },
31
31
  params: {
@@ -34,31 +34,33 @@ exports.TRACK_MILESTONE = (0, createNodeDescriptor_1.createNodeDescriptor)({
34
34
  },
35
35
  ],
36
36
  preview: {
37
- key: "milestone",
37
+ key: "goal",
38
38
  type: "text"
39
39
  },
40
40
  tags: ["analytics"],
41
41
  function: async ({ cognigy, config, projectId, organisationId, }) => {
42
42
  var _a;
43
43
  const { api } = cognigy;
44
- if (!(config === null || config === void 0 ? void 0 : config.milestone)) {
45
- api.log("error", `Invalid config for 'trackMilestone' Node`);
44
+ if (!(config === null || config === void 0 ? void 0 : config.goal)) {
45
+ api.log("error", `Invalid config for 'trackGoal' Node`);
46
+ api.logDebugError(`Invalid config for 'trackGoal' Node`);
46
47
  return;
47
48
  }
48
49
  const sessionState = api.getSessionStateCopy();
49
- const { selectedSteps, version, name, milestoneId, } = config.milestone;
50
- const activeCycleIds = ((_a = sessionState.analytics) === null || _a === void 0 ? void 0 : _a.milestoneCycleIds) || {};
51
- let cycleId = activeCycleIds[milestoneId];
50
+ const { selectedSteps, version, name, goalId, } = config.goal;
51
+ const activeCycleIds = ((_a = sessionState.analytics) === null || _a === void 0 ? void 0 : _a.goalCycleIds) || {};
52
+ let cycleId = activeCycleIds[goalId];
52
53
  const hasStartStep = selectedSteps.some(step => step.type === "start");
53
54
  if (!cycleId && !hasStartStep) {
54
- api.log("warn", `No start step found for milestone ${name} (${milestoneId}). Ignoring milestone tracking.`);
55
+ api.log("warn", `No start step found for goal ${name} (${goalId}). Ignoring goal tracking.`);
56
+ api.logDebugError(`No start step found for goal <b>${name}</b>.<br>Ignoring goal tracking.`);
55
57
  return;
56
58
  }
57
59
  // Create a new cycle id if there is a start step
58
60
  if (hasStartStep) {
59
61
  cycleId = (0, uuid_1.v4)();
60
- activeCycleIds[milestoneId] = cycleId;
61
- const sessionStateAnalyticsUpdate = Object.assign(Object.assign({}, sessionState.analytics), { milestoneCycleIds: activeCycleIds });
62
+ activeCycleIds[goalId] = cycleId;
63
+ const sessionStateAnalyticsUpdate = Object.assign(Object.assign({}, sessionState.analytics), { goalCycleIds: activeCycleIds });
62
64
  api.setSessionState("analytics", sessionStateAnalyticsUpdate);
63
65
  }
64
66
  const { sessionId, endpointUrlToken, endpointName, channel, endpointType, localeName, localeReferenceId, traceId, snapshotId, snapshotName, contactId } = api.getMetadata();
@@ -74,8 +76,8 @@ exports.TRACK_MILESTONE = (0, createNodeDescriptor_1.createNodeDescriptor)({
74
76
  sessionId,
75
77
  version,
76
78
  timestamp: new Date(),
77
- milestoneCycleId: cycleId,
78
- milestoneId,
79
+ goalCycleId: cycleId,
80
+ goalId,
79
81
  stepId: step.stepId,
80
82
  endpointUrlToken,
81
83
  endpointName,
@@ -88,8 +90,13 @@ exports.TRACK_MILESTONE = (0, createNodeDescriptor_1.createNodeDescriptor)({
88
90
  contactId
89
91
  }
90
92
  };
91
- await api.sendTrackMilestone(payload);
93
+ await api.sendTrackGoal(payload);
94
+ let msg = `<b>Goal Name:</b> ${name}<br><b>Step Name:</b> ${step.name}<br>`;
95
+ if (step.type) {
96
+ msg = msg + `<b>Step Type:</b> ${step.type}<br>`;
97
+ }
98
+ api.logDebugMessage(msg);
92
99
  }
93
100
  }
94
101
  });
95
- //# sourceMappingURL=trackMilestone.js.map
102
+ //# sourceMappingURL=trackGoal.js.map
@@ -79,7 +79,7 @@ exports.COPY_SLOTS_TO_CONTEXT = (0, createNodeDescriptor_1.createNodeDescriptor)
79
79
  { type: "field", key: "tag" },
80
80
  { type: "section", key: "advanced" }
81
81
  ],
82
- tags: ["data", "nlu"],
82
+ tags: ["ai", "data", "nlu"],
83
83
  function: async ({ cognigy, config }) => {
84
84
  const { key, tag, useNeg, mode } = config;
85
85
  const { input, api } = cognigy;
@@ -18,6 +18,7 @@ const service_1 = require("./service");
18
18
  const apps_1 = require("./apps");
19
19
  const agentAssist_1 = require("./agentAssist");
20
20
  const liveAgent_1 = require("./liveAgent");
21
+ const transcripts_1 = require("./transcripts");
21
22
  // import { REQUIRED_FIELDS } from "./requiredFields";
22
23
  // import { ALL_FIELDS } from "./allFields";
23
24
  const nodes = [
@@ -80,6 +81,7 @@ const nodes = [
80
81
  analytics_1.DELETE_PROFILE,
81
82
  analytics_1.MERGE_PROFILE,
82
83
  analytics_1.UPDATE_PROFILE,
84
+ analytics_1.ADD_MEMORY,
83
85
  analytics_1.BLIND_MODE,
84
86
  analytics_1.OVERWRITE_ANALYTICS,
85
87
  service_1.HANDOVER,
@@ -115,6 +117,7 @@ const nodes = [
115
117
  apps_1.SET_ADAPTIVE_CARD_APP_STATE,
116
118
  agentAssist_1.SET_IFRAME_TILE,
117
119
  agentAssist_1.SET_HTML_TILE,
120
+ agentAssist_1.SEND_TILE_DATA,
118
121
  agentAssist_1.SET_SECURE_FORMS_TILE,
119
122
  agentAssist_1.SET_ADAPTIVE_CARD_TILE,
120
123
  agentAssist_1.SET_AGENT_ASSIST_GRID,
@@ -127,8 +130,17 @@ const nodes = [
127
130
  agentAssist_1.KNOWLEDGE_ASSIST,
128
131
  knowledgeSearch_1.SEARCH_EXTRACT_OUTPUT,
129
132
  ];
130
- if (process.env.FEATURE_USE_MILESTONES === "true") {
131
- nodes.push(analytics_1.TRACK_MILESTONE);
133
+ if (process.env.FEATURE_USE_GOALS === "true") {
134
+ nodes.push(analytics_1.TRACK_GOAL);
135
+ }
136
+ if (process.env.DISABLE_FEATURE_TRANSCRIPT_MANAGER !== "true") {
137
+ nodes.push(transcripts_1.GET_TRANSCRIPT);
138
+ nodes.push(transcripts_1.ADD_TRANSCRIPT_STEP);
139
+ nodes.push(service_1.AI_AGENT_JOB);
140
+ nodes.push(service_1.AI_AGENT_JOB_DEFAULT);
141
+ nodes.push(service_1.AI_AGENT_JOB_TOOL);
142
+ nodes.push(service_1.AI_AGENT_TOOL_ANSWER);
143
+ nodes.push(service_1.AI_AGENT_HANDOVER);
132
144
  }
133
145
  if (process.env.FEATURE_USE_COGNIGY_LIVE_AGENT === "true") {
134
146
  nodes.push(liveAgent_1.ASSIST_INFO);
@@ -97,7 +97,7 @@ exports.KNOWLEDGE_SEARCH_V2 = (0, createNodeDescriptor_1.createNodeDescriptor)({
97
97
  key: "text",
98
98
  type: "text"
99
99
  },
100
- tags: ["knowledgeSearch", "knowledge", "search"],
100
+ tags: ["ai", "knowledgeSearch", "knowledge", "search"],
101
101
  function: async (knowledgeSearchParams) => {
102
102
  var _a;
103
103
  const { cognigy, config } = knowledgeSearchParams;
@@ -546,9 +546,9 @@ exports.SEARCH_EXTRACT_OUTPUT = (0, createNodeDescriptor_1.createNodeDescriptor)
546
546
  key: "text",
547
547
  type: "text"
548
548
  },
549
- tags: ["knowledgeSearch", "knowledge", "search"],
549
+ tags: ["ai", "knowledgeSearch", "knowledge", "search"],
550
550
  function: async (knowledgeSearchParams) => {
551
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
551
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
552
552
  const { cognigy, config, nodeId } = knowledgeSearchParams;
553
553
  const { input, api } = cognigy;
554
554
  const { topK, searchString, searchStoreLocation, searchStoreLocationContextKey, searchStoreLocationInputKey, searchSourceTags, searchSourceTagsFilterOp, temperature, maxTokens, topP, presencePenalty, frequencyPenalty, useStop, stop, storeLocation, contextKey, inputKey, timeout, timeoutMessage, outputFallback, outputMode, mode, errorHandling, errorHandlingGotoTarget, streamStopTokens, followUpDetection, debugLogTokenCount, debugLogRequestAndCompletion } = config;
@@ -593,10 +593,13 @@ USER: ${searchString}
593
593
  Does the last USER input refer to the conversation before?
594
594
  Answer with "true" or "false". Answer:`;
595
595
  let promptResponse;
596
+ // set the detailed results to true to get the token usage
597
+ const returnDetailedResults = true;
596
598
  try {
597
- promptResponse = await api.runGenerativeAIPrompt({ prompt }, "answerExtraction");
599
+ const firstFollowUpResponse = await api.runGenerativeAIPrompt({ prompt, detailedResults: returnDetailedResults }, "answerExtraction");
600
+ promptResponse = firstFollowUpResponse.result;
598
601
  // if we're in adminconsole, process debugging options
599
- (0, prompt_1.writeLLMDebugLogs)("Search Extract Output Follow Up Detection", prompt, promptResponse, debugLogTokenCount, false, cognigy);
602
+ (0, prompt_1.writeLLMDebugLogs)("Search Extract Output Follow Up Detection", prompt, firstFollowUpResponse, debugLogTokenCount, false, cognigy);
600
603
  // check if LLM thinks the input was a follow up
601
604
  if (promptResponse === null || promptResponse === void 0 ? void 0 : promptResponse.toLowerCase().includes("true")) {
602
605
  prompt = `You are tasked to rewrite a question based on a context, so that the question is clearer.
@@ -613,9 +616,10 @@ Context:
613
616
  ${lastRoundTrip}
614
617
  Question: ${searchString}
615
618
  New: `;
616
- promptResponse = await api.runGenerativeAIPrompt({ prompt }, "answerExtraction");
619
+ const secondFollowUpResponse = await api.runGenerativeAIPrompt({ prompt, detailedResults: returnDetailedResults }, "answerExtraction");
620
+ promptResponse = secondFollowUpResponse.result;
617
621
  // if we're in adminconsole, process debugging options
618
- (0, prompt_1.writeLLMDebugLogs)("Search Extract Output Follow Up Detection 2", prompt, promptResponse, debugLogTokenCount, false, cognigy);
622
+ (0, prompt_1.writeLLMDebugLogs)("Search Extract Output Follow Up Detection 2", prompt, secondFollowUpResponse, debugLogTokenCount, false, cognigy);
619
623
  // the actual search string to now use is the rewritten question
620
624
  actualSearchString = promptResponse;
621
625
  api.logDebugMessage(`UI__DEBUG_MODE__SEO__MESSAGE '${actualSearchString}'`);
@@ -706,6 +710,9 @@ New: `;
706
710
  }
707
711
  // Perform knowledge search
708
712
  try {
713
+ // Set understood to true so that the interaction doesn't look false in our analytics
714
+ (_d = api.setAnalyticsData) === null || _d === void 0 ? void 0 : _d.call(api, "understood", "true");
715
+ input.understood = true;
709
716
  const knowledgeSearchResponse = await api.knowledgeSearch(data);
710
717
  (0, prompt_1.writeLLMDebugLogs)("Search Extract Output Embeddings Call", data.query, undefined, debugLogTokenCount, false, cognigy);
711
718
  // Handle possible response errors
@@ -737,10 +744,10 @@ New: `;
737
744
  }
738
745
  // #endregion 1 Perform Search
739
746
  // #region 2 Perform Answer Extraction
740
- let documents = (_d = knowledgeSearchResponseData === null || knowledgeSearchResponseData === void 0 ? void 0 : knowledgeSearchResponseData.topK) === null || _d === void 0 ? void 0 : _d.map(result => result === null || result === void 0 ? void 0 : result.text).join(' ');
747
+ let documents = (_e = knowledgeSearchResponseData === null || knowledgeSearchResponseData === void 0 ? void 0 : knowledgeSearchResponseData.topK) === null || _e === void 0 ? void 0 : _e.map(result => result === null || result === void 0 ? void 0 : result.text).join(' ');
741
748
  const replacedUserInput = input.text + (actualSearchString !== input.text ? ` possibly meaning "${actualSearchString}"` : "");
742
- prompt = prompt.replace(/@userInput/, replacedUserInput);
743
- prompt = prompt.replace(/@foundDocuments/, documents);
749
+ prompt = prompt.replace(/@userInput/g, replacedUserInput);
750
+ prompt = prompt.replace(/@foundDocuments/g, documents);
744
751
  const answerLanguage = (() => {
745
752
  const answerLanguage = getLanguageName(language);
746
753
  // generic (ge-GE) and any other unknown languages result in "undefined"
@@ -749,7 +756,7 @@ New: `;
749
756
  }
750
757
  return answerLanguage;
751
758
  })();
752
- prompt = prompt.replace(/@answerLanguage/, answerLanguage);
759
+ prompt = prompt.replace(/@answerLanguage/g, answerLanguage);
753
760
  // check if we have found documents and if we are not just in "Search" only mode
754
761
  if (documents && (mode !== "s")) {
755
762
  // check if we received streamed output at all
@@ -768,16 +775,19 @@ New: `;
768
775
  streamedOutput = true;
769
776
  api.output(text, null);
770
777
  },
771
- streamStopTokens
778
+ streamStopTokens,
779
+ // set the detailed results to true to get the token usage
780
+ detailedResults: true
772
781
  };
773
782
  if (useStop) {
774
783
  promptData["stop"] = stop;
775
784
  }
776
785
  let promptResponse;
777
786
  try {
778
- promptResponse = await api.runGenerativeAIPrompt(promptData, "answerExtraction");
787
+ const mainPromptResponse = await api.runGenerativeAIPrompt(promptData, "answerExtraction");
788
+ promptResponse = mainPromptResponse.result;
779
789
  // if we're in adminconsole, process debugging options
780
- (0, prompt_1.writeLLMDebugLogs)("Search Extract Output Main Prompt", prompt, promptResponse, debugLogTokenCount, debugLogRequestAndCompletion, cognigy);
790
+ (0, prompt_1.writeLLMDebugLogs)("Search Extract Output Main Prompt", prompt, mainPromptResponse, debugLogTokenCount, debugLogRequestAndCompletion, cognigy);
781
791
  if (storeLocation === "context") {
782
792
  api.addToContext(contextKey, promptResponse, "simple");
783
793
  }
@@ -932,7 +942,7 @@ New: `;
932
942
  {
933
943
  "separator": true,
934
944
  "type": "TextBlock",
935
- "text": (_e = knowledgeSearchResponseData === null || knowledgeSearchResponseData === void 0 ? void 0 : knowledgeSearchResponseData.topK) === null || _e === void 0 ? void 0 : _e[0].text,
945
+ "text": (_f = knowledgeSearchResponseData === null || knowledgeSearchResponseData === void 0 ? void 0 : knowledgeSearchResponseData.topK) === null || _f === void 0 ? void 0 : _f[0].text,
936
946
  "wrap": true,
937
947
  "spacing": "Padding"
938
948
  }
@@ -953,7 +963,7 @@ New: `;
953
963
  "version": "1.6"
954
964
  };
955
965
  // @ts-ignore
956
- if ((_h = (_g = (_f = knowledgeSearchResponseData === null || knowledgeSearchResponseData === void 0 ? void 0 : knowledgeSearchResponseData.topK) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.chunkMetaData) === null || _h === void 0 ? void 0 : _h.url) {
966
+ if ((_j = (_h = (_g = knowledgeSearchResponseData === null || knowledgeSearchResponseData === void 0 ? void 0 : knowledgeSearchResponseData.topK) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.chunkMetaData) === null || _j === void 0 ? void 0 : _j.url) {
957
967
  ADAPTIVE_CARD_RESULT.body[2].items[0].columns[1].items.push({
958
968
  "type": "ActionSet",
959
969
  "actions": [
@@ -961,7 +971,7 @@ New: `;
961
971
  "type": "Action.OpenUrl",
962
972
  "title": "Open Source",
963
973
  // @ts-ignore
964
- "url": (_j = knowledgeSearchResponseData === null || knowledgeSearchResponseData === void 0 ? void 0 : knowledgeSearchResponseData.topK) === null || _j === void 0 ? void 0 : _j[0].chunkMetaData.url
974
+ "url": (_k = knowledgeSearchResponseData === null || knowledgeSearchResponseData === void 0 ? void 0 : knowledgeSearchResponseData.topK) === null || _k === void 0 ? void 0 : _k[0].chunkMetaData.url
965
975
  }
966
976
  ],
967
977
  "separator": true