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.
Project description
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.
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
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 PyGptRes-1.0.tar.gz.
File metadata
- Download URL: PyGptRes-1.0.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
232f8f9ec5df46c5ac987b9501a4b7245cdb66efacbc14a79edebc901415d88c
|
|
| MD5 |
a16fabcbe850d44c77873c54b58122b9
|
|
| BLAKE2b-256 |
e845624befcfebe763dd4b171ffd15831c6f83a6a657393c0b6141469d871fc2
|
File details
Details for the file PyGptRes-1.0-py3-none-any.whl.
File metadata
- Download URL: PyGptRes-1.0-py3-none-any.whl
- Upload date:
- Size: 2.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23ab138bee0420e22fb6b92b4e1d4804f28d16d451400b856725aa6219b85b93
|
|
| MD5 |
1b2fa60ef8abf5266245eaef593f5c82
|
|
| BLAKE2b-256 |
4795261d88b75eb27de5cba810bf3a266053b49f42e66297818e5fe5da1d7e6d
|