0

I'm fetching mail conversations using an api that returns me data in this format

interface MailModel {
  "@odata.etag": string;
  id: string;
  createdDateTime: string;
  lastModifiedDateTime: string;
  changeKey: string;
  categories: string[];
  receivedDateTime: string;
  sentDateTime: string;
  hasAttachments: boolean;
  internetMessageId: string;
  subject: string;
  bodyPreview: string;
  importance: string;
  parentFolderId: string;
  conversationId: string;
  conversationIndex: string;
  isDeliveryReceiptRequested: boolean | null;
  isReadReceiptRequested: boolean;
  isRead: boolean;
  isDraft: boolean;
  webLink: string;
  inferenceClassification: string;
  body: {
    contentType: string;
    content: string;
  };
  sender: {
    emailAddress: {
      name: string;
      address: string;
    };
  };
  from: {
    emailAddress: {
      name: string;
      address: string;
    };
  };
  toRecipients: {
    emailAddress: {
      name: string;
      address: string;
    };
  }[];
  ccRecipients: {
    emailAddress: {
      name: string;
      address: string;
    };
  }[];
  bccRecipients: {
    emailAddress: {
      name: string;
      address: string;
    };
  }[];
  replyTo: {
    emailAddress: {
      name: string;
      address: string;
    };
  }[];
  flag: {
    flagStatus: string;
  };
}

Based on a drafted reply and the mail conversation history. I would like that openAI propose to me a professional reply

There's what I'm prompting

    const prompt = `The draft reply  \n ************* \n "${req.body.replyText }" \n**********\n  \n 
Conversation mail  : \n ###### ${JSON.stringify(cleanedMailExchange)} \n #####. \n \n 
Propose me a better reply in a professional business tone with use of corporate jargon. \n`;

{
  role: "system",
  content: `Improve my drafted reply to a mail conversation and make it look more professional reply . You should understand a mail conversation that i'll provide you. write a short reply`,
},
{ role: "user",
  content: prompt
}

So actually I'm not iterating over the json format data.

The issue is that OpenAI is not always improving the reply, but it's responding to it .

For example when I give " I'm not ok with you" as a reply to improve . Chatgpt respond with " I'm sad to hear that you are not ok, ect " instead of writing :

Hi [Recipient's Name],

I wanted to express that I'm not okay with our recent interaction. Communication is important to me, and I believe discussing this can help us understand each other better. Can we find a time to talk about it?

Thanks,

1 Answer 1

1

Edit prompt slightly ex.

"I have drafted a reply to an email conversation, but I need help refining it to sound more professional and incorporate appropriate corporate jargon. Here is my draft reply:

"DRAFT: [your draft]"

Based on the context of the email conversation below, please help me revise my draft to create a polished and professional response.

Email Conversation Context: ${JSON.stringify(cleanedMailExchange)}

Please provide a revised version of my draft that maintains the intended message but enhances the tone, clarity, and formality appropriate for a business setting."

I think that can help.

1
  • Realy nice prompt. thanks !
    – infodev
    Dec 19, 2023 at 8:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.