Update README.md
Browse files
README.md
CHANGED
|
@@ -1,180 +1,191 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
from
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
from
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
```
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
```
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
- **
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
- **
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
- **
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
- **
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
metrics:
|
| 6 |
+
- code_eval
|
| 7 |
+
library_name: adapter-transformers
|
| 8 |
+
pipeline_tag: text-generation
|
| 9 |
+
tags:
|
| 10 |
+
- code
|
| 11 |
+
---
|
| 12 |
+
# Ddroidlabs-mixture-of-agents
|
| 13 |
+
small agentic model designed as a coding assistant
|
| 14 |
+
|
| 15 |
+
# Mixture of Agents Model (MAM) - Full-Stack Development Team
|
| 16 |
+
|
| 17 |
+
## Overview
|
| 18 |
+
|
| 19 |
+
The Mixture of Agents Model (MAM) is an AI-driven full-stack development team that integrates specialized agents for front-end development, back-end development, database management, DevOps, and project management. This unified model leverages a pretrained transformer and fine-tuned datasets to handle a variety of software development tasks efficiently.
|
| 20 |
+
|
| 21 |
+
## Folder Structure
|
| 22 |
+
|
| 23 |
+
```
|
| 24 |
+
mixture_of_agents/
|
| 25 |
+
βββ app.py
|
| 26 |
+
βββ colab_notebook.ipynb
|
| 27 |
+
βββ dataset/
|
| 28 |
+
β βββ code_finetune_dataset.json
|
| 29 |
+
βββ agents/
|
| 30 |
+
β βββ front_end_agent.py
|
| 31 |
+
β βββ back_end_agent.py
|
| 32 |
+
β βββ database_agent.py
|
| 33 |
+
β βββ devops_agent.py
|
| 34 |
+
β βββ project_management_agent.py
|
| 35 |
+
βββ integration/
|
| 36 |
+
β βββ integration_layer.py
|
| 37 |
+
βββ model/
|
| 38 |
+
βββ load_pretrained_model.py
|
| 39 |
+
βββ fine_tune_model.py
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
## Setup Instructions
|
| 43 |
+
|
| 44 |
+
### Prerequisites
|
| 45 |
+
|
| 46 |
+
- Python 3.7 or higher
|
| 47 |
+
- Flask
|
| 48 |
+
- Google Colab account (for running the notebook)
|
| 49 |
+
- Libraries: `transformers`, `datasets`, `numpy`, `pandas`
|
| 50 |
+
|
| 51 |
+
### Installation
|
| 52 |
+
|
| 53 |
+
1. **Clone the Repository:**
|
| 54 |
+
```bash
|
| 55 |
+
git clone https://github.com/your-repo/mixture_of_agents.git
|
| 56 |
+
cd mixture_of_agents
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
2. **Install Required Libraries:**
|
| 60 |
+
```bash
|
| 61 |
+
pip install -r requirements.txt
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
3. **Upload to Google Drive:**
|
| 65 |
+
- Upload the `mixture_of_agents` folder to your Google Drive.
|
| 66 |
+
|
| 67 |
+
4. **Open Colab Notebook:**
|
| 68 |
+
- Open `colab_notebook.ipynb` in Google Colab.
|
| 69 |
+
|
| 70 |
+
### Running the Model
|
| 71 |
+
|
| 72 |
+
1. **Mount Google Drive:**
|
| 73 |
+
- Mount your Google Drive in Colab by running the first cell of the notebook:
|
| 74 |
+
```python
|
| 75 |
+
from google.colab import drive
|
| 76 |
+
drive.mount('/content/drive')
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
2. **Install Necessary Packages:**
|
| 80 |
+
- Install the required packages in the Colab environment:
|
| 81 |
+
```python
|
| 82 |
+
!pip install transformers datasets
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
3. **Load and Fine-Tune the Model:**
|
| 86 |
+
- Follow the steps in the Colab notebook to load the pretrained model and fine-tune it using the provided dataset:
|
| 87 |
+
```python
|
| 88 |
+
from model.load_pretrained_model import load_model_and_tokenizer
|
| 89 |
+
model, tokenizer = load_model_and_tokenizer()
|
| 90 |
+
|
| 91 |
+
from model.fine_tune_model import fine_tune_model
|
| 92 |
+
fine_tune_model(model, tokenizer, '/content/drive/MyDrive/mixture_of_agents/dataset/code_finetune_dataset.json')
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
4. **Initialize and Use the Agents:**
|
| 96 |
+
- Initialize the agents and use the integration layer to process tasks:
|
| 97 |
+
```python
|
| 98 |
+
from agents.front_end_agent import FrontEndAgent
|
| 99 |
+
from agents.back_end_agent import BackEndAgent
|
| 100 |
+
from agents.database_agent import DatabaseAgent
|
| 101 |
+
from agents.devops_agent import DevOpsAgent
|
| 102 |
+
from agents.project_management_agent import ProjectManagementAgent
|
| 103 |
+
from integration.integration_layer import IntegrationLayer
|
| 104 |
+
|
| 105 |
+
front_end_agent = FrontEndAgent(model, tokenizer)
|
| 106 |
+
back_end_agent = BackEndAgent(model, tokenizer)
|
| 107 |
+
database_agent = DatabaseAgent(model, tokenizer)
|
| 108 |
+
devops_agent = DevOpsAgent(model, tokenizer)
|
| 109 |
+
project_management_agent = ProjectManagementAgent(model, tokenizer)
|
| 110 |
+
integration_layer = IntegrationLayer(front_end_agent, back_end_agent, database_agent, devops_agent, project_management_agent)
|
| 111 |
+
|
| 112 |
+
task_data = {'task': 'Create a responsive website layout'}
|
| 113 |
+
result = integration_layer.process_task('front_end', task_data)
|
| 114 |
+
print(result)
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
### Running the Web Application
|
| 118 |
+
|
| 119 |
+
1. **Ensure All Agent Files and Integration Layer Are Available:**
|
| 120 |
+
- Make sure the `agents` and `integration` directories with their respective Python files (`front_end_agent.py`, `back_end_agent.py`, `database_agent.py`, `devops_agent.py`, `project_management_agent.py`, and `integration_layer.py`) are in the same directory as `app.py`.
|
| 121 |
+
|
| 122 |
+
2. **Run the Application:**
|
| 123 |
+
- Execute the `app.py` script to start the Flask web server:
|
| 124 |
+
```bash
|
| 125 |
+
python app.py
|
| 126 |
+
```
|
| 127 |
+
|
| 128 |
+
3. **Using the API:**
|
| 129 |
+
- Open your web browser and navigate to `http://127.0.0.1:5000/` to see the welcome message.
|
| 130 |
+
- Use a tool like `curl` or Postman to send a POST request to the `/process` endpoint with JSON payload to process tasks.
|
| 131 |
+
|
| 132 |
+
### Example POST Request
|
| 133 |
+
You can use the following example JSON payload to test the `/process` endpoint:
|
| 134 |
+
|
| 135 |
+
```json
|
| 136 |
+
{
|
| 137 |
+
"task_type": "front_end",
|
| 138 |
+
"task_data": {
|
| 139 |
+
"task": "Create a responsive website layout"
|
| 140 |
+
}
|
| 141 |
+
}
|
| 142 |
+
```
|
| 143 |
+
|
| 144 |
+
**Using `curl`:**
|
| 145 |
+
```bash
|
| 146 |
+
curl -X POST http://127.0.0.1:5000/process -H "Content-Type: application/json" -d '{"task_type": "front_end", "task_data": {"task": "Create a responsive website layout"}}'
|
| 147 |
+
```
|
| 148 |
+
|
| 149 |
+
## Agent Descriptions
|
| 150 |
+
|
| 151 |
+
### Front-End Agent
|
| 152 |
+
- **File:** `agents/front_end_agent.py`
|
| 153 |
+
- **Responsibilities:** UI/UX design, HTML, CSS, JavaScript frameworks (React, Vue).
|
| 154 |
+
|
| 155 |
+
### Back-End Agent
|
| 156 |
+
- **File:** `agents/back_end_agent.py`
|
| 157 |
+
- **Responsibilities:** Server-side logic, API development, frameworks like Node.js, Django.
|
| 158 |
+
|
| 159 |
+
### Database Agent
|
| 160 |
+
- **File:** `agents/database_agent.py`
|
| 161 |
+
- **Responsibilities:** Database design, query optimization, data migration.
|
| 162 |
+
|
| 163 |
+
### DevOps Agent
|
| 164 |
+
- **File:** `agents/devops_agent.py`
|
| 165 |
+
- **Responsibilities:** CI/CD pipelines, server management, deployment automation.
|
| 166 |
+
|
| 167 |
+
### Project Management Agent
|
| 168 |
+
- **File:** `agents/project_management_agent.py`
|
| 169 |
+
- **Responsibilities:** Requirement gathering, task management, progress tracking.
|
| 170 |
+
|
| 171 |
+
### Integration Layer
|
| 172 |
+
- **File:** `integration/integration_layer.py`
|
| 173 |
+
- **Responsibilities:** Ensures seamless communication and coordination between agents.
|
| 174 |
+
|
| 175 |
+
## Fine-Tuning Dataset
|
| 176 |
+
|
| 177 |
+
### Dataset File
|
| 178 |
+
- **File:** `dataset/code_finetune_dataset.json`
|
| 179 |
+
- **Description:** Contains examples of various coding tasks to fine-tune the model for development-related tasks.
|
| 180 |
+
|
| 181 |
+
## Contributing
|
| 182 |
+
|
| 183 |
+
Contributions are welcome! Please fork the repository and create a pull request with your changes. Ensure your code follows the project's style guidelines and includes appropriate tests.
|
| 184 |
+
|
| 185 |
+
## License
|
| 186 |
+
|
| 187 |
+
This project is licensed under the apache-2.0 License.
|
| 188 |
+
|
| 189 |
+
## Contact
|
| 190 |
+
|
| 191 |
+
For any questions or issues, please open an issue on GitHub or contact the repository maintainer.
|