Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Automated Code Generation AI Agent Tutorial #24

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
162 changes: 162 additions & 0 deletions ai_agent_tutorials/ai_coding_agent/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
21 changes: 21 additions & 0 deletions ai_agent_tutorials/ai_coding_agent/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Sakalya Mitra

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
98 changes: 98 additions & 0 deletions ai_agent_tutorials/ai_coding_agent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# AutoTabML - Automated Machine Learning Code Generator for Tabular Data

AutoTabML is an innovative application designed to automate the generation of machine learning code for tabular data. Utilizing CrewAI and the Groq Llama 70B model, AutoTabML simplifies the process of building and debugging machine learning models for both regression and classification problems. With this tool, you can generate working code, debug errors, and run your code without writing a single line of code manually.

## Features

- **Automated Code Generation**: Generate Python code for machine learning tasks based on your tabular dataset and problem description.
- **EDA and Feature Engineering**: Perform comprehensive Exploratory Data Analysis (EDA) and feature engineering.
- **Model Recommendation**: Get suggestions for the most suitable machine learning models for your problem.
- **Code Modification and Debugging**: Modify generated code based on user suggestions and debug errors effortlessly.
- **In-app Execution**: Run the generated code within the application and view the results without the need for external IDEs or additional installations.

## How It Works

AutoTabML leverages multiple agents, each specializing in different aspects of the machine learning pipeline. Here's a brief overview of the agents and their roles:

- **Data Reader Agent**: Reads and loads the uploaded dataset.
- **Problem Definition Agent**: Clarifies the machine learning problem based on user input.
- **EDA Agent**: Performs exploratory data analysis to understand data characteristics.
- **Feature Engineering Agent**: Executes feature engineering based on EDA results.
- **Model Recommendation Agent**: Suggests the most suitable machine learning models.
- **Starter Code Generator Agent**: Generates the initial Python code template for the project.
- **Code Modification Agent**: Adapts the generated code according to user feedback.
- **Code Debugger Agent**: Debugs the generated code to fix any issues.
- **Compiler Agent**: Extracts and compiles the Python code.

## Technology Used
- Python
- CrewAI
- Groq
- Streamlit

## Demo


## Getting Started

### Prerequisites

- Required Python packages (listed in `requirements.txt`)

### Installation

1. Clone the repository:

```bash
git clone https://github.com/Sakalya100/AutoTabML.git
cd AutoTabML
```

2. Create and activate a virtual environment:

```bash
python3 -m venv venv
source venv/bin/activate
```

3. Install the required packages:

```bash
pip install -r requirements.txt
```

4. Set up the environment variables by creating a `.env` file in the root directory and adding your Groq API key:

```
GROQ_API_KEY=your_groq_api_key
```

### Usage

1. Run the Streamlit application:

```bash
streamlit run app.py
```

2. Open your web browser and go to `http://localhost:8501`.

3. Describe your machine learning problem and upload a sample CSV of your dataset.

4. Click on "Process" to generate the initial code. You can then modify, debug, and run the code directly within the application.

### Example Workflow

1. **Describe Your Problem**: Enter a detailed description of the machine learning problem you want to solve.
2. **Upload Dataset**: Upload your dataset in CSV format.
3. **Generate Code**: Click the "Process" button to generate the initial Python code.
4. **Modify and Debug**: Use the provided text areas to suggest code modifications or paste error messages for debugging.
5. **Run the Code**: Execute the generated code and view the results, including any plots or outputs generated during execution.

### Contributors

- **Sakalya Mitra** - **Shalu Singh**

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
Loading