In this article we show how the API can extract names and company domains from a list of emails.

We discuss the following parts of the prompt in this article:

  • Instruction - A description that helps the API understand what task we want to do

  • Examples - This shows the API how to take the input and create the output

  • Input data - The text we want the API to format

  • Separators - characters that separate sections

  • Temperature parameter

Extract the names and company domain from a list of emails.

###

emails: bot1a@openaiexample.com

names: bot1a

domain: openaiexample.com

###

emails: bot2a@google.com, bot9a@example.com, bot10a@sample.gov

names: bo2a, bot9a, bot10a

domain: google.com, example.com, sample.gov

###

emails:

names:

Open this example in the Playground

Instruction

The instruction is the first line of the prompt: “Extract the names and company domains from a list of emails.”

Examples

Our desired output is a list of names and company domains. so t wo examples are provided, which extract names and company domains from a list of emails. These examples show the format we want the API to present in the completion.

Separators

We use “###” as separators. A newline character could also be used, however the “###” acts as a stronger delimiter and can be used as a Stop Sequence.

Input

The input section begins with “emails”. You can try this yourself by adding a list of comma separated email addresses after the final emails entry. When programmatically running this prompt you will need to add the word “names:” on a newline, after your list of emails, to ensure that the API does not generate additional email addresses.

Temperature

There is no need for randomness or creativity in the completion so we use a temperature value of 0. This signals to the API to only generate content that is related to the text included in the prompt.

Did this answer your question?