How to Use AI in Airtable (2024)

Sep 15, 2023Rosie Threlfall

In this guide, we'll demonstrate how to use AI with Airtable by linking the GPT-4 API to Airtable. We'll use AI and Airtable to generate various descriptions for online courses. We'll also be using the free Airtable extension Data Fetcher, which means there is no need for code. 

GPT-4 is the latest AI language model developed by OpenAI and is different to ChatGPT. You'll need to have a card set up for payments for the OpenAI API. This is a different service to ChatGPT Plus.

Airtable is also releasing its own AI, which is currently in the beta stage. Once it's out of the trial phase, this will be released as an optional paid add-on. 

Create a Courses Table

First, create a table called 'Courses' in an Airtable base. This is where we'll generate our AI content.

In the primary 'Name' field, enter these titles course titles:

  • Facebook Ads for Beginners
  • How to Budget and Forecast for Your Business
  • YouTube Marketing: Complete Guide To YouTube Growth

(Or feel free to use your own.)

Use AI in Airtable

Create a new field called 'Prompt' with type 'Formula' and then copy and paste the follwing code into the Formula field:

CONCATENATE("user:Write an encouraging and interesting description for an online course with the title '",Name, "''. Do not include the course title.")

AI-Airtable-2023-02.jpg

Click 'Create field'.

For some additional help on writing prompts for AI, you may find these these basic tips and instructions for writing good prompts for OpenAI useful.

Create a field in your Airtable 'Courses' table called 'Description' with a type of 'Long text'. This is where our AI-generated text will appear.

AI-Airtable-2023-03.jpg

Create another new field in your Airtable table called 'Description (formatted)' with type 'Formula' and copy and paste the following code into the Formula field:

SUBSTITUTE({Description},'"','')

AI-Airtable-2023-04.jpg

(By adding this formula, we are solving an occasional issue where the AI output from GPT-4 starts with a speech mark, consequently causing errors.)

Now you'll need to create a Grid view in your table called 'Needs description' with these conditions (The conditions are set using the 'Filter' menu);

  • The 'Name' field is not empty.

  • The 'Description' field is empty.

AI-Airtable-2023-05.jpg

Install Data Fetcher

To use AI in Airtable, we're going to install Data Fetcher from the Airtable marketplace. You'll need to either sign up for a free Data Fetcher or log into an existing one.

Group 1Data Fetcher Sign Up .png

Connect Airtable and the GPT-4 API

Data Fetcher requests enable you to fetch and import data from various sources, such as websites or APIs, into Airtable. In this case, we are using Data Fetcher to connect to OpenAI in Airtable.

Click on 'Create your first request' on the home screen of Data Fetcher.

Create your first request in Data Fetcher

Under Application, select 'OpenAI'.

Generate Company Descriptions with GPT3

Under Authorization, copy and paste your OpenAI API key.

Generate Company Descriptions with GPT3

Under Endpoint select 'Create chat message completion'.

Give your request a name such as 'Create Course Descriptions'.

Click 'Save and Continue.'

AI-Airtable-2023-06.jpg

Select the 'gpt-4' Model.

Connect-GPT4-to-Airtable-10.jpg

Click the + button next to Messages to add a reference to the prompt we specified in the Airtable table using the formula in the prompt field.

To find out more about how you can use messages in AI, we recommend reading more about how OpenAI prompts work here.

AI-Airtable-2023-14.jpg

Next, Select your output Table, 'Description' for Field and 'Needs description' for Run for every record in view.

Click 'Confirm'.

courses table prompt field reference.png

Your parameters should look like this. Click 'Save & Run'.

AI-Airtable-2023-10.jpg

The Response field mapping modal will now open. Set the 'Message' field to map to the 'Description' field in your output table and click 'Save & Run'.

AI-Airtable-2023-12.jpg


The AI course descriptions will now be generated and added to your Airtable table in the 'Description field'.

AI-Airtable-2023-13.jpg

Automatically Generate AI Descriptions using Airtable

Currently, we'd have to run the Data Fetcher request each time we added a new course title to Airtable in order to create the AI description.

However, using Data Fetcher's Trigger feature, it's easy to automatically generate AI text in Airtable.

Triggers let you automatically run a request whenever a change is made to an Airtable record. For example, when a new record is created, updated or deleted.

Triggers are a paid Data Fetcher feature, so you'll need to upgrade your account. Scroll to the tabs that say Schedule / Trigger / Webhook URL and click on the Upgrade button underneath.

upgrade.jpg

Select a plan to suit you and enter your payment details.

data fetcher upgrade pricing plans.png

In Data Fetcher, click 'I've done this'.

Schedule Data Fetcher

Next, select the 'Trigger' tab and underneath, click '+ Authorize'.

Authorize.jpg

Accept the prompt 'I understand, let's Authorize'.

Authorize2.jpg

Click '+ Add a base'.

Authorize3.jpg

By selecting 'All current and future bases in all current and future workspaces', we'll avoid the need to re-authorize access for individual bases in the future.

Click on 'Grant access'.

Authorize4.jpg

Back in Data Fetcher, ensure the Trigger tab is selected. For this tutorial, we'll use the trigger type of 'Record created' (meaning the request will be triggered every time a new record is created.) Then select your 'Courses' table and the 'Needs description' view.

Click 'Save'.

AI-Airtable-2023-11.jpg

Now, every time you add a new course title to Airtable, the Data Fetcher request will trigger, and a new AI text description will be generated and added to the 'Description' field.

Related Posts

How to Extract Data from Images in Airtable using AI

How to Extract Data from Images in Airtable using AI

Jul 25, 2024

Zayyad Muhammad Sani

OpenAI
Extract Data from PDFs to Airtable using OpenAI

Extract Data from PDFs to Airtable using OpenAI

Jul 18, 2024

Zayyad Muhammad Sani

OpenAIPDF
How to Use Airtable Generative AI

How to Use Airtable Generative AI

Jul 5, 2024

Andy Cloke

OpenAI