AI - AI Tasks

Many of Flow XO's AI capabilities are powered by Open AI's large language models. We provide raw access to Open AI's chat models using our Complete Chat ( https://support.flowxo.com/article/319-complete-chat) task. However, configuring this task to get the results you want can be tricky and require careful experimentation (called Prompt Engineering). Our AI Tasks action provides a small but growing list of predefined prompts that are easier to configure and user. 

Complete Text

The "Complete Text" template offers a super-simple way of using generative AI with any kind of prompt you like. Just provide a prompt, and an optional user message, and let the AI work it's magic.

Template - the AI template to use. For Complete Text, choose..."Complete Text"

Prompt -Tell the AI about the work you want it to perform. For example "write a short essay about frogs" or "Determine the main topics in the following user supplied text"

User Message - An optional message provided by your user. Usually you will fill this in with the message variable from the trigger. If your prompt is completely self contained and does not require user input, you can skip this setting.

Additional Instructions - add some information here about your agent and what rules you want it to follow. Gpt4 is better at following your rules than the other models, but they will all consider your instructions to some extent. This is optional, but it is recommended to at least introduce your bot and what role it is playing.

Recent chat history - how many recent chat messages to include. NOTE: If you set this value greater than zero, you likely don't need to use the Question field if the previous step was a messaging trigger or an Ask a Question as the users question will already be in the history. If you set this value to 0, you must use the question field so that the AI knows what question to answer.

AI Connection - which AI connection to use. Paid users can use their own Open AI connections to reduce cost. All users can use Flow XO AI credits.

Model - which Open AI model to use. Choices are ChatGPT (fastest, cheapest), ChatGPT 16k (include more reference data, more expensive), and Gpt4 (slower, more expensive, but far more accurate and better at following instructions). Experiment with them all to see which fits your use base best.

Max tokens - the most tokens the AI should use to generate a response. Smaller numbers result in shorter answers and faster responses. Larger numbers result in more detailed answer.

Temperature - the randomness or creativity of the AI. For typical Q&A tasks, usually 0 is the best setting, but experiment to see what works best for your actual usage.

Automatically send response - Whether or not the response should immediately be sent to the user as a new message. if there is not active chat (for instance this task is executed inside a webhook) this setting will not have any effect. 

Show typing indicator - Whether or not to show a typing indicator as soon as the AI starts processing. This is useful because AI responses often take many seconds to complete. This setting only works on the channels that support the bot starting a typing indicator (currently web and telegram).

Answer Question

The "Answer Question" AI task allows you to automatically respond to users questions based on some predefined reference data about your business, a certain topic, or anything else. Please note that we offer a more robust Q&A feature that can read all your content from your website or knowledge base and answer hallucination free questions automatically, while citing references and links, via our Knowledge Base feature. You can also implement an AI driven FAQ based on predefined questions and answers using our Intent Detection feature. However, this task is still useful in the following circumstances:

  • You have a limited amount of reference data about your business or subject, and don't need an entire knowledge base to help the AI answer user questions. This task is simpler and easier to use if you have a limited set of reference data.
  • You are using one or more knowledge bases, but for certain topics, you want the AI to have a limited set of information to draw from to increase answer quality. In this case you might combine all three Q&A technologies - intent detection to determine the topic the user has a question about, the knowledge base to answer general purpose questions, and this Answer Question task to answer certain targeted questions. As an example, imagine your customers often have questions about pricing. Your knowledge base, which is based on your entire website, sometimes provides unhelpful or incomplete answers about pricing because it is referring to documents in your knowledge base that are about the 'payments' feature of your app, and not your actual pricing plans. 

    The solution is to detect when a user has a pricing question using an intent detector, and send them to a flow that uses an Answer Question template from this task where you provide only specific, targeted information about your pricing plans. All other questions are directed instead to your Knowledge Base.

Template - the AI template to use. For Answer Question, choose..."Answer Question"

Question - the question from the user. If you are using Recent chat history (below) to include recent messages to and from the bot, you probably want to leave this blank, because the question from the user will already be in the chat history as the last message.

Reference Data - this is the "training" you will provide the AI so that it can answer your users questions. How much reference data is allowed is based on the model you are using. ChatGPT can accept up to 4k tokens (3000-4000 words). ChatGPT 16k can accept up to 16k tokens, or 13-16k words. Gpt4 accepts 8k tokens, or 6-8k words.

Additional Instructions - add some information here about your agent and what rules you want it to follow. Gpt4 is better at following your rules than the other models, but they will all consider your instructions to some extent. This is optional, but it is recommended to at least introduce your bot and what role it is playing.

Recent chat history - how many recent chat messages to include. NOTE: If you set this value greater than zero, you likely don't need to use the Question field if the previous step was a messaging trigger or an Ask a Question as the users question will already be in the history. If you set this value to 0, you must use the question field so that the AI knows what question to answer.

AI Connection - which AI connection to use. Paid users can use their own Open AI connections to reduce cost. All users can use Flow XO AI credits.

Model - which Open AI model to use. Choices are ChatGPT (fastest, cheapest), ChatGPT 16k (include more reference data, more expensive), and Gpt4 (slower, more expensive, but far more accurate and better at following instructions). Experiment with them all to see which fits your use base best.

Max tokens - the most tokens the AI should use to generate a response. Smaller numbers result in shorter answers and faster responses. Larger numbers result in more detailed answer.

Temperature - the randomness or creativity of the AI. For typical Q&A tasks, usually 0 is the best setting, but experiment to see what works best for your actual usage.

Automatically send response - Whether or not the response should immediately be sent to the user as a new message. if there is not active chat (for instance this task is executed inside a webhook) this setting will not have any effect. 

Show typing indicator - Whether or not to show a typing indicator as soon as the AI starts processing. This is useful because AI responses often take many seconds to complete. This setting only works on the channels that support the bot starting a typing indicator (currently web and telegram).

---

Here is a conversation with the task configured above:

Summarize Text

The "Summarize Text" template does just what it says. It summarizes a piece of text. You can also use this in conjunction with the Recent chat history setting to summarize the recent chat history. In this example we ask the Summarize Text task to summarize the first chapter of The Great Gatsby, in poetry form.

Template - the AI template to use, in the case "Summarize Text"

Input Text - The text you want summarized

Additional Instructions - any additional instructions or rules you want the AI to follow

Recent chat history - only useful for summarization if you want the chat history itself summarized

AI Connection  - Which AI connection to use

Model  - The Open AI model you want to use

Max Tokens  - the maximum number of tokens to generate in the summary

Temperature - randomness or creativity level of the AI

Automatically send response - Whether or not the response should immediately be sent to the user as a new message. if there is not active chat (for instance this task is executed inside a webhook) this setting will not have any effect. 

Show typing indicator - Whether or not to show a typing indicator as soon as the AI starts processing. This is useful because AI responses often take many seconds to complete. This setting only works on the channels that support the bot starting a typing indicator (currently web and telegram).

The result of the task as configured above look like this:

Summarizing Chat History

You can use the Summarize Text task to quickly and easily summarize the chat history of your user using the 'Recent chat history' setting. You can configure it like this:

Because you're passing in the chat history, all you need in the input text is an instruction to summarize the previous conversation. You should then include a number of chat messages.

We ran this task after a conversation with our Bean Q&A Bot from the first part of the article, and we got this result:

That's it! We hope you build great things with these easy to use AI templates!

Happy flowing...

Still need help? Contact Us Contact Us