An open API service indexing awesome lists of open source software.

https://github.com/coslynx/ai-powered-request-handler

AI-powered system efficiently manages and resolves user requests... Created at https://coslynx.com
https://github.com/coslynx/ai-powered-request-handler

ai-powered api-security api-wrapper code-generation developer-tools devops docker fastapi jwt language-model machine-learning mvp mvp-development openai-integration postgresql python python-backend request-handler software-development sqlalchemy

Last synced: about 2 months ago
JSON representation

AI-powered system efficiently manages and resolves user requests... Created at https://coslynx.com

Awesome Lists containing this project

README

          




AI Powered Request Handler System


A Python backend API for streamlined OpenAI interaction


Developed with the software and tools below.



Framework used for the backend API
Programming language used
Database used for storage
AI models integrated


git-last-commit
GitHub commit activity
GitHub top language

## ๐Ÿ“‘ Table of Contents
- ๐Ÿ“ Overview
- ๐Ÿ“ฆ Features
- ๐Ÿ“‚ Structure
- ๐Ÿ’ป Installation
- ๐Ÿ—๏ธ Usage
- ๐ŸŒ Hosting
- ๐Ÿ“„ License
- ๐Ÿ‘ Authors

## ๐Ÿ“ Overview
This repository contains the code for the AI Powered Request Handler System, a Python backend API designed to simplify user interactions with OpenAI's powerful language models. This MVP provides a user-friendly interface for accessing OpenAI's capabilities without needing extensive technical knowledge.

## ๐Ÿ“ฆ Features
| | Feature | Description |
|----|--------------------|--------------------------------------------------------------------------------------------------------------------|
| โš™๏ธ | **Architecture** | The codebase follows a modular architectural pattern with separate directories for different functionalities, ensuring easier maintenance and scalability. |
| ๐Ÿ“„ | **Documentation** | The repository includes a README file that provides a detailed overview of the MVP, its dependencies, and usage instructions.|
| ๐Ÿ”— | **Dependencies** | The codebase relies on various external libraries and packages such as FastAPI, SQLAlchemy, PyJWT, OpenAI, and Redis, essential for building the API, handling database interactions, and managing user authentication and caching.|
| ๐Ÿงฉ | **Modularity** | The modular structure allows for easier maintenance and reusability of the code, with separate directories and files for different functionalities such as controllers, services, and models.|
| ๐Ÿงช | **Testing** | Implement unit tests using frameworks like `pytest` to ensure the reliability and robustness of the codebase. |
| โšก๏ธ | **Performance** | Optimizes performance through caching mechanisms (Redis) and efficient database query optimization, ensuring fast and responsive service delivery. |
| ๐Ÿ” | **Security** | Enhances security by implementing measures such as input validation, data encryption, and secure communication protocols. |
| ๐Ÿ”€ | **Version Control**| Utilizes Git for version control with GitLab CI workflow files for automated build and release processes.|
| ๐Ÿ”Œ | **Integrations** | Interacts with the OpenAI API, PostgreSQL database, and utilizes Redis for caching, enabling robust functionality. |
| ๐Ÿ“ถ | **Scalability** | The architecture allows for horizontal scalability by leveraging containerization (Docker) and database sharding. |

## ๐Ÿ“‚ Structure
```text
โ”œโ”€โ”€ api
โ”‚ โ”œโ”€โ”€ src
โ”‚ โ”‚ โ”œโ”€โ”€ controllers
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ request_controller.py
โ”‚ โ”‚ โ”œโ”€โ”€ services
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ request_service.py
โ”‚ โ”‚ โ”œโ”€โ”€ models
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ request_model.py
โ”‚ โ”‚ โ”œโ”€โ”€ main.py
โ”‚ โ”‚ โ””โ”€โ”€ config
โ”‚ โ”‚ โ””โ”€โ”€ settings.py
โ”‚ โ”œโ”€โ”€ requirements.txt
โ”‚ โ””โ”€โ”€ startup.sh
โ”œโ”€โ”€ migrations
โ”‚ โ”œโ”€โ”€ __init__.py
โ”‚ โ”œโ”€โ”€ env.py
โ”‚ โ”œโ”€โ”€ versions.py
โ”‚ โ””โ”€โ”€ 0001_initial.py
โ”œโ”€โ”€ tests
โ”‚ โ””โ”€โ”€ test_request_controller.py
โ”œโ”€โ”€ celery
โ”‚ โ”œโ”€โ”€ __init__.py
โ”‚ โ””โ”€โ”€ tasks.py
โ”œโ”€โ”€ .env
โ”œโ”€โ”€ Dockerfile
โ”œโ”€โ”€ docker-compose.yml
โ””โ”€โ”€ .gitlab-ci.yml

```

