Python implementation of Unofficial ChatGPT Client
Project description
Update 30-DEC-2022
We have introduced a new method that utilizes a socket for faster performance without the need for a browser anymore. [NodeJS Version][C# Version]
For support join [Discord]
ChatGPT.py - Unofficial API client for ChatGPT [Discord]
Get Started
Install dependencies first
pip install --upgrade PyGPT
Example
import asyncio
from PyGPT import PyGPT
async def main():
chat_gpt = PyGPT('eyJhbGciOiJkaXIiLCJlbmMiOiJBMR0NN....')
await chat_gpt.connect()
await chat_gpt.wait_for_ready()
answer = await chat_gpt.ask('What is the capital of France?')
print(answer)
await chat_gpt.disconnect()
if __name__ == '__main__':
asyncio.run(main())
For multiple queries
import asyncio
from PyGPT import PyGPT
async def main():
chat_gpt = PyGPT('eyJhbGciOiJkaXIiLCJlbmMiOiJBMR0NN....')
await chat_gpt.connect()
await chat_gpt.wait_for_ready()
questions = ["how are you", "where do you live", "what do you do"]
for question in questions:
answer = await chat_gpt.ask(question)
print(answer)
await chat_gpt.disconnect()
if name == 'main':
asyncio.run(main())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
PyGPT-1.0.4.tar.gz
(3.8 kB
view details)
File details
Details for the file PyGPT-1.0.4.tar.gz
.
File metadata
- Download URL: PyGPT-1.0.4.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91b6206f76f8716583836a8be2b8edbdb2dc4eb70f7295dfc7b519739681e743 |
|
MD5 | 97ae4b7238c110a304c7d23d30b39702 |
|
BLAKE2b-256 | be4a8708c173e61f21c2bd5fe7a34f6958ada4bee28ede798e476593d2e0c0fc |