Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyGptRes-2.0.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

PyGptRes-2.0-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file PyGptRes-2.0.tar.gz.

File metadata

  • Download URL: PyGptRes-2.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

Hashes for PyGptRes-2.0.tar.gz
Algorithm Hash digest
SHA256 97566e89873288855321e19b35eb424bf92016aa63f14a7089541c7881161ca4
MD5 686554d87afc020b33774e143ded49d1
BLAKE2b-256 1075b7612fab552a357435a36330e16e817db5f4b12d7e119bdaddcf4ba82e6f

See more details on using hashes here.

File details

Details for the file PyGptRes-2.0-py3-none-any.whl.

File metadata

  • Download URL: PyGptRes-2.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

Hashes for PyGptRes-2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c0702a269f9ef57653b0e8ed45fba7e1ec305a8506caaac367620f70d5c5e302
MD5 27e0fc763316f41bdef9673b84eaaea0
BLAKE2b-256 fd281ad378df2e04b2c90e16489264fbaba33a64d6bff68f34138deba2be7bbd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page