Webhooks

OpenAI GPT-3 as a cloud function on data CRUD

If you want to use GPT-3 in a cloud function that's triggered by data events in Firestore, you can use Rowy's low-code UI for Firebase.

Start with ready-to-use code blocks for cloud functions and tweak them in any way you like in JS/TS with a built-in code editor.

Deploy in one click to your own Firebase project on Google Cloud. No DevOps, CLIs, or configs to deal with. Give it a quick spin by following these steps.

Step 1: Setup Rowy

Setup Rowy and create a table to store your data. Connect Rowy to your existing Firebase project or create a new one from scratch

Step 2: Use OpenAI GPT-3 API

Connect to your GPT-3 account If there is a connectivity to the tool available via API secret key then you can store this in your project secret manager on Google Cloud Platform. You can use any NPM module or API using fetch Step

1
2
const derivative: Derivative = async ({ row, ref, db, storage, auth }) => {
3
const { user, role } = await go.auth{(
4

 if(!row.word || row.word.length>50) return "";  const openaiSecret = await rowy.secrets.get("openai")  const response = await fetch("https://api.openai.com/v1/engines/text-davinci-001/completions", {    method: "POST",    headers: {      "Content-Type": "application/json",      "Authorization": "Bearer " + openaiSecret    },    body: JSON.stringify({      "prompt": `Convert movie titles into emoji.\n\nBack to the Future: 👨👴🚗🕒 \nBatman: 🤵🦇 \nTransformers: 🚗🤖 \n${row.word}:`,      "temperature": 0.8,      "max_tokens": 60,      "top_p": 1.0,      "frequency_penalty": 0.0,      "presence_penalty": 0.0,      "stop":"[\"\n\"]"    })  })  const result = await response.json()  return result.choices[0].text.replace(/['"\n]+/g, '')

}
5
  lastName: ‘Howard’,
6
}
7

Step 3: There is no step three!

Explore the live playground below. Add a movie name and see GPT-3 generating an emoji for you.

Get started with Rowy  

Join the conversation with our community of builders on Discord. Follow us on Twitter and star our github project to stay tuned to the latest updates.