Library / RAG & Knowledge Bases
RAG & Knowledge Bases
Embed Gmail Emails in PGVector with Ollama
When a new email arrives or on manual run, emails are embedded with Ollama and stored in Postgres with PGVector for semantic search.
What it does
## Magic here 🪄 #### (not really, just statistics) E-mail is stored in a emails_metadata structured table, and also fed to the nomic-embed-text model to be stored in a emails_embeddings table as vector embeddings so similarity searches are possible. The email_id field can be used to make the relation between the structured records and the vector embeddings, as it's stored in their metadata as emails_metadata.id. This is also the case for thread_id.
The steps
- Embeddings Ollama
- Default Data Loader
- Recursive Character Text Splitter
- Gmail Trigger
- Loop Over Items
- Split Out
- Was manually triggered?
- Manual Trigger
- No Operation, do nothing
- Set before and after dates
- Extract email fields
- Store structured
- Store vectorized
- Create the table
16 steps in total.
Similar automations
RAG & Knowledge BasesEmbed Gmail Emails into PGVector with Ollama17 stepsRAG & Knowledge BasesAnswer support questions from your docs with Telegram, OpenRouter and pgvector28 stepsRAG & Knowledge BasesSearch Emails by Meaning and Structure with a Chatbot16 stepsWeb Scraping & ResearchExtract Airline Check-in Details with Ollama into PGVector13 steps