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

https://github.com/coslynx/ai-powered-request-response-system

AI-powered system that responds to requests with helpful information and answers... Created at https://coslynx.com
https://github.com/coslynx/ai-powered-request-response-system

ai-powered api-client api-wrapper asynchronous code-generation data-validation developer-tools devops fastapi language-model machine-learning mvp mvp-development openai-integration postgresql python python-backend request-response rest-api software-development

Last synced: 2 months ago
JSON representation

AI-powered system that responds to requests with helpful information and answers... Created at https://coslynx.com

Awesome Lists containing this project

README

          




AI Powered Request Response System


A Python backend application that serves as an AI wrapper, seamlessly connecting users to the power of OpenAI's language models.


Developed with the software and tools below.



Framework used
Backend Language
Database used
LLMs used


git-last-commit
GitHub commit activity
GitHub top language

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

## ๐Ÿ“ Overview
The repository contains a Minimum Viable Product (MVP) called "AI Powered Request Response System" that acts as a Python backend application, bridging the gap between human communication and advanced AI technologies. Users can send requests to the system via a defined API endpoint, which then processes them using the OpenAI API and returns a comprehensive response. The system is built with scalability, security, and user experience in mind, using technologies like FastAPI, SQLAlchemy, and PostgreSQL.

## ๐Ÿ“ฆ Features
| | Feature | Description |
|----|--------------------|--------------------------------------------------------------------------------------------------------------------|
| โš™๏ธ | **Architecture** | The system utilizes a REST API architecture based on FastAPI for handling requests and responses. SQLAlchemy is used for database interaction with PostgreSQL. |
| ๐Ÿ“„ | **Documentation** | This README file provides a detailed overview of the MVP, its features, installation, usage, and deployment instructions.|
| ๐Ÿ”— | **Dependencies** | The project utilizes packages such as FastAPI, SQLAlchemy, psycopg2-binary, OpenAI, and Pydantic for API development, database interaction, and data validation. |
| ๐Ÿงฉ | **Modularity** | The codebase is organized into modules for better organization and maintainability, with separate files for models, routers, and utilities. |
| ๐Ÿงช | **Testing** | Includes unit tests using `pytest` to ensure the robustness and reliability of the codebase. |
| โšก๏ธ | **Performance** | The backend is designed for efficient processing of user requests and returns responses promptly. Caching strategies are implemented for frequently asked questions. |
| ๐Ÿ” | **Security** | The backend utilizes robust authentication and authorization protocols. Input validation and data sanitization are implemented to prevent security vulnerabilities. |
| ๐Ÿ”€ | **Version Control**| Utilizes Git for version control with a `startup.sh` script for managing the application startup process. |
| ๐Ÿ”Œ | **Integrations** | The backend seamlessly integrates with the OpenAI API, securely communicating with it to process user requests and retrieve responses. |
| ๐Ÿ“ถ | **Scalability** | The system is designed for scalability with the use of PostgreSQL for data storage and efficient request handling techniques. |

## ๐Ÿ“‚ Structure
```text
โ”œโ”€โ”€ main.py # Application entry point
โ”œโ”€โ”€ database.py # Database setup and session management
โ”œโ”€โ”€ models
โ”‚ โ””โ”€โ”€ models.py # Database models
โ”œโ”€โ”€ routers
โ”‚ โ””โ”€โ”€ requests.py # API routes for handling user requests
โ”œโ”€โ”€ utils
โ”‚ โ””โ”€โ”€ helpers.py # Utility functions
โ”œโ”€โ”€ services
โ”‚ โ””โ”€โ”€ openai_service.py # OpenAI API interaction logic
โ””โ”€โ”€ tests
โ””โ”€โ”€ test_main.py # Unit tests for the main application logic
```

## ๐Ÿ’ป Installation
### ๐Ÿ”ง Prerequisites
- Python 3.9+
- PostgreSQL 14+
- Docker (optional, for containerized deployment)

### ๐Ÿš€ Setup Instructions
1. **Clone the repository:**
```bash
git clone https://github.com/coslynx/AI-Powered-Request-Response-System.git
cd AI-Powered-Request-Response-System
```
2. **Install dependencies:**
```bash
pip install -r requirements.txt
```
3. **Set up the database:**
- Create a PostgreSQL database.
- Update the `DATABASE_URL` in the `.env` file with your database connection string.
4. **Configure environment variables:**
```bash
cp .env.example .env
```
Replace `sk-YOUR_API_KEY_HERE` with your actual OpenAI API key.

## ๐Ÿ—๏ธ Usage
### ๐Ÿƒโ€โ™‚๏ธ Running the MVP
1. **Start the application:**
```bash
python main.py
```

### โš™๏ธ Configuration
- The `.env` file contains environment variables like the OpenAI API key and database connection string.

### ๐Ÿ“š Examples
- **Sending a request:**
```bash
curl -X POST http://localhost:8000/requests -H "Content-Type: application/json" -d '{"text": "What is the meaning of life?"}'
```
- **Response:**
```json
{
"id": 1,
"text": "What is the meaning of life?",
"response": "The meaning of life is a question that has been pondered by philosophers and theologians for centuries. There is no one definitive answer, and the meaning of life may be different for each individual. Some people find meaning in their relationships, their work, their faith, or their hobbies. Ultimately, the meaning of life is up to each individual to decide.",
"created_at": "2023-12-18T15:10:10.123456Z"
}
```

## ๐ŸŒ Hosting
### ๐Ÿš€ Deployment Instructions
1. **Build a Docker image (optional):**
```bash
docker build -t ai-request-response-system:latest .
```
2. **Run the Docker container (optional):**
```bash
docker run -p 8000:8000 ai-request-response-system:latest
```
3. **Deploy to a cloud platform (e.g., Heroku):**
- Create a new Heroku app:
```bash
heroku create ai-request-response-system-production
```
- Set environment variables:
```bash
heroku config:set OPENAI_API_KEY=your_openai_api_key
heroku config:set DATABASE_URL=your_database_url
```
- Deploy the code:
```bash
git push heroku main
```

### ๐Ÿ”‘ Environment Variables
- `OPENAI_API_KEY`: Your OpenAI API key
- `DATABASE_URL`: Your PostgreSQL database connection string (e.g., `postgresql://user:password@host:port/database`)

## ๐Ÿ“œ API Documentation
### ๐Ÿ” Endpoints
- **POST /requests**
- Description: Create a new request to the OpenAI API.
- Request Body:
```json
{
"text": "Your request here"
}
```
- Response:
```json
{
"id": 1,
"text": "Your request here",
"response": "The response from OpenAI",
"created_at": "2023-12-18T15:10:10.123456Z"
}
```

## ๐Ÿ“œ 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-Response-System

### ๐Ÿ“ž 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!