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.9.tar.gz
(3.5 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.9.tar.gz.
File metadata
- Download URL: gptbots-0.1.9.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ab4aca876822ad44709b8a69dc7a74520314ccc730794869fd7467267c72a30
|
|
| MD5 |
1d13f93b2c7f8b0f892cb31894372e7a
|
|
| BLAKE2b-256 |
8ba5a91c4b32421e2ce8e5e0c45b5b735962e51ca9c760120d9df7dccdfad615
|
File details
Details for the file gptbots-0.1.9-py3-none-any.whl.
File metadata
- Download URL: gptbots-0.1.9-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36021bcce2c87653dd37c344692aa7c659a1c617b27d26cfc5d99c50ba7ab575
|
|
| MD5 |
4789b29fd2fecb3e3879d8685e458fe3
|
|
| BLAKE2b-256 |
88bd0f7723a331fe589edbfc70b1ab87901534949d76d535079170d753479a14
|