✨Power Your App with ChatGPT
Utilize OpenAI's ChatGPT with Adalo's Ask ChatGPT Custom Action to harness AI inside your Adalo App
How can I use AI in my apps?
Our new Ask ChatGPT Custom Action makes it easy for anyone to use AI to perform all kinds of amazing new functions in their Adalo apps. Think of it as an all-in-one API you can use to perform an almost unlimited number of possible tasks:
Chat with AI
Automatic writing based on a prompt
Text processing (check spelling, improve grammar, alter tone, etc.)
Content moderation
Language translation
Sentiment analysis
Content moderation
Lots more!
Before ChatGPT, each of these would’ve required its own tool or API, but now you can just use one simple tool and rely on the power of AI to make your apps better than ever.
Note that Custom Actions are only available on the Professional plan and higher.
Important: Large Language Models (LLMs) take time to return a response. No LLM currently provides instant results. We’ve used GPT 3.5 turbo for the best possible response times, but OpenAI can still take a while to process your request and return the result. We do not have control over this response time. To optimize your response times, keep your prompts and requests as brief as possible and minimize any additional Adalo actions that are connected to a request.
Adding Your OpenAI API Key
To get started, make sure you have an OpenAI account and go to https://platform.openai.com/account/api-keys to create a new “Secret Key” that will be used to connect your Adalo account to your OpenAI account. Copy your secret key and paste it into the API Keys section of the Settings panel in any Adalo app (note that this one key will apply to all of the apps in that org).
That’s it! That’s all the setup you need to start using our new Ask ChatGPT Custom Action.
Pricing and OpenAI Tokens
OpenAI uses a token system to monitor your usage of their services. Each time you or one of your users interacts with the Ask ChatGPT Custom Action, it will use tokens. The longer the prompt, the more tokens used. Be sure to read OpenAI’s doc titled, “What are tokens and how to count them?” and also visit their pricing page.
Our Custom Action uses the gpt-3.5-turbo model (you can easily make your own Custom Actions if you want to use different models). At the time of this writing, the cost is $0.002 per 1K tokens. You’ll want to monitor your usage as your app grows, but you’ll find that it’s quite affordable given the unbelievable value of a powerful LLM like GPT 3.5.
Adding the Custom Action
The Ask ChatGPT Custom Action appears inside the Custom Action menu, which you can find anywhere you add an Action, such as on a button or screen.
We’ve done all the work to set up this Custom Action for you, so it’s ready to go as soon as you add it. All you need to do is add a prompt. You can ask the bot anything you would ask ChatGPT and it will return a result. You can type in a prompt in the field, or use Magic Text to pull in data from your database or inputs on the screen.
The “History” field is optional and allows you to add extra context to your prompt, such as past messages that you want the bot to remember. If you’re creating a chat experience like ChatGPT, you can save the text of all the messages in the conversation to a single record that you update with every new message sent and received, then put that record in here for the history.
Important: Use the history feature sparingly and only when needed. It will use more tokens and you will quickly fill the available context window. If you use it, you’ll want to clear it periodically to avoid hitting the context window limit.
Using the Response
After you set up your prompt, create a second action for whatever you want to do with the response (create a record, update an input, etc.). In this second action, use MagicText to select the Response from the “Ask ChatGPT” flyout.
There are lots of other useful bits of information returned from the API that may be useful to you as you’re building, such as the total number of tokens used. Most of the time, you’ll simply want the response.
Building an AI Chat App
This is the most straightforward example of using the Ask ChatGPT Custom action. All you have to do is take input from the user, send it as a prompt to the LLM, and show the response. You’ll want to save each message send and response to your DB and show them in a list. As mentioned above, you can also optionally use the History feature to give more context to the bot’s replies.
Don’t stop at chat though! There’s so much more that you can do with AI in your apps. Be sure to watch our video tutorial on different use cases.
Useful Prompts for Amazing AI-Powered Apps
Using the power of Adalo and ChatGPT, you can do all kinds of powerful operations in your apps without writing any code. All you need is the right prompt! Here are some that are useful. Try experimenting with the prompts below and making your own.
Make Writing More Professional:
If the users of your app are expected to write anything, you can use AI to clean up the writing, check spelling and grammar, and even change the tone to be more professional, fun, etc.
Tip: If the bot is returning extra text that you don’t want or need, such as “Sure! Here’s your answer,” try adding instructions to the prompt that let the bot know how to format the response. Example: “Only return the updated sentence, don't say anything else.” Prompt: Return the following sentence cleaned up to sound professional and kind (only return the updated sentence, don't say anything else): [input]
Content Moderation:
Want to ensure your users don’t send insulting or profane messages in your app? Let AI do the moderation for you. Try the prompt below and then show the user a message that asks them to tone it down if the response is yes. Prompt: Only include a single-word response with no punctuation: Yes or No. Does this comment include strong or insulting language? Comment: [input]
Translation:
Does your app have users speaking several different languages? No problem. Include a translate button and use the prompt below. Prompt: Translate the following to English (only return the updated sentence, don't say anything else): [input]
Sentiment Analysis and Comment Tagging:
This one is a huge time saver. If your app includes messaging or feedback, you can have AI read each message as it is submitted and tag it with a sentiment, topic, or anything else you want. Explain to the bot how you want each comment to be analyzed and the response format and let it do the rest! Prompt: Perform sentiment analysis on the following comment. Only reply with a single word and no punctuation: Positive, Negative, or Neutral. Here's the comment: [input]
Last updated