A project originally developed by Antonio Raffaele Iacovazzi as part of his Master’s Thesis in Computer Science, with the goal of developing a chat-based agent that helps users adopt sustainable food habits.
Subsequently, Lorenzo Blanco, as part of his Bachelor's Thesis in Computer Science, further developed the chat-based agent by enhancing its functionalities, improving usability and overall user experience, and expanding its domain beyond sustainability to also address the promotion of healthy food habits.
✅ The Telegram bot is currently active and operational. You can interact with it searching @emealio_bot on Telegam and typing the /start command.
Instructions below are intended for running the project locally.
Python 3 is required.
Download or clone this repository into a local folder.
-
MongoDB Community Edition
Installation Guide -
MongoDB Compass (a handy frontend GUI)
Compass Download
- Extract
emealio_food_db.zipto a location of your choice. - Open MongoDB Compass.
- Create a new database and name it:
➤emealio_food_db - Create a collection inside it called:
➤ingredients - Import data:
- Click on the collection, then use the "Add Data" > "Import JSON" function to import
emealio_food_db.ingredients.json.
- Click on the collection, then use the "Add Data" > "Import JSON" function to import
- Repeat the process for the remaining
.jsonfiles:- For example,
emealio_food_db.recipes.jsonshould be imported into a collection namedrecipes. - Make sure each collection is named exactly like the corresponding file (without the
.jsonextension).
- For example,
The dataset does not include embeddings due to their size (~3GB).
Follow these steps to generate them locally.
Make sure the following Python libraries are installed:
pip install pandas numpy pymongo sentence_transformersRun the script:
python datasetUtilities/compute_embeddings.py- This process takes around 1.5 hours.
- Progress is shown every 100 items with a message like:
Done N
The core agent code is located in the projectRoot folder.
Use pip to install required libraries:
pip install -r requirements.txt-
Create a new bot using BotFather on Telegram.
(Or contact me at ar.iacovazzi@gmail.com to gain access to the existing bot.) -
Create a
.envfile in theprojectRootfolder with the following contents:
OPENAI_API_KEY=
TELEGRAM_BOT_TOKEN=
ANTHROPIC_API_KEY=- Add your corresponding API keys.
- You can provide just one (OpenAI or Anthropic), or none if you plan to configure a different LLM via LangChain.
Launch the agent:
python TelegramBot.py- Send
/startto the bot on Telegram. - If it replies, everything is working! 🎉
You can verify everything is set up correctly by running:
python test.py- Tests are validated with:
- OpenAI GPT-4o
- Anthropic Claude Sonnet 3.5
- If all tests pass, the bot is ready to go.
- If you use a different LLM, ensure it passes all tests—otherwise, the agent may not work properly.
Alternatively, you can run E-Mealio fully containerized with Docker and Docker Compose — no manual setup required.
E-Mealio/
├── docker-compose.yml
├── Dockerfile
├── mongo_dump/ # Precomputed MongoDB dump (BSON format), WARNING: the actual files are not in the folder, check the readme inside to understand how to download them.
├── .env # Contains API keys
└── projectRoot/ # Main bot code
Create a .env file in the root (same directory as docker-compose.yml) with:
OPENAI_API_KEY=your_openai_key
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
ANTHROPIC_API_KEY=your_anthropic_keyYou can leave some variables blank if you're not using a specific provider.
Download the precomputed MongoDB dump from the following link:
🔗 Download emealio_food_db.zip
Then:
- Unzip the file.
- Place the contents inside the
/mongo_dumpdirectory.
From the root of the project, run:
docker-compose up --buildThis will:
- Start a MongoDB container
- Automatically restore the precomputed database from
/mongo_dump - Launch the Telegram bot
- Open your Telegram bot and send
/start - You should receive a response from the bot within a few seconds 🎉
MongoDB data is stored in a Docker-managed volume named mongo_data.
To completely reset the environment (including clearing the database), run:
docker-compose down -v