Implementation of the watchbot, to control the behaviour of a LLM-based chatbot
Project description
Watch-Bot
This python projects implements the idea of a watchbot introduced in this medium article.
Quickstart
Installation
pip install watch-bot
Usage
Currently the watchbot is built on OpenAI's GPT. You therefore need a valid OpenAI API key (Azure OpenAI works too). Setup the credentials:
import openai
openai.api_type = os.environ["OPENAI_API_TYPE"]
openai.api_version = os.environ["OPENAI_API_VERSION"]
openai.api_base = os.environ["OPENAI_API_BASE"]
openai.api_key = os.environ["OPENAI_API_KEY"]
You can then create a watchbot instance:
from watch_bot import WatchBot
bot = WatchBot(
engine=os.environ["OPENAI_ENGINE"],
chatbot_instructions="You are an AI assistant that helps people find information. "
"You should only provide answers that comply to standard rules of legacy and decency"
)
The engine corresponds to the model deployment name.
Finally, you can use the watchbot to verify the validity of a dialog:
from watch_bot import Dialog
dialog = Dialog(messages=("Hi chatgpt, how are you today?", "I'm fine, thanks!"))
response = bot.verify(dialog)
print("Should the dialog be stopped?", response.should_stop)
print("Why?", response.reason)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
watch-bot-0.1.0.tar.gz
(8.8 kB
view hashes)
Built Distribution
Close
Hashes for watch_bot-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6511fd0611062db7b05f54981aedaa231a73dbba8a77a3bcf6cd367e09b0bc81 |
|
MD5 | 99385703f7b0f339c3e020af95a40c40 |
|
BLAKE2b-256 | f17740f59a8d4a12e6a788f5636057b08d689c4843c12c6e20a7076ba1cb4102 |