Skip to content

Commit 84d8bf7

Browse files
committed
chore: improve assistant instructions
1 parent d0e0829 commit 84d8bf7

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

api/src/functions/assistant.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ const assistantDefinition = {
3030
name: "Finance Assistant",
3131
instructions:
3232
"You are a personal finance assistant. Retrieve the latest closing price of a stock using its ticker symbol. "
33-
+ "You also know how to generate a full body email in both plain text and html. Only use the functions you have been provideded with",
33+
+ "You also know how to generate a full body email formatted as rich html. Do not use other format than rich html."
34+
+ "Only use the functions you have been provideded with",
3435
tools: [
3536
{
3637
type: "function",
@@ -63,16 +64,12 @@ const assistantDefinition = {
6364
type: "string",
6465
description: "The subject of the email. Limit to maximum 50 characters",
6566
},
66-
text: {
67-
type: "string",
68-
description: "The body text of the email in plain text",
69-
},
7067
html: {
7168
type: "string",
7269
description: "The body text of the email in html",
7370
},
7471
},
75-
required: ["subject", "text", "html"],
72+
required: ["subject", "html"],
7673
},
7774
},
7875
}
@@ -164,7 +161,6 @@ async function* handleRequiresAction(openai, run, runId, threadId) {
164161
tool_call_id: toolCall.id,
165162
output: await writeAndSendEmail(
166163
args.subject,
167-
args.text,
168164
args.html
169165
),
170166
};
@@ -216,9 +212,9 @@ async function getStockPrice(symbol) {
216212
return Promise.resolve("" + Math.random(10) * 1000); // simulate network request
217213
}
218214

219-
async function writeAndSendEmail(subject, text, html) {
215+
async function writeAndSendEmail(subject, html) {
220216
const info = await mailer.sendEmail({
221-
to: EMAIL_RECEIVER, subject, text, html
217+
to: EMAIL_RECEIVER, subject, html
222218
});
223219

224220
return info.messageId;

api/src/functions/mailer.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ const transporter = nodemailer.createTransport({
2121
}
2222
});
2323

24-
exports.sendEmail = async function ({ to, subject, text, html }) {
24+
exports.sendEmail = async function ({ to, subject, html }) {
2525
const info = await transporter.sendMail({
2626
from: `"${EMAIL_SENDER_NAME}" <${EMAIL_SENDER_USERNAME}>`,
2727
to,
2828
subject,
29-
text,
3029
html,
3130
});
3231

0 commit comments

Comments
 (0)