Mary Rose Cook

Texting with GPT-3

I set up my GPT-3 account so I can text with it over SMS. It’s pretty fun.

Texting with GPT-3

To build this, I combined Airtable and Twilio. Here’s how it works:

  1. I text my query to a Twilio phone number. E.g. “What is a good thing to reflect on as I fall asleep?”
  2. Twilio receives the text and sends a webhook with the query to Airtable.
  3. Airtable receives the webhook and this triggers an automation.
  4. The automation stores the query.
  5. The automation sends the query to the GPT-3 API.
  6. The automation gets the response from the GPT-3 API.
  7. The automation stores the response.
  8. The automation texts the response back to me.

Airtable serves two purposes.

First, it sends the query to the GPT-3 API.

Second, it provides a way to store queries and responses, which allows it to build up context in an exchange. For example, imagine I send this initial message to GPT-3:

The following is a conversation with an AI movie buff.
The movie buff has excellent taste in movies and is
great at recommending obscure but high quality movies.

Human: Hello, can you recommend me a movie?
AI: Sure, how about Hoop Dreams?
Human: I loved that.  Can you recommend me a movie like it?
AI:

It replied with:

Sure, how about Beautiful Girls.

I replied:

...Human: I actually didn't like that movie at all.  Can you
recommend me another?

GPT-3:

AI: Sure, how about Boyhood?

Me:

...Human: I did like that one.  I really loved Drinking
Buddies which felt more truthy.  Can you recommend a movie
like that?

The ...s are what create the context. GPT-3 only operates based on your query. It has no memory of what you sent it previously. To retain context, each query you send must recapitulate earlier messages.

So, in step 5 above, Airtable gathers up all earlier consecutive queries that start with ..., plus one more (the query that started the exchange e.g. “The following [etc]”), plus the intervening replies from GPT-3. It sends this whole chunk to GPT-3 as a query.

This enables you to steer the algorithm towards more and more useful responses.


Subscribe to my newsletter to hear about my latest work