@cognigy/rest-api-client 4.100.0 → 2025.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/awsBedrockIAMProviderConnection.js +11 -0
- package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/index.js +5 -1
- package/build/shared/charts/descriptors/message/question/question.js +12 -32
- package/build/shared/charts/descriptors/message/say.js +10 -7
- package/build/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +90 -64
- package/build/shared/charts/descriptors/service/aiAgent/aiAgentJobMCPTool.js +2 -2
- package/build/shared/charts/descriptors/service/aiAgent/helpers/createSystemMessage.js +22 -8
- package/build/shared/charts/descriptors/service/handoverV2.js +0 -6
- package/build/shared/charts/descriptors/voice/mappers/setSessionConfig.mapper.js +7 -4
- package/build/shared/constants.js +0 -1
- package/build/shared/interfaces/IOrganisation.js +32 -8
- package/build/shared/interfaces/handover.js +21 -5
- package/build/shared/interfaces/messageAPI/endpoints.js +12 -2
- package/build/shared/interfaces/messageAPI/handover.js +34 -6
- package/build/shared/interfaces/resources/IEndpoint.js +1 -0
- package/build/shared/interfaces/resources/IWebrtcWidgetConfig.js +1 -0
- package/build/shared/interfaces/resources/TWebhookChannelType.js +5 -0
- package/dist/esm/shared/charts/descriptors/connectionNodes/generativeAIProviders/awsBedrockIAMProviderConnection.js +8 -0
- package/dist/esm/shared/charts/descriptors/connectionNodes/generativeAIProviders/index.js +3 -0
- package/dist/esm/shared/charts/descriptors/message/question/question.js +12 -32
- package/dist/esm/shared/charts/descriptors/message/say.js +10 -7
- package/dist/esm/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +91 -65
- package/dist/esm/shared/charts/descriptors/service/aiAgent/aiAgentJobMCPTool.js +2 -2
- package/dist/esm/shared/charts/descriptors/service/aiAgent/helpers/createSystemMessage.js +20 -7
- package/dist/esm/shared/charts/descriptors/service/handoverV2.js +0 -6
- package/dist/esm/shared/charts/descriptors/voice/mappers/setSessionConfig.mapper.js +7 -4
- package/dist/esm/shared/constants.js +0 -1
- package/dist/esm/shared/interfaces/IOrganisation.js +32 -8
- package/dist/esm/shared/interfaces/handover.js +21 -5
- package/dist/esm/shared/interfaces/messageAPI/endpoints.js +11 -1
- package/dist/esm/shared/interfaces/messageAPI/handover.js +34 -6
- package/dist/esm/shared/interfaces/resources/IEndpoint.js +1 -0
- package/dist/esm/shared/interfaces/resources/IWebrtcWidgetConfig.js +1 -0
- package/dist/esm/shared/interfaces/resources/TWebhookChannelType.js +5 -0
- package/package.json +1 -1
- package/types/index.d.ts +30 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
# 2025.11.0
|
|
2
|
+
Released: May 27th, 2025
|
|
3
|
+
|
|
4
|
+
Released state of package up to date with Cognigy.AI v2025.11.0
|
|
5
|
+
|
|
6
|
+
# 2025.10.0
|
|
7
|
+
Released: May 13th, 2025
|
|
8
|
+
|
|
9
|
+
Released state of package up to date with Cognigy.AI v2025.10.0
|
|
10
|
+
|
|
1
11
|
# 4.100.0
|
|
2
12
|
Released: April 29th, 2025
|
|
3
13
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AWS_BEDROCK_IAM_PROVIDER_CONNECTION = void 0;
|
|
4
|
+
exports.AWS_BEDROCK_IAM_PROVIDER_CONNECTION = {
|
|
5
|
+
type: "AwsBedrockProviderIamRole",
|
|
6
|
+
label: "UI__NODE_EDITOR__AWS_BEDROCK_PROVIDER_IAM_ROLE_CONNECTION__LABEL",
|
|
7
|
+
fields: [
|
|
8
|
+
{ fieldName: "roleArn", label: "UI__CONNECTION_EDITOR__FIELD_ROLE_ARN" },
|
|
9
|
+
]
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=awsBedrockIAMProviderConnection.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cognigyGenerativeAIProviderModule = exports.MISTRAL_PROVIDER_CONNECTION = exports.OPEN_AI_COMPATIBLE_PROVIDER_CONNECTION = exports.AWS_BEDROCK_PROVIDER_CONNECTION = exports.ALEPH_ALPHA_PROVIDER_CONNECTION = exports.GOOGLE_VERTEXAI_PROVIDER_CONNECTION = exports.ANTHROPIC_PROVIDER_CONNECTION = exports.AZURE_OPEN_AI_OAUTH2_PROVIDER_CONNECTION = exports.AZURE_OPEN_AI_V2_PROVIDER_CONNECTION = exports.AZURE_OPEN_AI_PROVIDER_CONNECTION = exports.OPEN_AI_PROVIDER_CONNECTION = void 0;
|
|
3
|
+
exports.cognigyGenerativeAIProviderModule = exports.MISTRAL_PROVIDER_CONNECTION = exports.OPEN_AI_COMPATIBLE_PROVIDER_CONNECTION = exports.AWS_BEDROCK_IAM_PROVIDER_CONNECTION = exports.AWS_BEDROCK_PROVIDER_CONNECTION = exports.ALEPH_ALPHA_PROVIDER_CONNECTION = exports.GOOGLE_VERTEXAI_PROVIDER_CONNECTION = exports.ANTHROPIC_PROVIDER_CONNECTION = exports.AZURE_OPEN_AI_OAUTH2_PROVIDER_CONNECTION = exports.AZURE_OPEN_AI_V2_PROVIDER_CONNECTION = exports.AZURE_OPEN_AI_PROVIDER_CONNECTION = exports.OPEN_AI_PROVIDER_CONNECTION = void 0;
|
|
4
4
|
/* Custom modules */
|
|
5
5
|
const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
|
|
6
6
|
const openAIProviderConnection_1 = require("./openAIProviderConnection");
|
|
@@ -11,6 +11,7 @@ const anthropicProviderConnection_1 = require("./anthropicProviderConnection");
|
|
|
11
11
|
const googleVertexAIProviderConnection_1 = require("./googleVertexAIProviderConnection");
|
|
12
12
|
const alephAlphaProviderConnection_1 = require("./alephAlphaProviderConnection");
|
|
13
13
|
const awsBedrockProviderConnection_1 = require("./awsBedrockProviderConnection");
|
|
14
|
+
const awsBedrockIAMProviderConnection_1 = require("./awsBedrockIAMProviderConnection");
|
|
14
15
|
const openAICompatibleProviderConnection_1 = require("./openAICompatibleProviderConnection");
|
|
15
16
|
const mistralProviderConnection_1 = require("./mistralProviderConnection");
|
|
16
17
|
var openAIProviderConnection_2 = require("./openAIProviderConnection");
|
|
@@ -29,6 +30,8 @@ var alephAlphaProviderConnection_2 = require("./alephAlphaProviderConnection");
|
|
|
29
30
|
Object.defineProperty(exports, "ALEPH_ALPHA_PROVIDER_CONNECTION", { enumerable: true, get: function () { return alephAlphaProviderConnection_2.ALEPH_ALPHA_PROVIDER_CONNECTION; } });
|
|
30
31
|
var awsBedrockProviderConnection_2 = require("./awsBedrockProviderConnection");
|
|
31
32
|
Object.defineProperty(exports, "AWS_BEDROCK_PROVIDER_CONNECTION", { enumerable: true, get: function () { return awsBedrockProviderConnection_2.AWS_BEDROCK_PROVIDER_CONNECTION; } });
|
|
33
|
+
var awsBedrockIAMProviderConnection_2 = require("./awsBedrockIAMProviderConnection");
|
|
34
|
+
Object.defineProperty(exports, "AWS_BEDROCK_IAM_PROVIDER_CONNECTION", { enumerable: true, get: function () { return awsBedrockIAMProviderConnection_2.AWS_BEDROCK_IAM_PROVIDER_CONNECTION; } });
|
|
32
35
|
var openAICompatibleProviderConnection_2 = require("./openAICompatibleProviderConnection");
|
|
33
36
|
Object.defineProperty(exports, "OPEN_AI_COMPATIBLE_PROVIDER_CONNECTION", { enumerable: true, get: function () { return openAICompatibleProviderConnection_2.OPEN_AI_COMPATIBLE_PROVIDER_CONNECTION; } });
|
|
34
37
|
var mistralProviderConnection_2 = require("./mistralProviderConnection");
|
|
@@ -44,6 +47,7 @@ exports.cognigyGenerativeAIProviderModule = (0, createNodeDescriptor_1.createExt
|
|
|
44
47
|
googleVertexAIProviderConnection_1.GOOGLE_VERTEXAI_PROVIDER_CONNECTION,
|
|
45
48
|
alephAlphaProviderConnection_1.ALEPH_ALPHA_PROVIDER_CONNECTION,
|
|
46
49
|
awsBedrockProviderConnection_1.AWS_BEDROCK_PROVIDER_CONNECTION,
|
|
50
|
+
awsBedrockIAMProviderConnection_1.AWS_BEDROCK_IAM_PROVIDER_CONNECTION,
|
|
47
51
|
openAICompatibleProviderConnection_1.OPEN_AI_COMPATIBLE_PROVIDER_CONNECTION,
|
|
48
52
|
mistralProviderConnection_1.MISTRAL_PROVIDER_CONNECTION
|
|
49
53
|
]
|
|
@@ -742,27 +742,6 @@ DO NOT talk about other topics. Do not offer general assistance.`,
|
|
|
742
742
|
},
|
|
743
743
|
defaultValue: true,
|
|
744
744
|
},
|
|
745
|
-
process.env.FEATURE_USE_COGNIGY_LIVE_AGENT && {
|
|
746
|
-
key: constants_1.COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS.ESCALATE_ANSWERS_AGENT_ASSIST_INIT_MESSAGE,
|
|
747
|
-
type: "cognigyText",
|
|
748
|
-
label: "UI__NODE_EDITOR__MESSAGE__QUESTION__QUESTION__FIELDS__ESCALATE_ANSWERS_AGENT_ASSIST_INIT_MESSAGE__LABEL",
|
|
749
|
-
description: "UI__NODE_EDITOR__MESSAGE__QUESTION__QUESTION__FIELDS__ESCALATE_ANSWERS_AGENT_ASSIST_INIT_MESSAGE__DESCRIPTION",
|
|
750
|
-
condition: {
|
|
751
|
-
key: "escalateAnswersAction",
|
|
752
|
-
value: "handover"
|
|
753
|
-
}
|
|
754
|
-
},
|
|
755
|
-
{
|
|
756
|
-
key: "escalateAnswersRepeatHandoverMessage",
|
|
757
|
-
type: "toggle",
|
|
758
|
-
label: "UI__NODE_EDITOR__MESSAGE__QUESTION__QUESTION__FIELDS__ESCALATE_ANSWERS_REPEAT_HANDOVER_MESSAGE__LABEL",
|
|
759
|
-
description: "UI__NODE_EDITOR__MESSAGE__QUESTION__QUESTION__FIELDS__ESCALATE_ANSWERS_REPEAT_HANDOVER_MESSAGE__DESCRIPTION",
|
|
760
|
-
defaultValue: false,
|
|
761
|
-
condition: {
|
|
762
|
-
key: "escalateAnswersAction",
|
|
763
|
-
value: "handover"
|
|
764
|
-
}
|
|
765
|
-
},
|
|
766
745
|
{
|
|
767
746
|
key: "escalateAnswersHandoverCancelIntent",
|
|
768
747
|
type: "cognigyText",
|
|
@@ -1718,7 +1697,6 @@ DO NOT talk about other topics. Do not offer general assistance.`,
|
|
|
1718
1697
|
"escalateAnswersHandoverSendResolveEvent",
|
|
1719
1698
|
"escalateAnswersHandoverAdditionalCategoryIds",
|
|
1720
1699
|
process.env.FEATURE_USE_COGNIGY_LIVE_AGENT && constants_1.COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS.ESCALATE_ANSWERS_HANDOVER_LIVE_AGENT_INBOX_ID,
|
|
1721
|
-
process.env.FEATURE_USE_COGNIGY_LIVE_AGENT && constants_1.COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS.ESCALATE_ANSWERS_AGENT_ASSIST_INIT_MESSAGE,
|
|
1722
1700
|
process.env.FEATURE_USE_COGNIGY_LIVE_AGENT && constants_1.COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS.ESCALATE_ANSWERS_ALLOW_AGENT_INJECT,
|
|
1723
1701
|
"escalateAnswersHandoverChatwootInboxId",
|
|
1724
1702
|
"escalateAnswersHandoverSendTranscriptAsFirstMessage",
|
|
@@ -1840,7 +1818,7 @@ DO NOT talk about other topics. Do not offer general assistance.`,
|
|
|
1840
1818
|
//#endregion DescriptorFields
|
|
1841
1819
|
function: async ({ cognigy, nodeId, organisationId, config, inputOptions }) => {
|
|
1842
1820
|
var _a, _b, _c;
|
|
1843
|
-
const { say, type, validationMessage, repromptLLMProvider, repromptType = "text", repromptLLMPrompt, repromptLLMTurns, repromptLLMStream, repromptLLMStreamStopTokens, repromptSay, repromptFlowNode, repromptParseIntents, repromptParseKeyphrases, repromptAbsorbContext, validationRepeat, storeResultInContext, contextKey, storeInContactProfile, profileKey, storeDetailedResults, parseResultOnEntry, repromptCondition, maxExecutionDiff, resultLocation, skipRepromptOnIntent, onlyAcceptEscalationIntents, preventTranscript, escalateAnswersAction, escalateAnswersThreshold, escalateAnswersGotoTarget, escalateAnswersExecuteTarget, escalateAnswersGotoExecutionMode, escalateAnswersInjectedText, escalateAnswersInjectedData, escalateAnswersMessage, escalateAnswersRepromptPrevention, escalateAnswersOnce, escalateAnswersHandoverText, escalateAnswersRepeatHandoverMessage, escalateAnswersHandoverCancelIntent, escalateAnswersHandoverQuickReply, escalateAnswersHandoverChatwootInboxId, escalateAnswersHandoverLiveAgentInboxId, escalateAnswersHandoverAdditionalCategoryIds, escalateAnswersHandoverSendTranscriptAsFirstMessage, escalateAnswersHandoverSalesforcePrechatEntities, escalateAnswersHandoverSalesforcePrechatDetails, escalateAnswersHandoverGenesysLanguage, escalateAnswersHandoverGenesysSkills, escalateAnswersHandoverGenesysPriority, escalateAnswersHandoverGenesysCustomAttributes, escalateAnswersHandoverEightByEightChannelId, escalateAnswersHandoverEightByEightQueueId, escalateAnswersHandoverEightByEightJSONProps, escalateAnswersHandoverSendResolveEvent, escalateAnswersHandoverResolveBehavior,
|
|
1821
|
+
const { say, type, validationMessage, repromptLLMProvider, repromptType = "text", repromptLLMPrompt, repromptLLMTurns, repromptLLMStream, repromptLLMStreamStopTokens, repromptSay, repromptFlowNode, repromptParseIntents, repromptParseKeyphrases, repromptAbsorbContext, validationRepeat, storeResultInContext, contextKey, storeInContactProfile, profileKey, storeDetailedResults, parseResultOnEntry, repromptCondition, maxExecutionDiff, resultLocation, skipRepromptOnIntent, onlyAcceptEscalationIntents, preventTranscript, escalateAnswersAction, escalateAnswersThreshold, escalateAnswersGotoTarget, escalateAnswersExecuteTarget, escalateAnswersGotoExecutionMode, escalateAnswersInjectedText, escalateAnswersInjectedData, escalateAnswersMessage, escalateAnswersRepromptPrevention, escalateAnswersOnce, escalateAnswersHandoverText, escalateAnswersRepeatHandoverMessage, escalateAnswersHandoverCancelIntent, escalateAnswersHandoverQuickReply, escalateAnswersHandoverChatwootInboxId, escalateAnswersHandoverLiveAgentInboxId, escalateAnswersHandoverAdditionalCategoryIds, escalateAnswersHandoverSendTranscriptAsFirstMessage, escalateAnswersHandoverSalesforcePrechatEntities, escalateAnswersHandoverSalesforcePrechatDetails, escalateAnswersHandoverGenesysLanguage, escalateAnswersHandoverGenesysSkills, escalateAnswersHandoverGenesysPriority, escalateAnswersHandoverGenesysCustomAttributes, escalateAnswersHandoverEightByEightChannelId, escalateAnswersHandoverEightByEightQueueId, escalateAnswersHandoverEightByEightJSONProps, escalateAnswersHandoverSendResolveEvent, escalateAnswersHandoverResolveBehavior, escalateAnswersAllowAgentInject, escalateAnswersSendOnActiveEvent, escalateAnswersSendOnQueueEvent, escalateIntentsAction, escalateIntentsValidIntents, escalateIntentsThreshold, escalateIntentsGotoTarget, escalateIntentsExecuteTarget, escalateIntentsGotoExecutionMode, escalateIntentsInjectedText, escalateIntentsInjectedData, escalateIntentsMessage, escalateIntentsHandoverText, escalateIntentsRepeatHandoverMessage, escalateIntentsHandoverCancelIntent, escalateIntentsHandoverQuickReply, escalateIntentsHandoverChatwootInboxId, escalateIntentsHandoverLiveAgentInboxId, escalateIntentsHandoverAdditionalCategoryIds, escalateIntentHandoverSendTranscriptAsFirstMessage, escalateIntentsHandoverSalesforcePrechatEntities, escalateIntentsHandoverSalesforcePrechatDetails, escalateIntentsHandoverGenesysLanguage, escalateIntentsHandoverGenesysSkills, escalateIntentsHandoverGenesysPriority, escalateIntentsHandoverGenesysCustomAttributes, escalateIntentsHandoverEightByEightChannelId, escalateIntentsHandoverEightByEightQueueId, escalateIntentsHandoverEightByEightJSONProps, escalateIntentsRepromptPrevention, escalateIntentsHandoverSendResolveEvent, escalateIntentsHandoverResolveBehavior, escalateIntentsAgentAssistInitMessage, escalateIntentsAllowAgentInject, escalateIntentsSendOnActiveEvent, escalateIntentsSendOnQueueEvent, reconfirmationBehaviour, reconfirmationQuestion, reconfirmationQuestionReprompt, handoverOutput, cleanTextLocale, cleanDisallowedSymbols, additionalAllowedCharacters, additionalSpecialPhrases, resolveSpelledOutNumbers, resolvePhoneticAlphabet, additionalPhoneticAlphabet, replaceSpecialWords, additionalMappedSymbols, resolveSpelledOutAlphabet, resolvePhoneticCounters, contractSingleCharacters, contractNumberGroups, trimResult, runNLUAfterCleaning, overwrittenBaseAnswer } = config;
|
|
1844
1822
|
const { input, context, profile, api } = cognigy;
|
|
1845
1823
|
const rephraseWithAIParams = {
|
|
1846
1824
|
generativeAI_rephraseOutputMode: config.generativeAI_rephraseOutputMode,
|
|
@@ -1983,11 +1961,11 @@ DO NOT talk about other topics. Do not offer general assistance.`,
|
|
|
1983
1961
|
}
|
|
1984
1962
|
// output reconfirmation reprompt
|
|
1985
1963
|
if (reconfirmationQuestionReprompt) {
|
|
1986
|
-
await say_1.SAY.function({ cognigy, childConfigs: [], nodeId, organisationId, config: { handoverOutput, preventTranscript, say: { type: "text", text: [reconfirmationQuestionReprompt] } } });
|
|
1964
|
+
await say_1.SAY.function({ nodeType: "question.reconfirmation.reprompt", cognigy, childConfigs: [], nodeId, organisationId, config: { handoverOutput, preventTranscript, say: { type: "text", text: [reconfirmationQuestionReprompt] } } });
|
|
1987
1965
|
}
|
|
1988
1966
|
// output reconfirmationQuestion
|
|
1989
1967
|
const tentativeAnswerShortform = (activeQuestion === null || activeQuestion === void 0 ? void 0 : activeQuestion.tentativeAnswerShortform) || "";
|
|
1990
|
-
await say_1.SAY.function({ cognigy, childConfigs: [], nodeId, organisationId, config: { handoverOutput, preventTranscript, say: { type: "text", text: [reconfirmationQuestion.replace("[ANSWER]", tentativeAnswerShortform)] } } });
|
|
1968
|
+
await say_1.SAY.function({ nodeType: "question.reconfirmation", cognigy, childConfigs: [], nodeId, organisationId, config: { handoverOutput, preventTranscript, say: { type: "text", text: [reconfirmationQuestion.replace("[ANSWER]", tentativeAnswerShortform)] } } });
|
|
1991
1969
|
// set myself as next node and stop
|
|
1992
1970
|
api.setNextNode(nodeId);
|
|
1993
1971
|
api.stopExecution();
|
|
@@ -2053,7 +2031,7 @@ DO NOT talk about other topics. Do not offer general assistance.`,
|
|
|
2053
2031
|
if (isFirstExecution && !parseResultOnEntry) {
|
|
2054
2032
|
rephraseWithAIParams.promptType = "question";
|
|
2055
2033
|
rephraseWithAIParams.questionType = config.type;
|
|
2056
|
-
await say_1.SAY.function({ cognigy, childConfigs: [], nodeId, organisationId, config: Object.assign({ preventTranscript, say }, rephraseWithAIParams) });
|
|
2034
|
+
await say_1.SAY.function({ nodeType: "question.initial", cognigy, childConfigs: [], nodeId, organisationId, config: Object.assign({ preventTranscript, say }, rephraseWithAIParams) });
|
|
2057
2035
|
if (config.type === "date" && !config.datepicker_hidePicker) {
|
|
2058
2036
|
(0, datepickerUtils_1.showDatePicker)(cognigy, config);
|
|
2059
2037
|
}
|
|
@@ -2091,7 +2069,7 @@ DO NOT talk about other topics. Do not offer general assistance.`,
|
|
|
2091
2069
|
// remember a shortform of the given answer in the activeQuestion object
|
|
2092
2070
|
activeQuestion.tentativeAnswerShortform = (0, generateAnswerShortForm_1.generateAnswerShortForm)(type, result, cognigy.input.text);
|
|
2093
2071
|
// Output reconfirmationQuestion
|
|
2094
|
-
await say_1.SAY.function({ cognigy, childConfigs: [], nodeId, organisationId, config: { handoverOutput, preventTranscript, say: { type: "text", text: [reconfirmationQuestion.replace("[ANSWER]", activeQuestion.tentativeAnswerShortform)] } } });
|
|
2072
|
+
await say_1.SAY.function({ nodeType: "question.reconfirmation", cognigy, childConfigs: [], nodeId, organisationId, config: { handoverOutput, preventTranscript, say: { type: "text", text: [reconfirmationQuestion.replace("[ANSWER]", activeQuestion.tentativeAnswerShortform)] } } });
|
|
2095
2073
|
// remember that we are in reconfirmation mode and stop
|
|
2096
2074
|
api.setSystemContext("reconfirmationQuestionInProgress", true);
|
|
2097
2075
|
// we need to store the input, to be able to restore it afterwards
|
|
@@ -2212,6 +2190,7 @@ DO NOT talk about other topics. Do not offer general assistance.`,
|
|
|
2212
2190
|
return;
|
|
2213
2191
|
case "text":
|
|
2214
2192
|
await say_1.SAY.function({
|
|
2193
|
+
nodeType: "question.escalation",
|
|
2215
2194
|
cognigy,
|
|
2216
2195
|
childConfigs: [],
|
|
2217
2196
|
nodeId,
|
|
@@ -2257,7 +2236,6 @@ DO NOT talk about other topics. Do not offer general assistance.`,
|
|
|
2257
2236
|
eightByEightJSONProps: escalateIntentsHandoverEightByEightJSONProps || [],
|
|
2258
2237
|
sendResolveEvent: escalateIntentsHandoverSendResolveEvent,
|
|
2259
2238
|
resolveBehavior: escalateIntentsHandoverResolveBehavior,
|
|
2260
|
-
agentAssistInitMessage: escalateIntentsAgentAssistInitMessage,
|
|
2261
2239
|
allowAgentInject: escalateIntentsAllowAgentInject,
|
|
2262
2240
|
sendOnActiveEvent: escalateIntentsSendOnActiveEvent,
|
|
2263
2241
|
sendOnQueueEvent: escalateIntentsSendOnQueueEvent,
|
|
@@ -2361,6 +2339,7 @@ DO NOT talk about other topics. Do not offer general assistance.`,
|
|
|
2361
2339
|
return;
|
|
2362
2340
|
case "text":
|
|
2363
2341
|
await say_1.SAY.function({
|
|
2342
|
+
nodeType: "question.escalation",
|
|
2364
2343
|
cognigy,
|
|
2365
2344
|
childConfigs: [],
|
|
2366
2345
|
nodeId,
|
|
@@ -2406,7 +2385,6 @@ DO NOT talk about other topics. Do not offer general assistance.`,
|
|
|
2406
2385
|
eightByEightJSONProps: escalateAnswersHandoverEightByEightJSONProps || [],
|
|
2407
2386
|
sendResolveEvent: escalateAnswersHandoverSendResolveEvent,
|
|
2408
2387
|
resolveBehavior: escalateAnswersHandoverResolveBehavior,
|
|
2409
|
-
agentAssistInitMessage: escalateAnswersAgentAssistInitMessage,
|
|
2410
2388
|
allowAgentInject: escalateAnswersAllowAgentInject,
|
|
2411
2389
|
sendOnActiveEvent: escalateAnswersSendOnActiveEvent,
|
|
2412
2390
|
sendOnQueueEvent: escalateAnswersSendOnQueueEvent,
|
|
@@ -2443,7 +2421,7 @@ DO NOT talk about other topics. Do not offer general assistance.`,
|
|
|
2443
2421
|
if (sayReprompt) {
|
|
2444
2422
|
switch (repromptType) {
|
|
2445
2423
|
case "say":
|
|
2446
|
-
await say_1.SAY.function(Object.assign({ cognigy, childConfigs: [], nodeId, organisationId, config: { preventTranscript, say: repromptSay } }, rephraseWithAIParams));
|
|
2424
|
+
await say_1.SAY.function(Object.assign({ nodeType: "question.reprompt", cognigy, childConfigs: [], nodeId, organisationId, config: { preventTranscript, say: repromptSay } }, rephraseWithAIParams));
|
|
2447
2425
|
break;
|
|
2448
2426
|
case "execute":
|
|
2449
2427
|
// if a question reprompt is set to execute flow and we have just executed
|
|
@@ -2492,11 +2470,11 @@ DO NOT talk about other topics. Do not offer general assistance.`,
|
|
|
2492
2470
|
}
|
|
2493
2471
|
const repromptMessage = await api.runGenerativeAIPrompt(data, "gptPromptNode");
|
|
2494
2472
|
if (!repromptLLMStream) {
|
|
2495
|
-
await say_1.SAY.function({ cognigy, childConfigs: [], nodeId, organisationId, config: Object.assign({ preventTranscript, handoverOutput, say: { type: "text", text: [repromptMessage] } }, rephraseWithAIParams) });
|
|
2473
|
+
await say_1.SAY.function({ nodeType: "question.reprompt", cognigy, childConfigs: [], nodeId, organisationId, config: Object.assign({ preventTranscript, handoverOutput, say: { type: "text", text: [repromptMessage] } }, rephraseWithAIParams) });
|
|
2496
2474
|
}
|
|
2497
2475
|
break;
|
|
2498
2476
|
default: // this is also "text"
|
|
2499
|
-
await say_1.SAY.function({ cognigy, childConfigs: [], nodeId, organisationId, config: Object.assign({ preventTranscript, handoverOutput, say: { type: "text", text: [validationMessage] } }, rephraseWithAIParams) });
|
|
2477
|
+
await say_1.SAY.function({ nodeType: "question.reprompt", cognigy, childConfigs: [], nodeId, organisationId, config: Object.assign({ preventTranscript, handoverOutput, say: { type: "text", text: [validationMessage] } }, rephraseWithAIParams) });
|
|
2500
2478
|
}
|
|
2501
2479
|
}
|
|
2502
2480
|
/* If repeat toggle is on, also output question (and maybe datepicker) again */
|
|
@@ -2504,6 +2482,7 @@ DO NOT talk about other topics. Do not offer general assistance.`,
|
|
|
2504
2482
|
rephraseWithAIParams.promptType = "question";
|
|
2505
2483
|
rephraseWithAIParams.questionType = config.type;
|
|
2506
2484
|
await say_1.SAY.function({
|
|
2485
|
+
nodeType: "question.repeat",
|
|
2507
2486
|
cognigy,
|
|
2508
2487
|
childConfigs: [],
|
|
2509
2488
|
nodeId,
|
|
@@ -2520,6 +2499,7 @@ DO NOT talk about other topics. Do not offer general assistance.`,
|
|
|
2520
2499
|
rephraseWithAIParams.promptType = "question";
|
|
2521
2500
|
rephraseWithAIParams.questionType = config.type;
|
|
2522
2501
|
await say_1.SAY.function({
|
|
2502
|
+
nodeType: "question.initial",
|
|
2523
2503
|
cognigy,
|
|
2524
2504
|
childConfigs: [],
|
|
2525
2505
|
nodeId,
|
|
@@ -88,8 +88,8 @@ exports.SAY = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
88
88
|
type: "sayNode",
|
|
89
89
|
},
|
|
90
90
|
tags: ["basic", "message"],
|
|
91
|
-
function: async ({ cognigy, config, nodeId, organisationId }) => {
|
|
92
|
-
var _a, _b, _c, _d, _e, _f;
|
|
91
|
+
function: async ({ cognigy, config, nodeId, organisationId, nodeType }) => {
|
|
92
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
93
93
|
const { api } = cognigy;
|
|
94
94
|
const { text, loop, linear, type, _data } = config.say;
|
|
95
95
|
/*Say nodes are always forwardable */
|
|
@@ -145,28 +145,31 @@ exports.SAY = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
145
145
|
sayData._cognigy = sayData._cognigy || {};
|
|
146
146
|
sayData._cognigy._preventTranscript = true;
|
|
147
147
|
}
|
|
148
|
+
if (((_b = cognigy === null || cognigy === void 0 ? void 0 : cognigy.input) === null || _b === void 0 ? void 0 : _b.channel) === "voiceGateway2") {
|
|
149
|
+
sayData = Object.assign(Object.assign({}, sayData), { nodeType });
|
|
150
|
+
}
|
|
148
151
|
outputText = await (0, rephraseSentenceWithAi_1.rephraseSentenceWithAI)(outputText, config, api, organisationId);
|
|
149
152
|
await api.say(outputText, sayData, settings);
|
|
150
153
|
}
|
|
151
154
|
else {
|
|
152
|
-
const _cognigyDefault = (
|
|
155
|
+
const _cognigyDefault = (_c = _data === null || _data === void 0 ? void 0 : _data._cognigy) === null || _c === void 0 ? void 0 : _c._default;
|
|
153
156
|
const typeKey = "_" + type;
|
|
154
157
|
if (type === "quickReplies" || type === "buttons") {
|
|
155
|
-
if (((
|
|
158
|
+
if (((_d = _cognigyDefault === null || _cognigyDefault === void 0 ? void 0 : _cognigyDefault[typeKey]) === null || _d === void 0 ? void 0 : _d.text) && (_cognigyDefault === null || _cognigyDefault === void 0 ? void 0 : _cognigyDefault[typeKey].fallbackText)) {
|
|
156
159
|
const result = await (0, rephraseSentenceWithAi_1.rephraseMultipleSentencesWithAI)([_cognigyDefault[typeKey].text, _cognigyDefault[typeKey].fallbackText], config, api, organisationId);
|
|
157
160
|
if (result.length === 2) {
|
|
158
161
|
_cognigyDefault[typeKey].text = result[0];
|
|
159
162
|
_cognigyDefault[typeKey].fallbackText = result[1];
|
|
160
163
|
}
|
|
161
164
|
}
|
|
162
|
-
else if ((
|
|
165
|
+
else if ((_e = _cognigyDefault === null || _cognigyDefault === void 0 ? void 0 : _cognigyDefault[typeKey]) === null || _e === void 0 ? void 0 : _e.text) {
|
|
163
166
|
_cognigyDefault[typeKey].text = await (0, rephraseSentenceWithAi_1.rephraseSentenceWithAI)(_cognigyDefault[typeKey].text, config, api, organisationId);
|
|
164
167
|
}
|
|
165
|
-
else if ((
|
|
168
|
+
else if ((_f = _cognigyDefault === null || _cognigyDefault === void 0 ? void 0 : _cognigyDefault[typeKey]) === null || _f === void 0 ? void 0 : _f.fallbackText) {
|
|
166
169
|
_cognigyDefault[typeKey].fallbackText = await (0, rephraseSentenceWithAi_1.rephraseSentenceWithAI)(_cognigyDefault[typeKey].fallbackText, config, api, organisationId);
|
|
167
170
|
}
|
|
168
171
|
}
|
|
169
|
-
else if ((
|
|
172
|
+
else if ((_g = _cognigyDefault === null || _cognigyDefault === void 0 ? void 0 : _cognigyDefault[typeKey]) === null || _g === void 0 ? void 0 : _g.fallbackText) {
|
|
170
173
|
_cognigyDefault[typeKey].fallbackText = await (0, rephraseSentenceWithAi_1.rephraseSentenceWithAI)(_cognigyDefault[typeKey].fallbackText, config, api, organisationId);
|
|
171
174
|
}
|
|
172
175
|
const data = config.say;
|
|
@@ -18,10 +18,10 @@ const crypto_1 = require("crypto");
|
|
|
18
18
|
const setSessionConfig_mapper_1 = require("../../voice/mappers/setSessionConfig.mapper");
|
|
19
19
|
const setSessionConfig_mapper_2 = require("../../voice/mappers/setSessionConfig.mapper");
|
|
20
20
|
const logFullConfigToDebugMode_1 = require("../../../../helper/logFullConfigToDebugMode");
|
|
21
|
-
const transcripts_1 = require("../../../../interfaces/transcripts/transcripts");
|
|
22
21
|
const createSystemMessage_1 = require("./helpers/createSystemMessage");
|
|
23
22
|
const generateSearchPrompt_1 = require("./helpers/generateSearchPrompt");
|
|
24
23
|
const getUserMemory_1 = require("./helpers/getUserMemory");
|
|
24
|
+
const transcripts_1 = require("../../../../interfaces/transcripts/transcripts");
|
|
25
25
|
exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
26
26
|
type: "aiAgentJob",
|
|
27
27
|
defaultLabel: "AI Agent",
|
|
@@ -483,6 +483,20 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
483
483
|
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__LOG_TOKEN_COUNT__DESCRIPTION",
|
|
484
484
|
defaultValue: false
|
|
485
485
|
},
|
|
486
|
+
{
|
|
487
|
+
key: "debugLogSystemPrompt",
|
|
488
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__LOG_SYSTEM_PROMPT__LABEL",
|
|
489
|
+
type: "toggle",
|
|
490
|
+
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__LOG_SYSTEM_PROMPT__DESCRIPTION",
|
|
491
|
+
defaultValue: false
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
key: "debugLogToolDefinitions",
|
|
495
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__LOG_TOOL_DEFINITIONS__LABEL",
|
|
496
|
+
type: "toggle",
|
|
497
|
+
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__LOG_TOOL_DEFINITIONS__DESCRIPTION",
|
|
498
|
+
defaultValue: false
|
|
499
|
+
},
|
|
486
500
|
{
|
|
487
501
|
key: "debugResult",
|
|
488
502
|
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__LOG_KNOWLEDGE_RESULTS__LABEL",
|
|
@@ -815,6 +829,8 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
815
829
|
"debugConfig",
|
|
816
830
|
"debugResult",
|
|
817
831
|
"debugLogTokenCount",
|
|
832
|
+
"debugLogSystemPrompt",
|
|
833
|
+
"debugLogToolDefinitions"
|
|
818
834
|
],
|
|
819
835
|
}
|
|
820
836
|
],
|
|
@@ -835,9 +851,9 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
835
851
|
],
|
|
836
852
|
tags: ["ai", "aiAgent"],
|
|
837
853
|
function: async ({ cognigy, config, childConfigs, nodeId }) => {
|
|
838
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19;
|
|
854
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23;
|
|
839
855
|
const { api, context, input, profile, flowReferenceId } = cognigy;
|
|
840
|
-
const { aiAgent, llmProviderReferenceId, name: jobName, description: jobDescription, instructions: jobInstructions, outputImmediately, toolChoice, useStrict, memoryType, selectedProfileFields, memoryContextInjection, knowledgeSearchBehavior, knowledgeSearchTags, knowledgeSearchTagsFilterOp, knowledgeSearchAiAgentKnowledge, knowledgeSearchJobKnowledge, knowledgeSearchJobStore, knowledgeSearchGenerateSearchPrompt, knowledgeSearchTopK, timeoutInMs, maxTokens, temperature, logErrorToSystem, storeErrorInInput, errorHandling, errorHandlingGotoTarget, errorMessage, debugConfig, debugLogTokenCount, debugResult, storeLocation, contextKey, inputKey, streamStoreCopyInInput, streamStopTokens, processImages, transcriptImageHandling, sessionParams } = config;
|
|
856
|
+
const { aiAgent, llmProviderReferenceId, name: jobName, description: jobDescription, instructions: jobInstructions, outputImmediately, toolChoice, useStrict, memoryType, selectedProfileFields, memoryContextInjection, knowledgeSearchBehavior, knowledgeSearchTags, knowledgeSearchTagsFilterOp, knowledgeSearchAiAgentKnowledge, knowledgeSearchJobKnowledge, knowledgeSearchJobStore, knowledgeSearchGenerateSearchPrompt, knowledgeSearchTopK, timeoutInMs, maxTokens, temperature, logErrorToSystem, storeErrorInInput, errorHandling, errorHandlingGotoTarget, errorMessage, debugConfig, debugLogTokenCount, debugLogSystemPrompt, debugLogToolDefinitions, debugResult, storeLocation, contextKey, inputKey, streamStoreCopyInInput, streamStopTokens, processImages, transcriptImageHandling, sessionParams } = config;
|
|
841
857
|
try {
|
|
842
858
|
if (!aiAgent) {
|
|
843
859
|
throw new Error("Could not resolve AI Agent reference in AI Agent Node");
|
|
@@ -885,7 +901,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
885
901
|
throw new Error(`[VG2] Error on AI Agent Job node. Error message: ${error.message}`);
|
|
886
902
|
}
|
|
887
903
|
}
|
|
888
|
-
const
|
|
904
|
+
const _24 = profile, { profileId, accepted_gdpr, prevent_data_collection, privacy_policy } = _24, cleanedProfile = __rest(_24, ["profileId", "accepted_gdpr", "prevent_data_collection", "privacy_policy"]);
|
|
889
905
|
const userMemory = (0, getUserMemory_1.getUserMemory)(memoryType, selectedProfileFields, aiAgent, cleanedProfile);
|
|
890
906
|
/**
|
|
891
907
|
* ----- Knowledge Search Section -----
|
|
@@ -1004,6 +1020,12 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1004
1020
|
const isOnDemandKnowledgeStoreConfigured = knowledgeSearchBehavior === "onDemand" && ((knowledgeSearchAiAgentKnowledge && aiAgent.knowledgeReferenceId) || (knowledgeSearchJobKnowledge && knowledgeSearchJobStore));
|
|
1005
1021
|
// create the system Message from the AI Agent resource and this Node's config storage
|
|
1006
1022
|
const systemMessage = (0, createSystemMessage_1.createSystemMessage)(aiAgent, input, jobName, jobDescription, jobInstructions, userMemory, memoryContextInjection, isOnDemandKnowledgeStoreConfigured ? "onDemand" : "none");
|
|
1023
|
+
// Optional Debug Message for system prompt if enabled
|
|
1024
|
+
if (debugLogSystemPrompt && systemMessage.length > 0) {
|
|
1025
|
+
// Replace the Cognigy brand message in the logged prompt
|
|
1026
|
+
const debugSystemMessage = (_r = (_q = systemMessage[0]) === null || _q === void 0 ? void 0 : _q.content) === null || _r === void 0 ? void 0 : _r.replace(`${(0, createSystemMessage_1.getCognigyBrandMessage)()}\n`, "");
|
|
1027
|
+
(_s = api.logDebugMessage) === null || _s === void 0 ? void 0 : _s.call(api, debugSystemMessage, "UI__DEBUG_MODE__AI_AGENT_JOB__SYSTEM_PROMPT__HEADER");
|
|
1028
|
+
}
|
|
1007
1029
|
// Create Tools JSON
|
|
1008
1030
|
/** This is the list of tools that are used in the AI Agent Job */
|
|
1009
1031
|
const tools = [];
|
|
@@ -1072,12 +1094,12 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1072
1094
|
message: error.message,
|
|
1073
1095
|
}
|
|
1074
1096
|
: error;
|
|
1075
|
-
(
|
|
1097
|
+
(_t = api.logDebugError) === null || _t === void 0 ? void 0 : _t.call(api, `Unable to connect to MCP Server:<br>${JSON.stringify(errorDetails, null, 2)}`, child.config.name);
|
|
1076
1098
|
}
|
|
1077
1099
|
if (mcpTools) {
|
|
1078
1100
|
if (sendDebug) {
|
|
1079
1101
|
if (mcpTools.length === 0) {
|
|
1080
|
-
(
|
|
1102
|
+
(_u = api.logDebugMessage) === null || _u === void 0 ? void 0 : _u.call(api, `No tools fetched from MCP Tool "${child.config.name}".`, "MCP Tool");
|
|
1081
1103
|
}
|
|
1082
1104
|
if (mcpTools.length > 0) {
|
|
1083
1105
|
const messageLines = [`Fetched tools from MCP Tool "${child.config.name}"`];
|
|
@@ -1097,7 +1119,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1097
1119
|
});
|
|
1098
1120
|
}
|
|
1099
1121
|
});
|
|
1100
|
-
(
|
|
1122
|
+
(_v = api.logDebugMessage) === null || _v === void 0 ? void 0 : _v.call(api, messageLines.join("\n"), "MCP Tool");
|
|
1101
1123
|
}
|
|
1102
1124
|
}
|
|
1103
1125
|
const filteredMcpTools = mcpTools.filter((tool) => {
|
|
@@ -1147,6 +1169,39 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1147
1169
|
}
|
|
1148
1170
|
}
|
|
1149
1171
|
;
|
|
1172
|
+
// we only add this tool if at least one knowledge source is enabled
|
|
1173
|
+
if (isOnDemandKnowledgeStoreConfigured) {
|
|
1174
|
+
const knowledgeTool = {
|
|
1175
|
+
type: "function",
|
|
1176
|
+
function: {
|
|
1177
|
+
name: "retrieve_knowledge",
|
|
1178
|
+
description: "Find the answer to general prompts or questions searching the attached data sources. It focuses exclusively on a knowledge search and does not execute tasks like small talk, calculations, or script running.",
|
|
1179
|
+
parameters: {
|
|
1180
|
+
type: "object",
|
|
1181
|
+
properties: {
|
|
1182
|
+
generated_prompt: {
|
|
1183
|
+
type: "string",
|
|
1184
|
+
description: "Generated question including the context of the conversation (I want to know...)."
|
|
1185
|
+
},
|
|
1186
|
+
generated_buffer_phrase: {
|
|
1187
|
+
type: "string",
|
|
1188
|
+
description: "A generated delay or stalling phrase. Consider the context. Adapt to your speech style and language."
|
|
1189
|
+
},
|
|
1190
|
+
},
|
|
1191
|
+
required: ["generated_prompt", "generated_buffer_phrase"],
|
|
1192
|
+
additionalProperties: false
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
};
|
|
1196
|
+
if (useStrict) {
|
|
1197
|
+
knowledgeTool.function.strict = true;
|
|
1198
|
+
}
|
|
1199
|
+
toolNames.push(knowledgeTool.function.name + " (internal)");
|
|
1200
|
+
tools.push(knowledgeTool);
|
|
1201
|
+
}
|
|
1202
|
+
if (debugLogToolDefinitions) {
|
|
1203
|
+
(_w = api.logDebugMessage) === null || _w === void 0 ? void 0 : _w.call(api, tools, "UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_DEFINITIONS");
|
|
1204
|
+
}
|
|
1150
1205
|
// Optional Debug Message with the config
|
|
1151
1206
|
if (debugConfig) {
|
|
1152
1207
|
const messageLines = [];
|
|
@@ -1154,10 +1209,10 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1154
1209
|
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__AI_AGENT_NAME__LABEL</b> ${aiAgent.name}`);
|
|
1155
1210
|
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__JOB_NAME__LABEL</b> ${jobName}`);
|
|
1156
1211
|
// Safety settings
|
|
1157
|
-
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__SAFETY_SETTINGS_AVOID_HARMFUL_CONTENT</b> ${(
|
|
1158
|
-
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__SAFETY_SETTINGS_AVOID_UNGROUNDED_CONTENT</b> ${(
|
|
1159
|
-
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__SAFETY_SETTINGS_AVOID_COPYRIGHT_INFRINGEMENTS</b> ${(
|
|
1160
|
-
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__SAFETY_SETTINGS_PREVENT_JAILBREAK_AND_MANIPULATION</b> ${(
|
|
1212
|
+
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__SAFETY_SETTINGS_AVOID_HARMFUL_CONTENT</b> ${(_x = aiAgent === null || aiAgent === void 0 ? void 0 : aiAgent.safetySettings) === null || _x === void 0 ? void 0 : _x.avoidHarmfulContent}`);
|
|
1213
|
+
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__SAFETY_SETTINGS_AVOID_UNGROUNDED_CONTENT</b> ${(_y = aiAgent === null || aiAgent === void 0 ? void 0 : aiAgent.safetySettings) === null || _y === void 0 ? void 0 : _y.avoidUngroundedContent}`);
|
|
1214
|
+
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__SAFETY_SETTINGS_AVOID_COPYRIGHT_INFRINGEMENTS</b> ${(_z = aiAgent === null || aiAgent === void 0 ? void 0 : aiAgent.safetySettings) === null || _z === void 0 ? void 0 : _z.avoidCopyrightInfringements}`);
|
|
1215
|
+
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__SAFETY_SETTINGS_PREVENT_JAILBREAK_AND_MANIPULATION</b> ${(_0 = aiAgent === null || aiAgent === void 0 ? void 0 : aiAgent.safetySettings) === null || _0 === void 0 ? void 0 : _0.preventJailbreakAndManipulation}`);
|
|
1161
1216
|
// Tools
|
|
1162
1217
|
if (toolNames.length > 0) {
|
|
1163
1218
|
messageLines.push("<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__TOOLS__LABEL</b>");
|
|
@@ -1213,37 +1268,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1213
1268
|
messageLines.push(`UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__VOICE_SETTING__TTS_VOICE ${config.ttsVoice || 'UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__VOICE_SETTING__NOT_SET'}`);
|
|
1214
1269
|
messageLines.push(`UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__VOICE_SETTING__TTS_LABEL ${config.ttsLabel || 'UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__VOICE_SETTING__NOT_SET'}`);
|
|
1215
1270
|
messageLines.push(`UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__VOICE_SETTING__TTS_DISABLE_CACHE ${config.ttsDisableCache || 'UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__VOICE_SETTING__NOT_SET'}`);
|
|
1216
|
-
(
|
|
1217
|
-
}
|
|
1218
|
-
// keep this after the debug message since the "retrieve_knowledge" tool is implicit
|
|
1219
|
-
// we only add this tool if at least one knowledge source is enabled
|
|
1220
|
-
if (isOnDemandKnowledgeStoreConfigured) {
|
|
1221
|
-
const knowledgeTool = {
|
|
1222
|
-
type: "function",
|
|
1223
|
-
function: {
|
|
1224
|
-
name: "retrieve_knowledge",
|
|
1225
|
-
description: "Find the answer to general prompts or questions searching the attached data sources. It focuses exclusively on a knowledge search and does not execute tasks like small talk, calculations, or script running.",
|
|
1226
|
-
parameters: {
|
|
1227
|
-
type: "object",
|
|
1228
|
-
properties: {
|
|
1229
|
-
generated_prompt: {
|
|
1230
|
-
type: "string",
|
|
1231
|
-
description: "Generated question including the context of the conversation (I want to know...)."
|
|
1232
|
-
},
|
|
1233
|
-
generated_buffer_phrase: {
|
|
1234
|
-
type: "string",
|
|
1235
|
-
description: "A generated delay or stalling phrase. Consider the context. Adapt to your speech style and language."
|
|
1236
|
-
},
|
|
1237
|
-
},
|
|
1238
|
-
required: ["generated_prompt", "generated_buffer_phrase"],
|
|
1239
|
-
additionalProperties: false
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1242
|
-
};
|
|
1243
|
-
if (useStrict) {
|
|
1244
|
-
knowledgeTool.function.strict = true;
|
|
1245
|
-
}
|
|
1246
|
-
tools.push(knowledgeTool);
|
|
1271
|
+
(_1 = api.logDebugMessage) === null || _1 === void 0 ? void 0 : _1.call(api, messageLines.join("\n"), "UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__HEADER");
|
|
1247
1272
|
}
|
|
1248
1273
|
const transcript = await api.getTranscript({
|
|
1249
1274
|
limit: 50,
|
|
@@ -1257,14 +1282,14 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1257
1282
|
transcript.length > 0 &&
|
|
1258
1283
|
transcript[transcript.length - 1].role === transcripts_1.TranscriptRole.USER) {
|
|
1259
1284
|
const userInput = transcript[transcript.length - 1];
|
|
1260
|
-
const enhancedInput = `## Knowledge Source Context\nAdditional Context from the knowledge source: \n${JSON.stringify(knowledgeSearchResponseData)}\n\n\n${((
|
|
1285
|
+
const enhancedInput = `## Knowledge Source Context\nAdditional Context from the knowledge source: \n${JSON.stringify(knowledgeSearchResponseData)}\n\n\n${((_2 = userInput === null || userInput === void 0 ? void 0 : userInput.payload) === null || _2 === void 0 ? void 0 : _2.text) || input.text}`;
|
|
1261
1286
|
transcript[transcript.length - 1].payload.text = enhancedInput;
|
|
1262
1287
|
}
|
|
1263
1288
|
const isStreamingChannel = input.channel === "webchat3" || input.channel === "adminconsole";
|
|
1264
1289
|
const _messageId = (0, crypto_1.randomUUID)();
|
|
1265
1290
|
const llmPromptOptions = Object.assign(Object.assign({ prompt: "", chat: systemMessage,
|
|
1266
1291
|
// Temp fix to override the transcript if needed
|
|
1267
|
-
transcript: ((
|
|
1292
|
+
transcript: ((_3 = context === null || context === void 0 ? void 0 : context._cognigy) === null || _3 === void 0 ? void 0 : _3.transcript) ? [...context._cognigy.transcript] : transcript, detailedResults: true, timeoutInMs: timeoutInMs !== null && timeoutInMs !== void 0 ? timeoutInMs : 8000, maxTokens: maxTokens !== null && maxTokens !== void 0 ? maxTokens : 4000, temperature: temperature !== null && temperature !== void 0 ? temperature : 0.7, topP: 1, frequencyPenalty: 0, presencePenalty: 0, responseFormat: "text", stream: storeLocation === "stream", streamOnDataHandler: (text) => {
|
|
1268
1293
|
var _a;
|
|
1269
1294
|
text = isStreamingChannel ? text : text.trim();
|
|
1270
1295
|
if (text) {
|
|
@@ -1288,15 +1313,15 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1288
1313
|
};
|
|
1289
1314
|
}
|
|
1290
1315
|
// Set understood to true so that an AI Agent interaction doesn't look false in our analytics
|
|
1291
|
-
(
|
|
1316
|
+
(_4 = api.setAnalyticsData) === null || _4 === void 0 ? void 0 : _4.call(api, "understood", "true");
|
|
1292
1317
|
input.understood = true;
|
|
1293
|
-
const fullLlmResult = await ((
|
|
1318
|
+
const fullLlmResult = await ((_5 = api.runGenerativeAIPrompt) === null || _5 === void 0 ? void 0 : _5.call(api, llmPromptOptions, "aiAgent"));
|
|
1294
1319
|
const { messages } = fullLlmResult, llmResult = __rest(fullLlmResult, ["messages"]);
|
|
1295
1320
|
const llmProvider = llmResult === null || llmResult === void 0 ? void 0 : llmResult.provider;
|
|
1296
1321
|
const tokenUsage = fullLlmResult.tokenUsage;
|
|
1297
1322
|
// Send optional debug message with token usage
|
|
1298
1323
|
if (debugLogTokenCount && tokenUsage) {
|
|
1299
|
-
(
|
|
1324
|
+
(_6 = api.logDebugMessage) === null || _6 === void 0 ? void 0 : _6.call(api, tokenUsage, "UI__DEBUG_MODE__AI_AGENT_JOB__TOKEN_USAGE__HEADER");
|
|
1300
1325
|
}
|
|
1301
1326
|
// Identify if the result is a tool call
|
|
1302
1327
|
// If response is a tool call, set next node for Tools
|
|
@@ -1311,7 +1336,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1311
1336
|
isMcpToolCall = true;
|
|
1312
1337
|
}
|
|
1313
1338
|
if (mainToolCall.function.name !== "retrieve_knowledge" && toolChild === undefined) {
|
|
1314
|
-
(
|
|
1339
|
+
(_7 = api.logDebugError) === null || _7 === void 0 ? void 0 : _7.call(api, `UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__ERROR__BODY <b>${mainToolCall.function.name}</b>`, "UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__ERROR__HEADER");
|
|
1315
1340
|
}
|
|
1316
1341
|
// Add last tool call to session state for loading it from Tool Answer Node
|
|
1317
1342
|
api.updateSessionStateValues({
|
|
@@ -1319,20 +1344,21 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1319
1344
|
flow: flowReferenceId,
|
|
1320
1345
|
node: nodeId,
|
|
1321
1346
|
} }, (isMcpToolCall && {
|
|
1322
|
-
mcpServerUrl: (
|
|
1323
|
-
timeout: (
|
|
1347
|
+
mcpServerUrl: (_8 = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _8 === void 0 ? void 0 : _8.mcpServerUrl,
|
|
1348
|
+
timeout: (_9 = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _9 === void 0 ? void 0 : _9.timeout,
|
|
1324
1349
|
mcpToolNode: toolChild === null || toolChild === void 0 ? void 0 : toolChild.id,
|
|
1325
1350
|
})), { toolCall: mainToolCall }),
|
|
1326
1351
|
});
|
|
1327
1352
|
// if there are any parameters/arguments, add them to the input slots
|
|
1328
1353
|
if (mainToolCall.function.arguments) {
|
|
1329
|
-
input.aiAgent = Object.assign(Object.assign({}, input.aiAgent), { toolArgs: Object.assign(Object.assign({}, (
|
|
1354
|
+
input.aiAgent = Object.assign(Object.assign({}, input.aiAgent), { toolArgs: Object.assign(Object.assign({}, (_11 = (_10 = input.aiAgent) === null || _10 === void 0 ? void 0 : _10.toolArgs) !== null && _11 !== void 0 ? _11 : {}), mainToolCall.function.arguments) });
|
|
1330
1355
|
}
|
|
1331
1356
|
// Debug Message for Tool Calls, configured in the Tool Node
|
|
1332
|
-
if ((
|
|
1333
|
-
const
|
|
1357
|
+
if ((_12 = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _12 === void 0 ? void 0 : _12.debugMessage) {
|
|
1358
|
+
const toolId = isMcpToolCall ? mainToolCall.function.name : api.parseCognigyScriptText(toolChild.config.toolId);
|
|
1359
|
+
const messageLines = [`<b>UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__HEADER:</b> ${toolId}`];
|
|
1334
1360
|
// Arguments / Parameters Slots
|
|
1335
|
-
const slots = ((
|
|
1361
|
+
const slots = ((_13 = mainToolCall === null || mainToolCall === void 0 ? void 0 : mainToolCall.function) === null || _13 === void 0 ? void 0 : _13.arguments) && Object.keys(mainToolCall.function.arguments);
|
|
1336
1362
|
const hasSlots = slots && slots.length > 0;
|
|
1337
1363
|
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__SLOTS</b>${hasSlots ? "" : " -"}`);
|
|
1338
1364
|
if (hasSlots) {
|
|
@@ -1347,7 +1373,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1347
1373
|
messageLines.push(`- ${slot}: ${slotValueAsString}`);
|
|
1348
1374
|
});
|
|
1349
1375
|
}
|
|
1350
|
-
(
|
|
1376
|
+
(_14 = api.logDebugMessage) === null || _14 === void 0 ? void 0 : _14.call(api, messageLines.join("\n"), "UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__HEADER");
|
|
1351
1377
|
}
|
|
1352
1378
|
if (toolChild) {
|
|
1353
1379
|
api.setNextNode(toolChild.id);
|
|
@@ -1372,11 +1398,11 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1372
1398
|
}
|
|
1373
1399
|
// Optionally output the result immediately
|
|
1374
1400
|
if (llmResult.result && outputImmediately && !llmPromptOptions.stream) {
|
|
1375
|
-
await ((
|
|
1401
|
+
await ((_15 = api.output) === null || _15 === void 0 ? void 0 : _15.call(api, llmResult.result, {}));
|
|
1376
1402
|
}
|
|
1377
1403
|
else if (llmResult.finishReason && llmPromptOptions.stream) {
|
|
1378
1404
|
// send the finishReason as last output for a stream
|
|
1379
|
-
(
|
|
1405
|
+
(_16 = api.output) === null || _16 === void 0 ? void 0 : _16.call(api, "", {
|
|
1380
1406
|
_cognigy: {
|
|
1381
1407
|
_preventTranscript: true,
|
|
1382
1408
|
_messageId,
|
|
@@ -1399,7 +1425,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1399
1425
|
}
|
|
1400
1426
|
// Add response to Cognigy Input/Context for further usage
|
|
1401
1427
|
if (storeLocation === "context") {
|
|
1402
|
-
(
|
|
1428
|
+
(_17 = api.addToContext) === null || _17 === void 0 ? void 0 : _17.call(api, contextKey, llmResult, "simple");
|
|
1403
1429
|
}
|
|
1404
1430
|
else if (storeLocation === "input") {
|
|
1405
1431
|
api.addToInput(inputKey, llmResult);
|
|
@@ -1412,14 +1438,14 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1412
1438
|
const errorDetails = {
|
|
1413
1439
|
name: (error === null || error === void 0 ? void 0 : error.name) || "Error",
|
|
1414
1440
|
code: (error === null || error === void 0 ? void 0 : error.code) || (error === null || error === void 0 ? void 0 : error.httpStatusCode),
|
|
1415
|
-
message: (error === null || error === void 0 ? void 0 : error.message) || ((
|
|
1441
|
+
message: (error === null || error === void 0 ? void 0 : error.message) || ((_18 = error.originalErrorDetails) === null || _18 === void 0 ? void 0 : _18.message),
|
|
1416
1442
|
};
|
|
1417
|
-
(
|
|
1443
|
+
(_19 = api.emitEvent) === null || _19 === void 0 ? void 0 : _19.call(api, "nodeError", { nodeId, flowId: flowReferenceId, errorMessage: error });
|
|
1418
1444
|
if (logErrorToSystem) {
|
|
1419
|
-
(
|
|
1445
|
+
(_20 = api.log) === null || _20 === void 0 ? void 0 : _20.call(api, "error", JSON.stringify(errorDetails));
|
|
1420
1446
|
}
|
|
1421
1447
|
if (errorHandling !== "stop") {
|
|
1422
|
-
(
|
|
1448
|
+
(_21 = api.logDebugError) === null || _21 === void 0 ? void 0 : _21.call(api, errorDetails.message + (errorDetails.code ? ` (error code: ${errorDetails.code})` : ""), errorDetails.name);
|
|
1423
1449
|
}
|
|
1424
1450
|
if (storeErrorInInput) {
|
|
1425
1451
|
input.aiAgent = input.aiAgent || {};
|
|
@@ -1428,7 +1454,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1428
1454
|
if (errorHandling === "continue") {
|
|
1429
1455
|
// output the timeout message
|
|
1430
1456
|
if (errorMessage) {
|
|
1431
|
-
await ((
|
|
1457
|
+
await ((_22 = api.output) === null || _22 === void 0 ? void 0 : _22.call(api, errorMessage, null));
|
|
1432
1458
|
}
|
|
1433
1459
|
// Set default node as next node
|
|
1434
1460
|
const defaultChild = childConfigs.find(child => child.type === "aiAgentJobDefault");
|
|
@@ -1440,7 +1466,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1440
1466
|
if (!errorHandlingGotoTarget) {
|
|
1441
1467
|
throw new Error("GoTo Target is required");
|
|
1442
1468
|
}
|
|
1443
|
-
if (!((
|
|
1469
|
+
if (!((_23 = api.checkThink) === null || _23 === void 0 ? void 0 : _23.call(api, nodeId))) {
|
|
1444
1470
|
api.resetNextNodes();
|
|
1445
1471
|
await api.executeFlow({
|
|
1446
1472
|
flowNode: {
|