@cognigy/rest-api-client
Version:
Cognigy REST-Client
168 lines (136 loc) • 7.12 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.flowGenerationWithDescriptionPrompt = exports.flowGenerationWithTranscriptPrompt = void 0;
const flowGenerationWithTranscriptPromptString = `Create a new bot called "@@name" based on the following transcript example between the bot and a user:
# Transcript:
@@text
Write the bot in @@lng. Consider the following list of constraints:
# Instructions:
## Do only use flow nodes of the following list. Do not use other nodes.
## The configurable parameters are listed in brackets:
- say "Say stuff and output something using {{Node.js Code}}"
- question (output: "context.variable", validation: "text|yesNo|number|email|url", options: "Option 1|Option 2|Option 3") "Ask question with {{Node.js Code}} support?"
- backendCall (output: "context.variable") "Call external API"
- code "Node.js Code"
- switch "Node.js Code"
- case
- default
- if "Node.js Code"
- then
- else
# Examples:
## Example flow in English:
- question (output: "context.email", validation: "email") "What is your email address?"
- question (output: "context.url", validation: "url") "And what is the URL?"
- 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);"
- if "context.areDomainsSame === true"
- then
- say "The domains are the same."
- else
- say "The domains are not the same."
## Example flow in German:
- say "Hallo, ich bin ein Faktenprüfer. Ich entlarve Mythen durch Fakten."
- question (output: "context.color", validation: "text", options: "rot|grün|blau") "Welche Farbe hat der Himmel?"
- switch "context.color"
- case "blau"
- say "Du hast recht, das ist eine Tatsache."
- case "rot"
- say "Ja tatsächlich, manchmal ist der Himmel sogar rot."
- default
- say "Nein, der Himmel ist tagsüber normalerweise blau."
## Example flow in Spanish:
- say "Hola, puedo conectarlo con nuestro equipo de soporte."
- question (output: "context.wantsSupport", validation: "yesNo") "¿Te gustaría contactar el soporte?"
- if "context.wantsSupport === true"
- then
- backendCall (output: "context.contactDetails") "call API to retrieve contact details of support"
- say "Aquí tienes. Por favor vea los detalles de contacto de nuestro soporte: {{context.contactDetails}}"
- else
- backendCall (output: "context.success") "call API to log decision"
# Additional information:
## Say nodes and question nodes execute Node.js in double curly braces, for example:
- say "This is a {{context.variable.toLowerCase()}}"
- question (output: "context.result", validation: "text") "Do you like {{"banana".toUpperCase()}}?"
## When using the option parameter then use human-readable text and more than one option.
## Only use a switch node when considering multiple options.
## When using a switch node then always use a default node as last resort.
## Do not use a backendCall if a Code Node can solve it.
## Dot not use "for" nodes to simulate a for-loop.
## Use a smallest amount of flow nodes possible.
## Return just a list of nodes following the required format and instructions, and nothing else.`;
exports.flowGenerationWithTranscriptPrompt = [
{
role: "system",
content: flowGenerationWithTranscriptPromptString,
},
{
role: "user",
content: "Let's start."
}
];
const flowGenerationWithDescriptionPromptString = `Create a new bot called "@@name" with the following description:
"@@text" Write the bot in @@lng. Consider the following list of constraints:
# Instructions:
## Do only use flow nodes of the following list. Do not use other nodes.
## The configurable parameters are listed in brackets:
- say "Say stuff and output something using {{Node.js Code}}"
- question (output: "context.variable", validation: "text|yesNo|number|email|url", options: "Option 1|Option 2|Option 3") "Ask question with {{Node.js Code}} support?"
- backendCall (output: "context.variable") "Call external API"
- code "Node.js Code"
- switch "Node.js Code"
- case
- default
- if "Node.js Code"
- then
- else
# Examples:
## Example flow in English:
- question (output: "context.email", validation: "email") "What is your email address?"
- question (output: "context.url", validation: "url") "And what is the URL?"
- 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);"
- if "context.areDomainsSame === true"
- then
- say "The domains are the same."
- else
- say "The domains are not the same."
## Example flow in German:
- say "Hallo, ich bin ein Faktenprüfer. Ich entlarve Mythen durch Fakten."
- question (output: "context.color", validation: "text", options: "rot|grün|blau") "Welche Farbe hat der Himmel?"
- switch "context.color"
- case "blau"
- say "Du hast recht, das ist eine Tatsache."
- case "rot"
- say "Ja tatsächlich, manchmal ist der Himmel sogar rot."
- default
- say "Nein, der Himmel ist tagsüber normalerweise blau."
## Example flow in Spanish:
- say "Hola, puedo conectarlo con nuestro equipo de soporte."
- question (output: "context.wantsSupport", validation: "yesNo") "¿Te gustaría contactar el soporte?"
- if "context.wantsSupport === true"
- then
- backendCall (output: "context.contactDetails") "call API to retrieve contact details of support"
- say "Aquí tienes. Por favor vea los detalles de contacto de nuestro soporte: {{context.contactDetails}}"
- else
- backendCall (output: "context.success") "call API to log decision"
# Additional information:
## Say nodes and question nodes execute Node.js in double curly braces, for example:
- say "This is a {{context.variable.toLowerCase()}}"
- question (output: "context.result", validation: "text") "Do you like {{"banana".toUpperCase()}}?"
## When using the option parameter then use human-readable text and more than one option.
## Only use a switch node when considering multiple options.
## When using a switch node then always use a default node as last resort.
## Do not use a backendCall if a Code Node can solve it.
## Dot not use "for" nodes to simulate a for-loop.
## Use a smallest amount of flow nodes possible.
## Return just a list of nodes following the required format and instructions, and nothing else.`;
exports.flowGenerationWithDescriptionPrompt = [
{
role: "system",
content: flowGenerationWithDescriptionPromptString,
},
{
role: "user",
content: "Let's start."
}
];
//# sourceMappingURL=flowGeneration.js.map