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 = gptbots.Chatbot()creates a chatbot instance with default attributesbot = 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 namestemperature: default is 0.7; ranges from 0.0 to 1.0; higher generally means more creativecustom_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 promptchat_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 fileload(file_path)loads chat history and settings from preferred fileprint_messages()prints context without custom instructions in a prettier formatprint_context()prints context in a prettier format
Project details
Release history Release notifications | RSS feed
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.13.tar.gz
(3.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gptbots-0.1.13.tar.gz.
File metadata
- Download URL: gptbots-0.1.13.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65fdf2c46d9a4c5fa0f5c6b70d0b2bbf8629588c17f90e97292f6811cd234f74
|
|
| MD5 |
706bbec018a6154fd3d2185ea3b1c08b
|
|
| BLAKE2b-256 |
92d09eb6fa7ab664d82e538f2ef56ce5f0096e62e95a25b43b034fc16b91ab42
|
File details
Details for the file gptbots-0.1.13-py3-none-any.whl.
File metadata
- Download URL: gptbots-0.1.13-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab89858b303e8e18da456a60f337d93b09170af158fa3b897c15ada4ef49df66
|
|
| MD5 |
ed74245f0694ef26404c67fd6a49ea49
|
|
| BLAKE2b-256 |
5cdc2dbd33db3d3d3f3225a7543a3dca292e6a9cd945195be5eb62d908fb4699
|