This bot allows you to use LLMs such as ChatGPT, LLaMA3, and Gemini 1.5 from Discord
Download the executable for the latest release from Releases
NOTE: Currently MacOS and Linux do not have pre built binaries
- Clone this repo or download the source code from one of the Releases
$ git clone https://github.com/grqphical/LLMCord.git
- Create a virtual environment
$ python -m venv venv
- Activate the virtual environment
$ ./venv/Scripts/activate
NOTE On linux the path will be ./venv/bin/activate
- Install dependencies
$ pip install -r requirements.txt
If you want to convert the script into a binary run pyinstaller llmcord.spec
- Create a new Discord Application at the Discord Developer Portal and configure it to be a bot. (Guide Here)
- Create a .env file and add your bot's token as
DISCORD_TOKEN
- Create a file called
llmcord.toml
and add this to it:
system_prompt = "Use markdown if neccessary."
default_model = "llama3-70b"
[models.llama3-70b]
base_url = "https://api.groq.com/openai/"
model = "llama3-70b-8192"
token = "API_TOKEN_HERE"
client = "OpenAIClient"
NOTE I am using Groq AI here as an example so I have selected the OpenAIClient
due to it's API being compatible with OpenAI however LLMCord also includes a Google Gemini 1.5 client that you can use as GeminiClient
system_prompt
- Allows you to control the system prompt of the AI
default_model
- Specifies the default model REQUIRED
For each model you wish to make create it as a seperate table with a display name. In this case I chose llama3-70b
.
base_url
- Base URL for the API REQUIRED
model
- Which model to use REQUIRED
token
- API token for API, REQUIRED IF NEEDED BY API
client
- Which Client to use to send the request. The two included clients are OpenAIClient
and GeminiClient
. REQUIRED
$ python -m llmcord
Now you should be able to use LLMCord in any servers you have invited it to.
See CONTRIBUTING.md
You are able to make your own API clients by creating a python script in the plugins/
folder. Simply create a class that inherits from plugins.BaseClient
and implement
the get_response
method. Make sure it is a coroutine. In order to access the API use the aiohttp
library as it is already installed and used by LLMCord.
Look in the plugins folder for examples of custom clients
-
Changed license from MIT to Mozilla Public License 2.0
-
Added license to about section of bot
-
Bump aiohttp from 3.9.5 to 3.10.2 by @dependabot in #3
-
Added PyInstaller spec
-
Added compare command that allows you to send a response to two LLM's and compare their responses
-
Added about command
-
Improved Documentation
-
Added build scripts
-
Refactored code to work with Pyinstaller
-
Pre built executables are now able to be distrubuted
-
Moved commands into their own Cogs
-
Added unit tests for Config and Context
-
Fixed linting errors
-
Added CI for unit tests
-
Fixed error handling with certain edge cases when loading the configuration
-
Added error handling when selecting an invalid/undefined model. Before it would just get stuck in an infinite loop
-
Improved documentation
- Added custom logger
-
Added support for custom clients
-
Included
OpenAIClient
andGeminiClient
by default -
Changed
/list
to now show every model on a different line
Make sure to install both requirements.txt
and requirements.tests.txt
. Then run pytest
to run the tests.
I may or may not add these features later on.
-
Custom API Handlers (ability to define your own plugins to work with non-OpenAI compatible APIs)
-
File uploads
-
Integration with non LLM's (eg. DALL-E for image generation)
LLMCord is licensed under the Mozilla Public License 2.0