This content originally appeared on DEV Community and was authored by Abhishek Ulayil
This is a submission for the Nylas Challenge: AI Expedition, Galaxy Brain.
3 word email : Browse through your E-mails quickly.
There are many ways to categorize emails, with one common method being to sort them into separate folders based on priority. However, this approach can be cumbersome, as it requires checking each folder to ensure important emails weren't wrongly categorized. Introducing 3 Word Email, an AI-powered solution designed to simplify your email experience and alleviate the stress of an overflowing inbox. 3 Word Email empowers you to filter out unimportant emails yourself, giving you more control over your inbox.
3 words is all it takes
The concept of 3 Word Email is not about categorizing but summarizing the content into three words. Combined with category folders, the sender's name, and email address, this summary serves as a quick indicator of whether the email is worth your time.
View the full HTML not just text
To read an email, simply click on the card to view it with full HTML support. This approach puts you in control, allowing you to decide which emails are worth your time for a deeper read. It's a great exercise to do in the mornings—quickly glance at the three-word summary of each email, identify which ones are important to you at that moment, and read them right away.
Your emails look beautiful
Colorful accordion cards, inspired by vintage flight status flip boards, offer a stylish way to present content in a summarized format. The use of beautiful pastel shades, tailored to your email categories, makes it easy to identify and distinguish emails while adding a visually appealing touch.
3 word replies!?
To further expand on the three-word concept, I've added a quick reply feature. This allows you to generate an email body using a large language model, with the option to edit it before saving it as a draft or sending it as a reply.
Mobile first PWA
We rely on our mobile phones more than our PCs, so it's crucial that the app adapts seamlessly to smaller screens. I'm pleased to announce that 3 Word Email is a progressive web application, designed to scale effortlessly across different devices. With the new SQLite caching database implementation, the app should become more responsive as the cache stores most of the data. While your email data isn't stored in the cache, the LLM generated three-word summaries are, which significantly boosts performance.
In ascending order of time consumption
SQlite cache retrieval < Nylas API Access < AI API Access
On-Demand AI Usage and Secure Email Handling
There is a new caching mechanism using sqlite database which stores the AI generated 3 word summaries and avoids API calls and unnecessary slow downs. All your mail data is not stored on the server and is accessed on demand.
I've also included the option to revoke the Nylas grant at any time if you feel concerned and wish to revoke access to your email.
If you can't beat them, join them
This email app isn't intended to replace traditional email clients but to serve as a companion that won't overwhelm you with information. It doesn't make categorization decisions for you but allows you to manage your emails productively. You can continue using your regular email client alongside this app without any issues!
Another excellent feature for reducing email anxiety is the time-based filter option at the top of the main screen. This ensures you don't get bogged down by repeatedly looking at old or irrelevant emails.
Demo
Code
The service is currently live on Hugging Face, but the experience may be sub-optimal due to the restrictions of Hugging Face’s free tier and other AI agent limitations. Hosting and building locally would provide a better experience. To overcome the limitations on the number of queries that can be sent to Gemini in a short time, 3 Word Email will switch to meta's Llama model on Cloudflare workers. This change will ensure continuity and help prevent unexpected errors. Also the caching database takes time to build and would enhance the app speed after a while.
Technical Details
Backend Framework : Flask
AI provider : Google (previously Cloudflare)
Email SDK : Nylas Python SDK
Large Language Model : "Gemini 1.5 flash" (with some use of "@cf/meta/llama-3-8b-instruct")
Frontend Library : Bootstrap 5 with some custom JavaScript
Server : Gunicorn
Cache database : SQlite
Your Journey
To better describe my Journey, I have a day wise breakdown of the hackathon experience.
Day 1 (24th August 2024): I heard about this challenge and immediately began brainstorming ideas, 3 word email came to my mind and its name sounded catchy. Setting up a Nylas account was incredibly simple, and the documentation was excellent, enabling me to get my Flask application up and running in under an hour! I also utilized AI tools like ChatGPT/Gemini to help design my interface components, and with Bootstrap 5 UI, the interface is now responsive to display size, with consistent and clean aesthetics—perfectly aligned with the goal of reducing clutter. I did not have any prior knowledge of Cloudflare's AI workers (which I had to change later on), and I was pleasantly surprised by how easy they were to set up.
Day 2 (25th August 2024): I initialized a Git repository for the project and began by committing my initial work, which included the core idea of working with a three-word summary. There were a few frontend issues, such as fixing overflow problems and challenges with rendering the HTML component of the email. Once again, the Nylas API, with its Python SDK, was straightforward to work with. I used a debugger to examine various variables and functions to achieve the customization I needed.
Day 3 (26th August 2024): Leveraging the Nylas query options, I creatively implemented a time-based filter that loads emails from the last 'x' hours. You can easily adjust this timeframe by modifying the GET parameter
?timedelta=x
.Day 4 (27th August 2024): Continuing with the three-word theme, I added a feature that generates replies using the email body and your three (or more) word inputs to craft a well-rounded response. You can then edit this reply before sending it or saving it as a draft. I utilized Nylas drafts to create and store these drafts, also adding an option to send them directly. The process turned out to be much easier than I anticipated.
Day 5 (28th August 2024): I began adding essential features, such as an option to revoke the Nylas grant directly from the app, which is more convenient than doing so through the cloud provider settings (though it's recommended to revoke it there as well). Additionally, the landing page has been improved to maintain consistent styling, and now includes warnings and license information.
To host the app, I used Hugging Face Spaces and set up the repository there to make it live. I utilized Gunicorn to serve the Flask app, which required some configuration adjustments to enable live hosting.Day 6 (29th August 2024): I expected this day to be easy since most of the project was already completed, but I was in for a surprise. I focused on refining the landing and settings pages to ensure consistent styling, and also started drafting the blog post and recording a demo. However, I encountered some issues with the Llama model I was using—the generated responses sometimes had hallucinations and incorrect contexts. To address this, I switched to Google's Gemini 1.5 Flash model. This change significantly improved the experience, delivering better results and slightly faster performance. The Llama model still needs further tuning to produce more accurate outputs.
I've kept my previous work with Cloudflare and the Llama model within the app for countering the free tier limitations in gemini. Plus, Llama can be run locally, which is great for maintaining data privacy.Day 7 (30th August 2024):Running the Google Gemini model on the free tier comes with limitations on RPM (Requests per Minute) and TPM (Tokens per Minute). To work around this, I've incorporated the Llama model using Cloudflare after making a few burst requests to the Gemini model. This approach acts as a cooldown period, allowing continued use of the app and to avoid "429 Resource Usage Error" warnings. Additionally, I made some visual updates by adding pastel colors to the accordion cards.
Day 8 (31st August 2024): I re-recorded the demonstration video and made some minor edits to censor email IDs. After finishing the blog post and making a few last-minute changes, I also integrated an SQLite database for caching to improve the app's performance. Additionally, I completed the necessary PWA formalities, including adding service workers and manifests.
Day 9 (01st September 2024): Finally, it was time to submit this app for the challenge and publish the blog. Throughout this process, I've learned a great deal about utilizing AI features and integrating them into practical applications. This being my first AI project, I'm pleased with what I've accomplished, thanks to the Nylas API. It made accessing emails much easier, enabling me to help users streamline their email experience.
Overall, this project was an invaluable learning experience and greatly enhanced my confidence in leveraging AI to tackle real-world problems. I'm thankful to the Nylas team for organizing this hackathon challenge and for their excellent documentation, which allowed me to quickly prototype an application in just a few hours. I also appreciate the work behind the Llama 3 model and Google's Gemini 1.5 Flash model—both are impressive, in my opinion.
This content originally appeared on DEV Community and was authored by Abhishek Ulayil
Abhishek Ulayil | Sciencx (2024-09-01T18:27:05+00:00) 3 Word Email : Simplify Your Inbox with AI. Retrieved from https://www.scien.cx/2024/09/01/3-word-email-simplify-your-inbox-with-ai/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.