@cognigy/rest-api-client 2025.18.0 → 2025.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/authentication/AuthenticationAPI.js +1 -1
  3. package/build/authentication/OAuth2/OAuth2Authentication.js +12 -9
  4. package/build/connector/AxiosAdapter.js +6 -2
  5. package/build/shared/charts/descriptors/service/GPTPrompt.js +2 -2
  6. package/build/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +2 -2
  7. package/build/shared/charts/descriptors/service/llmPrompt/LLMPromptV2.js +2 -2
  8. package/build/shared/charts/descriptors/voice/mappers/transfer.mapper.js +20 -6
  9. package/build/shared/charts/descriptors/voicegateway2/nodes/transfer.js +39 -3
  10. package/build/shared/generativeAI/utils/generativeAIPrompts.js +17 -446
  11. package/build/shared/generativeAI/utils/prompts/flowGeneration.js +168 -0
  12. package/build/shared/generativeAI/utils/prompts/generateNodeOutput.js +39 -0
  13. package/build/shared/generativeAI/utils/prompts/intentSentenceGeneration.js +15 -0
  14. package/build/shared/generativeAI/utils/prompts/lexiconGeneration.js +22 -0
  15. package/build/shared/interfaces/generativeAI/IGenerativeAIModels.js +4 -0
  16. package/build/shared/interfaces/handover.js +3 -1
  17. package/build/shared/interfaces/messageAPI/endpoints.js +5 -2
  18. package/build/shared/interfaces/resources/INodeDescriptorSet.js +87 -77
  19. package/dist/esm/authentication/AuthenticationAPI.js +1 -1
  20. package/dist/esm/authentication/OAuth2/OAuth2Authentication.js +12 -9
  21. package/dist/esm/connector/AxiosAdapter.js +6 -2
  22. package/dist/esm/shared/charts/descriptors/service/GPTPrompt.js +1 -1
  23. package/dist/esm/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +1 -1
  24. package/dist/esm/shared/charts/descriptors/service/llmPrompt/LLMPromptV2.js +1 -1
  25. package/dist/esm/shared/charts/descriptors/voice/mappers/transfer.mapper.js +20 -6
  26. package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/transfer.js +39 -3
  27. package/dist/esm/shared/generativeAI/utils/generativeAIPrompts.js +16 -445
  28. package/dist/esm/shared/generativeAI/utils/prompts/flowGeneration.js +165 -0
  29. package/dist/esm/shared/generativeAI/utils/prompts/generateNodeOutput.js +36 -0
  30. package/dist/esm/shared/generativeAI/utils/prompts/intentSentenceGeneration.js +12 -0
  31. package/dist/esm/shared/generativeAI/utils/prompts/lexiconGeneration.js +19 -0
  32. package/dist/esm/shared/interfaces/generativeAI/IGenerativeAIModels.js +4 -0
  33. package/dist/esm/shared/interfaces/handover.js +3 -1
  34. package/dist/esm/shared/interfaces/messageAPI/endpoints.js +5 -2
  35. package/dist/esm/shared/interfaces/resources/INodeDescriptorSet.js +88 -78
  36. package/package.json +1 -1
  37. package/types/index.d.ts +1045 -1016
@@ -1,267 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generativeAIPrompts = exports.LEXICON_GENERATION_RESPONSE_EXAMPLE_NO_SYNONYMS = exports.LEXICON_GENERATION_RESPONSE_EXAMPLE = exports.LEXICON_GENERATION_PROMPT_SYNONYM_INSTRUCTIONS = exports.LEXICON_GENERATION_PROMPT_UNIVERSAL = exports.MODIFY_ADAPTIVE_CARD_PROMPT_UNIVERSAL = exports.GENERATE_ADAPTIVE_CARD_PROMPT_UNIVERSAL = exports.SENTENCE_GENERATION_PROMPT_UNIVERSAL = exports.flowGenerationPromptWithDescriptionForGpt35Turbo = exports.flowGenerationPromptWithTranscriptForGpt35Turbo = exports.flowGenerationPromptWithDescriptionForGpt4oAndMini = exports.flowGenerationPromptWithTranscriptForGpt4oAndMini = void 0;
3
+ exports.generativeAIPrompts = void 0;
4
4
  /** Prompts **/
