This blog explains how to build an AI-powered email Assistant that can draft, edit, and send emails, store them as vector embeddings, and retrieve similar emails using contextual search. The assistant leverages Semantic Kernel for AI operations, Neon for vector storage, and Azure OpenAI API for generative AI. Everything is hosted on Azure.
To try it,
- For detailed instructions and insights, you can read the full article here:
- Explore the GitHub Repository and create your own AI Email Assistant.
Features
- AI-Powered Draft Generation: Generate email drafts from natural language input using Semantic Kernel.
- Direct Email Sending: Securely send emails via Microsoft Graph API.
- Contextual Search: Perform similarity searches across historical emails and drafts using vector embeddings.
Architecture
The project is built using three main components:
- React Frontend:
- Provides a modern UI for email composition and management.
- Integrates seamlessly with backend services.
- Offers real-time draft previews and editing capabilities.
- Semantic Kernel Backend:
- Generates email drafts using AI models from Azure OpenAI.
- Creates vector embeddings for email content.
- Integrates with Microsoft Graph API for secure email sending.
- Exposes API endpoints for frontend communication.
- NEON Database:
- Serves as a serverless vector database for embeddings.
- Supports efficient similarity searches across historical emails and drafts.
- Offers scalable, reliable storage for real-time AI applications.
Technologies Used
- Frontend: React with modern UI components and responsive design.
- Backend: .NET with Semantic Kernel for seamless AI integration.
- Database: NEON Serverless PostgreSQL for storing vector embeddings.
- Authentication: Microsoft Graph API for secure email integration.
- AI Features: Azure OpenAI for text generation (GPT-4) and embeddings.
- Vector Search: PostgreSQL vector operations for similarity search.
Deployment
Both the backend and frontend are containerized with Docker and deployed to Azure.
New to Neon?
Why NEON is Ideal for This Use Case
Built-in support for the pgvector
extension allows for quick and accurate similarity searches, enabling contextual email retrieval. Neon’s serverless architecture automatically scales with the application’s demands, ensuring efficient handling of large volumes of emails. Neon’s database branching feature enables the creation of isolated, lightweight copies of the database in seconds. You can further extend the use case by introducing the database branching to create a dedicated database for each user. So that search queries that retrieve similar emails only belong to a certain user.
Learn how to build it
Here the repo is https://github.com/passadis/ai-mailer-semantickernel and ask us any questions in Discord.