Cloud
Toolbox
AI Task

AI Task

Generative AI Task
The AI Task Card in Botpress is designed to enable users to perform tasks using generative artificial intelligence.

It is a tool for generating content using Artificial Intelligence and can be used to automate a wide range of tasks. By providing clear instructions, specific inputs, and well-named variables, users can leverage the full capabilities of this tool to improve their workflows and boost their productivity.


Generative AI Task

Task Instructions


Generative AI Task instructions

To accomplish a generative task using the AI Task Card, users will need to provide specific instructions in natural language on what they want the AI engine to generate. This can be done using the Task Instructions parameter.


Users should provide a clear and detailed description of the task they want the AI engine to perform, including any relevant constraints or guidelines that should be followed.


There is a certain date beyond which the information is not available to the AI model. You can find that date on the model you use (for example GPT-3-5 (opens in a new tab)). If you want to get around this, please use a Knowledge Base and add its answer as an input to give context to the AI Task.


AI Task Input

Generative AI Task instructions

This is the input that will be sent to the Generative AI Engine. Think of it as the problem subject. Users should be as specific as possible when providing the AI task input, as this will help the AI engine generate more accurate and relevant content. You can use multiple variants as an input - not limited to:

TypeDescription
{{event.preview}}

that will use the last value sent to the bot as input to the AI Task.

{{workflow.variableName}}

where the variableName is a variable you have previously defined in this workflow and you want to use as an input to the AI Task.

{{user.propertyName}}where the propertyName is the user property we want to use as an input to the AI Task. In addition to free text, depending on your use case and what you are trying to achieve.

To make your AI task take into account the current date, you need to include it in the input by using this code snippet that shows the current date in javascript format: Today's date: {{ new Date().toLocaleString()}}


Storing result in variables

This allows users to specify the variables where the extracted information will be stored within Botpress. It is important to choose variable names that are easy to understand and identify, as these variables will be used to reference the generated content in other parts of the Botpress workflow and it will influence the AI task on what to extract and how.

Task Example

Generative AI Task example

Example Input

By providing clear and realistic examples, you can help the AI better understand its task and be used to solve real-world problems and generate useful content. This can ultimately lead to a more successful and productive experience for users who are targeting the power of artificial intelligence in their workflows.


The Task Example allows you to provide example text that the AI Task can expect to receive from the user, as well as examples of the outputs the AI Task should generate as a response. These examples help the AI Task to better understand the instruction that was provided to it as well as its output format.

Displaying result (optional)

Generative AI Task example

You still need a content-type card to display the output of the AI Task Card if you want to.

Advanced Settings

Temperature

Temperature is a setting that controls how creative and varied the responses generated by an AI language model can be. Think of it like a dial that you can turn up or down to control how much the AI is allowed to come up with new and different responses. It ranges from 0 to 1.

When the temperature is set to 0, the AI will stick to the same answer most of the time, which can be useful for tasks that require consistency and accuracy. However, if you want more creative and varied responses, you can turn up the temperature, and the AI will come up with more diverse answers that may not always be the same.

For example, if you ask the LLM "What is your favorite animal?", with a temperature of 1 it might respond with "My favorite animal is a cat because they are cute and cuddly", but it might also generate a response like "My favorite animal is a platypus because they're such odd creatures and so unique". Both responses are consistent with the LLM's training data (which includes information about cats and platypuses), but the second response is more creative and unexpected.

In simpler terms, temperature is a way to control how much "imagination" the AI has when generating responses. A lower temperature means more consistency, while a higher temperature means more creativity and variability.

Add transition to handle failure

You can enable this option to have your bot transition to another node when an issue happens with the AI Task. The possible issues are: Request Timeout (when the AI can't answer in a timely manner), Token Overflow (when the input or the output of the task exceeds the limit) and others.

AI Prompt Chaining

Prompt chaining is connecting multiple AI Task Cards together in a workflow, where the output of one AI Task Card becomes the input for the next. This can be a powerful technique for generating complex content, as it allows users to break down a large generative task into smaller, more manageable pieces.

Other practical examples would include the following:

  • Generating a full product description by chaining together separate AI Task Cards for the product name, features, benefits, and specifications
  • Creating a personalised email campaign by chaining together AI Task Cards for recipient names, email subject lines, and body text
  • Generating a complex chatbot response by chaining together AI Task Cards for intent recognition, entity extraction, and response generation

Prompt chaining can also help to improve the accuracy and relevance of generated content, as each AI Task Card can be optimized to perform a specific task, and the output of one AI Task Card can be used to inform the input of the next.

Finally, here are some guidelines and best practices for prompt chaining effectively in Botpress:

  • Breaking down large generative tasks into smaller, more manageable pieces
  • Testing each AI Task Card individually before chaining them together
  • Ensuring that the output of each AI Task Card is formatted correctly to be used as input for the next
  • Choosing the right variables names for the extracted information so they can be easily referenced in the chain