Big ML | CONTENT GENERATION

AI-Generated Email Replies with OPT-175B

In this article we continue the series on generating business content with Big ML models. The second in the series, this article is about formulating complete replies using OPT-175B.

If you’re just tuning in, check out the Table of Contents and the Introduction to using OPT-175B.

Complete email replies require context

When writing a simple email reply it was enough to just include the email received itself, and some notes on how to reply. There was some missing context but the model was able to fill it in with some boilerplate. Whole email replies are more complex and typically require extra generation steps to get right.

One way to do this is seed the system with your frequently asked questions, and follow a three-step process:

  1. Decide if any FAQ can answer the question asked in the message.
  2. If yes, decide which FAQ has the correct answer.
  3. Write a custom reply based on the FAQ answer.

This doesn’t get us all the way to full automation, but it’s a start.

So how can that be done? Start by putting together a list of your frequently asked questions. With a list in hand, you can ask the model OPT-175B if the question is answered by one of the frequently asked questions. Note that here we’re only using a few questions, but you can add many more.

See this input for a fictional coffee shop:

Here is an email to the coffee shop with a question:

Hi there!

I was wondering if you could tell me a little bit about your coffee beans. Where do they come from? How are they roasted?

Thank you for your time!

 

Here is a list of frequently asked questions for the coffee shop:

-What are your hours?

-Do you have any gluten-free or vegan options?

-What type of coffee beans do you use?

-How do you make your coffee?

 

Do the frequently asked questions answer the email?

Which gives us this output:

No, the email is asking a specific question about the coffee beans that is not answered in the frequently asked questions.

A robot brainPlease note that there can be an astonishing variety to the replied answer depending on the Temperature setting. The higher it is, the more ‘creative’ the AI gets. For more consistency you’ll want to experiment with lower settings.

As for the output; if the answer is no then you can stop there and have an operator respond to the question. The computer won’t be able to help this time.

But if the answer is yes, we can keep on going with a similar input prompt to the one above, shortened slightly for readability:

Here is an email to the coffee shop with a question:

Hi there!

I was wondering if you could tell me a little bit about your coffee beans. What type of coffee beans do you use?

Thank you for your time!

 

Here is a list of frequently asked questions for the coffee shop:

-What are your hours?

-Do you have any gluten-free or vegan options?

-What type of coffee beans do you use?

-How do you make your coffee?

 

Which of the frequently asked questions answers this email?

And output:

What type of coffee beans do you use?

And now that you know which question it is you can feed the question, answer, and email back in for one more go-around to finish up this line of questioning. Here is what that can look like:

Here is an email to the coffee shop with a question:

Hi there!

I was wondering if you could tell me a little bit about your coffee beans. What type of coffee beans do you use?

Thank you for your time!

 

Here is one of the frequently asked questions:

Question: What type of coffee beans do you use?

Answer: We use 100% Arabica coffee beans, roasted in small batches to ensure freshness.

 

Write a polite email from Becky replying to the first email.

Which gives the output:

Hi there!

 

Thank you for your email and question. We use 100% Arabica coffee beans at our coffee shop, which are roasted in small batches to ensure freshness. We hope you enjoy our coffee!

 

Thank you for your time,

Becky

And we have a fully-crafted email ready to be sent.

Automating the process

complicated looking machineBecause these models are accessible through APIs, you can automate this process entirely with code. One way to do that is to create a service which does the following:

  • Monitors a support inbox for emails coming in
  • When an email comes in, builds a prompt and sends it to the API
  • Uses the response to decide if the email should be handled by a person or if the AI can reply
  • If the AI can reply, continues making requests to the API to craft the email
  • Sends the email

It sounds complicated but when you break it down into these simple steps it is much easier to implement.

Developing a C# service to run in Azure

Developing this as a C# service designed to run as an Azure Function is simple enough for most developers to handle. The complicated bits are connecting to the email server, connecting to the GPT-3 API, and handling the configuration such as the list of frequently asked questions.

If you’d like to implement this on your own and would like a guide to follow check out Writing a Smart Email Responder with GPT-3 and C# by Ondrej Balas.

Up next: Summarizing long emails or other text

READY TO START YOUR PROJECT?

  • CRMs/ERPs
  • Payment Gateways
  • Accounting Systems
  • Lead Managements Tools
  • Web Apps
  • Legacy Systems
  • E-Commerce Systems
  • Freight/Shipping Systems
  • Social Media
  • Email Services

Get In Touch