Skip to main content

Simple ChatGPT

An extremely simple programmatic interface to ChatGPT. The conversation automatically gets truncated (from the oldest message) if the token limit is reached.

The goal of this project is to remove the need for boilerplate code to create a chat bot in your program, allowing you to jump right into integrating ChatGPT into whatever you are making.

You can use this package like:

from simplechatgpt import Chat

import os

chat = Chat(os.environ["OPENAI_API_KEY"])

while True:
    prompt = input("You: ")
    print("Bot:", chat.send(prompt))

You can choose a model when initializing your Chat object like:

chat = Chat(os.environ["OPENAI_API_KEY"], model="gpt-4")

As of the time of this writing (07/08/2023), the following models are available for use:

  • gpt-4
  • gpt-4-32k
  • gpt-3.5-turbo
  • gpt-3.5-turbo-16k

See https://platform.openai.com/docs/models/overview for a full list of available models.

You can also customize the "system" message to initialize the chat bot to act in a certain way throughout the conversation. For example,

key = os.environ["OPENAI_API_KEY"]
chat = Chat(key, chatbot_description="You are Hucklyberry Finn.")

while True:
    prompt = input("You: ")
    print("Bot:", chat.send(prompt))

Would produce responses like:

You: Hey son, how are you?
Bot: Well, I reckon I'm doin' alright Pa. How 'bout yourself?

Metadata

Release files for simplechatgpt 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simplechatgpt 1.2.0
File Size Uploaded Provenance Actions
simplechatgpt-1.2.0.tar.gz 2.8 kB Without provenance Details for simplechatgpt-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for simplechatgpt 1.2.0
File Interpreter ABI Platform Actions
simplechatgpt-1.2.0-py3-none-any.whl Python 3 none any Details for simplechatgpt-1.2.0-py3-none-any.whl

Total release size: 6.5 kB

Release files / simplechatgpt-1.2.0.tar.gz

Download URL simplechatgpt-1.2.0.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
058e7dab2c84cecdfe3e39050f11bb0d3b79f8cd39eda85609d9a08469db662d
BLAKE2b-256 checksum
How to use checksums
f9aef388c63b5241eb335aab3f8b2853221271299bbadd0cb5933b1e1321156a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.6 Darwin/22.5.0

Release files / simplechatgpt-1.2.0-py3-none-any.whl

Download URL simplechatgpt-1.2.0-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d81e6966c170e2c27501a78f8363b6b419e6b677d62311fd84fefb4ef75e740b
BLAKE2b-256 checksum
How to use checksums
797c2266ff05b9879790e4ba8f5bdcfc93b46c65d954c54a8e61482816724e8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.6 Darwin/22.5.0

Security for simplechatgpt 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page