Help

Welcome to the Airtable Community! If you're new here, check out our Getting Started area to get the most out of your community experience.

chatGPT for Airtable automation.

2744 1
cancel
Showing results for 
Search instead for 
Did you mean: 
chrisbyrne
4 - Data Explorer
4 - Data Explorer

Using chatGPT in an Airtable automation. 

In my use case, the automation triggers on when an Airtable record matches conditions,
then follows with 2 actions, run script and update record. Adjust the first part of the prompt
with your own use case. Tip: Use chatGPT to help you write a prompt for chatGPT (!)

 

let inputConfig = input.config();
text = `${inputConfig.text}`;

var key = "openai-api-key";

var url = "https://api.openai.com/v1/completions";

prompt = "Reword this text to grade 9 reading level: " + text;

var gpt = {
model : "text-davinci-003",
prompt : prompt,
temperature : 0,
max_tokens : 1024
};

response = await fetch(url, {
method: 'POST',
body: JSON.stringify(gpt),
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + key,
}
});

answer= await response.json();

data=answer.choices[0].text;

output.set('your-airtable-field',data);

 

1 Reply 1