@cognigy/rest-api-client 2025.15.1 → 2025.17.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 (76) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/build/apigroups/MetricsAPIGroup_2_0.js +10 -0
  3. package/build/apigroups/ResourcesAPIGroup_2_0.js +6 -0
  4. package/build/apigroups/SimulationAPIGroup_2_0.js +4 -0
  5. package/build/shared/charts/descriptors/data/debugMessage.js +13 -3
  6. package/build/shared/charts/descriptors/knowledgeSearch/searchExtractOutput.js +48 -49
  7. package/build/shared/charts/descriptors/logic/if/if.js +2 -2
  8. package/build/shared/charts/descriptors/logic/switch/switch.js +30 -21
  9. package/build/shared/charts/descriptors/message/question/question.js +3 -3
  10. package/build/shared/charts/descriptors/message/question/utils/validateQuestionAnswer.js +2 -2
  11. package/build/shared/charts/descriptors/nlu/generativeSlotFiller/prompt.js +31 -2
  12. package/build/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +40 -24
  13. package/build/shared/charts/descriptors/service/aiAgent/helpers/createToolDefinitions.js +4 -4
  14. package/build/shared/charts/descriptors/service/llmPrompt/LLMPromptV2.js +36 -21
  15. package/build/shared/charts/descriptors/transcripts/addTranscriptStep.js +3 -3
  16. package/build/shared/charts/descriptors/transcripts/getTranscript.js +23 -3
  17. package/build/shared/charts/descriptors/voice/mappers/setSessionConfig.mapper.js +3 -0
  18. package/build/shared/generativeAI/getPrompt.js +75 -0
  19. package/build/shared/generativeAI/utils/generativeAIPrompts.js +613 -0
  20. package/build/shared/generativeAI/utils/prompts/contextAwareUserQueryRephrasing.js +84 -0
  21. package/build/shared/interfaces/generativeAI/IGenerativeAIModels.js +2 -0
  22. package/build/shared/interfaces/messageAPI/handover.js +6 -0
  23. package/build/shared/interfaces/resources/IGetAiAgentJobsTools.js +3 -0
  24. package/build/shared/interfaces/resources/IKnowledgeDescriptor.js +38 -5
  25. package/build/shared/interfaces/resources/ILargeLanguageModel.js +16 -1
  26. package/build/shared/interfaces/restAPI/metrics/callCounter/v3.0/ICallCounterPreAggregatedValue_3_0.js +3 -0
  27. package/build/shared/interfaces/restAPI/metrics/callCounter/v3.0/IGetCallCounterOrganisationRest_3_0.js +3 -0
  28. package/build/shared/interfaces/restAPI/metrics/callCounter/v3.0/IGetCallCounterRest_3_0.js +3 -0
  29. package/build/shared/interfaces/restAPI/metrics/callCounter/v3.0/index.js +3 -0
  30. package/build/shared/interfaces/restAPI/resources/aiAgent/v2.0/IAiAgentJobNodeWithTools_2_0.js +65 -0
  31. package/build/shared/interfaces/restAPI/resources/aiAgent/v2.0/IGetAiAgentJobAndToolsRest_2_0 .js +4 -0
  32. package/build/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/IIndexKnowledgeDescriptorsRest_2_0.js +3 -0
  33. package/build/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/extension/IRunKnowledgeExtensionRest_2_0.js +3 -0
  34. package/build/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/index.js +16 -0
  35. package/build/shared/interfaces/restAPI/simulation/simulationRunBatch/IStopSimulationRunBatchRest_2_0.js +3 -0
  36. package/build/shared/interfaces/security/ICallCounterPreAggregatedValue.js +3 -0
  37. package/build/test.js +39 -0
  38. package/dist/esm/apigroups/MetricsAPIGroup_2_0.js +10 -0
  39. package/dist/esm/apigroups/ResourcesAPIGroup_2_0.js +6 -0
  40. package/dist/esm/apigroups/SimulationAPIGroup_2_0.js +4 -0
  41. package/dist/esm/shared/charts/descriptors/data/debugMessage.js +13 -3
  42. package/dist/esm/shared/charts/descriptors/knowledgeSearch/searchExtractOutput.js +48 -50
  43. package/dist/esm/shared/charts/descriptors/logic/if/if.js +2 -2
  44. package/dist/esm/shared/charts/descriptors/logic/switch/switch.js +30 -21
  45. package/dist/esm/shared/charts/descriptors/message/question/question.js +3 -3
  46. package/dist/esm/shared/charts/descriptors/message/question/utils/validateQuestionAnswer.js +4 -3
  47. package/dist/esm/shared/charts/descriptors/nlu/generativeSlotFiller/prompt.js +29 -1
  48. package/dist/esm/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +39 -23
  49. package/dist/esm/shared/charts/descriptors/service/aiAgent/helpers/createToolDefinitions.js +4 -4
  50. package/dist/esm/shared/charts/descriptors/service/llmPrompt/LLMPromptV2.js +43 -28
  51. package/dist/esm/shared/charts/descriptors/transcripts/addTranscriptStep.js +3 -3
  52. package/dist/esm/shared/charts/descriptors/transcripts/getTranscript.js +23 -3
  53. package/dist/esm/shared/charts/descriptors/voice/mappers/setSessionConfig.mapper.js +3 -0
  54. package/dist/esm/shared/generativeAI/getPrompt.js +68 -0
  55. package/dist/esm/shared/generativeAI/utils/generativeAIPrompts.js +610 -0
  56. package/dist/esm/shared/generativeAI/utils/prompts/contextAwareUserQueryRephrasing.js +81 -0
  57. package/dist/esm/shared/interfaces/generativeAI/IGenerativeAIModels.js +2 -0
  58. package/dist/esm/shared/interfaces/messageAPI/handover.js +6 -0
  59. package/dist/esm/shared/interfaces/resources/IGetAiAgentJobsTools.js +2 -0
  60. package/dist/esm/shared/interfaces/resources/IKnowledgeDescriptor.js +37 -5
  61. package/dist/esm/shared/interfaces/resources/ILargeLanguageModel.js +14 -0
  62. package/dist/esm/shared/interfaces/restAPI/management/authentication/ICreateJWTToken.js +1 -0
  63. package/dist/esm/shared/interfaces/restAPI/metrics/callCounter/v3.0/ICallCounterPreAggregatedValue_3_0.js +2 -0
  64. package/dist/esm/shared/interfaces/restAPI/metrics/callCounter/v3.0/IGetCallCounterOrganisationRest_3_0.js +2 -0
  65. package/dist/esm/shared/interfaces/restAPI/metrics/callCounter/v3.0/IGetCallCounterRest_3_0.js +2 -0
  66. package/dist/esm/shared/interfaces/restAPI/metrics/callCounter/v3.0/index.js +2 -0
  67. package/dist/esm/shared/interfaces/restAPI/resources/aiAgent/v2.0/IAiAgentJobNodeWithTools_2_0.js +65 -0
  68. package/dist/esm/shared/interfaces/restAPI/resources/aiAgent/v2.0/IGetAiAgentJobAndToolsRest_2_0 .js +3 -0
  69. package/dist/esm/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/IIndexKnowledgeDescriptorsRest_2_0.js +2 -0
  70. package/dist/esm/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/extension/IRunKnowledgeExtensionRest_2_0.js +2 -0
  71. package/dist/esm/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/index.js +2 -1
  72. package/dist/esm/shared/interfaces/restAPI/simulation/simulationRunBatch/IStopSimulationRunBatchRest_2_0.js +2 -0
  73. package/dist/esm/shared/interfaces/security/ICallCounterPreAggregatedValue.js +2 -0
  74. package/dist/esm/test.js +39 -0
  75. package/package.json +1 -1
  76. package/types/index.d.ts +299 -42
