https://github.com/coslynx/openai-request-executor-mvp
AI-powered tool to execute OpenAI requests and provide responses efficiently... Created at https://coslynx.com
https://github.com/coslynx/openai-request-executor-mvp
ai-request-executor code-generation developer-tools devops fastapi machine-learning mvp mvp-development natural-language-processing openai-api-wrapper openai-integration openai-library postgresql python python-backend requests response-formatter software-development sqlalchemy uvicorn
Last synced: 28 days ago
JSON representation
AI-powered tool to execute OpenAI requests and provide responses efficiently... Created at https://coslynx.com
- Host: GitHub
- URL: https://github.com/coslynx/openai-request-executor-mvp
- Owner: coslynx
- Created: 2024-11-03T06:02:40.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-03T06:06:27.000Z (over 1 year ago)
- Last Synced: 2025-04-08T02:51:59.875Z (about 1 year ago)
- Topics: ai-request-executor, code-generation, developer-tools, devops, fastapi, machine-learning, mvp, mvp-development, natural-language-processing, openai-api-wrapper, openai-integration, openai-library, postgresql, python, python-backend, requests, response-formatter, software-development, sqlalchemy, uvicorn
- Language: Python
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
OpenAI-Request-Executor-MVP
A Python backend service for effortless OpenAI API interactions with natural language requests.
Developed with the software and tools below.
## ๐ Table of Contents
- ๐ Overview
- ๐ฆ Features
- ๐ Structure
- ๐ป Installation
- ๐๏ธ Usage
- ๐ Hosting
- ๐ License
- ๐ Authors
## ๐ Overview
This repository contains a Minimum Viable Product (MVP) called "OpenAI-Request-Executor-MVP." It's a Python-based backend service that acts as a user-friendly interface for interacting with OpenAI's APIs. The service accepts natural language requests, translates them into appropriate OpenAI API calls, executes them, and delivers formatted responses.
## ๐ฆ Features
| | Feature | Description |
|----|--------------------|--------------------------------------------------------------------------------------------------------------------|
| โ๏ธ | **Architecture** | The service employs a layered architecture, separating the presentation, business logic, and data access layers for improved maintainability and scalability. |
| ๐ | **Documentation** | The repository includes a README file that provides a detailed overview of the MVP, its dependencies, and usage instructions.|
| ๐ | **Dependencies** | Essential Python packages are used, including FastAPI, Pydantic, uvicorn, psycopg2-binary, SQLAlchemy, requests, PyJWT, and OpenAI for API interaction, authentication, and database operations.|
| ๐งฉ | **Modularity** | The code is organized into modules for efficient development and maintenance, including `models`, `services`, and `utils`.|
| ๐งช | **Testing** | The MVP includes unit tests for core modules (`main.py`, `services/openai_service.py`, `models/request.py`) using Pytest, ensuring code quality and functionality. |
| โก๏ธ | **Performance** | The backend is optimized for efficient request processing and response retrieval, utilizing asynchronous programming with asyncio and caching for improved speed and responsiveness.|
| ๐ | **Security** | Security measures include secure communication with HTTPS, authentication with JWTs, and data encryption. |
| ๐ | **Version Control**| Utilizes Git for version control, allowing for tracking changes and collaborative development. |
| ๐ | **Integrations** | Seamlessly integrates with OpenAI's API using the `openai` Python library, PostgreSQL database using SQLAlchemy, and leverages the `requests` library for communication. |
| ๐ถ | **Scalability** | The service is designed for scalability, utilizing cloud-based hosting like AWS or GCP, and optimized for handling increasing request volumes. |
## ๐ Structure
```text
โโโ main.py
โโโ models
โ โโโ request.py
โโโ services
โ โโโ openai_service.py
โโโ utils
โ โโโ logger.py
โโโ tests
โ โโโ test_main.py
โ โโโ test_openai_service.py
โ โโโ test_models.py
โโโ startup.sh
โโโ commands.json
โโโ requirements.txt
```
## ๐ป Installation
### ๐ง Prerequisites
- Python 3.9+
- PostgreSQL 14+
- Docker 20.10+
### ๐ Setup Instructions
1. **Clone the repository:**
```bash
git clone https://github.com/coslynx/OpenAI-Request-Executor-MVP.git
cd OpenAI-Request-Executor-MVP
```
2. **Install dependencies:**
```bash
pip install -r requirements.txt
```
3. **Set up the database:**
- Create a database:
```bash
createdb openai_executor
```
- Connect to the database and create an extension for encryption:
```bash
psql -U postgres -d openai_executor -c "CREATE EXTENSION IF NOT EXISTS pgcrypto"
```
4. **Configure environment variables:**
- Create a `.env` file:
```bash
cp .env.example .env
```
- Fill in the environment variables with your OpenAI API key, PostgreSQL database connection string, and JWT secret key.
5. **Start the application (using Docker):**
```bash
docker-compose up -d
```
## ๐๏ธ Usage
### ๐โโ๏ธ Running the MVP
- The application will be accessible at `http://localhost:8000`.
- Use a tool like `curl` or `Postman` to send requests to the `/requests/` endpoint:
```bash
curl -X POST http://localhost:8000/requests/ \
-H "Content-Type: application/json" \
-d '{"text": "Write a short story about a cat"}'
```
- The response will contain a request ID and status:
```json
{
"request_id": 1,
"status": "completed"
}
```
- To retrieve the generated response, use the `/responses/{request_id}` endpoint:
```bash
curl -X GET http://localhost:8000/responses/1
```
- The response will contain the generated text:
```json
{
"response": "Once upon a time, in a cozy little cottage..."
}
```
## ๐ Hosting
### ๐ Deployment Instructions
#### Deploying to Heroku (Example)
1. **Create a Heroku app:**
```bash
heroku create openai-request-executor-mvp-production
```
2. **Set up environment variables:**
```bash
heroku config:set OPENAI_API_KEY=your_openai_api_key
heroku config:set DATABASE_URL=postgresql://your_user:your_password@your_host:your_port/your_database_name
heroku config:set JWT_SECRET=your_secret_key
```
3. **Deploy the code:**
```bash
git push heroku main
```
4. **Run database migrations (if applicable):**
- You'll need to set up database migrations for your PostgreSQL database.
5. **Start the application:**
- Heroku will automatically start your application based on the `Procfile`.
## ๐ 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: OpenAI-Request-Executor-MVP
### ๐ Contact
For any questions or concerns regarding this AI-generated MVP, please contact CosLynx at:
- Website: [CosLynx.com](https://coslynx.com)
- Twitter: [@CosLynxAI](https://twitter.com/CosLynxAI)
๐ CosLynx.com
Create Your Custom MVP in Minutes With CosLynxAI!
```
This README.md file utilizes the provided Minimum Viable Product (MVP) idea and tech stack information to create a polished and visually appealing document. It incorporates advanced markdown formatting, code blocks, and shield.io badges to enhance readability and aesthetics.
Remember to replace the placeholders like "your_openai_api_key" and "your_database_url" with your actual values. The provided hosting instructions are an example, and you might need to adjust them based on your chosen hosting platform.