diff --git a/README.md b/README.md index 84e27e1..369d944 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,11 @@ _Chatbots for Matrix._ +This bot supports OpenAI, Anthropic, and locally hosted models that use an OpenAI-compatible endpoint. It can run multiple different models using +different triggers, such as `!c4` for GPT4 and `!ca` for Anthropic, all through the same bot. + +
+ ## Install 1. Install requirements: @@ -9,36 +14,32 @@ _Chatbots for Matrix._ sudo apt install libolm-dev gcc python3-dev pip install -r requirements.txt ``` -2. Copy `config.sample.yaml` to `config.yaml` and fill it out with your bot's Matrix auth and your API key(s). +2. Copy `config.sample.yaml` to `config.yaml` and fill it out with the bot's Matrix authentication and your OpenAI and/or Anthropic API keys. +3. Start the bot with `python3 main.py` + +[Pantalaimon](https://github.com/matrix-org/pantalaimon) is **required** for the bot to be able to talk in encrypted rooms. + +I included a sample Systemd service (`matrixgpt.service`). -[Pantalaimon](https://github.com/matrix-org/pantalaimon) is **required** for the bot to be able to talk in encrypted -rooms. -I included a sample Systemd service. ## Use -Invite your bot to a room. - -Start a chat by prefixing your message with your trigger (for example, `!c`). The bot will create a thread when it -replies to you and you don't need to use the trigger in the thread. - -Don't try to use two bots in the same thread. - -You can DM a bot for a private chat. Don't use the trigger prefix in a DM. - -The bot will move its read marker when a new message is sent in the room. - -The bot can give helpful reactions: - -- 🚫 means that the user is not allowed to chat with the bot. -- ❌ means the bot encountered an exception. The bot restarts when it encounters an exception which means it will not be - able to respond for a short time after this reaction. -- ❌ 🔐 means there was a decryption failure. +First, invite your bot to a room. Then you can start a chat by prefixing your message with your trigger (for example, `!c hello!`). The bot will create a thread when it replies. You don't need to use the trigger in the thread. Use `!matrixgpt` to view the bot's help. The bot also responds to `!bots`. -## Encryption +
-This bot supports encryption. I recommend using [Pantalaimon](https://github.com/matrix-org/pantalaimon/) to manage -encryption keys as the built-in solution is a little janky and may be unreliable. +- Don't try to use two bots in the same thread. +- You can DM a bot for a private chat. Don't use the trigger prefix in a DM. +- The bot will move its read marker when a new message is sent in the room. + +
+ +The bot can give helpful reactions: + +- 🚫 means permission denied (not allowed to chat with the bot). +- 🕒 means the API timed out. +- ❌ means the bot encountered an exception. +- ❌ 🔐 means there was a decryption failure. diff --git a/config.sample.yaml b/config.sample.yaml index e45c304..c342ae6 100644 --- a/config.sample.yaml +++ b/config.sample.yaml @@ -40,6 +40,9 @@ allowed_to_invite: response_timeout: 120 command: + # Define what models respond to what trigger. + # Try adding multiple triggers! + # What triggers this model. - trigger: '!c4' diff --git a/matrix_gpt/config.py b/matrix_gpt/config.py index b495c6a..8e5f585 100644 --- a/matrix_gpt/config.py +++ b/matrix_gpt/config.py @@ -83,6 +83,7 @@ class ConfigManager: if not self._config.config['openai']['api_key'] and not self._config.config['anthropic']['api_key']: raise SchemeValidationError('You need an OpenAI or Anthropic API key') self._parsed_config = self._merge_in_list_defaults() + # TODO: make sure there aren't duplicate triggers self._command_prefixes = self._generate_command_prefixes() def _merge_in_list_defaults(self):