Skip to content

xiamx/mymails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mymails: RAG over your Maildir emails with Ollama + ChromaDB

Chat with over your 20 years of emails.

Prerequisites

  • Install Ollama and ensure ollama daemon is running.
  • Python 3.13 with Poetry.

Setup

cd mymails
poetry install

# Pull models
ollama pull nomic-embed-text
ollama pull llama3.1

OfflineIMAP

OfflineIMAP can be used to sync emails from your email provider to your local machine.

A sample offlineimap configuration syncing emails from iCloud to ~/Mail/iCloud.

file: ~/.offlineimaprc

[general]
accounts = iCloud
ui = ttyui

[Account iCloud]
localrepository = iCloudLocal
remoterepository = iCloudRemote

[Repository iCloudLocal]
type = Maildir
localfolders = ~/Mail/iCloud

[Repository iCloudRemote]
type = IMAP
remotehost = imap.mail.me.com
remoteuser = example@icloud.com
remotepass = some-secret-application-pass
ssl = yes
sslcacertfile = /etc/ssl/cert.pem
# run offlineimap
offlineimap

Ingest Maildir (ChromaDB 0.5.x PersistentClient)

poetry run python -m mymails.ingest \
  --maildir ~/Mail/iCloud \
  --persist ./chroma \
  --max-messages 100 \
  --reset

Progress, interruption, and resume

The ingestion supports a progress bar, graceful interruption (Ctrl-C), and automatic resume:

  • By default, a checkpoint file is written under the persist directory named like ingest_<collection>.state. Each processed message is recorded by a deterministic base id.
  • On restart, ingestion skips already-processed messages and continues from where it left off.
  • Use --no-progress to disable the tqdm progress bar.
  • Use --no-resume to force a full reprocess (or --reset to wipe the DB first).
  • Use --checkpoint /custom/path.state to choose a custom checkpoint location.
  • Use --batch-size N to control embedding/upsert batch size (default 64).

Query

poetry run python -m mymails.query \
  --persist ./chroma \
  --question "What were my travel plans June of 2024?"

Optional flags:

  • --collection emails to change collection name
  • --model llama3.1 to switch the chat model
  • --k 5 top-k documents to retrieve
  • --max-messages limit number of emails ingested for quick tests

Performance expectations

On a M3 Macbook Pro, average ingestion time is 2 minutes for 1000 emails.

About

RAG over your Maildir emails with Ollama + ChromaDB

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages