OpenAI Assistants call OpenAI’s models with specific instructions and extra context, in order to generate better responses. This guide shows you how to connect to and use the Open Assistants API in Airtable. It's 100% no-code. Let's get started!
1. Head to https://platform.openai.com/assistants and click "Create" to create your first OpenAI Assistant.
2. Add a Name for you assistant. We'll use "SEO Copywriter".
3. Add Instructions for your assistant. This is the extra context / information that your assistant needs to do its job. We'll use the following instructions:
You are an expert copywriter for a B2B SaaS company. Create a short blog post description for the blog post title. Return only the description. Use terse, instructional language. Avoid corporate, salesy or flowery language.
4. Select a Model, e.g. "gpt-4o".
OpenAI will automatically save the assistant:
You can use your existing table, 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 our 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:
1. Add Data Fetcher to your base from the Airtable marketplace.
2. After the Data Fetcher extension launches, sign up for a free account or sign in to your existing account.
3. After signing up, click "Create your first request".
1. Under Application, select "OpenAI".
2. 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.
3. For Endpoint, select "Create assistant thread and run".
4. Add a request name, like "Create descriptions".
5. Click Save & Continue.
6. Select the OpenAI Assistant that you created in the first step.
Our assistant knows its job - to create blog post descriptions - because of the context we provided when we created it using the OpenAI dashboard. All we need to do is provide a reference to the "Title" field in our table.
7. Under Messages, click the + button on the right-hand side to add a table reference.
8. For Table, select "Blog posts". For Field, select "Title". Under Run for every record in view, select "Needs description".
9. Click Confirm. The Messages step will now reference our Airtable data, ready to send it to the OpenAI assistants API.
10. Click "Save & Run" in the bottom right-hand.
The first time you run the requests, the Response Field Mapping will open.
11. Map the "Message" field that comes back from OpenAI to the existing "Description" field in your table. To do this, click Existing field, then select the "Description" field from the dropdown.
12. 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 ChatGPT endpoint.
You can manually connect to the OpenAI Assistants API by clicking "Run". However, you can also run the request automatically whenever a new record enters the "Needs description" view by using a Trigger.
1. Scroll to the Schedule | Trigger | Webhook URL tabs, select the Trigger tab, and click Upgrade.
2. Choose a Data Fetcher pricing plan from the different options depending on your needs and enter your payment details. Triggers are available on all paid plans.
3. Click I've done this back in Data Fetcher.
4. Click + Authorize on the Trigger tab.
5. Click the prompt I understand, let's Authorize.
6. Click + Add a base. By selecting "All current and future bases in all current and future workspaces", you will avoid the need to re-authorize access for individual bases in the future.
7. Click on "Grant access".
8. Back in Data Fetcher, under Trigger, choose the option to run the Airtable OpenAI Assistants integration for Record created.
9. Select the "Blog posts" Table and the "Needs description" View.
10. Finally, click Save. Whenever a record is created in the "Needs description" view, Data Fetcher will connect to the OpenAI Assistants API and generate a description.
Jul 25, 2024
•Zayyad Muhammad Sani
•OpenAIJul 18, 2024
•Zayyad Muhammad Sani
•OpenAIPDFJul 5, 2024
•Andy Cloke
•OpenAI