Skip to main content

A simple Python package for creating and interacting with GPT-based chatbots

Project description

gptbots

A simple Python package for creating and interacting with GPT-based chatbots

Preliminaries

Make sure your OpenAI API key is setup (see OpenAI's Quickstart tutorial).

Usage

To create a chatbot:

  • bot = Chatbot() creates a chatbot instance with default attributes
  • bot = Chatbot(model, temperature, custom_instructions, chatbot_name) creates a chatbot instance with custom attributes

To chat:

  • bot.chat(prompt) prints chatbot response to string prompt

See more functions below.

Attributes

  • model : default is "gpt-3.5-turbo-1106"; see OpenAI's documentation on models for valid model names
  • temperature : default is 0.7; ranges from 0.0 to 1.0; higher generally means more creative
  • custom\_instructions : default is "You are a helpful assistant."
  • chatbot\_name : default is "Assistant"
  • context : contains custom instructions, user messages, and chatbot responses

Functions

  • chat(prompt) prints chatbot response to string prompt
  • chat_image(prompt, url) prints chatbot response to string prompt + image URL (when using "gpt-4-vision-preview" (aka GPT-4 Turbo with vision)
  • save(file_path) saves chat history and settings to preferred file
  • load(file_path) loads chat history and settings from preferred file
  • print_messages() prints context without custom instructions in a prettier format
  • print_context() prints context in a prettier format

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

gptbots-0.1.4.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

gptbots-0.1.4-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file gptbots-0.1.4.tar.gz.

File metadata

  • Download URL: gptbots-0.1.4.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for gptbots-0.1.4.tar.gz
Algorithm Hash digest
SHA256 d6c50ecf09d96a0f88fe5418c5df252592756bfcdee7fb7b694c004ad3b41be2
MD5 3fc4751feff4fd386f556f0c5b908aac
BLAKE2b-256 eba32d805d08387b2d2a3b0642e9de24dbc5fb739692460f0654d0c4b3715c4b

See more details on using hashes here.

File details

Details for the file gptbots-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: gptbots-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for gptbots-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 757cfc676947247ecea0bb54b144c0426b6fbe00f8fa793eb66627cde654bf34
MD5 5f1d9d5a1428087768839af7006a4ecb
BLAKE2b-256 af0ad3c68a9f63ef838db111f3661597bcd0c8a90136a73ce280bc7db0569a6d

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