Open AI / ChatGPT

Using Open AI with Flow XO (GPT-3, ChatGPT, Dall-E)

We have published an extensive write up / tutorial on the best ways to use Open AI and Flow XO together. Check it out:

If you want to jump right in, please install this sample:

OpenAI is a leading AI research organization that has developed a suite of powerful AI tools that can help businesses grow and thrive. With OpenAI, you can leverage cutting-edge AI technologies to automate tasks, improve customer service, and gain valuable insights into your business. OpenAI's suite of tools includes GPT-3, a powerful language model that can generate human-like text, DALL-E, an image generation tool that can create unique images from text descriptions, and Codex, an AI-powered code generation tool that can help developers write code faster and more efficiently. By using OpenAI's tools, you can automate repetitive tasks, improve customer service with chatbots that can understand natural language, and gain valuable insights into your business with advanced analytics and data processing. With OpenAI, the possibilities are endless, and your business can grow and thrive in ways you never thought possible.

ChatGPT is a powerful AI tool developed by OpenAI that can help businesses improve their customer service, automate repetitive tasks, and increase efficiency. With ChatGPT, you can create chatbots that can understand natural language and respond to customer inquiries in real-time. This means that you can provide your customers with instant support, 24/7, without the need for human intervention. Additionally, ChatGPT can help you automate tasks such as appointment scheduling, order processing, and more, freeing up your team to focus on more important tasks. By using ChatGPT, you can improve your customer experience, increase productivity, and ultimately grow your business.

Flow XO integrates with OpenAI and provides access to their GPT-3 text generation, image generation, text editing and moderation tools. Additionally, we have an adapter to ChatGPT, which lets you host and customize ChatGPT directly inside your Flow XO workflows.

IMPORTANT: If you get an error when adding your Open AI API key to flow XO

If you see an error when connecting Open AI to Flow XO, it is because of this:

Please try one of the resolutions from that link to get past the issue.

This integration exposes all of the currently available endpoints from Open AI:

1. ChatGPT

Open AI provides a "Complete Chat" API, which provides direct access to the same conversational model used in their ChatGPT product. Flow XO makes this API directly available to your conversational flows, and allows you to host and customize ChatGPT to suit your business.

2. Text generation

This is the main text-based API from OpenAI. It can perform an astounding variety of tasks very well, everything from writing full blog posts to classifying user input to translating between languages.

3. Image generation

Known as Dall-e, the image generation API takes a text prompt, such as "an image of a robot writing at a computer", and can generate one or more images to match the prompt. Here's an example of the output from that exact prompt:

4. Editing text & code

OpenAI provides an API that can take a given block of text, and make changes to it based on a set of written instructions. For example, you can give it some user input and ask it to translate the input to spanish, or to correct the spelling and grammar, or even to convert from first person to third person.

5. Moderation

OpenAI provides an API that, given some user input, can determine if the input should be flagged for dangerous content, and will be specific about if the content contains hate speech, sexually violent content, etc.

OpenAI Resources

The best place to begin learn how to use these powerful tools is from the Open AI documentation. To make the best use of this technology, you should understand what AI models are available, how they impact pricing, and work through some examples of how best to utilize the technology. Any of the published examples you see in the example gallery for Open AI can be implemented easily using our integration.

Introduction to OpenAI, how it works and what it can do for your business
A listing of the currently available AI models, and how and when you might use each
Pricing information for the various AI models
A set of easy to understand examples of how to use Open AI text generation for a wide variety of tasks
Tips and tricks for making GPT-3 models bend to your will
Official documentation on using the ChatGPT API from Open AI
Technical documentation for the OpenAI API on which our integration is based
Writing good prompts to achieve the best results with text completions

Getting Started

1. Create an OpenAI account

2. Get an OpenAI API key

3. Log into Flow XO or create a free account
4.Add the Flow XO OpenAPI integration to a flow.

Open AI response time (speed) can be very unpredictable. If you are having difficulty with very long delays when using the Open AI integration, see this article: Open AI Reliability and Performance