5
5
  const contextAwareUserQueryRephrasing_1 = require("./prompts/contextAwareUserQueryRephrasing");
6
6
  const rephraseSentences_1 = require("./prompts/rephraseSentences");
7
- exports.flowGenerationPromptWithTranscriptForGpt4oAndMini = `Create a new bot called "@@name" based on the following transcript example between the bot and a user:
8
-
9
- # Transcript:
10
-
11
- @@text
12
-
13
- Write the bot in @@lng. Consider the following list of constraints:
14
-
15
- # Instructions:
16
-
17
- ## Do only use flow nodes of the following list. Do not use other nodes.
18
-
19
- ## The configurable parameters are listed in brackets:
20
- - say "Say stuff and output something using {{Node.js Code}}"
21
- - question (output: "context.variable", validation: "text|yesNo|number|email|url", options: "Option 1|Option 2|Option 3") "Ask question with {{Node.js Code}} support?"
22
- - backendCall (output: "context.variable") "Call external API"
23
- - code "Node.js Code"
24
- - switch "Node.js Code"
25
- - case
26
- - default
27
- - if "Node.js Code"
28
- - then
29
- - else
30
-
31
- # Examples:
32
-
33
- ## Example flow in English:
34
-
35
- - question (output: "context.email", validation: "email") "What is your email address?"
36
- - question (output: "context.url", validation: "url") "And what is the URL?"
37
- - 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);"
38
- - if "context.areDomainsSame === true"
39
- - then
40
- - say "The domains are the same."
41
- - else
42
- - say "The domains are not the same."
43
-
44
- ## Example flow in German:
45
-
46
- - say "Hallo, ich bin ein Faktenprüfer. Ich entlarve Mythen durch Fakten."
47
- - question (output: "context.color", validation: "text", options: "rot|grün|blau") "Welche Farbe hat der Himmel?"
48
- - switch "context.color"
49
- - case "blau"
50
- - say "Du hast recht, das ist eine Tatsache."
51
- - case "rot"
52
- - say "Ja tatsächlich, manchmal ist der Himmel sogar rot."
53
- - default
54
- - say "Nein, der Himmel ist tagsüber normalerweise blau."
55
-
56
- ## Example flow in Spanish:
57
-
58
- - say "Hola, puedo conectarlo con nuestro equipo de soporte."
59
- - question (output: "context.wantsSupport", validation: "yesNo") "¿Te gustaría contactar el soporte?"
60
- - if "context.wantsSupport === true"
61
- - then
62
- - backendCall (output: "context.contactDetails") "call API to retrieve contact details of support"
63
- - say "Aquí tienes. Por favor vea los detalles de contacto de nuestro soporte: {{context.contactDetails}}"
64
- - else
65
- - backendCall (output: "context.success") "call API to log decision"
66
-
67
- # Additional information:
68
-
69
- ## Say nodes and question nodes execute Node.js in double curly braces, for example:
70
-
71
- - say "This is a {{context.variable.toLowerCase()}}"
72
- - question (output: "context.result", validation: "text") "Do you like {{"banana".toUpperCase()}}?"
73
-
74
- ## When using the option parameter then use human-readable text and more than one option.
75
- ## Only use a switch node when considering multiple options.
76
- ## When using a switch node then always use a default node as last resort.
77
- ## Do not use a backendCall if a Code Node can solve it.
78
- ## Dot not use "for" nodes to simulate a for-loop.
79
- ## Use a smallest amount of flow nodes possible.
80
-
81
- ## Return just a list of nodes following the required format and instructions, and nothing else.`;
82
- exports.flowGenerationPromptWithDescriptionForGpt4oAndMini = `Create a new bot called "@@name" with the following description:
83
- "@@text" Write the bot in @@lng. Consider the following list of constraints:
84
-
85
- # Instructions:
86
-
87
- ## Do only use flow nodes of the following list. Do not use other nodes.
88
-
89
- ## The configurable parameters are listed in brackets:
90
- - say "Say stuff and output something using {{Node.js Code}}"
91
- - question (output: "context.variable", validation: "text|yesNo|number|email|url", options: "Option 1|Option 2|Option 3") "Ask question with {{Node.js Code}} support?"
92
- - backendCall (output: "context.variable") "Call external API"
93
- - code "Node.js Code"
94
- - switch "Node.js Code"
95
- - case
96
- - default
97
- - if "Node.js Code"
98
- - then
99
- - else
100
-
101
- # Examples:
102
-
103
- ## Example flow in English:
104
-
105
- - question (output: "context.email", validation: "email") "What is your email address?"
106
- - question (output: "context.url", validation: "url") "And what is the URL?"
107
- - 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);"
108
- - if "context.areDomainsSame === true"
109
- - then
110
- - say "The domains are the same."
111
- - else
112
- - say "The domains are not the same."
113
-
114
- ## Example flow in German:
115
-
116
- - say "Hallo, ich bin ein Faktenprüfer. Ich entlarve Mythen durch Fakten."
117
- - question (output: "context.color", validation: "text", options: "rot|grün|blau") "Welche Farbe hat der Himmel?"
118
- - switch "context.color"
119
- - case "blau"
120
- - say "Du hast recht, das ist eine Tatsache."
121
- - case "rot"
122
- - say "Ja tatsächlich, manchmal ist der Himmel sogar rot."
123
- - default
124
- - say "Nein, der Himmel ist tagsüber normalerweise blau."
125
-
126
- ## Example flow in Spanish:
127
-
128
- - say "Hola, puedo conectarlo con nuestro equipo de soporte."
129
- - question (output: "context.wantsSupport", validation: "yesNo") "¿Te gustaría contactar el soporte?"
130
- - if "context.wantsSupport === true"
131
- - then
132
- - backendCall (output: "context.contactDetails") "call API to retrieve contact details of support"
133
- - say "Aquí tienes. Por favor vea los detalles de contacto de nuestro soporte: {{context.contactDetails}}"
134
- - else
135
- - backendCall (output: "context.success") "call API to log decision"
136
-
137
- # Additional information:
138
-
139
- ## Say nodes and question nodes execute Node.js in double curly braces, for example:
140
- - say "This is a {{context.variable.toLowerCase()}}"
141
- - question (output: "context.result", validation: "text") "Do you like {{"banana".toUpperCase()}}?"
142
-
143
- ## When using the option parameter then use human-readable text and more than one option.
144
- ## Only use a switch node when considering multiple options.
145
- ## When using a switch node then always use a default node as last resort.
146
- ## Do not use a backendCall if a Code Node can solve it.
147
- ## Dot not use "for" nodes to simulate a for-loop.
148
- ## Use a smallest amount of flow nodes possible.
149
-
150
- ## Return just a list of nodes following the required format and instructions, and nothing else.`;
151
- exports.flowGenerationPromptWithTranscriptForGpt35Turbo = `Create a new bot called "@@name" with the following transcript between the bot and a user: "@@text"
152
- Write the bot in @@lng. Consider the following list of constraints:
153
- 1. Do only use flow nodes of the following list. Do not use other nodes. The configurable parameters are listed in brackets:
154
- - say "Say stuff and output something using {{Node.js Code}}"
155
- - question (output: "context.variable", validation: "text|yesNo|number|email|url", options: "Option 1|Option 2|Option 3") "Ask question with {{Node.js Code}} support?"
156
- - backendCall (output: "context.variable") "Call external API"
157
- - code "Node.js Code"
158
- - switch "Node.js Code"
159
- - case
160
- - default
161
- - if "Node.js Code"
162
- - then
163
- - else
164
- 2. Example flow in English:
165
- - question (output: "context.email", validation: "email") "What is your email address?"
166
- - question (output: "context.url", validation: "url") "And what is the URL?"
167
- - 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);"
168
- - if "context.areDomainsSame === true"
169
- - then
170
- - say "The domains are the same."
171
- - else
172
- - say "The domains are not the same."
173
- 3. Example flow in German:
174
- - say "Hallo, ich bin ein Faktenprüfer. Ich entlarve Mythen durch Fakten."
175
- - question (output: "context.color", validation: "text", options: "rot|grün|blau") "Welche Farbe hat der Himmel?"
176
- - switch "context.color"
177
- - case "blau"
178
- - say "Du hast recht, das ist eine Tatsache."
179
- - case "rot"
180
- - say "Ja tatsächlich, manchmal ist der Himmel sogar rot."
181
- - default
182
- - say "Nein, der Himmel ist tagsüber normalerweise blau."
183
- 4. Example flow in Spanish:
184
- - say "Hola, puedo conectarlo con nuestro equipo de soporte."
185
- - question (output: "context.wantsSupport", validation: "yesNo") "¿Te gustaría contactar el soporte?"
186
- - if "context.wantsSupport === true"
187
- - then
188
- - backendCall (output: "context.contactDetails") "call API to retrieve contact details of support"
189
- - say "Aquí tienes. Por favor vea los detalles de contacto de nuestro soporte: {{context.contactDetails}}"
190
- - else
191
- - backendCall (output: "context.success") "call API to log decision"
192
- 5. Say nodes and question nodes execute Node.js in double curly braces, for example:
193
- - say "This is a {{context.variable.toLowerCase()}}"
194
- - question (output: "context.result", validation: "text") "Do you like {{"banana".toUpperCase()}}?"
195
- 6. When using the option parameter then use human-readable text and more than one option.
196
- 7. Only use a switch node when considering multiple options.
197
- 8. When using a switch node then always use a default node as last resort.
198
- 9. Do not use a backendCall if a Code Node can solve it.
199
- 10. Dot not use "for" nodes to simulate a for-loop.
200
- 11. Use a smallest amount of flow nodes possible.
201
- 12. Lets think step by step.
202
- `;
203
- exports.flowGenerationPromptWithDescriptionForGpt35Turbo = `Create a new bot called "@@name" with the following description:
204
- "@@text" Write the bot in @@lng. Consider the following list of constraints:
205
- 1. Do only use flow nodes of the following list. Do not use other nodes. The configurable parameters are listed in brackets:
206
- - say "Say stuff and output something using {{Node.js Code}}"
207
- - question (output: "context.variable", validation: "text|yesNo|number|email|url", options: "Option 1|Option 2|Option 3") "Ask question with {{Node.js Code}} support?"
208
- - backendCall (output: "context.variable") "Call external API"
209
- - code "Node.js Code"
210
- - switch "Node.js Code"
211
- - case
212
- - default
213
- - if "Node.js Code"
214
- - then
215
- - else
216
- 2. Example flow in English:
217
- - question (output: "context.email", validation: "email") "What is your email address?"
218
- - question (output: "context.url", validation: "url") "And what is the URL?"
219
- - 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);"
220
- - if "context.areDomainsSame === true"
221
- - then
222
- - say "The domains are the same."
223
- - else
224
- - say "The domains are not the same."
225
- 3. Example flow in German:
226
- - say "Hallo, ich bin ein Faktenprüfer. Ich entlarve Mythen durch Fakten."
227
- - question (output: "context.color", validation: "text", options: "rot|grün|blau") "Welche Farbe hat der Himmel?"
228
- - switch "context.color"
229
- - case "blau"
230
- - say "Du hast recht, das ist eine Tatsache."
231
- - case "rot"
232
- - say "Ja tatsächlich, manchmal ist der Himmel sogar rot."
233
- - default
234
- - say "Nein, der Himmel ist tagsüber normalerweise blau."
235
- 4. Example flow in Spanish:
236
- - say "Hola, puedo conectarlo con nuestro equipo de soporte."
237
- - question (output: "context.wantsSupport", validation: "yesNo") "¿Te gustaría contactar el soporte?"
238
- - if "context.wantsSupport === true"
239
- - then
240
- - backendCall (output: "context.contactDetails") "call API to retrieve contact details of support"
241
- - say "Aquí tienes. Por favor vea los detalles de contacto de nuestro soporte: {{context.contactDetails}}"
242
- - else
243
- - backendCall (output: "context.success") "call API to log decision"
244
- 5. Say nodes and question nodes execute Node.js in double curly braces, for example:
245
- - say "This is a {{context.variable.toLowerCase()}}"
246
- - question (output: "context.result", validation: "text") "Do you like {{"banana".toUpperCase()}}?"
247
- 6. When using the option parameter then use human-readable text and more than one option.
248
- 7. Only use a switch node when considering multiple options.
249
- 8. When using a switch node then always use a default node as last resort.
250
- 9. Do not use a backendCall if a Code Node can solve it.
251
- 10. Dot not use "for" nodes to simulate a for-loop.
252
- 11. Use a smallest amount of flow nodes possible.
253
- 12. The output must start with a valid node from the list above.
254
- 13. Lets think step by step.
255
- 14. Return just a list of nodes listed in constrain 1, and nothing else.`;
256
- exports.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>`;
257
- exports.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.`;
258
- exports.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.`;
259
- exports.LEXICON_GENERATION_PROMPT_UNIVERSAL = 'For the NLU model lexicon with the title "@@name" and the description "@@description",' +
260
- ' generate @@lexiconEntries varied words in "@@lng".@@synonymInstructions' +
261
- '\n\nRespond with a valid JSON with the format following the example: `@@example`';
262
- exports.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.";
263
- exports.LEXICON_GENERATION_RESPONSE_EXAMPLE = '[{"word": "test","synonyms": ["trial","attempt"]},{"word": "demo","synonyms": ["proof of concept"]}]';
264
- exports.LEXICON_GENERATION_RESPONSE_EXAMPLE_NO_SYNONYMS = '[{"word": "test"},{"word": "demo"}]';
7
+ const flowGeneration_1 = require("./prompts/flowGeneration");
8
+ const intentSentenceGeneration_1 = require("./prompts/intentSentenceGeneration");
9
+ const lexiconGeneration_1 = require("./prompts/lexiconGeneration");
10
+ const generateNodeOutput_1 = require("./prompts/generateNodeOutput");
265
11
  exports.generativeAIPrompts = {
266
12
  "default": {
267
13
  answerExtraction: {
@@ -273,6 +19,17 @@ exports.generativeAIPrompts = {
273
19
  question: rephraseSentences_1.rephraseQuestionPrompt,
274
20
  questionReprompt: rephraseSentences_1.rephraseQuestionRepromptPrompt
275
21
  },
22
+ intentSentenceGeneration: intentSentenceGeneration_1.intentSentenceGenerationPrompt,
23
+ generateNodeOutput: {
24
+ text: generateNodeOutput_1.generateNodeOutputTextPrompt,
25
+ adaptiveCard: generateNodeOutput_1.generateNodeOutputCreateAdaptiveCardPrompt,
26
+ editAdaptiveCard: generateNodeOutput_1.generateNodeOutputModifyAdaptiveCardPrompt,
27
+ },
28
+ lexiconGeneration: lexiconGeneration_1.lexiconGenerationPrompt,
29
+ flowGeneration: {
30
+ description: flowGeneration_1.flowGenerationWithDescriptionPrompt,
31
+ transcript: flowGeneration_1.flowGenerationWithTranscriptPrompt
32
+ }
276
33
  },
277
34
  "claude-3-haiku-20240307": {
278
35
  answerExtraction: {
@@ -288,192 +45,6 @@ exports.generativeAIPrompts = {
288
45
  answerExtraction: {
289
46
  contextAwareUserQueryRephrasing: contextAwareUserQueryRephrasing_1.alternativeContextAwareUserQueryRephrasingChatPrompt
290
47
  },
291
- },
292
- "gpt-4o-mini": {
293
- intentSentenceGeneration: {
294
- messages: [
295
- {
296
- role: "user",
297
- content: exports.SENTENCE_GENERATION_PROMPT_UNIVERSAL,
298
- },
299
- ],
300
- },
301
- generateNodeOutput: {
302
- text: {
303
- messages: [
304
- {
305
- role: "user",
306
- content: 'Create @@noOfSentencesToGenerate unique sentences based on the description: "@@description" in @@language and return them as a pipe-separated string.',
307
- },
308
- ],
309
- },
310
- adaptiveCard: {
311
- messages: [
312
- {
313
- role: "user",
314
- content: exports.GENERATE_ADAPTIVE_CARD_PROMPT_UNIVERSAL,
315
- },
316
- ],
317
- },
318
- editAdaptiveCard: {
319
- messages: [
320
- {
321
- role: "user",
322
- content: exports.MODIFY_ADAPTIVE_CARD_PROMPT_UNIVERSAL,
323
- },
324
- ],
325
- },
326
- },
327
- lexiconGeneration: {
328
- messages: [
329
- {
330
- role: "user",
331
- content: exports.LEXICON_GENERATION_PROMPT_UNIVERSAL,
332
- },
333
- ],
334
- },
335
- flowGeneration: {
336
- description: {
337
- messages: [
338
- {
339
- role: "user",
340
- content: exports.flowGenerationPromptWithDescriptionForGpt4oAndMini,
341
- },
342
- ],
343
- },
344
- transcript: {
345
- messages: [
346
- {
347
- role: "user",
348
- content: exports.flowGenerationPromptWithTranscriptForGpt4oAndMini,
349
- },
350
- ],
351
- },
352
- }
353
- },
354
- "gpt-4o": {
355
- intentSentenceGeneration: {
356
- messages: [
357
- {
358
- role: "user",
359
- content: exports.SENTENCE_GENERATION_PROMPT_UNIVERSAL,
360
- },
361
- ],
362
- },
363
- generateNodeOutput: {
364
- text: {
365
- messages: [
366
- {
367
- role: "user",
368
- content: 'Create @@noOfSentencesToGenerate unique sentences based on the description: "@@description" in @@language and return them as a pipe-separated string.',
369
- },
370
- ],
371
- },
372
- adaptiveCard: {
373
- messages: [
374
- {
375
- role: "user",
376
- content: exports.GENERATE_ADAPTIVE_CARD_PROMPT_UNIVERSAL,
377
- },
378
- ],
379
- },
380
- editAdaptiveCard: {
381
- messages: [
382
- {
383
- role: "user",
384
- content: exports.MODIFY_ADAPTIVE_CARD_PROMPT_UNIVERSAL,
385
- },
386
- ],
387
- },
388
- },
389
- lexiconGeneration: {
390
- messages: [
391
- {
392
- role: "user",
393
- content: exports.LEXICON_GENERATION_PROMPT_UNIVERSAL,
394
- },
395
- ],
396
- },
397
- flowGeneration: {
398
- description: {
399
- messages: [
400
- {
401
- role: "user",
402
- content: exports.flowGenerationPromptWithDescriptionForGpt4oAndMini,
403
- },
404
- ],
405
- },
406
- transcript: {
407
- messages: [
408
- {
409
- role: "user",
410
- content: exports.flowGenerationPromptWithTranscriptForGpt4oAndMini,
411
- },
412
- ],
413
- },
414
- }
415
- },
416
- "gpt-3.5-turbo": {
417
- intentSentenceGeneration: {
418
- messages: [
419
- {
420
- role: "user",
421
- content: exports.SENTENCE_GENERATION_PROMPT_UNIVERSAL,
422
- },
423
- ],
424
- },
425
- generateNodeOutput: {
426
- text: {
427
- messages: [
428
- {
429
- role: "user",
430
- content: 'Create @@noOfSentencesToGenerate unique sentences based on the description: "@@description" in @@language and return them as a pipe-separated string.',
431
- },
432
- ],
433
- },
434
- adaptiveCard: {
435
- messages: [
436
- {
437
- role: "user",
438
- content: exports.GENERATE_ADAPTIVE_CARD_PROMPT_UNIVERSAL,
439
- },
440
- ],
441
- },
442
- editAdaptiveCard: {
443
- messages: [
444
- {
445
- role: "user",
446
- content: exports.MODIFY_ADAPTIVE_CARD_PROMPT_UNIVERSAL,
447
- },
448
- ],
449
- },
450
- },
451
- lexiconGeneration: {
452
- messages: [
453
- {
454
- role: "user",
455
- content: exports.LEXICON_GENERATION_PROMPT_UNIVERSAL,
456
- },
457
- ],
458
- },
459
- flowGeneration: {
460
- description: {
461
- messages: [
462
- {
463
- role: "user",
464
- content: exports.flowGenerationPromptWithDescriptionForGpt35Turbo,
465
- },
466
- ],
467
- },
468
- transcript: {
469
- messages: [
470
- {
471
- role: "user",
472
- content: exports.flowGenerationPromptWithTranscriptForGpt35Turbo,
473
- },
474
- ],
475
- },
476
- }
477
- },
48
+ }
478
49
  };
479
50
  //# sourceMappingURL=generativeAIPrompts.js.map
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.flowGenerationWithDescriptionPrompt = exports.flowGenerationWithTranscriptPrompt = void 0;
4
+ const flowGenerationWithTranscriptPromptString = `Create a new bot called "@@name" based on the following transcript example between the bot and a user:
5
+
6
+ # Transcript:
7
+
8
+ @@text
9
+
10
+ Write the bot in @@lng. Consider the following list of constraints:
11
+
12
+ # Instructions:
13
+
14
+ ## Do only use flow nodes of the following list. Do not use other nodes.
15
+
16
+ ## The configurable parameters are listed in brackets:
17
+ - say "Say stuff and output something using {{Node.js Code}}"
18
+ - question (output: "context.variable", validation: "text|yesNo|number|email|url", options: "Option 1|Option 2|Option 3") "Ask question with {{Node.js Code}} support?"
19
+ - backendCall (output: "context.variable") "Call external API"
20
+ - code "Node.js Code"
21
+ - switch "Node.js Code"
22
+ - case
23
+ - default
24
+ - if "Node.js Code"
25
+ - then
26
+ - else
27
+
28
+ # Examples:
29
+
30
+ ## Example flow in English:
31
+
32
+ - question (output: "context.email", validation: "email") "What is your email address?"
33
+ - question (output: "context.url", validation: "url") "And what is the URL?"
34
+ - 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);"
35
+ - if "context.areDomainsSame === true"
36
+ - then
37
+ - say "The domains are the same."
38
+ - else
39
+ - say "The domains are not the same."
40
+
41
+ ## Example flow in German:
42
+
43
+ - say "Hallo, ich bin ein Faktenprüfer. Ich entlarve Mythen durch Fakten."
44
+ - question (output: "context.color", validation: "text", options: "rot|grün|blau") "Welche Farbe hat der Himmel?"
45
+ - switch "context.color"
46
+ - case "blau"
47
+ - say "Du hast recht, das ist eine Tatsache."
48
+ - case "rot"
49
+ - say "Ja tatsächlich, manchmal ist der Himmel sogar rot."
50
+ - default
51
+ - say "Nein, der Himmel ist tagsüber normalerweise blau."
52
+
53
+ ## Example flow in Spanish:
54
+
55
+ - say "Hola, puedo conectarlo con nuestro equipo de soporte."
56
+ - question (output: "context.wantsSupport", validation: "yesNo") "¿Te gustaría contactar el soporte?"
57
+ - if "context.wantsSupport === true"
58
+ - then
59
+ - backendCall (output: "context.contactDetails") "call API to retrieve contact details of support"
60
+ - say "Aquí tienes. Por favor vea los detalles de contacto de nuestro soporte: {{context.contactDetails}}"
61
+ - else
62
+ - backendCall (output: "context.success") "call API to log decision"
63
+
64
+ # Additional information:
65
+
66
+ ## Say nodes and question nodes execute Node.js in double curly braces, for example:
67
+
68
+ - say "This is a {{context.variable.toLowerCase()}}"
69
+ - question (output: "context.result", validation: "text") "Do you like {{"banana".toUpperCase()}}?"
70
+
71
+ ## When using the option parameter then use human-readable text and more than one option.
72
+ ## Only use a switch node when considering multiple options.
73
+ ## When using a switch node then always use a default node as last resort.
74
+ ## Do not use a backendCall if a Code Node can solve it.
75
+ ## Dot not use "for" nodes to simulate a for-loop.
76
+ ## Use a smallest amount of flow nodes possible.
77
+
78
+ ## Return just a list of nodes following the required format and instructions, and nothing else.`;
79
+ exports.flowGenerationWithTranscriptPrompt = [
80
+ {
81
+ role: "system",
82
+ content: flowGenerationWithTranscriptPromptString,
83
+ },
84
+ {
85
+ role: "user",
86
+ content: "Let's start."
87
+ }
88
+ ];
89
+ const flowGenerationWithDescriptionPromptString = `Create a new bot called "@@name" with the following description:
90
+ "@@text" Write the bot in @@lng. Consider the following list of constraints:
91
+
92
+ # Instructions:
93
+
94
+ ## Do only use flow nodes of the following list. Do not use other nodes.
95
+
96
+ ## The configurable parameters are listed in brackets:
97
+ - say "Say stuff and output something using {{Node.js Code}}"
98
+ - question (output: "context.variable", validation: "text|yesNo|number|email|url", options: "Option 1|Option 2|Option 3") "Ask question with {{Node.js Code}} support?"
99
+ - backendCall (output: "context.variable") "Call external API"
100
+ - code "Node.js Code"
101
+ - switch "Node.js Code"
102
+ - case
103
+ - default
104
+ - if "Node.js Code"
105
+ - then
106
+ - else
107
+
108
+ # Examples:
109
+
110
+ ## Example flow in English:
111
+
112
+ - question (output: "context.email", validation: "email") "What is your email address?"
113
+ - question (output: "context.url", validation: "url") "And what is the URL?"
114
+ - 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);"
115
+ - if "context.areDomainsSame === true"
116
+ - then
117
+ - say "The domains are the same."
118
+ - else
119
+ - say "The domains are not the same."
120
+
121
+ ## Example flow in German:
122
+
123
+ - say "Hallo, ich bin ein Faktenprüfer. Ich entlarve Mythen durch Fakten."
124
+ - question (output: "context.color", validation: "text", options: "rot|grün|blau") "Welche Farbe hat der Himmel?"
125
+ - switch "context.color"
126
+ - case "blau"
127
+ - say "Du hast recht, das ist eine Tatsache."
128
+ - case "rot"
129
+ - say "Ja tatsächlich, manchmal ist der Himmel sogar rot."
130
+ - default
131
+ - say "Nein, der Himmel ist tagsüber normalerweise blau."
132
+
133
+ ## Example flow in Spanish:
134
+
135
+ - say "Hola, puedo conectarlo con nuestro equipo de soporte."
136
+ - question (output: "context.wantsSupport", validation: "yesNo") "¿Te gustaría contactar el soporte?"
137
+ - if "context.wantsSupport === true"
138
+ - then
139
+ - backendCall (output: "context.contactDetails") "call API to retrieve contact details of support"
140
+ - say "Aquí tienes. Por favor vea los detalles de contacto de nuestro soporte: {{context.contactDetails}}"
141
+ - else
142
+ - backendCall (output: "context.success") "call API to log decision"
143
+
144
+ # Additional information:
145
+
146
+ ## Say nodes and question nodes execute Node.js in double curly braces, for example:
147
+ - say "This is a {{context.variable.toLowerCase()}}"
148
+ - question (output: "context.result", validation: "text") "Do you like {{"banana".toUpperCase()}}?"
149
+
150
+ ## When using the option parameter then use human-readable text and more than one option.
151
+ ## Only use a switch node when considering multiple options.
152
+ ## When using a switch node then always use a default node as last resort.
153
+ ## Do not use a backendCall if a Code Node can solve it.
154
+ ## Dot not use "for" nodes to simulate a for-loop.
155
+ ## Use a smallest amount of flow nodes possible.
156
+
157
+ ## Return just a list of nodes following the required format and instructions, and nothing else.`;
158
+ exports.flowGenerationWithDescriptionPrompt = [
159
+ {
160
+ role: "system",
161
+ content: flowGenerationWithDescriptionPromptString,
162
+ },
163
+ {
164
+ role: "user",
165
+ content: "Let's start."
166
+ }
167
+ ];
168
+ //# sourceMappingURL=flowGeneration.js.map