Skip to content

Commit

Permalink
Issue #50: Add prompts to Source control (#120)
Browse files Browse the repository at this point in the history
* fix: add support for dashes in metadata

* Add Adobe prompts to source control

* Update generated prompt files

* Update generated prompt files

* Add target-audiences files

* Update package.json & package-lock.json
  • Loading branch information
roribio authored Nov 28, 2023
1 parent 2a1e2a2 commit 4d94bea
Show file tree
Hide file tree
Showing 22 changed files with 1,515 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm test && npm run lint
npm run prompts && npm test && npm run lint
84 changes: 42 additions & 42 deletions data/bundledPromptTemplates.json

Large diffs are not rendered by default.

Binary file modified examples/Templates.zip
Binary file not shown.
631 changes: 631 additions & 0 deletions examples/prompt-templates.csv

Large diffs are not rendered by default.

Binary file added examples/prompt-templates.xlsx
Binary file not shown.
Binary file removed examples/promptTemplates.xlsx
Binary file not shown.
Binary file removed examples/segments.xlsx
Binary file not shown.
Binary file added examples/target-audiences.xlsx
Binary file not shown.
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"start": "REACT_APP_VERSION=$npm_package_version aio app run --local",
"preview": "REACT_APP_VERSION=$npm_package_version aio app run",
"grammar": "nearleyc web-src/src/helpers/expressions.ne -o web-src/src/helpers/Parser.generated.js",
"prompts": "node scripts/prompt-generator.js",
"build": "REACT_APP_VERSION=$npm_package_version aio app build",
"deploy:app": "npm run grammar && REACT_APP_VERSION=$npm_package_version aio app deploy --no-actions",
"deploy:actions": "aio app deploy --no-web-assets",
Expand All @@ -25,6 +26,7 @@
"@react-spectrum/toast": "3.0.0-beta.6",
"@spectrum-icons/illustrations": "3.6.7",
"@spectrum-icons/workflow": "4.2.6",
"exceljs": "^4.4.0",
"framer-motion": "10.16.5",
"localforage": "1.10.0",
"nearley": "2.20.1",
Expand Down
105 changes: 105 additions & 0 deletions prompt-templates/card.prompt
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{{# -------------------------------------------------------------------------- }}
{{# CONTEXT }}
{{# Describe the context of where content will be displayed, detailing the }}
{{# intented user experience or expected interaction. }}
{{# -------------------------------------------------------------------------- }}
On our webpage, users are presented with a Card. block which has multiple Card elements. A Card contains summary content and actions about a single subject and linking to its details. They can be used by themselves or within a list. Cards are interactive, and the entire Card container needs to be clickable. Each Card has its own title and description text which should not be presenting detailed information or multiple concepts. Upon interacting with the Card element, {{explain_interaction}}.

{{# -------------------------------------------------------------------------- }}
{{# INTENT }}
{{# State the intended user experience and the rationale behind crafting such }}
{{# an experience. }}
{{# -------------------------------------------------------------------------- }}
Our intent is to engage with users to click and {{explain_intent}}.

{{# -------------------------------------------------------------------------- }}
{{# TARGET AUDIENCE }}
{{# Describe the audience you're targeting by specifying all relevant traits }}
{{# or behaviors. }}
{{# -------------------------------------------------------------------------- }}
Your assigned target audience is {{target_audience}}.

{{# -------------------------------------------------------------------------- }}
{{# TASK }}
{{# Describe the content to be generated. We suggest you modify the hypotheses }}
{{# to fit your needs. }}
{{# -------------------------------------------------------------------------- }}
Your task is to compose {{number_of_variations}} distinct piece(s) of copy for a Card targeted to our target audience that is concise, engaging and persuasive to the user by selecting any available content provided in double-brackets ([[]]) below. The text you compose will be used to test the hypotheses below in a live experiment. Keep in mind the specific traits of our target audience, considering that users will typically only read the title.

To accomplish your task, the text you compose must strictly comply with the following requirements listed in triple backticks (```) below and address the following hypotheses:
- Users will be more likely to engage with the Card if it is personalized to their interests.
- Users will be more likely to engage with the Card if the text is concise, persuasive and engaging.

{{# -------------------------------------------------------------------------- }}
{{# REQUIREMENTS }}
{{# Specify any and all conditions your content must comply with to meet your }}
{{# brand writing guidelines. }}
{{# -------------------------------------------------------------------------- }}
Requirements: ```
- The text must consist of three parts, a Title, a Body and a "AI Rationale".
- The text must be brief, such that:
* In 20 words (100 characters) or less, compose the "AI Rationale" text first and use it to explain your reasoning for composing the copy, before composing the other parts.
* The Title text must not exceed 6 words or 30 characters, including spaces.
* The Body text must not exceed 13 words or 65 characters, including spaces.
- The tone of the text needs to be: {{tone_of_voice}}.
- The product name must appear once either in the Title text or Body text.
- Never abbreviate or shorten the name of the product in the text.
- Compose the text without using the same adjective more than once.
- Do not use exclamation marks or points at the end of sentences in the text.
- Do not use exclamation marks or points in the text.
- Format the response as an array of valid, iterable RFC8259 compliant JSON. Always list the "AI Rationale" attribute last.
```

{{# -------------------------------------------------------------------------- }}
{{# ADDTIONAL CONTEXT }}
{{# Here you will Provide more background information or specific details to }}
{{# guide the creation of the content. }}
{{# -------------------------------------------------------------------------- }}
Additional context: [[
{{additional_context}}
]]

{{# -------------------------------------------------------------------------- }}
{{# METADATA }}
{{# -------------------------------------------------------------------------- }}
{{@explain_interaction,
label="Explain user interaction",
description="Elaborate on the user's interaction with the element, emphasizing the results and impacts of the interaction",
default="the user is taken to a product page displaying a detailed view of our bestselling wireless headphones. Here, they can read product specifications, customer reviews, and make a purchase if they so choose",
type=text
}}

{{@explain_intent,
label="Explain interaction intent",
description="Specify the primary objectives and purposes of the content presented within the web element",
default="interact more with our website content so they can make an informed purchase decision",
type=text
}}

{{@target_audience,
label="Target Audience",
description="Choose the specific audience for which the content is tailored, as indicated in the audience spreadsheet",
spreadsheet=target-audiences,
default="Universal audience: This audience includes all people, spanning all backgrounds. While some members are heavy consumers of digital media and highly influenced by social media, other individuals may rely more on traditional media channels. They all place value on experiences and brand alignment in their purchasing decisions"
}}

{{@tone_of_voice,
label="Tone of voice",
description="Indicate the desired tone of voice",
default="optimistic, smart, engaging, human, and creative",
type=text
}}

{{@number_of_variations,
label="Number of Variations",
description="Enter a number to generate the desired number of variations",
default=4,
type=number
}}

{{@additional_context,
label="Additional Context",
description="Provide more background information or specific details to guide the creation of the content",
default="No additional context provided",
type=text
}}
94 changes: 94 additions & 0 deletions prompt-templates/cart-abandonment.prompt
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{{# -------------------------------------------------------------------------- }}
{{# CONTEXT }}
{{# Describe the context of where content will be displayed, detailing the }}
{{# intented user experience or expected interaction. }}
{{# -------------------------------------------------------------------------- }}
On our webpage, users are presented with a web banner reminding them that they have an on-going purchase ready in their shopping cart. Upon interacting with the web banner, the user will navigate to a page where they can complete the checkout process or, alternatively, compare and choose a different product for purchase.

{{# -------------------------------------------------------------------------- }}
{{# INTENT }}
{{# State the intended user experience and the rationale behind crafting such }}
{{# an experience. }}
{{# -------------------------------------------------------------------------- }}
Our intent is for users to complete a purchase, either by completing the purchase that is in their shopping cart or by choosing a new product.

{{# -------------------------------------------------------------------------- }}
{{# TARGET AUDIENCE }}
{{# Describe the audience you're targeting by specifying all relevant traits }}
{{# or behaviors. }}
{{# -------------------------------------------------------------------------- }}
Your assigned target audience is {{target_audience}}.

{{# -------------------------------------------------------------------------- }}
{{# TASK }}
{{# Describe the content to be generated. We suggest you modify the hypotheses }}
{{# to fit your needs. }}
{{# -------------------------------------------------------------------------- }}
Your task is to compose {{number_of_variations}} distinct piece(s) of copy for a web banner targeted to our target audience that is specific to the Additional Context provided in double-brackets ([[]]) below. The text you compose will be used to test the hypotheses below in a live experiment. Keep in mind the specific traits of our target audience, considering that users will typically only read the title.

To accomplish your task, the text you compose must strictly comply with the following requirements numbered in triple backticks (```) below and address the following hypotheses:
- Customers will be more likely complete a purchase if there's a sense of urgency
- Customers will be more likely complete a purchase if it is easy for them to complete the purchase
- Customers will be more likely complete a purchase if the offer is relevant to their needs

{{# -------------------------------------------------------------------------- }}
{{# REQUIREMENTS }}
{{# Specify any and all conditions your content must comply with to meet your }}
{{# brand writing guidelines. }}
{{# -------------------------------------------------------------------------- }}
Requirements: ```
- The text must consist of four parts, a Title, a Body, a Call-to-Action and a "AI Rationale".
- The text must be brief, such that:
* In 20 words (100 characters) or less, compose the "AI Rationale" text first and use it to explain your reasoning for composing the copy, before composing the other parts.
* The Title text must not exceed 7 words or 35 characters, including spaces.
* The Body text must not exceed 15 words or 75 characters, including spaces.
* The Call-to-Action text must not exceed 4 words or 20 characters, including spaces.
- The tone of the text needs to be: {{tone_of_voice}}.
- The product name must appear once either in the Title text or Body text.
- Never abbreviate or shorten the name of the product in the text.
- Compose the text without using the same adjective more than once.
- Do not use exclamation marks or points at the end of sentences in the text.
- Do not use exclamation marks or points in the text.
- Avoid generic phrases like "Learn More", "Get Started" in the call-to-action text.
10. Format the response as an array of valid, iterable RFC8259 compliant JSON. Always list the "AI Rationale" attribute last.
```

{{# -------------------------------------------------------------------------- }}
{{# ADDTIONAL CONTEXT }}
{{# Here you will Provide more background information or specific details to }}
{{# guide the creation of the content. }}
{{# -------------------------------------------------------------------------- }}
Additional context: [[
{{additional_context}}
]]

{{# -------------------------------------------------------------------------- }}
{{# METADATA }}
{{# -------------------------------------------------------------------------- }}
{{@target_audience,
label="Target Audience",
description="Choose the specific audience for which the content is tailored, as indicated in the audience spreadsheet",
spreadsheet=target-audiences,
default="Universal audience: This audience includes all people, spanning all backgrounds. While some members are heavy consumers of digital media and highly influenced by social media, other individuals may rely more on traditional media channels. They all place value on experiences and brand alignment in their purchasing decisions"
}}

{{@tone_of_voice,
label="Tone of voice",
description="Indicate the desired tone of voice",
default="optimistic, smart, engaging, human, and creative",
type=text
}}

{{@number_of_variations,
label="Number of Variations",
description="Enter a number to generate the desired number of variations",
default=4,
type=number
}}

{{@additional_context,
label="Additional Context",
description="Provide more background information or specific details to guide the creation of the content",
default="No additional context provided",
type=text
}}
51 changes: 51 additions & 0 deletions prompt-templates/faq.prompt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{# --------------------- }}
{{# CONTEXT }}
{{# --------------------- }}
On our webpage, users encounter an FAQ section that serves as a key resource for information on {{product}}. This section is designed to answer the most common questions. Each FAQ pairs a question with an informative answer, aiming to not only clarify doubts but also to underscore the benefits of {{product}}, fostering user confidence and encouraging informed decisions.

{{# --------------------- }}
{{# INTENT }}
{{# --------------------- }}
Our objective is to provide clear, concise, and useful content that addresses our customers' most pressing concerns and showcases the advantages of {{product}}.

{{# --------------------- }}
{{# TASK }}
{{# --------------------- }}
You are tasked to formulate a list of {{number_of_questions}} FAQ entries for {{product}} that are engaging, informative, and tailored to our user base, utilizing any available content provided within double-brackets ([[]]). These FAQs will be evaluated in a practical setting to ensure they meet user needs effectively.

{{# --------------------- }}
{{# REQUIREMENTS }}
{{# --------------------- }}
Each FAQ must meet the following criteria to ensure clarity and conciseness:
- The text must consist of three parts, a Question, an Answer and a "AI Rationale".
- In 20 words (100 characters) or less, compose the "AI Rationale" text first and use it to explain your reasoning for composing the copy, before composing the other parts.
- Questions should be direct and not exceed 15 words.
- Answers must be informative yet brief, limited to 100 words.
- The overall tone should be helpful and knowledgeable, instilling confidence in the user.
- Format the response as an array of valid, iterable RFC8259 compliant JSON. Always list the "AI Rationale" attribute last.

Additional context for the {{product}} and user inquiries can be found here: [[{{additional_context}}]]"

{{# --------------------- }}
{{# METADATA. }}
{{# --------------------- }}
{{@product,
label="Product",
default="Best selling headphones",
description="Identify the specific product for which the FAQ is being created.",
type=text
}}

{{@number_of_questions,
label="Number of Questions",
description="Enter the number of FAQ entries to be generated.",
default=4,
type=number
}}

{{@additional_context,
label="Additional Context",
description="Provide more background information or specific details to guide the creation of the FAQ content.",
default="No additional context provided",
type=text
}}
Loading

0 comments on commit 4d94bea

Please sign in to comment.