Use the OpenAI Assistants API in Airtable with No-Code

Jan 5, 2024Rosie Threlfall

OpenAI Assistants can call OpenAI’s models with specific instructions to tune their personality and capabilities. This guide will show you how to connect to and use the Open Assistants API in Airtable without the need for code.

Create Assistant in OpenAI

If you haven't done already, sign up for OpenAI and add a billing method. Then head over to https://platform.openai.com/assistants and click "Create" to create your first OpenAI Assistant.

Add a Name and Instructions for your assistant. For this guide, we'll use the instructions: You are an expert copywriter for a B2B SaaS company. You create SEO-optimised blog post descriptions for the blog post title that is provided.

Select a Model, e.g. gpt-4. Then click "Save" to create your assistant.

create openai assistant.png

Set up Airtable Base

You can use your existing base, but for this guide we'll use a table called "Blog posts" with a single-line text field called "Title" and a long-text field called "Description". The "Title" field contains the following blog post titles:

  • How to Import AWS S3 Data to Airtable with No-Code
  • How to Import WordPress Data to Airtable
  • How to Track your Website's SEO Performance in Airtable
blog posts table records.png

We need a view that contains all the blog posts without descriptions. Create a new Grid view called "Needs description" with the following filters:

  • "Title" is not empty
  • "Description" is empty
needs description grid view.png

Add Data Fetcher to Airtable

Click "Extensions" on the right-hand side of the screen, then click "Add an extension".

add an extension.png

Search for "Data Fetcher", then click "Add" and "Add extension".

add data fetcher extension.png

Alternatively, you can install Data Fetcher from the Airtable marketplace.

After Data Fetcher launches, sign up for a free account or sign in to your existing account.

sign up for data fetcher.png

Connect to OpenAI Assistants API in Airtable

Click on "Create your first request".

create your first request.png

Under Application, select "OpenAI".

Generate Company Descriptions with GPT3

Under Authorization, copy and paste your OpenAI API key. If you do not have one yet, click "Create new secret key" here in the OpenAI dashboard.

Generate Company Descriptions with GPT3

For Endpoint, select "Create assistant thread and run".

Add a request name, like "Create descriptions" and click "Save & Run".

create descriptions save and run.png

Select the OpenAI Assistant that you created.

openai assistant.png

Our assistant knows its job - to create blog post descriptions - because of the context we provided when we created it using the OpenAI platform. All we need to do is provide the blog post titles in our table.

Under Messages, select the + button to add a reference.

For Table, select "Blog posts". For Field, select "Title". Under Run for every record in view, select "Needs description". Click "Confirm".

table reference.png

Click "Save & Run" in the bottom right-hand side.

openai assistants save and run.png

The first time you run the requests, the Response Field Mapping will open. Map the "Message" field that comes back from OpenAI to the existing "Description" field in your table. Click "Existing field", then select the "Description" field drop the dropdown.

map to existing description field.png

Then click "Save & Run" in the bottom right.

save and run response field mapping.png

The request will run for every record in your "Needs description" view. This may take some time as the OpenAI Assistants API tends to be slower than the GPT chat completions endpoint.

Run OpenAI Assistant in Airtable Automatically

You can manually run your request whenever you want by clicking "Run". You can also set it up to run automatically whenever a new record enters the "Needs description" view using the Triggers feature.

Triggers are a paid Data Fetcher feature, so you'll first need to upgrade your account. Scroll to the Schedule / Trigger / Webhook URL tabs 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, select the Trigger tab is selected. For this tutorial, we'll use the trigger type of "Record created". Also select the "Blog posts" table and the "Needs description" view.

Finally, click "Save". The request will now run automatically whenever a record is created in the "Needs description" view and create the blog post description.

needs description trigger.png

Related Posts

How to Translate Records in Airtable using AI

How to Translate Records in Airtable using AI

Nov 8, 2023

Andy Cloke

OpenAITranslation
How to Use AI in Airtable (2023)

How to Use AI in Airtable (2023)

Sep 15, 2023

Rosie Threlfall

OpenAI