Skip to content

Latest commit

 

History

History
63 lines (42 loc) · 1.09 KB

File metadata and controls

63 lines (42 loc) · 1.09 KB

Telegram Translation Bot with integrated local AI

A Telegram bot that translates messages using a locally running LLM (Ollama), so no data leaving your machine.

Example:

  • Input: Hello, how are you?
  • Output: Привет, как дела?

How translation works

  • Language is detected using langdetect
  • Target language is selected via simple rules (you can easily customise it however you like):
    • EN / DE -> Russian
    • RU -> English
  • A prompt is sent to the local LLM
  • The model returns only the translated text

Setup

1. Clone repository

2. Create virtual environment

python -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate

3. Install dependencies

pip install -r requirements.txt

4. Setup environment variables

Create a .env file:

TOKEN=your_telegram_bot_token
MODEL=model_of_your_choice

5. Start Ollama

Make sure Ollama is running locally:

ollama run qwen3

Default API endpoint:

http://localhost:11434/api/generate

6. Run the bot

python bot.py