3.2 KiB
ChatGPT User Guide with Abstraction
Welcome to the ChatGPT user guide! This document will walk you through the Reverse Engineered ChatGPT API, its usage, and how to leverage the abstraction in revgpt.py
for seamless integration.
Table of Contents
- Installation
- Initial Setup and Configuration
- Using the Abstract Class from
revgpt.py
- V1 Standard ChatGPT
- V3 Official Chat API
- Credits & Disclaimers
Installation
To kickstart your journey with ChatGPT, first, install the ChatGPT package:
python -m pip install --upgrade revChatGPT
Supported Python Versions:
- Minimum: Python3.9
- Recommended: Python3.11+
Initial Setup and Configuration
- Account Setup: Register on OpenAI's ChatGPT.
- Authentication: Obtain your access token from OpenAI's platform.
- Environment Variables: Configure your environment with the necessary variables. An example of these variables can be found at the bottom of the guide.
Using the Abstract Class from revgpt.py
The abstraction provided in revgpt.py
is designed to simplify your interactions with ChatGPT.
- Import the Necessary Modules:
from dotenv import load_dotenv
from revgpt import AbstractChatGPT
- Load Environment Variables:
load_dotenv()
- Initialize the ChatGPT Abstract Class:
chat = AbstractChatGPT(api_key=os.getenv("ACCESS_TOKEN"), **config)
- Start Interacting with ChatGPT:
response = chat.ask("Hello, ChatGPT!")
print(response)
With the abstract class, you can seamlessly switch between different versions or models of ChatGPT without changing much of your code.
V1 Standard ChatGPT
If you wish to use V1 specifically:
- Import the model:
from swarms.models.revgptV1 import RevChatGPTModelv1
- Initialize:
model = RevChatGPTModelv1(access_token=os.getenv("ACCESS_TOKEN"), **config)
- Interact:
response = model.run("What's the weather like?")
print(response)
V3 Official Chat API
For users looking to integrate the official V3 API:
- Import the model:
from swarms.models.revgptV4 import RevChatGPTModelv4
- Initialize:
model = RevChatGPTModelv4(access_token=os.getenv("OPENAI_API_KEY"), **config)
- Interact:
response = model.run("Tell me a fun fact!")
print(response)
Credits & Disclaimers
- This project is not an official OpenAI product and is not affiliated with OpenAI. Use at your own discretion.
- Many thanks to all the contributors who have made this project possible.
- Special acknowledgment to virtualharby for the motivating music!
By following this guide, you should now have a clear understanding of how to use the Reverse Engineered ChatGPT API and its abstraction. Happy coding!