Skip to content

Commit 9de51fd

Browse files
Update prompts for varied reply lengths (#25)
1 parent e1bf43c commit 9de51fd

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ WellSaid helps you communicate with more empathy and clarity by offering convers
66
## Features
77

88
- **Conversation Summaries**: Analyze your Messages app conversations with a partner from the last 1-24 hours
9-
- **Smart Reply Suggestions**: Get AI-generated reply options (via OpenAI or a local Khoj server) based on conversation context
9+
- **Smart Reply Suggestions**: Get short, medium, and long AI-generated reply options (via OpenAI or a local Khoj server) based on conversation context
1010
- **Conversation History Context**: Considers recent message history (configurable via `HISTORY_LOOKBACK_HOURS`) to provide more contextually relevant suggestions
1111
- **Tone Selection**: Choose from four different tones for your replies:
1212
- Gentle
@@ -146,7 +146,7 @@ yarn dev
146146
WellSaid connects to your macOS Messages database to fetch your conversations with a specific contact (set via the `PARTNER_PHONE` environment variable). It then uses an AI provider (OpenAI's API by default, or a configured local Khoj server if `KHOJ_API_URL` is set) to analyze the conversation and generate:
147147

148148
1. A summary of the conversation, including emotional tone and key topics
149-
1. Three suggested replies in your chosen tone
149+
1. Three suggested replies (short, medium, and long) in your chosen tone
150150

151151
## Technical Details
152152

src/lib/openAi.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ const summaryFunction = {
3434
type: 'function',
3535
function: {
3636
name: 'draft_replies',
37-
description: 'Generate a short summary and three suggested replies',
37+
description:
38+
'Generate a short summary and three suggested replies (short, medium, and long)',
3839
parameters: {
3940
type: 'object',
4041
properties: {

src/lib/prompts.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ export const PERMANENT_CONTEXT = `${CUSTOM_CONTEXT}\n\nMessages with role "user"
55

66
export const buildReplyPrompt = (tone: string, context: string): string => `
77
Given the conversation above, provide a brief summary including the emotional tone, main topics, and any changes in mood.
8-
Suggest 3 replies that I might send. Focus on the most recent messages when crafting replies.
8+
Suggest 3 replies that I might send. Provide one short reply, one medium-length reply, and one long reply. Focus on the most recent messages when crafting replies.
99
Tone: ${tone}
1010
${context ? `Recent conversation context (for reference only):\n${context}\n` : ''}
1111
Please respond using this format:
1212
Summary: <summary>
1313
Suggested replies:
14-
Reply 1: <reply>
15-
Reply 2: <reply>
16-
Reply 3: <reply>
14+
Reply 1: <short reply>
15+
Reply 2: <medium reply>
16+
Reply 3: <long reply>
1717
`
1818

1919
export const buildKhojPrompt = (
@@ -33,16 +33,16 @@ export const buildKhojPrompt = (
3333
${formattedMessages}
3434
3535
Please give a brief summary, including the emotional tone, main topics, and any changes in mood.
36-
Suggest 3 replies that I might send. Focus on the most recent messages when crafting replies.
36+
Suggest 3 replies that I might send. Provide one short reply, one medium-length reply, and one long reply. Focus on the most recent messages when crafting replies.
3737
3838
Tone: ${tone}
3939
${context ? `Recent conversation context (for reference only):\n${context}\n` : ''}
4040
4141
Please respond using this format:
4242
Summary: <summary>
4343
Suggested replies:
44-
Reply 1: <reply>
45-
Reply 2: <reply>
46-
Reply 3: <reply>
44+
Reply 1: <short reply>
45+
Reply 2: <medium reply>
46+
Reply 3: <long reply>
4747
`
4848
}

0 commit comments

Comments
 (0)