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 attributesbot = 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.5.tar.gz
(2.5 kB
view details)
File details
Details for the file gptbots-0.1.5.tar.gz.
File metadata
- Download URL: gptbots-0.1.5.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd349f422c2564f447f535bce1f7e4f7d9331f482404884048c946284727bd5f
|
|
| MD5 |
10511eee261bfbc7c10daab6fc170c9e
|
|
| BLAKE2b-256 |
62e240c165e26357586594cd32cfbd85745501c08dbaf1ef98d2926ccc6c7238
|