@@ -0,0 +1,610 @@
1
+ /** Prompts **/
2
+ import { contextAwareUserQueryRephrasingChatPrompt, alternativeContextAwareUserQueryRephrasingChatPrompt, } from "./prompts/contextAwareUserQueryRephrasing";
3
+ export const flowGenerationPromptWithTranscriptForGpt4oAndMini = `Create a new bot called "@@name" based on the following transcript example between the bot and a user:
4
+
5
+ # Transcript:
6
+
7
+ @@text
8
+
9
+ Write the bot in @@lng. Consider the following list of constraints:
10
+
11
+ # Instructions:
12
+
13
+ ## Do only use flow nodes of the following list. Do not use other nodes.
14
+
15
+ ## The configurable parameters are listed in brackets:
16
+ - say "Say stuff and output something using {{Node.js Code}}"
17
+ - question (output: "context.variable", validation: "text|yesNo|number|email|url", options: "Option 1|Option 2|Option 3") "Ask question with {{Node.js Code}} support?"
18
+ - backendCall (output: "context.variable") "Call external API"
19
+ - code "Node.js Code"
20
+ - switch "Node.js Code"
21
+ - case
22
+ - default
23
+ - if "Node.js Code"
24
+ - then
25
+ - else
26
+
27
+ # Examples:
28
+
29
+ ## Example flow in English:
30
+
31
+ - question (output: "context.email", validation: "email") "What is your email address?"
32
+ - question (output: "context.url", validation: "url") "And what is the URL?"
33
+ - code "function areDomainsSame(email, url) { let emailSplit = email.split('@'); let urlSplit = url.split('.'); if (emailSplit[1] === urlSplit[1]) { return true; } return false;} context.areDomainsSame = areDomainsSame(context.email, context.url);"
34
+ - if "context.areDomainsSame === true"
35
+ - then
36
+ - say "The domains are the same."
37
+ - else
38
+ - say "The domains are not the same."
39
+
40
+ ## Example flow in German:
41
+
42
+ - say "Hallo, ich bin ein Faktenprüfer. Ich entlarve Mythen durch Fakten."
43
+ - question (output: "context.color", validation: "text", options: "rot|grün|blau") "Welche Farbe hat der Himmel?"
44
+ - switch "context.color"
45
+ - case "blau"
46
+ - say "Du hast recht, das ist eine Tatsache."
47
+ - case "rot"
48
+ - say "Ja tatsächlich, manchmal ist der Himmel sogar rot."
49
+ - default
50
+ - say "Nein, der Himmel ist tagsüber normalerweise blau."
51
+
52
+ ## Example flow in Spanish:
53
+
54
+ - say "Hola, puedo conectarlo con nuestro equipo de soporte."
55
+ - question (output: "context.wantsSupport", validation: "yesNo") "¿Te gustaría contactar el soporte?"
56
+ - if "context.wantsSupport === true"
57
+ - then
58
+ - backendCall (output: "context.contactDetails") "call API to retrieve contact details of support"
59
+ - say "Aquí tienes. Por favor vea los detalles de contacto de nuestro soporte: {{context.contactDetails}}"
60
+ - else
61
+ - backendCall (output: "context.success") "call API to log decision"
62
+
63
+ # Additional information:
64
+
65
+ ## Say nodes and question nodes execute Node.js in double curly braces, for example:
66
+
67
+ - say "This is a {{context.variable.toLowerCase()}}"
68
+ - question (output: "context.result", validation: "text") "Do you like {{"banana".toUpperCase()}}?"
69
+
70
+ ## When using the option parameter then use human-readable text and more than one option.
71
+ ## Only use a switch node when considering multiple options.
72
+ ## When using a switch node then always use a default node as last resort.
73
+ ## Do not use a backendCall if a Code Node can solve it.
74
+ ## Dot not use "for" nodes to simulate a for-loop.
75
+ ## Use a smallest amount of flow nodes possible.
76
+
77
+ ## Return just a list of nodes following the required format and instructions, and nothing else.`;
78
+ export const flowGenerationPromptWithDescriptionForGpt4oAndMini = `Create a new bot called "@@name" with the following description:
79
+ "@@text" Write the bot in @@lng. Consider the following list of constraints:
80
+
81
+ # Instructions:
82
+
83
+ ## Do only use flow nodes of the following list. Do not use other nodes.
84
+
85
+ ## The configurable parameters are listed in brackets:
86
+ - say "Say stuff and output something using {{Node.js Code}}"
87
+ - question (output: "context.variable", validation: "text|yesNo|number|email|url", options: "Option 1|Option 2|Option 3") "Ask question with {{Node.js Code}} support?"
88
+ - backendCall (output: "context.variable") "Call external API"
89
+ - code "Node.js Code"
90
+ - switch "Node.js Code"
91
+ - case
92
+ - default
93
+ - if "Node.js Code"
94
+ - then
95
+ - else
96
+
97
+ # Examples:
98
+
99
+ ## Example flow in English:
100
+
101
+ - question (output: "context.email", validation: "email") "What is your email address?"
102
+ - question (output: "context.url", validation: "url") "And what is the URL?"
103
+ - code "function areDomainsSame(email, url) { let emailSplit = email.split('@'); let urlSplit = url.split('.'); if (emailSplit[1] === urlSplit[1]) { return true; } return false;} context.areDomainsSame = areDomainsSame(context.email, context.url);"
104
+ - if "context.areDomainsSame === true"
105
+ - then
106
+ - say "The domains are the same."
107
+ - else
108
+ - say "The domains are not the same."
109
+
110
+ ## Example flow in German:
111
+
112
+ - say "Hallo, ich bin ein Faktenprüfer. Ich entlarve Mythen durch Fakten."
113
+ - question (output: "context.color", validation: "text", options: "rot|grün|blau") "Welche Farbe hat der Himmel?"
114
+ - switch "context.color"
115
+ - case "blau"
116
+ - say "Du hast recht, das ist eine Tatsache."
117
+ - case "rot"
118
+ - say "Ja tatsächlich, manchmal ist der Himmel sogar rot."
119
+ - default
120
+ - say "Nein, der Himmel ist tagsüber normalerweise blau."
121
+
122
+ ## Example flow in Spanish:
123
+
124
+ - say "Hola, puedo conectarlo con nuestro equipo de soporte."
125
+ - question (output: "context.wantsSupport", validation: "yesNo") "¿Te gustaría contactar el soporte?"
126
+ - if "context.wantsSupport === true"
127
+ - then
128
+ - backendCall (output: "context.contactDetails") "call API to retrieve contact details of support"
129
+ - say "Aquí tienes. Por favor vea los detalles de contacto de nuestro soporte: {{context.contactDetails}}"
130
+ - else
131
+ - backendCall (output: "context.success") "call API to log decision"
132
+
133
+ # Additional information:
134
+
135
+ ## Say nodes and question nodes execute Node.js in double curly braces, for example:
136
+ - say "This is a {{context.variable.toLowerCase()}}"
137
+ - question (output: "context.result", validation: "text") "Do you like {{"banana".toUpperCase()}}?"
138
+
139
+ ## When using the option parameter then use human-readable text and more than one option.
140
+ ## Only use a switch node when considering multiple options.
141
+ ## When using a switch node then always use a default node as last resort.
142
+ ## Do not use a backendCall if a Code Node can solve it.
143
+ ## Dot not use "for" nodes to simulate a for-loop.
144
+ ## Use a smallest amount of flow nodes possible.
145
+
146
+ ## Return just a list of nodes following the required format and instructions, and nothing else.`;
147
+ export const flowGenerationPromptWithTranscriptForGpt35Turbo = `Create a new bot called "@@name" with the following transcript between the bot and a user: "@@text"
148
+ Write the bot in @@lng. Consider the following list of constraints:
149
+ 1. Do only use flow nodes of the following list. Do not use other nodes. The configurable parameters are listed in brackets:
150
+ - say "Say stuff and output something using {{Node.js Code}}"
151
+ - question (output: "context.variable", validation: "text|yesNo|number|email|url", options: "Option 1|Option 2|Option 3") "Ask question with {{Node.js Code}} support?"
152
+ - backendCall (output: "context.variable") "Call external API"
153
+ - code "Node.js Code"
154
+ - switch "Node.js Code"
155
+ - case
156
+ - default
157
+ - if "Node.js Code"
158
+ - then
159
+ - else
160
+ 2. Example flow in English:
161
+ - question (output: "context.email", validation: "email") "What is your email address?"
162
+ - question (output: "context.url", validation: "url") "And what is the URL?"
163
+ - code "function areDomainsSame(email, url) { let emailSplit = email.split('@'); let urlSplit = url.split('.'); if (emailSplit[1] === urlSplit[1]) { return true; } return false;} context.areDomainsSame = areDomainsSame(context.email, context.url);"
164
+ - if "context.areDomainsSame === true"
165
+ - then
166
+ - say "The domains are the same."
167
+ - else
168
+ - say "The domains are not the same."
169
+ 3. Example flow in German:
170
+ - say "Hallo, ich bin ein Faktenprüfer. Ich entlarve Mythen durch Fakten."
171
+ - question (output: "context.color", validation: "text", options: "rot|grün|blau") "Welche Farbe hat der Himmel?"
172
+ - switch "context.color"
173
+ - case "blau"
174
+ - say "Du hast recht, das ist eine Tatsache."
175
+ - case "rot"
176
+ - say "Ja tatsächlich, manchmal ist der Himmel sogar rot."
177
+ - default
178
+ - say "Nein, der Himmel ist tagsüber normalerweise blau."
179
+ 4. Example flow in Spanish:
180
+ - say "Hola, puedo conectarlo con nuestro equipo de soporte."
181
+ - question (output: "context.wantsSupport", validation: "yesNo") "¿Te gustaría contactar el soporte?"
182
+ - if "context.wantsSupport === true"
183
+ - then
184
+ - backendCall (output: "context.contactDetails") "call API to retrieve contact details of support"
185
+ - say "Aquí tienes. Por favor vea los detalles de contacto de nuestro soporte: {{context.contactDetails}}"
186
+ - else
187
+ - backendCall (output: "context.success") "call API to log decision"
188
+ 5. Say nodes and question nodes execute Node.js in double curly braces, for example:
189
+ - say "This is a {{context.variable.toLowerCase()}}"
190
+ - question (output: "context.result", validation: "text") "Do you like {{"banana".toUpperCase()}}?"
191
+ 6. When using the option parameter then use human-readable text and more than one option.
192
+ 7. Only use a switch node when considering multiple options.
193
+ 8. When using a switch node then always use a default node as last resort.
194
+ 9. Do not use a backendCall if a Code Node can solve it.
195
+ 10. Dot not use "for" nodes to simulate a for-loop.
196
+ 11. Use a smallest amount of flow nodes possible.
197
+ 12. Lets think step by step.
198
+ `;
199
+ export const flowGenerationPromptWithDescriptionForGpt35Turbo = `Create a new bot called "@@name" with the following description:
200
+ "@@text" Write the bot in @@lng. Consider the following list of constraints:
201
+ 1. Do only use flow nodes of the following list. Do not use other nodes. The configurable parameters are listed in brackets:
202
+ - say "Say stuff and output something using {{Node.js Code}}"
203
+ - question (output: "context.variable", validation: "text|yesNo|number|email|url", options: "Option 1|Option 2|Option 3") "Ask question with {{Node.js Code}} support?"
204
+ - backendCall (output: "context.variable") "Call external API"
205
+ - code "Node.js Code"
206
+ - switch "Node.js Code"
207
+ - case
208
+ - default
209
+ - if "Node.js Code"
210
+ - then
211
+ - else
212
+ 2. Example flow in English:
213
+ - question (output: "context.email", validation: "email") "What is your email address?"
214
+ - question (output: "context.url", validation: "url") "And what is the URL?"
215
+ - code "function areDomainsSame(email, url) { let emailSplit = email.split('@'); let urlSplit = url.split('.'); if (emailSplit[1] === urlSplit[1]) { return true; } return false;} context.areDomainsSame = areDomainsSame(context.email, context.url);"
216
+ - if "context.areDomainsSame === true"
217
+ - then
218
+ - say "The domains are the same."
219
+ - else
220
+ - say "The domains are not the same."
221
+ 3. Example flow in German:
222
+ - say "Hallo, ich bin ein Faktenprüfer. Ich entlarve Mythen durch Fakten."
223
+ - question (output: "context.color", validation: "text", options: "rot|grün|blau") "Welche Farbe hat der Himmel?"
224
+ - switch "context.color"
225
+ - case "blau"
226
+ - say "Du hast recht, das ist eine Tatsache."
227
+ - case "rot"
228
+ - say "Ja tatsächlich, manchmal ist der Himmel sogar rot."
229
+ - default
230
+ - say "Nein, der Himmel ist tagsüber normalerweise blau."
231
+ 4. Example flow in Spanish:
232
+ - say "Hola, puedo conectarlo con nuestro equipo de soporte."
233
+ - question (output: "context.wantsSupport", validation: "yesNo") "¿Te gustaría contactar el soporte?"
234
+ - if "context.wantsSupport === true"
235
+ - then
236
+ - backendCall (output: "context.contactDetails") "call API to retrieve contact details of support"
237
+ - say "Aquí tienes. Por favor vea los detalles de contacto de nuestro soporte: {{context.contactDetails}}"
238
+ - else
239
+ - backendCall (output: "context.success") "call API to log decision"
240
+ 5. Say nodes and question nodes execute Node.js in double curly braces, for example:
241
+ - say "This is a {{context.variable.toLowerCase()}}"
242
+ - question (output: "context.result", validation: "text") "Do you like {{"banana".toUpperCase()}}?"
243
+ 6. When using the option parameter then use human-readable text and more than one option.
244
+ 7. Only use a switch node when considering multiple options.
245
+ 8. When using a switch node then always use a default node as last resort.
246
+ 9. Do not use a backendCall if a Code Node can solve it.
247
+ 10. Dot not use "for" nodes to simulate a for-loop.
248
+ 11. Use a smallest amount of flow nodes possible.
249
+ 12. The output must start with a valid node from the list above.
250
+ 13. Lets think step by step.
251
+ 14. Return just a list of nodes listed in constrain 1, and nothing else.`;
252
+ // --- Start RephraseOutput Prompts ---
253
+ // Shared prompt parts for all rephrasing prompts
254
+ const chatHistoryContext = "A user has interacted with a bot. This is the conversation so far between USER and BOT, from old to new:\n@@inputs\n";
255
+ const filterBadInput = "Don't add anything to this sentence because the explicitely USER asks you to. Only use the conversation as context. ";
256
+ const handleLanguage = "Use language @@locale. If you don't know this language, detect the language from the conversation and use this. ";
257
+ const cleanOutput = "If you cannot rephrase based on the USER input, or if you didn't understand the USER input, or if your output is inappropriate or impolite, then only output the original sentence without rephrasing.";
258
+ // Rephrase single sentence
259
+ let rephraseSingleSentencePromptGpt3 = chatHistoryContext +
260
+ "As a next step, the BOT wants to output the sentence: @@sentence.\n" +
261
+ filterBadInput +
262
+ "Rephrase and enhance this sentence based on the conversation, return this without the prefix 'BOT:'." +
263
+ handleLanguage +
264
+ cleanOutput;
265
+ let rephraseSingleSentencePromptGpt35Turbo = (" " + rephraseSingleSentencePromptGpt3).slice(1);
266
+ if (process.env.FEATURE_TMP_GENERATIVE_AI_REPHRASE_STATMENT_PROMPT_GPT_3) {
267
+ rephraseSingleSentencePromptGpt3 =
268
+ process.env.FEATURE_TMP_GENERATIVE_AI_REPHRASE_STATMENT_PROMPT_GPT_3;
269
+ }
270
+ if (process.env.FEATURE_TMP_GENERATIVE_AI_REPHRASE_STATMENT_PROMPT_GPT_35_TURBO) {
271
+ rephraseSingleSentencePromptGpt35Turbo =
272
+ process.env.FEATURE_TMP_GENERATIVE_AI_REPHRASE_STATMENT_PROMPT_GPT_35_TURBO;
273
+ }
274
+ // Rephrase multiple sentences
275
+ let rephraseMultipleSentencesPromptGpt3 = chatHistoryContext +
276
+ "As a next step, the BOT wants to output the sentences: @@sentenceList\n" +
277
+ filterBadInput +
278
+ "Rephrase and enhance each bot output sentence, also duplicates, each one based on the conversation." +
279
+ handleLanguage +
280
+ cleanOutput +
281
+ "Output the results as a valid json array of strings, one string for each rewritten bot ouput, without the prefix 'BOT:'.";
282
+ let rephraseMultipleSentencesPromptGpt35Turbo = (" " + rephraseMultipleSentencesPromptGpt3).slice(1);
283
+ if (process.env.FEATURE_TMP_GENERATIVE_AI_REPHRASE_MULTIPLE_STATMENTs_PROMPT_GPT_3) {
284
+ rephraseMultipleSentencesPromptGpt3 =
285
+ process.env
286
+ .FEATURE_TMP_GENERATIVE_AI_REPHRASE_MULTIPLE_STATMENTs_PROMPT_GPT_3;
287
+ }
288
+ if (process.env
289
+ .FEATURE_TMP_GENERATIVE_AI_REPHRASE_MULTIPLE_STATMENTs_PROMPT_GPT_35_TURBO) {
290
+ rephraseMultipleSentencesPromptGpt35Turbo =
291
+ process.env
292
+ .FEATURE_TMP_GENERATIVE_AI_REPHRASE_MULTIPLE_STATMENTs_PROMPT_GPT_35_TURBO;
293
+ }
294
+ // Rephrase question
295
+ let rephraseQuestionPromptGpt3 = chatHistoryContext +
296
+ "The BOT wants to ask this question to the USER: @@question.\n" +
297
+ filterBadInput +
298
+ "Based on the conversation, rephrase this question without changing the topic of the question or the expected answer type @@expectedAnswer. Return this, without the prefix 'BOT:'.\n" +
299
+ handleLanguage +
300
+ cleanOutput;
301
+ let rephraseQuestionPromptGpt35Turbo = (" " + rephraseQuestionPromptGpt3).slice(1);
302
+ if (process.env.FEATURE_TMP_GENERATIVE_AI_REPHRASE_QUESTION_PROMPT_GPT_3) {
303
+ rephraseQuestionPromptGpt3 =
304
+ process.env.FEATURE_TMP_GENERATIVE_AI_REPHRASE_QUESTION_PROMPT_GPT_3;
305
+ }
306
+ if (process.env.FEATURE_TMP_GENERATIVE_AI_REPHRASE_QUESTION_PROMPT_GPT_35_TURBO) {
307
+ rephraseQuestionPromptGpt35Turbo =
308
+ process.env.FEATURE_TMP_GENERATIVE_AI_REPHRASE_QUESTION_PROMPT_GPT_35_TURBO;
309
+ }
310
+ // Rephrase reprompted question
311
+ let rephraseQuestionRepromptPromptGpt3 = chatHistoryContext +
312
+ "The BOT asked: @@question\n" +
313
+ "The USER answered: @@answer.\n" +
314
+ "If the answer is inappropriate, then stop and just say: @@reprompt" +
315
+ "The BOT did not understand this, because the expected answer is @@expectedAnswer." +
316
+ "As a next step, the BOT wants to output: @@reprompt\n" +
317
+ "Based on the conversation, rephrase and enhance this sentence and return it, without the prefix 'BOT:'.\n" +
318
+ handleLanguage +
319
+ cleanOutput;
320
+ let rephraseQuestionRepromptPromptGpt35Turbo = (" " + rephraseQuestionRepromptPromptGpt3).slice(1);
321
+ if (process.env.FEATURE_TMP_GENERATIVE_AI_REPHRASE_REPROMPT_QUESTION_PROMPT_GPT_3) {
322
+ rephraseQuestionRepromptPromptGpt3 =
323
+ process.env
324
+ .FEATURE_TMP_GENERATIVE_AI_REPHRASE_REPROMPT_QUESTION_PROMPT_GPT_3;
325
+ }
326
+ if (process.env
327
+ .FEATURE_TMP_GENERATIVE_AI_REPHRASE_REPROMPT_QUESTION_PROMPT_GPT_35_TURBO) {
328
+ rephraseQuestionRepromptPromptGpt35Turbo =
329
+ process.env
330
+ .FEATURE_TMP_GENERATIVE_AI_REPHRASE_REPROMPT_QUESTION_PROMPT_GPT_35_TURBO;
331
+ }
332
+ // --- End RephraseOutput Prompts ---
333
+ export const SENTENCE_GENERATION_PROMPT_UNIVERSAL = `For NLU model intent '@@name'<description> with the description '@@description'</description>. Create @@noOfSentencesToGenerate varied sentences other than the given examples<language> in @@language</language>. Return nothing but a JSON array of strings.\n<default-reply>Also, consider framing the sentences like a user question that a human would answer: @@defaultReply.\n</default-reply><example-sentences>Examples: @@exampleSentences \n</example-sentences>`;
334
+ export const GENERATE_ADAPTIVE_CARD_PROMPT_UNIVERSAL = `Create an adaptiveCard based on the description: "@@description" in @@language. Return nothing but the Adaptive Card JSON object. Your Adaptive Card should accurately reflect the requirements described in the description, while still adhering to the Adaptive Card JSON specification.`;
335
+ export const MODIFY_ADAPTIVE_CARD_PROMPT_UNIVERSAL = `Please modify the @@lastOutput Adaptive Card JSON based on the provided instruction "@@description". Return nothing but the Adaptive Card JSON object. The language of the Adaptive Card text should be @@language. Your modified Adaptive Card should accurately reflect the changes described in the description, while still adhering to the Adaptive Card JSON specification.`;
336
+ export const LEXICON_GENERATION_PROMPT_UNIVERSAL = 'For the NLU model lexicon with the title "@@name" and the description "@@description",' +
337
+ ' generate @@lexiconEntries varied words in "@@lng".@@synonymInstructions' +
338
+ '\n\nRespond with a valid JSON with the format following the example: `@@example`';
339
+ export const LEXICON_GENERATION_PROMPT_SYNONYM_INSTRUCTIONS = " For each word, also list all known synonyms. The number of synonyms for each word does not have to be the same.";
340
+ export const LEXICON_GENERATION_RESPONSE_EXAMPLE = '[{"word": "test","synonyms": ["trial","attempt"]},{"word": "demo","synonyms": ["proof of concept"]}]';
341
+ export const LEXICON_GENERATION_RESPONSE_EXAMPLE_NO_SYNONYMS = '[{"word": "test"},{"word": "demo"}]';
342
+ export const generativeAIPrompts = {
343
+ "default": {
344
+ answerExtraction: {
345
+ contextAwareUserQueryRephrasing: contextAwareUserQueryRephrasingChatPrompt
346
+ },
347
+ },
348
+ "claude-3-haiku-20240307": {
349
+ answerExtraction: {
350
+ contextAwareUserQueryRephrasing: alternativeContextAwareUserQueryRephrasingChatPrompt
351
+ },
352
+ },
353
+ "amazon.nova-micro-v1:0": {
354
+ answerExtraction: {
355
+ contextAwareUserQueryRephrasing: alternativeContextAwareUserQueryRephrasingChatPrompt
356
+ },
357
+ },
358
+ "pixtral-12b-2409": {
359
+ answerExtraction: {
360
+ contextAwareUserQueryRephrasing: alternativeContextAwareUserQueryRephrasingChatPrompt
361
+ },
362
+ },
363
+ "gpt-4o-mini": {
364
+ intentSentenceGeneration: {
365
+ messages: [
366
+ {
367
+ role: "user",
368
+ content: SENTENCE_GENERATION_PROMPT_UNIVERSAL,
369
+ },
370
+ ],
371
+ },
372
+ generateNodeOutput: {
373
+ text: {
374
+ messages: [
375
+ {
376
+ role: "user",
377
+ content: 'Create @@noOfSentencesToGenerate unique sentences based on the description: "@@description" in @@language and return them as a pipe-separated string.',
378
+ },
379
+ ],
380
+ },
381
+ adaptiveCard: {
382
+ messages: [
383
+ {
384
+ role: "user",
385
+ content: GENERATE_ADAPTIVE_CARD_PROMPT_UNIVERSAL,
386
+ },
387
+ ],
388
+ },
389
+ editAdaptiveCard: {
390
+ messages: [
391
+ {
392
+ role: "user",
393
+ content: MODIFY_ADAPTIVE_CARD_PROMPT_UNIVERSAL,
394
+ },
395
+ ],
396
+ },
397
+ },
398
+ lexiconGeneration: {
399
+ messages: [
400
+ {
401
+ role: "user",
402
+ content: LEXICON_GENERATION_PROMPT_UNIVERSAL,
403
+ },
404
+ ],
405
+ },
406
+ flowGeneration: {
407
+ description: {
408
+ messages: [
409
+ {
410
+ role: "user",
411
+ content: flowGenerationPromptWithDescriptionForGpt4oAndMini,
412
+ },
413
+ ],
414
+ },
415
+ transcript: {
416
+ messages: [
417
+ {
418
+ role: "user",
419
+ content: flowGenerationPromptWithTranscriptForGpt4oAndMini,
420
+ },
421
+ ],
422
+ },
423
+ },
424
+ aiEnhancedOutputs: {
425
+ multipleSentences: {
426
+ messages: [
427
+ { role: "user", content: rephraseMultipleSentencesPromptGpt35Turbo },
428
+ ],
429
+ },
430
+ singleSentence: {
431
+ messages: [
432
+ { role: "user", content: rephraseSingleSentencePromptGpt35Turbo },
433
+ ],
434
+ },
435
+ question: {
436
+ messages: [{ role: "user", content: rephraseQuestionPromptGpt35Turbo }],
437
+ },
438
+ questionReprompt: {
439
+ messages: [
440
+ { role: "user", content: rephraseQuestionRepromptPromptGpt35Turbo },
441
+ ],
442
+ },
443
+ },
444
+ },
445
+ "gpt-4o": {
446
+ intentSentenceGeneration: {
447
+ messages: [
448
+ {
449
+ role: "user",
450
+ content: SENTENCE_GENERATION_PROMPT_UNIVERSAL,
451
+ },
452
+ ],
453
+ },
454
+ generateNodeOutput: {
455
+ text: {
456
+ messages: [
457
+ {
458
+ role: "user",
459
+ content: 'Create @@noOfSentencesToGenerate unique sentences based on the description: "@@description" in @@language and return them as a pipe-separated string.',
460
+ },
461
+ ],
462
+ },
463
+ adaptiveCard: {
464
+ messages: [
465
+ {
466
+ role: "user",
467
+ content: GENERATE_ADAPTIVE_CARD_PROMPT_UNIVERSAL,
468
+ },
469
+ ],
470
+ },
471
+ editAdaptiveCard: {
472
+ messages: [
473
+ {
474
+ role: "user",
475
+ content: MODIFY_ADAPTIVE_CARD_PROMPT_UNIVERSAL,
476
+ },
477
+ ],
478
+ },
479
+ },
480
+ lexiconGeneration: {
481
+ messages: [
482
+ {
483
+ role: "user",
484
+ content: LEXICON_GENERATION_PROMPT_UNIVERSAL,
485
+ },
486
+ ],
487
+ },
488
+ flowGeneration: {
489
+ description: {
490
+ messages: [
491
+ {
492
+ role: "user",
493
+ content: flowGenerationPromptWithDescriptionForGpt4oAndMini,
494
+ },
495
+ ],
496
+ },
497
+ transcript: {
498
+ messages: [
499
+ {
500
+ role: "user",
501
+ content: flowGenerationPromptWithTranscriptForGpt4oAndMini,
502
+ },
503
+ ],
504
+ },
505
+ },
506
+ aiEnhancedOutputs: {
507
+ multipleSentences: {
508
+ messages: [
509
+ { role: "user", content: rephraseMultipleSentencesPromptGpt35Turbo },
510
+ ],
511
+ },
512
+ singleSentence: {
513
+ messages: [
514
+ { role: "user", content: rephraseSingleSentencePromptGpt35Turbo },
515
+ ],
516
+ },
517
+ question: {
518
+ messages: [{ role: "user", content: rephraseQuestionPromptGpt35Turbo }],
519
+ },
520
+ questionReprompt: {
521
+ messages: [
522
+ { role: "user", content: rephraseQuestionRepromptPromptGpt35Turbo },
523
+ ],
524
+ },
525
+ },
526
+ },
527
+ "gpt-3.5-turbo": {
528
+ intentSentenceGeneration: {
529
+ messages: [
530
+ {
531
+ role: "user",
532
+ content: SENTENCE_GENERATION_PROMPT_UNIVERSAL,
533
+ },
534
+ ],
535
+ },
536
+ generateNodeOutput: {
537
+ text: {
538
+ messages: [
539
+ {
540
+ role: "user",
541
+ content: 'Create @@noOfSentencesToGenerate unique sentences based on the description: "@@description" in @@language and return them as a pipe-separated string.',
542
+ },
543
+ ],
544
+ },
545
+ adaptiveCard: {
546
+ messages: [
547
+ {
548
+ role: "user",
549
+ content: GENERATE_ADAPTIVE_CARD_PROMPT_UNIVERSAL,
550
+ },
551
+ ],
552
+ },
553
+ editAdaptiveCard: {
554
+ messages: [
555
+ {
556
+ role: "user",
557
+ content: MODIFY_ADAPTIVE_CARD_PROMPT_UNIVERSAL,
558
+ },
559
+ ],
560
+ },
561
+ },
562
+ lexiconGeneration: {
563
+ messages: [
564
+ {
565
+ role: "user",
566
+ content: LEXICON_GENERATION_PROMPT_UNIVERSAL,
567
+ },
568
+ ],
569
+ },
570
+ flowGeneration: {
571
+ description: {
572
+ messages: [
573
+ {
574
+ role: "user",
575
+ content: flowGenerationPromptWithDescriptionForGpt35Turbo,
576
+ },
577
+ ],
578
+ },
579
+ transcript: {
580
+ messages: [
581
+ {
582
+ role: "user",
583
+ content: flowGenerationPromptWithTranscriptForGpt35Turbo,
584
+ },
585
+ ],
586
+ },
587
+ },
588
+ aiEnhancedOutputs: {
589
+ multipleSentences: {
590
+ messages: [
591
+ { role: "user", content: rephraseMultipleSentencesPromptGpt35Turbo },
592
+ ],
593
+ },
594
+ singleSentence: {
595
+ messages: [
596
+ { role: "user", content: rephraseSingleSentencePromptGpt35Turbo },
597
+ ],
598
+ },
599
+ question: {
600
+ messages: [{ role: "user", content: rephraseQuestionPromptGpt35Turbo }],
601
+ },
602
+ questionReprompt: {
603
+ messages: [
604
+ { role: "user", content: rephraseQuestionRepromptPromptGpt35Turbo },
605
+ ],
606
+ },
607
+ },
608
+ },
609
+ };
610
+ //# sourceMappingURL=generativeAIPrompts.js.map