Skip to main content

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 = gptbots.Chatbot() creates a chatbot instance with default attributes
  • bot = gptbots.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 methods 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

Methods

  • 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

Metadata

Release files for gptbots 0.1.14

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

Source distribution (sdist)

Source distribution for gptbots 0.1.14
File Size Uploaded
gptbots-0.1.14.tar.gz 3.6 kB Details

Built distribution (wheel)

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

Total release size: 7.5 kB

Release files / gptbots-0.1.14.tar.gz

Download URL gptbots-0.1.14.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6407fd0a66f27d3b4e962f1a2cf68ce87a5b50ba0d4c0cb350d0be5cab06f965
BLAKE2b-256 checksum
How to use checksums
47654fcd615c8ff64b337a3ca09cd18c7cfa976f2e929e90a4f9dd8d21391f1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Release files / gptbots-0.1.14-py3-none-any.whl

Download URL gptbots-0.1.14-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
76ddc55e01bde39ac30598beb559eaae5fe6f2afb128e89dbc6661c085150be5
BLAKE2b-256 checksum
How to use checksums
7afba5e6e29c614c80b7d855f96adac2ac7723d7850523c237149c33556227d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Release history Release notifications | RSS feed

This release

0.1.14 This release

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

1 release file

0.1.5

1 release file

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

1 release file

0.1.0

2 release files

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