Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const examples: {
description: "Archive newsletters and label them as 'Newsletter'.",
icon: <NewspaperIcon className="h-4 w-4" />,
rule: {
name: "Archive and label newsletters",
name: "Newsletters",
conditions: [
{
type: ConditionType.AI,
Expand Down
12 changes: 6 additions & 6 deletions apps/web/app/(app)/[emailAccountId]/assistant/examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const examplePromptsBase = [
"If someone asks for help with Product or Company, draft a reply telling them I no longer work there, but they should reach out to Company for support",
"Review any emails from questions@pr.com and see if any are about finance. If so, draft a friendly reply that answers the question",
"If people ask me to speak at an event, label the email @[Speaker Opportunity] and archive it",
"Label customer emails as @[Customer]",
"Label emails from customers as @[Customer]",
"Label legal documents as @[Legal]",
"Label server errors as @[Error]",
"Label Stripe emails as @[Stripe]",
Expand All @@ -80,8 +80,8 @@ export function getExamplePrompts(
const founderPromptArray = [
...commonPrompts,
"If someone asks to set up a call, draft a reply with my calendar link: https://cal.com/example",
"Label customer feedback emails as @[Customer Feedback]",
"Label customer support emails as @[Customer Support]",
"Label emails with feedback from customers about our product as @[Customer Feedback]",
"Label emails from customers who need our help and support as @[Customer Support]",
"Label emails from investors as @[Investor]",
"Label legal documents as @[Legal]",
"Label emails about travel as @[Travel]",
Expand Down Expand Up @@ -109,7 +109,7 @@ export function getPersonas(provider: string) {
"Label emails about affiliate programs as @[Affiliate] and archive them",
"Label collaboration requests as @[Collab] and draft a reply asking about their audience size and engagement rates",
"Label brand partnership emails as @[Brand Deal] and forward to manager@example.com",
"Label media inquiries as @[Press] and draft a reply a polite reply",
"Label media inquiries to us as @[Press] and draft a polite reply",
],
provider,
),
Expand Down Expand Up @@ -244,7 +244,7 @@ export function getPersonas(provider: string) {
...commonPrompts,
"Label emails from influencers as @[Influencer]",
"Label emails from ad platforms (Google, Meta, LinkedIn) as @[Advertising]",
"Label press inquiries as @[Press] and forward to pr@company.com",
"Label press inquiries to us as @[Press] and forward to pr@company.com",
"Label emails about content marketing as @[Content]",
"If someone asks about sponsorship, label as @[Sponsorship] and draft a reply asking about their audience size",
"If someone requests to guest post, label as @[Guest Post] and draft a reply with our guidelines",
Expand All @@ -262,7 +262,7 @@ export function getPersonas(provider: string) {
promptArray: processPromptsWithTerminology(
[
...commonPrompts,
"Label customer support tickets as @[Support Ticket]",
"Label customer requests for help as @[Support Ticket]",
"If someone reports a critical issue, label as @[Urgent Support] and forward to urgent@company.com",
"Label bug reports as @[Bug] and forward to engineering@company.com",
"Label feature requests as @[Feature Request] and forward to product@company.com",
Expand Down
6 changes: 3 additions & 3 deletions apps/web/app/(app)/[emailAccountId]/onboarding/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const usersRolesInfo: Record<
suggestedLabels: [
{
label: "Customer Feedback",
description: "Feedback and suggestions from customers",
description: "Feedback and suggestions we receive from our customers",
},
{
label: "Investor",
Expand Down Expand Up @@ -61,7 +61,7 @@ export const usersRolesInfo: Record<
suggestedLabels: [
{
label: "Customer Feedback",
description: "Feedback and suggestions from customers",
description: "Feedback and suggestions we receive from our customers",
},
{
label: "Urgent",
Expand Down Expand Up @@ -171,7 +171,7 @@ export const usersRolesInfo: Record<
suggestedLabels: [
{
label: "Support Ticket",
description: "Customer help requests and issues",
description: "Customer requests for help with our product or service",
},
{
label: "Bug",
Expand Down
3 changes: 2 additions & 1 deletion apps/web/utils/ai/assistant/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@ Best practices:
- When creating rules, in most cases, you should use the "aiInstructions" and sometimes you will use other fields in addition.
- If a rule can be handled fully with static conditions, do so, but this is rarely possible.
- IMPORTANT: prefer "draft a reply" over "reply". Only if the user explicitly asks to reply, then use "reply". Clarify beforehand this is the intention. Drafting a reply is safer as it means the user can approve before sending.
- Use short, concise rule names (preferably a single word). For example: 'Marketing', 'Newsletters', 'Urgent', 'Receipts'. Avoid verbose names like 'Archive and label marketing emails'.

Always explain the changes you made.
Use simple language and avoid jargon in your reply.
Expand Down Expand Up @@ -745,7 +746,7 @@ Examples:
<output>
<create_rule>
{
"name": "Label Newsletters",
"name": "Newsletters",
"condition": { "aiInstructions": "Newsletters" },
"actions": [
{
Expand Down
4 changes: 3 additions & 1 deletion apps/web/utils/ai/rule/create-rule-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ export const createRuleSchema = (provider: string) =>
z.object({
name: z
.string()
.describe("The name of the rule. No need to include 'Rule' in the name."),
.describe(
"A short, concise name for the rule (preferably a single word). For example: 'Marketing', 'Newsletters', 'Urgent', 'Receipts'. Avoid verbose names like 'Archive and label marketing emails'.",
),
condition: conditionSchema,
actions: z.array(actionSchema(provider)).describe("The actions to take"),
});
Expand Down
2 changes: 1 addition & 1 deletion apps/web/utils/ai/rule/create-rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export async function aiCreateRule(
emailAccount: EmailAccountWithAI,
) {
const system =
"You are an AI assistant that helps people manage their emails. Generate a JSON response with the rule details.";
"You are an AI assistant that helps people manage their emails. Generate a JSON response with the rule details. Use short, concise rule names (preferably a single word like 'Marketing', 'Newsletters', 'Urgent').";
const prompt = `Generate a rule for these instructions:
<instructions>
${instructions}
Expand Down
8 changes: 5 additions & 3 deletions apps/web/utils/ai/rule/prompt-to-rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ ${cleanedPromptFile}
function getSystemPrompt() {
return `You are an AI assistant that converts email management rules into a structured format. Parse the given prompt and convert it into rules.

Use short, concise rule names (preferably a single word). For example: 'Marketing', 'Newsletters', 'Urgent', 'Receipts'. Avoid verbose names like 'Archive and label marketing emails'.

IMPORTANT: If a user provides a snippet, use that full snippet in the rule. Don't include placeholders unless it's clear one is needed.

You can use multiple conditions in a rule, but aim for simplicity.
Expand All @@ -74,7 +76,7 @@ IMPORTANT: You must return a JSON object.
<output>
{
"rules": [{
"name": "Label Newsletters",
"name": "Newsletters",
"condition": {
"aiInstructions": "Apply this rule to newsletters"
},
Expand All @@ -101,7 +103,7 @@ IMPORTANT: You must return a JSON object.
<output>
{
"rules": [{
"name": "Forward Urgent Emails",
"name": "Forward Urgent",
"condition": {
"aiInstructions": "Apply this rule to emails mentioning system outages or critical issues"
},
Expand Down Expand Up @@ -166,7 +168,7 @@ IMPORTANT: You must return a JSON object.
<output>
{
"rules": [{
"name": "Reply to Call Requests",
"name": "Call Requests",
"condition": {
"aiInstructions": "Apply this rule to emails from people asking to set up a call"
},
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.17.39
v2.17.40
Loading