A simple Python package for creating and interacting with GPT-based chatbot
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 functions 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
Functions
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.7.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.7.tar.gz.
File metadata
- Download URL: gptbots-0.1.7.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 |
10a1a9e1bf05810c83b6ac88f29e45a9b04e1cdbd570258ef9910db0c0443ad1
|
|
| MD5 |
9bfde2a95eaa59c891c6ef1453592fad
|
|
| BLAKE2b-256 |
100b459b68133ef541d35c7ba8f381d1190695a6b1c3d70f4c5091acccd796dd
|
File details
Details for the file gptbots-0.1.7-py3-none-any.whl.
File metadata
- Download URL: gptbots-0.1.7-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 |
fe34536615f64bb52e5d2e4f525c66a866d35f599334a6de555c6177a9dc29d2
|
|
| MD5 |
f7531bbd32c179e4b98a2d2aa7133149
|
|
| BLAKE2b-256 |
a9984ddbb7066790404e8a9d80d2c0dc2791f1b8c489db4558ec84b07619dc99
|