Turn Your Gmail Emails into Smart Vector Embeddings with Ollama and PGVector
detail.loadingPreview
Automate the conversion of your Gmail emails into powerful vector embeddings using Ollama and store them with PGVector. This workflow transforms unstructured email data into a format suitable for advanced AI applications, enabling intelligent search, sentiment analysis, and more.
About This Workflow
This n8n workflow revolutionizes how you interact with your Gmail data. It seamlessly fetches emails, processes their content, and generates sophisticated vector embeddings using the Ollama AI model. These embeddings are then prepared for storage in a PGVector database, allowing for efficient similarity searches and contextual understanding of your email communications. Whether you're looking to build a custom email search engine, perform sentiment analysis on past conversations, or feed your email data into other AI models, this workflow provides a robust foundation. The setup is designed to be adaptable, with clear instructions for handling bulk imports and continuous monitoring of new incoming emails.
Key Features
- Automated Email Ingestion: Trigger the workflow manually for bulk import or set it to continuously monitor your Gmail inbox for new emails.
- Powerful AI Embeddings: Leverage Ollama's capabilities to generate high-quality vector embeddings from your email text.
- Data Structuring for AI: Automatically extracts and formats relevant email fields, including text, sender, recipient, and timestamps, along with custom metadata.
- Intelligent Text Splitting: Employs a recursive character text splitter to manage long email content effectively, ensuring optimal embedding generation.
- Flexible Data Integration: Designed with PGVector in mind, providing a structured output ready for efficient storage and querying.
How To Use
- Manual Trigger for Bulk Import: Start by using the 'Manual Trigger' node. Configure the 'Set before and after dates' node to define the date range for your initial bulk import. Then, press the 'Test workflow' button to process all emails within that range.
- Gmail Trigger for Continuous Monitoring: For ongoing email processing, activate the 'Gmail Trigger' node. This node is configured to check your inbox every minute.
- Email Content Extraction: The 'Extract email fields' node pulls the relevant content (text, sender, recipient, IDs, date) from each email.
- Data Preparation for Embeddings: The 'Default Data Loader' node takes the extracted email text and associated metadata (email ID, thread ID) to prepare it for embedding.
- Text Chunking: The 'Recursive Character Text Splitter' divides longer email content into manageable chunks, optimizing the embedding process.
- Embedding Generation: The 'Embeddings Ollama' node utilizes the specified Ollama model ('nomic-embed-text:latest') to generate vector embeddings for each text chunk.
- Conditional Execution: The 'Was manually triggered?' node acts as a control flow, determining whether the workflow was initiated manually or by the Gmail trigger, directing execution accordingly.
Apps Used
Workflow JSON
{
"id": "1deadb8d-7e19-4271-a69b-1ecbf0839e69",
"name": "Turn Your Gmail Emails into Smart Vector Embeddings with Ollama and PGVector",
"nodes": 8,
"category": "DevOps",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: 1deadb8d-7e19...
About the Author
Free n8n Workflows Official
System Admin
The official repository for verified enterprise-grade workflows.
Statistics
Related Workflows
Discover more workflows you might like
Effortless Bug Reporting: Slack Slash Command to Linear Issue
Streamline your bug reporting process by instantly creating Linear issues directly from Slack using a simple slash command. This workflow enhances team collaboration by providing immediate feedback and a structured approach to logging defects, saving valuable time for development and QA teams.
Automate Qualys Report Generation and Retrieval
Streamline your Qualys security reporting by automating the generation and retrieval of reports. This workflow ensures timely access to crucial security data without manual intervention.
Automated PR Merged QA Notifications
Streamline your QA process with this automated workflow that notifies your team upon successful Pull Request merges. Leverage AI and vector stores to enrich notifications and ensure seamless integration into your development pipeline.