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-1.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-1.0-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

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

Hashes for PyGptRes-1.0.tar.gz
Algorithm Hash digest
SHA256 232f8f9ec5df46c5ac987b9501a4b7245cdb66efacbc14a79edebc901415d88c
MD5 a16fabcbe850d44c77873c54b58122b9
BLAKE2b-256 e845624befcfebe763dd4b171ffd15831c6f83a6a657393c0b6141469d871fc2

See more details on using hashes here.

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

Hashes for PyGptRes-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 23ab138bee0420e22fb6b92b4e1d4804f28d16d451400b856725aa6219b85b93
MD5 1b2fa60ef8abf5266245eaef593f5c82
BLAKE2b-256 4795261d88b75eb27de5cba810bf3a266053b49f42e66297818e5fe5da1d7e6d

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