Skip to content
FlowHubFluxonLab
C
AI Automationfree

Gmail to Vector Embeddings with PGVector and Ollama

by Alfonso Correttiadapted from n8n official workflow galleryUpdated Aug 2026
RequiresCCodeDDefault Data LoaderEmbeddings OllamaEmbeddings OllamaGmailGmailPostgresPostgresPostgres PGVector StorePostgres PGVector StoreRecursive Character Text SplitterRecursive Character Text Splitter
Share Post Share
EOEmbeddings OllamaEmbeddings Olla…DDDefault Data LoaderDefault Data Lo…TSRecursive Character Text SplitterRecursive Chara…Gmail TriggerSILoop Over ItemsSOSplit OutIfWas manually triggered?Was manually tr…MaManual TriggerNONo Operation, do nothingNo Operation, d…SeSet before and after datesSet before and …SeExtract email fieldsExtract email f…Store structuredVSStore vectorizedCreate the tableCoExplode interval into weeksExplode interva…Get a batch of messagesGet a batch of …1234567891011121314151617
1/5
STEPS · 17
Starts on a Gmail event

Gmail to Vector Embeddings with PGVector and Ollama Who is this for? Everyone! Did you dream of asking an AI "what hotel did I stay in for holidays last summer?" or "what were my marks last semester like?". Dream no more, as vector similarity searches and this workflow are the foundations to make it possible (as long as the information appears in your e-mails 😅). 100% local This workflow is designed to use locally-hosted open source. Ollama as LLM provider, nomic-embed-text as the embeddings model, and pgvector as the vector database engine, on top of Postgres. But.. how?! Firstly, specify the date you created your Gmail account on, then manually run the workflow in order to bulk read all your e-mail in monthly batches. Your database is now populated! Now it's the task for other workflows to query the vector database. Activate the workflow so that new e-mail is continuously added by the Gmail Trigger upon receiving it.

Tags

n8nreference-onlydocument-default-data-loaderembeddings-ollamagmailpostgrestext-splitter-recursive-character-text-splittervector-store-pgvector
Connects
CCodeDDefault Data LoaderembeddingsollamaEmbeddings OllamagmailGmailpostgresPostgrespostgrespgvectorstorePostgres PGVector Store
CategoryAI Automation
Triggermanual
Complexitycomplex
Nodes16
AddedApr 27, 2025

Related workflows

See all AI Automation
ACDgmail
free

AI: Summarize podcast episode and enhance using Wikipedia

The workflow automates the process of creating a summarized and enriched podcast digest, which is then sent via email. Note that to use this template, you need to be on n8n version 1.19.4 or later.

by n8n Team
DhtmlWopenaichatmodel
free

Scrape and summarize webpages with AI

This workflow integrates both web scraping and NLP functionalities. It uses HTML parsing to extract links, HTTP requests to fetch essay content, and AI-based summarization using GPT-4o. It's an excellent example of an end-to-end automated task that is not only efficient but also provides real value by summarizing valuable content. Note that to use this template, you need to be on n8n version 1.50.0 or later.

by n8n Team
BCgmail
free

Verify Japanese invoice registration numbers from Gmail using Gemini, NTA API, Sheets and Slack

Quick Overview This workflow monitors Gmail for unread invoice emails with PDF attachments, extracts invoice details with Google Gemini, verifies Japanese qualified invoice registration numbers against the National Tax Agency (NTA) Invoice Web-API, logs results to Google Sheets, and sends Slack alerts for invalid, missing, or inconclusive checks. How it works Polls Gmail hourly for unread emails matching “has:attachment invoice” and downloads the first attachment. Extracts text from the attached invoice PDF. Uses Google Gemini to parse the invoice text into structured fields such as the T-registration number, issuer name, invoice date, and amounts. Normalizes and validates the registration number to ensure it matches the required “T + 13 digits” format. If the format is valid, calls the NTA Invoice Web-API to verify the registration number and interprets the response as valid, invalid, or not found. Appends the invoice details and verification status to a Google Sheets worksheet. Routes the outcome by sending the appropriate Slack alert for invalid/not found/inconclusive results or marking the invoice email as read when the number is valid. Setup Connect your Gmail OAuth2 credentia

by Oka Hironobu