## ๐Ÿ’ป Installation
### ๐Ÿ”ง Prerequisites
- Python 3.9+
- Docker
- PostgreSQL
- Redis

### ๐Ÿš€ Setup Instructions
1. Clone the repository:
```bash
git clone https://github.com/coslynx/AI-Powered-Request-Handler.git
cd AI-Powered-Request-Handler
```
2. Install dependencies:
```bash
pip install -r requirements.txt
```
3. Set up the database:
```bash
# Create a PostgreSQL database and user
# Update the DATABASE_URL in your .env file
# Run database migrations:
alembic upgrade head
```
4. Configure environment variables:
```bash
cp .env.example .env
# Fill in necessary environment variables like OPENAI_API_KEY, DATABASE_URL, and JWT_SECRET_KEY (optional)
```

## ๐Ÿ—๏ธ Usage
### ๐Ÿƒโ€โ™‚๏ธ Running the MVP
1. Start the development server using Docker Compose:
```bash
docker-compose up -d
```

2. Access the application:
- API endpoints: `http://localhost:8000/docs`

### โš™๏ธ Configuration
- Environment variables are loaded from the `.env` file.
- Configuration settings are defined in `api/src/config/settings.py`.

### ๐Ÿ“š Examples
- **Send a request to GPT-3**:
```bash
curl -X POST http://localhost:8000/requests \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-d '{"text": "Write a short story about a cat who travels to space"}'
```

## ๐ŸŒ Hosting
### ๐Ÿš€ Deployment Instructions
1. **Build the Docker image:**
```bash
docker build -t ai-request-handler:latest .
```

2. **Push the image to a container registry (e.g., Docker Hub):**
```bash
docker push your-dockerhub-username/ai-request-handler:latest
```

3. **Deploy using Docker Compose (update the image name in the `docker-compose.yml` file):**
```bash
docker-compose up -d
```

### ๐Ÿ”‘ Environment Variables
- `OPENAI_API_KEY`: Your OpenAI API key.
- `DATABASE_URL`: Connection string for your PostgreSQL database.
- `JWT_SECRET_KEY`: Secret key for JWT token generation (optional).
- `REDIS_URL`: URL for your Redis instance (optional).

## ๐Ÿ“œ API Documentation
### ๐Ÿ” Endpoints
- **POST /requests**:
- Description: Send a request to an OpenAI model.
- Body: `{ "text": string }`
- Response: `{ "response": string }`

### ๐Ÿ”’ Authentication
- For the MVP, authentication is optional. You can implement JWT authentication by following the steps in the `auth.py` file.

## ๐Ÿ“œ License & Attribution

### ๐Ÿ“„ License
This Minimum Viable Product (MVP) is licensed under the [GNU AGPLv3](https://choosealicense.com/licenses/agpl-3.0/) license.

### ๐Ÿค– AI-Generated MVP
This MVP was entirely generated using artificial intelligence through [CosLynx.com](https://coslynx.com).

No human was directly involved in the coding process of the repository: AI-Powered-Request-Handler

### ๐Ÿ“ž Contact
For any questions or concerns regarding this AI-generated MVP, please contact CosLynx at:
- Website: [CosLynx.com](https://coslynx.com)
- Twitter: [@CosLynxAI](https://x.com/CosLynxAI)


๐ŸŒ CosLynx.com


Create Your Custom MVP in Minutes With CosLynxAI!