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.
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.
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:
We need a view that contains all the blog posts without descriptions. Create a new Grid view called "Needs description" with the following filters:
Click "Extensions" on the right-hand side of the screen, then click "Add an extension".
Search for "Data Fetcher", then click "Add" and "Add extension".
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.
Click on "Create your first request".
Under Application, select "OpenAI".
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.
For Endpoint, select "Create assistant thread and run".
Add a request name, like "Create descriptions" and click "Save & Run".
Select the OpenAI Assistant that you created.
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".
Click "Save & Run" in the bottom right-hand side.
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.
Then click "Save & Run" in the bottom right.
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.
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.
Select a plan to suit you and enter your payment details.
In Data Fetcher, click "I've done this".
Next, select the Trigger tab and underneath, click "+ Authorize".
Accept the prompt "I understand, let's Authorize".
Click "+ Add a base".
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".
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.
Jan 24, 2024
•Andy Cloke
•OpenAINov 8, 2023
•Andy Cloke
•OpenAITranslationSep 15, 2023
•Rosie Threlfall
•OpenAI