# Prompt Templates

Here are a few example prompts to give you an idea of what a good prompt can look like in Relay.app.

* [Extract invoice details from an email](#id-1.-extract-invoice-details-from-an-email)
* [Classify & summarize incoming customer support emails](#id-2.-classify-and-summarize-incoming-customer-support-emails)
* [Extract action items & summarize meeting notes](#id-3.-extract-action-items-and-summarize-meeting-notes)
* [Extract event details from a website with upcoming webinars](#id-4.-extract-event-details-from-a-website-with-upcoming-webinars)

***

### 1. Extract invoice details from an email

{% code overflow="wrap" %}

```
The email we just received contains an invoice. Extract the following information from the invoice:

* Name of the vendor
* Amount
* Due date
```

{% endcode %}

#### Additional context

<div align="left"><figure><img src="https://647519108-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXkKoEy3xMIYaIwd4mRAB%2Fuploads%2Fgit-blob-b69aa4725acc47c1550f59e204f4f7e5c35a7108%2FCleanShot%202024-11-01%20at%2017.16.59.png?alt=media" alt="AI step output configuration showing fields for vendor, amount, and dueDate with their respective data types" width="375"><figcaption></figcaption></figure></div>

### 2. Classify & summarize incoming customer support emails

<pre data-overflow="wrap"><code>You're a customer support agent for a SaaS product. You just received an email from <a data-footnote-ref href="#user-content-fn-1">[$ Email::From name]</a>.

Please summarize their message in one sentence, and classify the email either as a 'Feature request', 'Bug report' or 'Other' when neither of the first two are a good fit.
</code></pre>

#### Output & Context

<div align="left"><figure><img src="https://647519108-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXkKoEy3xMIYaIwd4mRAB%2Fuploads%2Fgit-blob-22a848d6e16947b8d59b9f64c861a8389d5e533a%2FCleanShot%202024-11-01%20at%2017.25.08.png?alt=media" alt="AI step output configuration displaying summary and emailClassification fields, with emailClassification configured as a single select field" width="375"><figcaption><p>The Output is generated via the <strong>Auto-generate from prompt</strong> button</p></figcaption></figure></div>

<div align="left"><figure><img src="https://647519108-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXkKoEy3xMIYaIwd4mRAB%2Fuploads%2Fgit-blob-7b5b0956d7f4bc32fbca945e4363af2c7075b5e9%2FCleanShot%202024-11-01%20at%2017.12.48.png?alt=media" alt="Single select field configuration showing choices for Feature request, Bug report, and Other options in the emailClassification field" width="375"><figcaption><p>The <strong>Choices</strong> as defined for the emailClassification single select output</p></figcaption></figure></div>

### 3. Extract action items & summarize meeting notes

{% code overflow="wrap" %}

```
You're an executive assistant and are tasked to process meeting notes that arrive in [John's] mailbox. You just received an email with meeting notes.

Read the meeting notes in the email. Create a list of all the action items assigned to [John], and summarize the meeting notes.
```

{% endcode %}

#### Output & Context

<div align="left"><figure><img src="https://647519108-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXkKoEy3xMIYaIwd4mRAB%2Fuploads%2Fgit-blob-1256fb1c6c6b7eaf614bb85069b87a681853ee51%2FCleanShot%202024-11-01%20at%2017.21.25.png?alt=media" alt="AI step output configuration showing actionItemsAssignedToJohn as a list field and meetingSummary as a text field" width="375"><figcaption><p>The Output is generated via the <strong>Auto-generate from prompt</strong> button</p></figcaption></figure></div>

<div align="left"><figure><img src="https://647519108-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXkKoEy3xMIYaIwd4mRAB%2Fuploads%2Fgit-blob-5f1eed73b4373fc40ce6ffdf3836e41a6729fa1e%2FCleanShot%202024-11-01%20at%2017.22.31.png?alt=media" alt="List field configuration showing actionItemsAssignedToJohn configured as a List with Text as the nested type" width="375"><figcaption><p>The <strong>actionItemsAssignedToJohn</strong> list is defined as a List of text variables</p></figcaption></figure></div>

### 4. Extract event details from a website with upcoming webinars

<pre data-overflow="wrap" data-full-width="false"><code>Below you will find a website that lists upcoming webinars for [Product].

Extract a list of all upcoming webinar events from this website. For each of them, extract:

* The name of the webinar
* The name of the presenter
* The date
* The start time
* A link to sign up

Website contents below this line
------
<a data-footnote-ref href="#user-content-fn-2">[$ Scraped Website Content]</a>
</code></pre>

#### Output

<div align="left"><figure><img src="https://647519108-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXkKoEy3xMIYaIwd4mRAB%2Fuploads%2Fgit-blob-b4b578a25c38c89fdec2a5386f48301ba3299445%2FCleanShot%202024-10-31%20at%2017.33.00.png?alt=media" alt="AI step output configuration showing webinarEvents as a List of JSON Objects with nested fields for webinar details" width="375"><figcaption><p>The Output section as generated via <strong>Auto-generate from prompt</strong>.</p></figcaption></figure></div>

**Note 1**: The AI model doesn't have access to the Internet directly. You'll first need to scrape content from a website via the built-in [Scrape Text from Website](https://docs.relay.app/built-in-actions/scrape-text-from-website) action. Afterwards, you will be able to insert this as a variable in the prompt (`[$ Scraped Content]` in the example above).

**Note 2**: if you were to construct this output yourself without the 'Auto-generate' button, you will have to do the following:

* Add one top-level output
  * Variant: **List**
  * Type: **JSON Array**
  * Nested type: **JSON Object**
* For the definition of the JSON Object inside the list, you will then add individual fields of (of the **Single** variant) for each piece of information that you want to extract, e.g. the date of the webinar

<div align="left"><figure><img src="https://647519108-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXkKoEy3xMIYaIwd4mRAB%2Fuploads%2Fgit-blob-111c3aa5bbb72ca2a345f623fd464627c182b06a%2FCleanShot%202024-10-31%20at%2017.38.53.gif?alt=media" alt="Animated demonstration of configuring a list of JSON objects output, showing the creation of nested fields within the object structure" width="311"><figcaption><p>Specifying a "list of objects" as a desired output in AI steps</p></figcaption></figure></div>

[^1]: This variable contains the name of the sender of the email that triggered this workflow run

[^2]: This variable contains the output of a [Scrape Text from Website](https://docs.relay.app/built-in-actions/scrape-text-from-website) step


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.relay.app/ai/prompt-templates.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
