A bridge that allows Ollama to join Telegram chats as a bot
Project description
Tellama
Tellama is a lightweight bot that integrates LLMs with Telegram's bot API. It allows you to chat with your favorite language model in Telegram private or group chats.
[!IMPORTANT] Tellama is still in early stages of development. The current version is finished in just two afternoons. You may run into bugs, unexpected behavior, or incomplete documentation. Please report any problems you encounter by opening an issue.
Here is a demo of Tellama in action:
Quick Start
Option 1: Run with Docker
The official image is hosted at ghcr.io/k4yt3x/tellama:latest.
To pass options with environment variables:
docker run \
--network=host \
-v $PWD:/data \
-e TELEGRAM_TOKEN="YOUR_TELEGRAM_BOT_TOKEN" \
-e OLLAMA_MODEL="YourModelName" \
ghcr.io/k4yt3x/tellama:latest
You can also save the environment variables in a .env file to make things easier:
docker run \
--network=host \
-v $PWD:/data \
--env-file .env \
ghcr.io/k4yt3x/tellama:latest
To pass options with command-line arguments:
docker run \
--network=host \
-v $PWD:/data \
ghcr.io/k4yt3x/tellama:latest \
--telegram-token="YOUR_TELEGRAM_BOT_TOKEN" \
--model="YourModelName"
Option 2: Install from PyPI
You can also install Tellama directly using pip:
pip install tellama
To pass options with environment variables:
export TELEGRAM_TOKEN="YOUR_TELEGRAM_BOT_TOKEN"
export OLLAMA_MODEL="YourModelName"
tellama
You can also save the environment variables in a .env file to make things easier:
set -a; source .env; set +a
tellama
To pass options with command-line arguments:
tellama --telegram-token="YOUR_TELEGRAM_BOT_TOKEN" --model="YourModelName"
Further Configuration
To see all available options, run:
tellama --help
or consult the project repository for more details.
Configuration
You will need to add custom default instructions for the model. Run the bot once to create the database, then add the instructions to the chat_instructions table in the SQLite database. A custom instruction entry with the chat_id of NULL will be used as the default instruction for all chats. You can also add instructions for specific chats by adding entries with the chat_id of the chat you want to customize.
INSERT INTO chat_instructions (instructions) VALUES ('Your custom instructions');
Here is an example for how the instructions should look like:
<instructions>
- Your name is Tellama.
- You are an AI chatbot built by @JohnDoe for Telegram group chats.
- You should not engage in any harmful, illegal, or unethical conversations.
- You should be polite, respectful, and helpful to all users.
- You should obey laws, morals, and ethics.
- Contents between `<instructions></instructions>` are instructions for you to follow.
- Contents after `<instructions></instructions>` are messages from users in the chat.
- User messages are in the format of `<nickname>: <message>`.
- Your responses should be text-only, without any tags or identifiers.
</instructions>
License
Tellama is licensed under GNU AGPL version 3.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tellama-0.1.0.tar.gz.
File metadata
- Download URL: tellama-0.1.0.tar.gz
- Upload date:
- Size: 20.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71076076a16ed8885a7892499382fdcf844ad0b1b44b1db7000bd5343b5ec2ed
|
|
| MD5 |
bbb8fb763fc0c2b8f8d1aacc93cd4c5d
|
|
| BLAKE2b-256 |
86cf8690e649822da87c0d44b0e0aaa1eecd14cc78a3d923f1787cbcf61e8d32
|
File details
Details for the file tellama-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tellama-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1a92098e2c21afff77ce40532dff847809f17a4a56a7178dfd51e39d0fa0c1f
|
|
| MD5 |
9e81e9d3e0adea31392152c5ccd73298
|
|
| BLAKE2b-256 |
385d8a2e1c45cc72a770f2512c158cf9bd8fdf52a2219ed306062675b2b86894
|