# Godamlah_comp_project
This is my first AI project using the JamAI base, which I developed for the **GODAMLah Competition 2024**, powered by **DATASONIC**.
## Project Overview
ChatGuardAI is a conversational monitoring tool that uses JamAI to detect harmful, toxic, or illegal content in real-time messages. The bot flags inappropriate behavior and provides detailed analysis reports for flagged messages.
## Features
- **Harmful Content Detection**: Identifies harmful messages based on analysis through JamAI.
- **Detailed Reporting**: Generates reports for flagged messages, including labels, severity levels, and explanations.
- **Customizable Alerts**: Notifies users in real time when harmful content is detected.
- **JamAI Integration**: Leverages the power of JamAI's table-based processing for enhanced analysis.
## Key Technologies
- **JamAI**: For advanced message analysis and classification.
- **Telegram Bot API**: To provide an interface for real-time interaction.
- **Python (Asyncio)**: For efficient event handling and integration.
## Installation
### Prerequisites
- Python 3.8 or later installed on your system.
- A Telegram bot created through [BotFather](https://t.me/BotFather) to get your bot's API key.
- A JamAI Base account with API key and project ID.
### Steps
1. **Clone this repository**:
```bash
git clone https://github.com/yourusername/Godamlah_comp_project.git
cd Godamlah_comp_project -
Install the required Python dependencies:
pip install -r requirements.txt
-
Set up your JamAI credentials:
- Open the
chatguard_ai.pyfile. - Replace
add your JamAI Base api keywith your JamAI API key. - Replace
add your JamAI Base project idwith your JamAI project ID.
- Open the
-
Set up your Telegram Bot API key:
- Replace
7348521172:AAFRrJdL1hMXymkW4VeawQJ15HwdeF3VtQcin thechatguard_ai.pyfile with your Telegram bot's API key.
- Replace
-
Run the bot:
python chatguard_ai.py
-
Start interacting with your bot on Telegram. Search for your bot's name in the Telegram app and start a chat.
- /start: Sends a welcome message to the user.
- /givereport: Generates a detailed report of the most recent harmful message flagged by the bot.
Ensure you have the following table configured in JamAI for processing messages:
- Table Name:
ChatGuardAI_3.0 - Fields Required:
Message(text field for input messages)Label(classification output indicating harmful or not)Level(severity level of the message)Report(detailed analysis or explanation)
Refer to JamAI’s documentation to set up and configure tables properly.
-
User sends a message in a Telegram chat.
-
ChatGuardAI analyzes the message through JamAI.
-
If harmful content is detected, the bot sends an alert:
⚠️ Harmful Message Report: 🏷️ Label: Harmful 📝 Message: "This is an example of a toxic message." 📈 Level: High Type /givereport for a detailed analysis. -
The user can type
/givereportto receive a detailed explanation of why the message was flagged.
Contributions are welcome! If you'd like to contribute:
- Fork this repository.
- Create a new branch:
git checkout -b feature-name. - Make your changes and commit them:
git commit -m 'Add feature name'. - Push to the branch:
git push origin feature-name. - Open a pull request on GitHub.
This project is licensed under the MIT License.
- GODAMLah Competition 2024 by DATASONIC
- JamAI Base for their powerful NLP and AI tools
- Telegram API for providing an easy-to-use platform for bot integration
- Python Asyncio for making efficient event handling possible
### Instructions for Users
1. **Ensure you have Python 3.8+ installed**:
Check your version using:
```bash
python --version
-
Create a Telegram bot:
- Go to BotFather in Telegram.
- Use the
/newbotcommand to create a new bot. - Copy the API token provided.
-
Set up JamAI:
- Sign up at JamAI Base and create a project.
- Create a table named
ChatGuardAI_3.0with the required fields. - Obtain your API key and project ID.
-
Run the bot locally:
After setup, run the bot and start sending messages in Telegram to test the functionality. -
Troubleshooting:
- Ensure all dependencies are installed using
pip install -r requirements.txt. - Verify your JamAI credentials and Telegram bot API key are correct.
- Check logs for errors (
loggingis enabled by default).
- Ensure all dependencies are installed using