Skip to main content

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.2.1.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

watch_bot-0.2.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file watch-bot-0.2.1.tar.gz.

File metadata

  • Download URL: watch-bot-0.2.1.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for watch-bot-0.2.1.tar.gz
Algorithm Hash digest
SHA256 48aaeb4e192d950bf705ef8d7dc67cb2550cb77ce356c6c0c3a2c77620decb8a
MD5 2e9e2a83466fce65ca5975ee8a8f3ed1
BLAKE2b-256 ce8f02beb6f2a9a96132b9f86f52e1fdd65eb07dab86737bca6f56b121614edb

See more details on using hashes here.

File details

Details for the file watch_bot-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: watch_bot-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for watch_bot-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a3e74c1ca1972b37f12b7315b7f686f2dd558c41db2bcc44e87a773d9eaf7a31
MD5 09f50b1e90f6dbc8463070d33b5299a4
BLAKE2b-256 1f268d17c470aae1a7f352426da48f31ef5d166591a5c9bc3b859ae3db7e9458

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page