PyGptRes
PyGptRes is a Python module for interacting with OpenAI's GPT-3.5 Turbo API to create natural language conversations with cutting-edge language models.
Usage
Here's how to use this module in your Python code:
from pygpt import PyGpt
if __name__ == "__main__":
pygpt = PyGpt()
pygpt.login("ACCESS TOKEN")
pygpt.init()
pygpt.send("Hello?")
Be sure to initialize your PyGptRes instance by first calling the login method with your access token and then calling init to configure the necessary URL and headers.
Example Usage
Here's a simple example of using PyGptRes to send a message to the GPT-3.5 Turbo API:
# Initialize PyGptRes
pygpt = PyGptRes()
pygpt.login("YOUR_ACCESS_TOKEN")
pygpt.init()
ChatBot
from pygptres import PyGptRes
pygpt = PyGptRes()
pygpt.login("ACCESS_KEY")
pygpt.init()
conversation = []
while True:
user_input = input("You: ")
if user_input == "quit":
break
response = pygpt.send(user_input)
content = response['choices'][0]['message']['content']
print(content, end='', flush=True)
print("")
conversation.append({"role": "assistant", "content": content})
Send a message to the API
response = pygpt.send("Hello, how are you?")
Process the API response
print(response)
Make sure to replace "YOUR_ACCESS_TOKEN" with your actual access token.
License
This project is licensed under the MIT License.
Release files for PyGptRes 2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| PyGptRes-2.0.tar.gz | 2.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| PyGptRes-2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.9 kB
Release files / PyGptRes-2.0.tar.gz
| Download URL | PyGptRes-2.0.tar.gz |
|---|---|
| Size | 2.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
97566e89873288855321e19b35eb424bf92016aa63f14a7089541c7881161ca4
|
|
BLAKE2b-256 checksum How to use checksums |
1075b7612fab552a357435a36330e16e817db5f4b12d7e119bdaddcf4ba82e6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / PyGptRes-2.0-py3-none-any.whl
| Download URL | PyGptRes-2.0-py3-none-any.whl |
|---|---|
| Size | 2.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c0702a269f9ef57653b0e8ed45fba7e1ec305a8506caaac367620f70d5c5e302
|
|
BLAKE2b-256 checksum How to use checksums |
fd281ad378df2e04b2c90e16489264fbaba33a64d6bff68f34138deba2be7bbd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|