The multi-LLM agent can perform a variety of tasks, including sending personalized emails, querying company data, and managing records such as adding, updating, and deleting company information. It streamlines workflows by leveraging natural language processing to understand and execute tasks with minimal manual intervention.
Key Features:
- Email Automation: The agent can send emails to one or more companies based on the email addresses stored in the Excel file. It supports both individual and bulk email sending.
- Data Querying: Users can query the Excel file to retrieve company names, emails, and send status, making data retrieval straightforward and efficient.
- Record Management: The agent allows users to add new company records, update existing email addresses, or delete records entirely based on company names.
- Efficient Workflow: Powered by
LlamaIndex
, the agent ensures personalized interactions with minimal effort, reducing time spent on repetitive tasks.
By using this AI-driven system, users can automate email campaigns, track communication status, and manage their company data without manual entry, all from a simple command-line interface.
- Powers the agent's reasoning and decision-making capabilities using the GPT-4 Turbo (gpt-4o-mini) model.
- A locally hosted LLM leveraging the Llama 3.1 model for efficient querying and analysis of the Excel dataset.
- Facilitates data manipulation and management within the Excel file.
- Handles email sending operations via the SMTP protocol.
- Parses email content stored in markdown file for subject and message configuration.
- Manages sensitive configuration settings like email credentials via environment variables.
- Provides a flexible framework for building the AI-driven agent and enabling natural language interaction with tools and data.
To use this project, you need to install Ollama and the Llama 3.1 model locally. Follow the steps below:
-
Install Ollama Locally:
- Download and install Ollama from Ollama's official website.
-
Install the Llama 3.1 Model:
- After installing Ollama, open a terminal and run the following command to pull the Llama 3.1 model:
ollama pull llama3.1
- After installing Ollama, open a terminal and run the following command to pull the Llama 3.1 model:
To set up the project locally, follow these steps:
-
Clone the Repository:
- Clone this repository to your local machine:
git clone [email protected]:maciekmalachowski/SmartMailer.git cd SmartMailer
- Clone this repository to your local machine:
-
Create a Virtual Environment:
- Create a virtual environment for the project:
python -m venv ai_venv
- Activate the virtual environment:
- On Windows:
ai_venv\Scripts\activate
- On macOS/Linux:
source ai_venv/bin/activate
- On Windows:
- Create a virtual environment for the project:
-
Install Dependencies:
- Install the required dependencies from
requirements.txt
:pip install -r requirements.txt
- Install the required dependencies from
-
Create a
.env
File:-
In the root of the project, create a
.env
file with the following environment variables:EMAIL = "[email protected]" PASSWORD = "examplepass" OPENAI_API_KEY = "exampleCZS5njczXqSBlOfavoO-iHOovT3BlbkFJwcWvyftM7ltRSS8Pkby8zGO4HK4TV8iJf4-fsuuNxayHUkmVPtBuFDUfvPq0czDInnsNWh_eEA"
-
Google App Passwords: If you are using a Google account and have 2-factor authentication enabled, you may need to generate an App Password for this project. You can read more about creating App Passwords here.
-
Optional (but recommended): If you have limited space on your main disk, you can specify the location for caching the Ollama models by adding the following variable to the
.env
file:OLLAMA_MODELS = "D:\Example\ollama_models"
This will redirect Ollama's model cache to the specified location.
-
Once these steps are completed, the environment will be ready to run the project!
To use this AI-driven email agent, follow the steps below:
-
Activate the Virtual Environment:
- Before running the agent, make sure to activate the virtual environment:
- On Windows:
ai_venv\Scripts\activate
- On macOS/Linux:
source ai_venv/bin/activate
- On Windows:
- Before running the agent, make sure to activate the virtual environment:
-
Run the Agent:
- Once the environment is activated, you can start the agent by running:
python agent.py
- This will load the agent, and you will be prompted to enter commands.
- Once the environment is activated, you can start the agent by running:
-
Example Prompts:
You can interact with the agent by typing different prompts. Here are some examples:
- Query the Excel file:
- Retrieve all company names and emails:
Retrieve all company names and emails.
- Retrieve all company names and emails:
- Add a new record:
- Add a company with name and email:
Add company named example1 with email [email protected].
- Add a company with name and email:
- Delete a record:
- Delete a company record based on the company name:
Delete company named example1.
- Delete a company record based on the company name:
- Update a record:
- Update the email for a specific company:
Update email for company named example1 to [email protected].
- Update the email for a specific company:
- Send an email:
- Send an email to a company name listed in the Excel file:
Send email to company named example1.
- Send an email to a company name listed in the Excel file:
- Check sent emails:
- Query the status of emails that have been sent:
Which emails have been sent?
- Query the status of emails that have been sent:
-
Excel File Structure:
The Excel file (
company_data.xlsx
) used by the agent contains the following columns:- Company_name: The name of the company.
- Company_email: The email address of the company.
- Send_status: A field that tracks the status of the email sent to the company (e.g., sent, pending).
-
Updating Email Title and Subject:
You can easily customize the email's Subject and Message by updating the
email.md
markdown file. This file contains the following structure:--- Subject: "TEST SUBJECT" Message: "TEST MESSAGE" ---
Simply replace
"TEST SUBJECT"
and"TEST MESSAGE"
with the desired email title and content. These changes will be reflected in the emails the agent sends.
Simply enter the prompts, and the agent will perform the corresponding actions like querying, adding, deleting, updating records, or sending emails.
Distributed under the MIT License. See LICENSE.txt
for more information.