In this simple tutorial, we'll learn to connect to the OpenAI API in Airtable without coding.
We'll set up the Airtable OpenAI integration to generate descriptions for a list of podcasts in our Airtable base.
Let's get into it!
1. Create a table called "Podcasts" or use an existing table.
2. Add the items you want to generate descriptions for in the "Name" field.
3. Create another field called "Description" with the type "Long text".
4. Create a new Grid view called "Needs description" and add the following filters:
1. Add Data Fetcher to you base from the Airtable marketplace.
2. Sign up for a free Data Fetcher account.
3. On the home screen of Data Fetcher, click Create your first request. Requests in Data Fetcher are how you import data into or send data from your Airtable base with no-code.
1. For Application, select "OpenAI" to use the Airtable OpenAI integration.
You will need your OpenAI API key. Create one in your OpenAI dashboard if you don't have one yet.
2. Copy and paste your OpenAI API key into Data Fetcher under Authorization.
3. For Endpoint, choose 'Create chat message completion'.
4. Give your request a name, such as "Generate descriptions".
5. Click Save and Continue.
6. On the next screen, for Model, choose "GPT-4o".
For Messages, we want to add the message that we will send to the OpenAI API, and reference our "Name" field, so that the podcast names are substituted in when we run the request
7. Write the following sentence:
Write a single-sentence description of the podcast:
8. Click the + button on the right-hand side of the input.
9. On the window that opens, select the "Podcasts" Table. Then select "Prompt" for Field and 'Needs description' for Run for every record in view.
10. Click Confirm.
The Messages field should now contain a reference to our "Name" field.
11. Click Save & Run in the bottom right.
Now the request will run, and the Response Field Mapping modal will open. This is where you can specify which fields to import from the OpenAI API and how they map to fields in Airtable.
12. Map the "Message" field to map to your existing 'Description' field.
13. Click "Save & Run" in the bottom right of the Response Field Mapping.
Data Fetcher will now run the Airtable OpenAI integration and generate the podcast descriptions using AI! Return to your default view in Airtable and you will see them.
You can automatically run the request when a new record is created using Data Fetcher's Trigger feature.
Triggers are a paid Data Fetcher feature, so you'll first need to upgrade your workspace.
1. Scroll to the Schedule / Trigger / Webhook URL tabs and click on the Upgrade button on the Trigger tab.
2. Select a pricing plan to suit you and enter your payment details.
3. In Data Fetcher, click I've done this.
Now you need to authorize Data Fetcher to access your Airtable base.
4. Click + Authorize.
5. On the modal that pops up, click I understand, let's Authorize.
6. Go through the Airtable authorize process in the window that opens.
Back in Data Fetcher, ensure the Trigger tab is selected.
7. Select the trigger type of "Record created".
8. Select the "Podcasts" table and the "Needs description" view.
9. Click "Save" in the bottom right to save the trigger.
The Airtable OpenAI integration will now run whenever a record is created in the "Needs description" view.
As well as generating text, we can also OpenAI and Data Fetcher to generate images using AI in Airtable.
Jul 25, 2024
•Zayyad Muhammad Sani
•OpenAIJul 18, 2024
•Zayyad Muhammad Sani
•OpenAIPDFJul 5, 2024
•Andy Cloke
•OpenAI