Jason JunJason Jun

Paramail

2023

Paramail is an AI web app that helps Korean users easily understand and reply to English emails. I developed this project for the first GenAI Hackathon in South Korea and won second place in the competition.

Received email submittingReceived email submitting
Email translationEmail translation
Email analysis & reply list
generationEmail analysis & reply list generation
Reply email generationReply email generation

The app is divided into two main functions: creating new emails and replying to emails. Composing a new email is straightforward and can be done with ChatGPT alone, so I focused on streamlining the process of composing a reply email.

Reply email generation flowReply email generation flow

When the user enters the English email they received, the translation and analysis process begins. For direct translation, I used the Google Translate API for speed. The email analysis is handled by the OpenAI GPT-3.5 model.

Prompt engineering

The most challenging aspect of prompt engineering was consistently obtaining the desired form of response. Even with the API temperature set to 0 and a precise response type requested, GPT would sometimes return an unexpected answer.

Email analysis prompt
structureEmail analysis prompt structure

When analysing emails, I prioritised Korean accuracy over speed. Instead of using the Google API, I asked GPT to respond directly in Korean. However, GPT sometimes ignored this request and replied in English. To mitigate this, I assigned GPT the role of "Assistant for Korean email recipients" in the prompt, which seemed to help.

To make GPT responses usable on the frontend, it was essential to standardise the format. I used the Few-Shot technique, which involves including example questions and answers in the prompts. Through iterative testing, I determined the example emails and the optimal number to minimise token usage while ensuring stable answer formats.

Email analysis consists of generating a short summary, a checklist of things the recipient shouldn't miss, and a list of possible responses based on that.

Rendering UI based on GPT response

To transform GPT's response into a user interface, I used Regex to split the text. Error handling was crucial since the GPT response format is not always 100% reliable.

Rendering UI from
responseRendering UI from response

Finally, the response email is generated based on the initial email received and the user's selected or manually entered response. To help the user see the full content of the generated response email, the Google Translate API was used to provide a translation.

Technical specifications

The app was built on Next.js and utilised Supabase for authentication and the database. For some UI components like Tab, Dialog, and Popover, I used Radix UI, and the styling was done with Tailwind CSS. The credit payment system was implemented using Supabase and Stripe.