Lightweight version of ChatGPT
Uses API by Pawan
Disclaimer
This is not open source. PawanOsman can see all your requests and your session token.
Install
pip3 install ChatGPT-lite
Setup:
Getting session token
Check https://github.com/acheong08/ChatGPT/wiki/Setup
Usage
Command line
usage: ChatGPT-lite [-h] [--session_token SESSION_TOKEN] [--bypass_node BYPASS_NODE (optional)] [--async_mode]
Example development:
import argparse
import sys
import asyncio
from ChatGPT_lite.ChatGPT import Chatbot
async def async_main(args):
if args.session_token is None:
print("Please provide a session token")
sys.exit(1)
chat = Chatbot(args.session_token, args.bypass_node)
await asyncio.gather(chat.wait_for_ready())
while True:
try:
prompt = input("You: ")
if prompt == "!exit":
break
response = await chat.ask(prompt)
print(f"\nBot: {response['answer']}\n")
except KeyboardInterrupt:
break
# Close sockets
chat.close()
# exit
sys.exit(0)
def sync_main(args):
chat = Chatbot(args.session_token, args.bypass_node)
# Create loop
loop = asyncio.new_event_loop()
# Set
asyncio.set_event_loop(loop)
# Run
loop.run_until_complete(chat.wait_for_ready())
while True:
try:
prompt = input("You: ")
if prompt == "!exit":
break
response = loop.run_until_complete(chat.ask(prompt))
print(f"\nBot: {response['answer']}\n")
except KeyboardInterrupt:
break
# Close sockets
chat.close()
# stop asyncio event loop
loop.stop()
# exit
sys.exit(0)
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--session_token', type=str, default=None)
parser.add_argument('--bypass_node', type=str,
default="https://gpt.pawan.krd")
parser.add_argument('--async_mode', action='store_true')
args = parser.parse_args()
if args.session_token is None:
print("Please provide a session token")
sys.exit(1)
print("Starting. Please wait...")
if args.async_mode:
asyncio.run(async_main(args))
else:
sync_main(args)
if __name__ == "__main__":
main()
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ChatGPT_lite-0.0.5.tar.gz
(4.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ChatGPT_lite-0.0.5.tar.gz.
File metadata
- Download URL: ChatGPT_lite-0.0.5.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ca1701107cc1ef196a280e20d3e1852c02c79055ebae48143690b8084759e84
|
|
| MD5 |
c696758d281019697b7a8e461105ece4
|
|
| BLAKE2b-256 |
3386e97dafede302b3397a6108e95c518b8988a656bcc0a1c92d660867b12d6e
|
File details
Details for the file ChatGPT_lite-0.0.5-py3-none-any.whl.
File metadata
- Download URL: ChatGPT_lite-0.0.5-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1941929bfd8b7bf051f48d6247c89513a0e88749d8af344231b0191c77e432a
|
|
| MD5 |
d16fcf76f9168858e666f60b734be6e1
|
|
| BLAKE2b-256 |
93d7e3448c785fecfb82ead7d9ecb380ba7751cb46afbac50b05b3db02bcb9e9
|