Skip to content
NEWMarketplace and the trig8n Agent: sell what you build, and get plans and changes that are tested before you see them. See what is new

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

  1. Embeddings Ollama
  2. Default Data Loader
  3. Recursive Character Text Splitter
  4. Gmail Trigger
  5. Loop Over Items
  6. Split Out
  7. Was manually triggered?
  8. Manual Trigger
  9. No Operation, do nothing
  10. Set before and after dates
  11. Extract email fields
  12. Store structured
  13. Store vectorized
  14. Create the table

16 steps in total.

Similar automations