{"id":57444,"date":"2023-06-25T08:16:30","date_gmt":"2023-06-25T07:16:30","guid":{"rendered":"https:\/\/developer.kore.ai\/v10-1\/?p=57444"},"modified":"2024-01-19T13:29:41","modified_gmt":"2024-01-19T13:29:41","slug":"genai-prompt","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/bot-builder-tool\/dialog-task\/genai-prompt\/","title":{"rendered":"GenAI Prompt (BETA)"},"content":{"rendered":"<section class=\"l-section wpb_row height_auto\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row type_default valign_top\"><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><div class=\"ult-spacer spacer-6ae86feb46af2\" data-id=\"6ae86feb46af2\" data-height=\"10\" data-height-mobile=\"10\" data-height-tab=\"10\" data-height-tab-portrait=\"\" data-height-mobile-landscape=\"\" style=\"clear:both;display:block;\"><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<p>The GenAI Prompt lets bot developers leverage the full potential of LLM and Generative AI models to quickly build their own prompts. Developers can select a specific AI model, tweak its settings, and preview the response for the prompt. The node allows developers to creatively leverage LLMs by defining the prompt using conversation context and the response from the LLMs in defining the subsequent conversation flow.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Node_Behavior\">Node Behavior<\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"Runtime\">Runtime<\/span><\/h3>\n<p>You can work with this node like with any other node within Dialog Tasks and can invoke it within multiple tasks. During runtime, the node behaves as follows:<\/p>\n<ol>\n<li>On reaching the GenAI Prompt, the platform parses any variable used in the prompt and constructs the request using the Prompt and the Advanced Settings.<\/li>\n<li>An API call is made to the model with the request.<\/li>\n<li>The <a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/bot-builder-tool\/dialog-task\/genai-prompt\/#About_Responses\">response is stored in the context object<\/a> as part of the dialog context and can be used to define the transitions or any other part of the bot configuration.<\/li>\n<li>The platform exits from the GenAI Prompt node when a successful response is received, or the defined timeout condition is met.<\/li>\n<\/ol>\n<h2><span class=\"ez-toc-section\" id=\"Enable_the_Node\">Enable the Node<\/span><\/h2>\n<p>This node is not available by default. You can enable it for all Dialog Tasks as follows:<\/p>\n<ul>\n<li>Configure the Open AI integration and enable the GenAI Prompt feature under <b>Build<\/b> &gt; <b>Natural Language<\/b> &gt; <b>Advanced NLU Settings<\/b>. You can also select an LLM model and its settings for the features. By default, these selections are applicable across the platform for the feature. <a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/nlp\/llm-and-generative-ai\/#Enable_LLM_Features\" target=\"_blank\" rel=\"noopener noreferrer\">Learn more<\/a>.<br \/>\n<a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20230903090401\/GenAIprompt-AdvancedNLUSettings-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-59064\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20230903090401\/GenAIprompt-AdvancedNLUSettings-1.png\" alt=\"\" width=\"750\" height=\"450\" \/><\/a><\/li>\n<\/ul>\n<div class=\"alert alert-info\"><b>Note:<\/b> If you do not configure an LLM model and do not enable the GenAI Prompt feature, then the node will not be available within the Dialog Builder.<\/div>\n<p>Setting up a GenAI Prompt in a dialog task involves adding the node at the appropriate location in the dialog flow and configuring various properties of the node, as explained below.<\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<\/div><\/div><\/div><\/div><\/div><\/section><section class=\"l-section wpb_row height_auto\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row type_default valign_top\"><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><div class=\"ult-spacer spacer-6ae86feb4757c\" data-id=\"6ae86feb4757c\" data-height=\"20\" data-height-mobile=\"20\" data-height-tab=\"20\" data-height-tab-portrait=\"\" data-height-mobile-landscape=\"\" style=\"clear:both;display:block;\"><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h2><span class=\"ez-toc-section\" id=\"Add_the_Node\">Add the Node<\/span><\/h2>\n<ol>\n<li>Go to <b>Build<\/b> &gt; <b>Conversational Skills<\/b> &gt; <b>Dialog Tasks<\/b> and select the task to which you want to add the GenAI Prompt.<\/li>\n<li>Use the \u201c<b>+<\/b>&#8221; button next to the node under which you want to add the <strong>GenAI Prompt<\/strong>. Then, choose <b>GenAI Prompt<\/b>, and then click <b>New GenAI Prompt<\/b>. (For more information on adding nodes, see <a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/chatbot-overview\/using-the-dialog-builder-tool\/#Add_Nodes\" target=\"_blank\" rel=\"noopener noreferrer\">different ways to add a node<\/a>.) Alternatively, you can drag and drop the <strong>GenAI Prompt<\/strong> node to the required location on the canvas.<\/li>\n<li>The GenAI Prompt window is displayed with the <b>Component Properties<\/b> tab selected by default.<br \/>\n<a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20230903090820\/Add-GenAIPromptDialog.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-59067\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20230903090820\/Add-GenAIPromptDialog.png\" alt=\"\" width=\"800\" height=\"600\" \/><\/a><\/li>\n<\/ol>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"ult-spacer spacer-6ae86feb476ba\" data-id=\"6ae86feb476ba\" data-height=\"20\" data-height-mobile=\"20\" data-height-tab=\"20\" data-height-tab-portrait=\"\" data-height-mobile-landscape=\"\" style=\"clear:both;display:block;\"><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h2><span class=\"ez-toc-section\" id=\"Configure_the_Node\">Configure the Node<\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"Component_Properties\">Component Properties<\/span><\/h3>\n<p>The settings made within this section affect this node across all instances in all dialog tasks.<\/p>\n<p><a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20230903091225\/GenAIprompt-componentproperties.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-59070\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20230903091225\/GenAIprompt-componentproperties.png\" alt=\"\" width=\"480\" height=\"700\" \/><\/a><\/p>\n<h4>General Settings<\/h4>\n<p>In this section, you can provide <b>Name<\/b> and <b>Display Name<\/b> for the node and write your own OpenAI <b>Prompt<\/b>.<\/p>\n<ul>\n<li><b>Prompt<\/b>: A prompt allows you to define the request to be sent to the LLMs for generating a response. Some of the use cases for prompts include entity or topic extraction, rephrasing, or dynamic content generation. The prompt can have up to 2000 characters, and it can be defined using text, Context, Content, and Environment variables.<\/li>\n<li><b>Preview Response<\/b>: Check the preview of the OpenAI response for your prompt. When you click <b>Preview Response<\/b>, the Platform parses any variable used in the prompt and constructs OpenAI request using the Prompt and the Advanced Settings. If the response is not relevant, you can tweak the Prompt and the Advanced Settings to make the response better.<\/li>\n<\/ul>\n<h4>Advanced Settings<\/h4>\n<p>In this section, you can change the model and tweak its settings.<\/p>\n<p>Adjusting the settings allows you to fine-tune the model&#8217;s behavior to meet your needs. <b>The default settings work fine for most cases<\/b>. However, if required, you can tweak the settings and find the right balance for your use case.<br \/>\n<a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20230625092107\/component-properties-advanced-settings.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-57462\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20230625092107\/component-properties-advanced-settings.png\" alt=\"Set System Context, Temperature, and Max Tokens\" width=\"300\" height=\"429\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20230625092107\/component-properties-advanced-settings.png 394w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20230625092107\/component-properties-advanced-settings-210x300.png 210w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<ul>\n<li><b>Model<\/b>: The default model for which the settings are displayed. You can choose another supported mode if it\u2019s configured. If you select a non-default model, it\u2019s used for this node only. If you want to change the default model, you can select the model in the drop-down list and use the <b>Mark Default<\/b> option shown next to its name.<\/li>\n<li><b>System Context<\/b>: Add a brief description of the use case context to guide the model.<\/li>\n<li><b>Temperature<\/b>: The setting controls the randomness of the model&#8217;s output. A higher temperature, like 0.8 or above, can result in unexpected, creative, and less relevant responses. On the other hand, a lower temperature, like 0.5 or below, makes the output more focused and relevant.<\/li>\n<li><b>Max Tokens<\/b>: It indicates the total number of tokens used in the API call to the model. It affects the cost and the time taken to receive a response. A token can be as short as one character or as long as one word, depending on the text.<\/li>\n<\/ul>\n<h4>Advanced Controls<\/h4>\n<p>In this section, you can select the maximum wait time to receive a response from the LLM and decide how the bot should respond when the timeout occurs.<br \/>\n<a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20230625093415\/component-properties-advanced-controls.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-57465\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20230625093415\/component-properties-advanced-controls.png\" alt=\"Timeout settings for the node\" width=\"300\" height=\"348\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20230625093415\/component-properties-advanced-controls.png 433w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20230625093415\/component-properties-advanced-controls-258x300.png 258w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<ul>\n<li><b>Timeout<\/b>: Select the maximum wait time from the drop-down list. The timeout range can be any value between 10 to 60, the default being 10.<\/li>\n<li><b>Timeout Error Handling<\/b>: Choose how the bot should respond when the timeout occurs:\n<ul>\n<li>Close the Task and trigger Task Execution Failure Event<\/li>\n<li>Continue with the task and transition to this node; select the node from the drop-down list.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"ult-spacer spacer-6ae86feb4790c\" data-id=\"6ae86feb4790c\" data-height=\"20\" data-height-mobile=\"20\" data-height-tab=\"20\" data-height-tab-portrait=\"\" data-height-mobile-landscape=\"\" style=\"clear:both;display:block;\"><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"Instance_Properties\">Instance Properties<\/span><\/h3>\n<p>On the <b>Instance Properties<\/b> tab, you can configure the instance-specific fields for this GenAI Prompt. These settings are applicable only for this instance and will not affect any other instances of this node.<br \/>\n<a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20230903091539\/genaiprompt-instanceproperties.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-59073\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20230903091539\/genaiprompt-instanceproperties.png\" alt=\"\" width=\"500\" height=\"550\" \/><\/a><\/p>\n<h4>Custom Tags<\/h4>\n<p>In this section, you can add Custom Meta Tags to the conversation flow to profile VA-user conversations and derive business-critical insights from usage and execution metrics. You can add tags for the following:<\/p>\n<ul>\n<li><b>Message<\/b>: Define custom tags to be added to the current message in the conversation.<\/li>\n<li><b>User<\/b>: Define custom tags to be added to the user\u2019s profile information.<\/li>\n<li><b>Session<\/b>: Define custom tags to be added to the current conversation session.<\/li>\n<\/ul>\n<p>For more information on custom tags, see <a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/bot-builder-tool\/dialog-task\/custom-meta-tags\/\">Custom Meta Tags<\/a>.<\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"ult-spacer spacer-6ae86feb47a15\" data-id=\"6ae86feb47a15\" data-height=\"20\" data-height-mobile=\"20\" data-height-tab=\"20\" data-height-tab-portrait=\"\" data-height-mobile-landscape=\"\" style=\"clear:both;display:block;\"><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"Connections_Properties\">Connections Properties<\/span><\/h3>\n<p>On the <b>Connections<\/b> tab, you can set the transition properties to determine the node in the dialog task to execute next. You can write conditional statements based on the values of any Entity or Context Objects in the dialog task, or you can use intents for transitions. See <a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/bot-builder-tool\/dialog-task\/nodes-conditions\/\" target=\"_blank\" rel=\"noopener noreferrer\">Adding IF-Else Conditions to Node Connections<\/a> for a detailed setup guide.<br \/>\n<a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20230903091830\/GenAI-prompt-connections.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-59076\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20230903091830\/GenAI-prompt-connections.png\" alt=\"\" width=\"500\" height=\"650\" \/><\/a><\/p>\n<div class=\"alert alert-info\"><b>Note<\/b>: These conditions apply only for this instance and will not affect this node when used in any other dialog.<\/div>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"ult-spacer spacer-6ae86feb47acb\" data-id=\"6ae86feb47acb\" data-height=\"20\" data-height-mobile=\"20\" data-height-tab=\"20\" data-height-tab-portrait=\"\" data-height-mobile-landscape=\"\" style=\"clear:both;display:block;\"><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h2><span class=\"ez-toc-section\" id=\"About_Responses\">About Responses<\/span><\/h2>\n<p>All the responses collected are stored in context variables. For example, <code>{{context.GenerativeAINode.NodeName.properties}}<\/code>. You can define transitions using the context variables.<br \/>\nThe responses are captured in a specific format, as shown below.<\/p>\n<pre>\u201ccontext\u201d:{\r\n\"GenerativeAINode\": {\r\n    \"NodeName\": {\r\n      \"id\": \"cmpl-7UbzLTumD9ALpfa1mcpf15dK3RnWM\",\r\n      \"object\": \"text_completion\",\r\n      \"created\": 1687530223,\r\n      \"model\": \"text-davinci-003\",\r\n      \"choices\": [\r\n        {\r\n          \"text\": \"\\n\\nI'm sorry, I'm not able to provide that information. However, I would be happy to direct you to a website that may provide the information you are looking for.\",\r\n          \"index\": 0,\r\n          \"logprobs\": null,\r\n          \"finish_reason\": \"stop\"\r\n        }\r\n      ],\r\n      \"usage\": {\r\n        \"prompt_tokens\": 58,\r\n        \"completion_tokens\": 37,\r\n        \"total_tokens\": 95\r\n      },\r\n      \"1687530221473\": [\r\n        {\r\n          \"nodeId\": \"NodeName\",\r\n          \"startTime\": \"2023-06-23T14:23:42.904Z\",\r\n          \"endTime\": \"2023-06-23T14:23:46.029Z\"\r\n        }\r\n      ]\r\n    }\r\n  }\r\n}\r\n<\/pre>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"ult-spacer spacer-6ae86feb47b72\" data-id=\"6ae86feb47b72\" data-height=\"20\" data-height-mobile=\"20\" data-height-tab=\"20\" data-height-tab-portrait=\"\" data-height-mobile-landscape=\"\" style=\"clear:both;display:block;\"><\/div><\/div><\/div><\/div><\/div><\/div><\/section>\n","protected":false},"excerpt":{"rendered":"The GenAI Prompt lets bot developers leverage the full potential of LLM and Generative AI models to quickly build their own prompts. Developers can select a specific AI model, tweak its settings, and preview the response for the prompt. The node allows developers to creatively leverage LLMs by defining the prompt using conversation context and...","protected":false},"author":26,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[],"class_list":["post-57444","post","type-post","status-publish","format-standard","hentry","category-dialog-task"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/57444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/users\/26"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/comments?post=57444"}],"version-history":[{"count":34,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/57444\/revisions"}],"predecessor-version":[{"id":61028,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/57444\/revisions\/61028"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/media?parent=57444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/categories?post=57444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/tags?post=57444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}