- 📍 Overview
- 📦 Features
- 📂 Structure
- 💻 Installation
- 🏗️ Usage
- 🌐 Hosting
- 📄 License
- 👏 Authors
This repository hosts the backend for the AI Powered OpenAI Request Wrapper MVP. It's a Python application designed to simplify interactions with OpenAI's powerful language models. The MVP functions as a bridge between users and the OpenAI API, making it easier to leverage AI for diverse tasks.
Feature | Description |
---|---|
Request Handling | Accepts user requests for OpenAI API interactions, including model selection, prompt, and parameters. |
API Call Generation | Translates user requests into properly formatted OpenAI API calls, ensuring accurate encoding of model selection, prompt, parameters, and authentication details. |
Response Processing | Parses and formats responses from the OpenAI API for easy understanding by the user, handling various response formats and extracting relevant information. |
Database Integration | Stores API keys and user preferences in a PostgreSQL database for efficient and personalized interactions. |
Authentication | Uses JWTs for secure user authentication and authorization, ensuring safe access to the application and its resources. |
├── commands.json # Defines available commands for the application
├── .env # Stores environment variables securely
├── README.md # This file
├── requirements.txt # Lists all Python dependencies
├── startup.sh # Script for setting up the application environment
├── main.py # Main application entry point
└── src
└── __init__.py # Application initialization
└── routers
└── request_router.py # Handles requests to the /request endpoint
└── services
└── openai_service.py # Manages interactions with the OpenAI API
└── models
└── request.py # Database model for storing requests and responses
└── schemas
└── request_schema.py # Pydantic schemas for validating API requests and responses
└── database
└── database.py # Manages the database connection
└── models.py # Defines the database models for the application
└── utils
└── logger.py # Provides a centralized logging system
└── tests
└── test_openai_service.py # Unit tests for the openai_service
└── test_request_router.py # Unit tests for the request_router
- Python 3.9+
- PostgreSQL 14+
- Docker
- Clone the repository:
git clone https://github.com/coslynx/OpenAI-Request-Wrapper-MVP.git cd OpenAI-Request-Wrapper-MVP
- Install dependencies:
pip install -r requirements.txt
- Create the database:
createdb openai_request_wrapper
- Create the
pgcrypto
extension in the database:psql -U postgres -d openai_request_wrapper -c "CREATE EXTENSION IF NOT EXISTS pgcrypto"
- Set up environment variables:
Replace placeholders in
cp .env.example .env
.env
with your own values:OPENAI_API_KEY
: Your OpenAI API keyDATABASE_URL
: Your PostgreSQL database connection stringJWT_SECRET
: Your secret key for JWT token generation
- Start the application:
python main.py
For deployment, consider using a platform like Heroku or AWS.
Heroku Deployment:
- Install Heroku CLI:
npm install -g heroku
- Login to Heroku:
heroku login
- Create a new Heroku app:
heroku create openai-request-wrapper-production
- Set up environment variables:
heroku config:set OPENAI_API_KEY=YOUR_OPENAI_API_KEY heroku config:set DATABASE_URL=your_database_url_here heroku config:set JWT_SECRET=your_secret_key
- Deploy the code:
git push heroku main
This Minimum Viable Product (MVP) is licensed under the GNU AGPLv3 license.
- Drix10
- Kais Radwan
Create Your Custom MVP in Minutes With CosLynxAI!