The integration provides 4 different powerful tools from Open AI.

1. Complete Chat

The "Complete Chat" task provides direct access to the language models that power Chat GPT. Chat GPT is a language model specifically trained to participate in extended conversations between a human and an AI assistant. Because it is designed for chat, it has two primary inputs, the "Prompt" and "Messages". 

Prompt - The "prompt" lets you guide ChatGPT on what kind of persona it should adopt, and you can give it some rules (which it will try to follow, but doesn't always) about what it can talk about and provide background information it can use to answer questions. 
The "messages" area is where you insert the history of the conversation so far. You can also use this space to provide examples of user interactions that can help ChatGPT know how to answer questions later on in the conversation.

In the prompt, you will tell the bot who it is, what it's objective is in interacting with your users, and optionally provide it some context that it can use for answering questions. In the example screenshot above, we added some basic information about Flow XO that ChatGPT can use to answer pricing questions and basic questions about our company. Be aware, however, that unlike the older GPT-3 model (discussed below), ChatGPT is much more up to date, and will be continuously trained on newer information. This information is NOT updated in realtime, however. If your topic or your company has been around for awhile and has some exposure on the internet, ChatGPT is probably already aware of it and can already answer questions about you. But the information won't be completely up to date, so extensive testing is required to make sure ChatGPT doesn't answer incorrectly, or confuse questions about your company with questions about a similar company or topic. Any time you discover ChatGPT is making up incorrect answers about your business, you should put the correct answers in the prompt so it can answer correctly.

Messages - In the "messages" area, you will put the history of the chat so far. You can use the Get Chat Transcript from the Utilities task ( to inject the current chat history. The labels are important here - each messages should be on a new line, labeled with one of: "System:", "Assistant:" or "User:". System messages are guiding messages to help the bot know its rules and what background information to pull from. Assistant messages are from Flow XO, and user messages are not surprisingly from your user. To have the bot answer user questions, you always want the last message to be a user message. See the screenshot above for an example.

Model - This is the Open AI model that ChatGPT should use. Currently there are only two available, and the one you will always want to use unless you know just what you are doing is the default of gpt-3.5-turbo. If you have access to gpt-4, that model will be available as well.

Max Tokens - the maximum number of tokens to generate

Temperature - How creative the bot should be. See the Open AI documentation for more information on this and the other specialized and lesser used parameters in the integration.

2. Complete Text

Important note: Before getting started with Text Completion, you should read the Open AI documentation on prompt design. It's also extremely helpful to review their simple and easy to follow examples.

The most important parameters in the Completion API are available in the Flow XO integration, and you can read about all of them here. The most important fields are prompt, model, maximum characters, and temperature.

Prompt - the prompt is the most important and only required field for the Complete Text action. You should follow the linked guidelines on prompt design to get good results from GPT-3. Usually you will want to make a good guess at a prompt that can achieve your goals, such as determining topic a user needs help with, and then test thoroughly and make adjustments to the prompt, such as adding more examples, until you get the results you want. You will also evolve your prompts over time as you get feedback from yourusers.

Model - the model determines how powerful the AI algorithm is, how fast or slow it is, and how much it will cost. The most powerful, but also the slowest and most expensive model is "text-davinci-003". You should always try to use the lowest priced model that gives you adequate results, as these smaller models, while less robust, will also deliver results to your users more quickly. "text-davinci-003" is extraordinarily capable, but also relatively pricey and can take much longer to generate a result, particularly longer results such as blog posts. So be sure to play with the various models to see if a lower model will give you reasonable results before settling on "text-davinci-003". Here is a list of the most current models and when you might want to use each one.

Maximum Characters - the max characters field determines the most characters the model can generate in an output. The default of 100 is fine for most question/answer styles prompts, classifying text into categories, etc. But if you are generating creative content like blog posts or summaries, you'll want to increase this number to ensure the model provides an adequate level of detail and doesn't get cut off in the middle of a sentence.

Temperature  - the Temperature determines how much randomness/flexibility the model has in generating a response. The temperature is a number between 0.0-2.0, where 1.0 is suitable for most creating writing tasks. We provided some presets, Precise = 0.0, Creative = 1.0, Insane = 2.0. At higher numbers, anything 1.5 or over, will often produce nonsense and wildly inaccurate responses. For factual content, such as Q&A involving technical questions, it's best to stick with lower temperatures as model can start to give very realistic sounding but absolutely wrong results with higher temperatures. If you use a temperature > 0, do plenty of testing to make sure the model doesn't make up misleading answers for questions you expect your users to ask.

The other parameter worth mentioning specifically is the Suffix Prompt. 

Suffix Prompt  - the suffix prompt can be used to provide more context to the model for generating creative writing. For example, if you set a prompt of:

Once upon a time there was a fox who 

You can include a suffix that the model will consider in its task as the end of the content. So you might add a suffix prompt of

Never again did he steal another chicken!

This will cause the model to generate a story that involves your hero the fox who stole a chicken, or will incorporate stolen chickens into the text in some way. Many tasks do not need a suffix prompt, so whether or not it will help your task depends a lot on your specific needs and plenty of testing/experimentation.

For other parameters and what they mean, see here.

3. Generate image

The "Generate image" task is very straightforward. You provide it a prompt, an image size, and how many images you want to generate, and you will get back URLs to the image(s) that resulted from the provided prompt. When you generate more than one image, the model will generate different variations of the prompt for you. This is very useful when you are trying to get an image for a specific purpose, as often one of the 5 possible images is very good. Keep in mind image generation can be expensive and extremely addictive, so be careful about exposing it directly to your end users.

IMPORTANT NOTE: Open AI keeps these images available via URL for a very short time. You will either need to generate a fresh image for each user (which means they will receive a random image generated from your prompt) or you will need to download the image quickly and re-upload using the image upload tool to make it a permanent part of your flow. If you try to use the image URLs you receive from this API long term, i.e. longer than the same session in which they were generated, your links will break, usually within hours or less.

Prompt - the prompt to give Dall-e to generate an image. An example might be "A classroom full of children all raising their hands"

This prompt produced a variety of different images, some of which are just weird, and some of which might be very useful to your project:

Cute! Appropriate for many uses

Umm...not sure what's going on here, but I don't think I like it :)

Might as well be professional stock art:

I think these kids might be being robbed :(

4. Edit Text

The "Edit Text" action, like the text generation action, can be quite powerful. You give it some input, and some instructions on what to do with that input, and it will do its best. It can be amazingly capable, and will translate text to and from common languages, fix grammar and spelling, and even convert abbreviate text messages into proper sentences.

Here are the parameters:

input - this is the text you want edited/corrected. In the example above, we hard-coded some input, but usually you'll take this from an Ask a Question or some other source of user input. 

Edit instructions - Explain what you want accomplished. You can see from the example, we asked the AI to translate abbreviate text-speak into proper english. It did a fine job of it too - the output was "I am happy to see you. I will be back soon."

Model / Temperature - these work the same as Complete Text, except the models are limited only to models for editing text or computer source code.

5. Moderation 

The moderation action simply analyzes text for dangerous messages that include threats of violence, hate speech, explicit sexual content, etc. The result of this analysis is whether or not the content should be flagged as dangerous, and the specific reason why. Here is an example of the result from the above example:

Specialty Tasks

In addition to the core Open AI APIs which we expose via the above basic integrations, we also have assembled a set of "Prompt Template" tasks that pre-configure some common Open API jobs for you to make them easier to user. These include:

  • Text Classification - classify some input text into a category of your choosing
  • Intent Detection - classify your users messages to determine their underlying intention. This task also detects the language your user is using.
  • Language Translation & Detection - Detect your users language, translate their messages into the language you are using, and translate your messages back into their language quickly and easily
  • Conversation Summarization - Summarize a conversation. Best used with the Flow XO Utilities function Get Chat Transcript.
  • Text Summarization - Summarize longer form text, such as an article, into a short blurb easy for your users to consume.

Classify Text

Categorize some input into one of a set of categorize of your choosing

Input Text - The text you want to classify.

Categories - The list of possible categories. Separate each category with a comma. 

Examples - Any training examples to help correct errors made by ChatGPT. You won't always need examples, but if you are not getting the results you expect, you can help guide the AI by adding a list of examples that demonstrate places the bot is making a mistake. Each example should be on it's own line, and be in the format {category}:{example text}. For example, if you have the categories of "pricing" and "sales" and the AI thinks that "What plans do you offer" is "Sales" but you want it to be "pricing", you could add one or more examples, like so:

pricing: What are your plans?
pricing: How much are your plans?
pricing: What are your pricing tiers?

Unknown category - When categorizing text, you usually want to have an unknown category, so that if the users input simply cannot be categorized (maybe it's just gibbrish) then there is a standard way to categorize these kinds of inputs. By default, the unknown category is just called 'unknown' but you can name it whatever you want. Keep in mind that the name you give it will influence how ChatGPT categorizes your inputs - if you name it something that doesn't mean the same thing as unknown, such as "types of fish" - this will confuse the AI model and hurt the performance of this task.

Model / Temperature - these work the same as Complete Text, except the models are limited only to models for editing text or computer source code.

Detect user intent

A specialization of Classify Text that attempts to categorize user input into an intended action. Also captures the users language, and attempts to guess at any parameters such as dates or numbers in the users input.

Input Text - The text you want to detect intent on. NOTE: Open AI does a very good job with most languages, so the input text can usually be in any language, and it will be matched to your intents defined in english. The output of this task will also indicate the language the user is using so you can translate your responses back to that language later.

Intents - The list of possible intents. Separate each intent with a comma.  NOTE: this is an optional field. If you provide intents, each message will be matched to one of the provided intents or the 'unknown intent'. However, if you do NOT provide an intent, Open AI will make an educated guess. This is not very helpful for building an intent dispatcher, to react to user intents in specific ways, but it can be very useful in analyzing your users behavior to understand what kinds of things they are trying to do with your bot, to help you know what specific intents you should plan for an implement.

Examples - Any training examples to help correct errors made by ChatGPT. You won't always need examples, but if you are not getting the results you expect, you can help guide the AI by adding a list of examples that demonstrate places the bot is making a mistake. Each example should be on it's own line, and be in the format {intent}[{language}]:{example text}. For example:

upgrades[en]: upgrade my plan to enterprise
upgrades[es]: actualizar mi plan a empresa
upgrades[ru]: обновить мой план до бизнеса

Unknown intent - The intent to use when the users input cannot be matched to any of your specified intents.

Model / Temperature - these work the same as Complete Text, except the models are limited only to models for editing text or computer source code.

Language Detection & Translation

This versatile action can detect the language of its input and translate that input into the language of your choosing. You can use this both to translate incoming messages so you can understand them, and translate outgoing messages so your user can understand them. Here's an example of that:

Input Text - The text you want to translate/detect

Target language - The language you want the input text translated into. 

Model / Temperature - these work the same as Complete Text, except the models are limited only to models for editing text or computer source code.

Summarize Conversation

This task will summarize a conversation between any number of parties. It's ideal, however, for summarizing Flow XO conversations, when combined with the Flow XO Utilities - Chat Transcript task.

Conversation messages  - Put the conversation you want summarized here. This could be pasted from the transcript of a podcast, or inserted from the Flow XO Utilities -> Get Chat Transcript to summarize the current conversation with the user.

Summarize Text

Summarize any longer form text into a short, understandable paragraph.

Text to summarize - shockingly, you should put the text you want summarized here :)

That's it for now! We will be creating more detailed walkthroughs and videos in the near future, so stay tuned. And as always, reach out if you have any questions to

Still need help? Contact Us Contact Us