Photo by
DALL•E

Getting a summary of an email thread

Author
Yael Kurz
·
·
3 min read

Staying on top of your inbox can feel like a full-time job when you have to set aside time to weed through spam, monitor threads that need a follow up, and find action items and agreements with your clients and colleagues.

Luckily, with One AI you can get a high-quality Summary of a whole thread instantly, with one API call. In addition, you can get names, dates, emotions, sentiments, and highlight the key parts of the correspondence, making it much easier to manage your email communication effectively. 

Here’s how we can get a summary in the Language Studio.

We used this email thread as an example. 

```

On Sun, Oct 9, 2022, 12:42 Mark wrote:

Hi Dave,

I want to implement a new feature on our site.

Can you add a field for the users to add their pets name so that we can ship with their products  a  note for their pet?

Also make sure that the animal kind is in our database.

If the owner orders cat food we can assume it's a cat.

If the owner ordered something that can be purchased for multiple animals (like a bed or a container for food).

Give the owner an option to specify what animal he is buying the item for (you can say that we want to give that animal free treats and that's why we are asking) .

I want the pet's name to be sent to the shipping department along with the delivery details and a custom note to the pet.

The not for the pet should say :

Hello  [Pets name],

Hope you will enjoy our product.

If for some reason you are not satisfied with it we can exchange your product or give you store credit/refund.

Thanks,

Mark

On Sun, Oct 9, 2022 at 13:45 PM Dave wrote:

Hi!

No problem.

I'm currently working on other urgent things. Can this wait for next week?

I also think it might be neat to ask for the pets age, so we can better customize suggestions for the customer. What do you think?

Regards,

Dave

On Sun, Oct 9, 2022, 14:21 Mark wrote:

I think adding that might complicate things. But we can consider this after we're done with this feature.

It can wait till next week. Let me know when you're done and please add George know youre working on it.

Also, please ask John from sales to give you the data he already has so you can add that to the customers database.

cheers.

Mark

On Sun, Oct 9, 2022 at 15:50 PM Dave wrote:

Ok.

```

Now let’s jump to One AI’s Language Studio. On the bottom-right of the screen you can find our Language Skills, represented by a bunch of rectangles. Each Skill can be dragged and dropped onto Skills pipeline box, above the library.

Copy-paste the email thread you want to process to the input area. Now pick the ‘Summarize’ Language Skill to summarize the key information. Add the “Names'' to detect the participants, products, and places. In this example, you can see that “Numbers & Time'' extracted the dates and times. Last but not least, let's add “Sentiments” to get an idea of how positive or negative the correspondence was. 

Here’s the pipeline we got, now let’s hit run and see the results:

We successfully pulled the sentiment, identified the names and the dates, and generated a summary. 

Please pay attention also to the yellow notification badge on top of the “+” sign. It hints that you can use additional Language Skills: 

Here are the Language Skills that were detected on top of those we already selected:

Now it’s time to copy your code and proceed to your code editor.

In the code editor:

Step1: Pick one of the generated code you need to your code editor (click here to generate your own API key):

Step 2: Run “pip install oneai” for Python SDK or “npm install oneai” for Node.js SDK to get the library. Make sure to import all the required packages:

```

import oneai

import base64

oneai.api_key = "[YOUR ONEAI API KEY]"

```

In our example, we used Python SDK code. Here is what we got when we run all the skills together: sentiments, name, numbers time, and summary:

```

pipeline = oneai.Pipeline(

   steps = [

       oneai.skills.Emotions(),

       oneai.skills.Names(),

       oneai.skills.Numbers(),

       oneai.skills.Summarize(),

     ]

   )

output = pipeline.run(emailThread)

```

Here are the outputs:

Summary:

```

output.summary.text

'Mark On Sun, Oct 9, 2022, 12:42 Mark wrote: I want to implement a new feature on our site.

Can you add a field for the users to add their pets name so that we can ship with their products a note for their pet?

Also make sure that the animal kind is in our database.'

```

Emotions:

```

output.emotions

[oneai.Label(type='emotion', skill='emotions', name='happiness', output_spans=[Span(start=991, end=1002, section=0, text='No problem.')],

span_text='No problem.'), oneai.Label(type='emotion', skill='emotions', name='happiness',

output_spans=[Span(start=1589, end=1596, section=0, text='cheers.')], span_text='cheers.')]

```

Names:

```

[[x.name,x.value] for x in output.names]

[['PERSON', 'Mark'],

['PERSON', 'Dave'],

['PERSON', 'Mark'],

['PERSON', 'Dave'],

['PERSON', 'Dave'],

['PERSON', 'Mark'],

['PERSON', 'George'],

['PERSON', 'John'],

['PERSON', 'Mark'],

['PERSON', 'Dave']]

```

Numbers:

```

[[x.name,x.value,x.data,x.span_text] for x in output.numbers]

[['DATE',  '2022-10-09 12:42',  {'date_time': '2022-10-09T12:42', 'timezone': None, 'precision': 'MINUTE'},  'Sun, Oct 9, 2022, 12:42'],

['DATE',  '2022-10-09 13:45',  {'date_time': '2022-10-09T13:45', 'timezone': None, 'precision': 'MINUTE'},  'Sun, Oct 9, 2022 at 13:45 PM'],

['DATE',  '2022-10-31 00:00',  {'date_time': '2022-10-31T00:00', 'timezone': None, 'precision': 'WEEK'},  'next week'],

['DATE',  '2022-10-09',  {'date_time': '2022-10-09T00:00', 'timezone': None, 'precision': 'DAY'},  'Sun, Oct 9, 2022, 14:21'],

['DATE',  '2022-10-31 00:00',  {'date_time': '2022-10-31T00:00', 'timezone': None, 'precision': 'WEEK'},  'next week'],

['DATE',  '2022-10-09 15:50',  {'date_time': '2022-10-09T15:50', 'timezone': None, 'precision': 'MINUTE'},  'Sun, Oct 9, 2022 at 15:50 PM']]

```

Conclusion

Extracting key information from an entire email thread is no longer a time-consuming process. In a few clicks you can get sales insights for your report or action items list to set up tasks for your team. Find out more at One AI Studio

Want to try it out? Place your email in our summary tool.