Giter VIP home page Giter VIP logo

menghuan1918 / sum-mail-event Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 56 KB

这个项目旨在利用本地LLM对邮件进行过滤,仅提取出与用户(自定义画像)有关的事件/通知/紧急邮件。 This project aims to filter emails using local LLM to extract only events/notification/urgent emails that are relevant to the user (custom portrait).

License: GNU General Public License v3.0

Python 100.00%

sum-mail-event's Introduction

Sum-Mail-Event

English | 中文

This project aims to filter emails using local LLM to extract only event/notification/urgent emails that are relevant to the user (custom portrait). The LLM related part of it is designed to work well even with 7B Q4 quantitative model.

Although the design goal is to use local LLM, in theory it should be compatible with any openai format online api.

Running main.py its going to:

  • Read the configuration file and get the contents of the latest few (custom number) emails.
  • If it contains images, it will OCR them.
  • Determine email category by LLM (need to see now/need to see/relevant emails/spam).
  • Local storage of email summaries
  • Send summarised emails according to the set threshold.
  • In particular, for local LLM, there is a back-end on-demand implementation.

How to use

Install dependencies

pip install -r requirements.txt

Perform mailbox/LLM configuration

Copy config.json to config_private.json and configure your own response messages in it.

If you are using local LLM, you should also modify the run.py section for local LLM on-demand.

You can also create a new disclaimers.txt, where you can place multi-terminal text separated by blank lines if you have fixed unimportant text in your messages (e.g. warnings using the Outlook forwarding feature). The programme will automatically delete the parts of the message that have the same text as these.

Parsing in config.json

email_add: the address of the mailbox.
email_pwd: password of the mailbox.
email_host: IMAPC server address, default is outlook's
smtp_host: SMTP server address, default is outlook's
smtp_port: SMTP server port, default is outlook's
number_of_mail: the number of the latest mail to get.
model_name: the name of the requested LLM model.
model_addr: the address of the requested model.
model_key: API key of the requested LLM
model_max_tokens: maximum tokens of LLM
local_model: if or not it is a local model
retry_times: Maximum number of retries for LLM requests.
try_wait: waiting time before retrying after a failed request.
wait_time: timeout for each LLM request.
send_email: a summary email will be sent to this mailbox
threshold_value: the threshold of sending, when the weight of stacked emails exceeds this value, it will trigger sending. The weight of spam is 1, general mail is 2, related mail is 3 and urgent mail is 100.

Run

python main.py

You can set it to execute regularly every x hours

Planning

  • Optimise the formatting of summary emails sent out
  • Add a shortcut script to run persistently
  • Add vector library to work with LLM for quizzing email content.
  • Add more ways to notify summary emails

sum-mail-event's People

Contributors

menghuan1918 avatar

Stargazers

 avatar

Watchers

Kostas Georgiou avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.