How to use GPT-4o in Airtable with No-Code

Jun 17, 2024Andy Cloke

In this tutorial, we'll learn how to use GPT-4o, OpenAI's latest large language model (LLM), to generate product descriptions for products we have stored in an Airtable base. We'll use an Airtable extension, Data Fetcher, to connect our Airtable base to OpenAI's API and generate descriptions for each product in Airtable. 

GPT-4o vs GPT-4 Turbo

GPT-4o is the first OpenAI LLM that can accept video, image, text, and audio input at the same time. GPT-4o is also cheaper and faster than GPT-4 Turbo, OpenAI's previous flagship LLM. As OpenAI describes:

GPT-4o is 2x faster, half the price, and has 5x higher rate limits compared to GPT-4 Turbo. We plan to launch support for GPT-4o's new audio and video capabilities to a small group of trusted partners in the API in the coming weeks.

Developers building applications on top of OpenAI’s GPT models will take advantage of GPT-4o's all-in-one vision, text, and audio input capabilities to build more intuitive apps. For now, though, developers can only use GPT-4o's text and vision capabilities, as OpenAI hasn't announced when the audio and video features will be available in the API.

Setting up the Products Table

Before we install Data Fetcher, we'll create the table that will hold the products and their descriptions:

1. Create a new table and name it “Products”, or use your existing table.

2. Add the following products under the “Name” field. We’re using shoes in this tutorial, but you can input any product (or anything at all!) you want in the “Name” field.

  • adidas Originals Samba OG trainers in white
  • Puma Palermo Leather trainers in white and black
  • Reebok Club C Grounds trainers in black with gum sole

3. Rename the “Notes” field to “Description”. This is where our product descriptions will be once we’ve generated them.

products table.png

4. Create a new Grid View called "Needs Description". We'll use this view to filter out all the shoes in the table that don't have a description, which is all the shoes at the moment.

5. Click the Filter button on the toolbar, and add the following filters:

  • Set “Name” to is not empty for the first condition.
  • Set “Description” to is empty for the second condition.
products needs description view.png

With the table set up, we can move on to Data Fetcher.

Installing Data Fetcher

1. Add the Data Fetcher extension to your Airtable base. 

2. Once you’ve added the extension, sign in to Data Fetcher or sign up if you don’t have an account.

sign up for data fetcher.png

3. Once Data Fetcher opens in your Airtable base, click Create your first request.

create your first request logo 2 smaller.png

Use GPT-4o in Airtable

1. Select OpenAI under Application. You can search for it or scroll down.

open ai application.png

2. Rename the request to “Generate product descriptions”.

generate product descriptions name.png

3. Put in your OpenAI API key under Authorization. You can generate an API key in your OpenAI account.

api key authorization.png

4. Under Endpoint, select Create chat message completion.

ChatGPT-Airtable-Integration5.jpg

5. Click Save and Continue in the bottom right corner.

save & continue.png

Once you've finished the previous steps, you'll be taken to a new section to continue the configuration.

6. GPT-4o should be automatically selected under Model, so you don't have to change this option. 

gpt-4o model from openai.png

Sending Messages to GPT-4o

OpenAI’s API considers the text input it takes from us as messages / prompts. When we send a message to the API, we have to specify the message’s role. OpenAI has three message roles: system, user, and assistant.

The system role tells GPT-4o how to behave and respond to our prompts. Since we want GPT-4o to give us product descriptions of the shoes in the “Products” table, we'll instruct it to be an expert footwear copywriter.

1. Under Messages, type/ paste in this text and press Enter.

system: You are an expert footwear copywriter.

The system message will be added.

openai copywriter system message.png

2. In the Messages input, below the system message, type this text (Data Fetcher will add the user role prefix automatically):

Generate a short description of a product with the name:

Next, we want to add a reference to our "Name" field in Airtable.

3. Click the + icon on the right-hand side of the input.

messages + button.png

4. In the window that opens, select Name under Field, then select Needs description under Run every record in view.

Screenshot 2024-06-25 at 12.14.14.png

5. Click Confirm.

The window will close and take you back to the request.

6. Click Save and Run in the bottom right corner.

Mapping the Response Field

After running the previous steps, Data Fetcher will take you to Response Field Mapping. On this page, you'll map the response data to specific fields in the table.

response_field_mapping.png

OpenAI returns several fields, but we're only interested in the “Message” field.

Click the Existing field option under "Message", then select “Description” from the dropdown.

openai shoe message mapped to description.png

Click Save and Run in the bottom right corner.

Data Fetcher will populate the "Description" field of each record with the response from GPT-4o. Go back to the default grid view in your table, and you should see the generated descriptions.

ai generated product descriptions.png

Use GPT4o in Airtable Automatically

You can use Data Fetcher's Trigger feature to connect to GPT-4o automatically when there is a new product in our Airtable base. This saves you the effort of manually running the request.

The Trigger feature is available on our paid plans, so you can follow these steps to upgrade and use the feature:

  • Open the request in Data Fetcher, scroll down to the Schedule / Trigger / Webhook URL tabs, select Trigger, then Upgrade.

schedule trigger webhook url tabs.png
  • Select the paid plan that suits you best and complete the payment process. 

  • Go back to your request in Data Fetcher and click I’ve done this.

trigger tab upgrade I-ve done this.png

Now we need to give Data Fetcher API access to your Airtable base. This allows the GPT-4o Airtable integration to run automatically, even when you are not logged into Airtable. Click + Authorize.

trigger tab authorize.png

A warning dialog will pop up in Data Fetcher. Click I understand, let's Authorize.

I understand. Let-s authorize.png

A new window will open, asking you to grant Data Fetcher access to your Airtable base. Click Add a base. Select All current and future bases in all current and future workspaces so you don’t need to authorize Data Fetcher anytime you want to use it on an Airtable base.

schedule-authorize-bases.jpg

Then, click Grant access.

Back in Data Fetcher, we can set up the request trigger. We want to connect to OpenAI whenever a new record is created, so select Record created.

trigger tab record created.png

For the Table, select "Products" and for the View select "Needs description". By using the filtered "Needs description" view, we ensure that we'll only create descriptions for products with a value in the "Name" field.

product table and needs description view for trigger.png

Click Save at the bottom of the screen. The trigger is set up and will use GPT-4o to create a description whenever a new product is added.

That’s all for this tutorial. We hope you’ll do creative things with what you learned here. As other GPT-4o features become available, we’ll have new tutorials for you. Until then, check out the Data Fetcher blog to see other ways Data Fetcher can save you time when working with Airtable.

Related Posts

How to Use Airtable Generative AI

How to Use Airtable Generative AI

Jul 5, 2024

Andy Cloke

OpenAI
Connect to the OpenAI API in Airtable with No-Code

Connect to the OpenAI API in Airtable with No-Code

Jun 25, 2024

Andy Cloke

OpenAI