An automated Python translation assistant that monitors for jobs, processes documents (.docx, .pptx, .xlsx), and uses multiple LLMs (GPT, Claude, Gemini) for high-quality, comparable translations and critiques.
This tool is designed to automate the "first pass" of a translation workflow. It solves the tedious problem of manually preparing documents, sending them to various services, and collating the results. It runs as a headless background service that can watch for new jobs in a CSV file or new files in a "hot folder," process them automatically, and regenerate fully-formatted documents with the translated text.
It is controlled by a powerful, interactive web interface (UI) that allows for real-time configuration, job monitoring, and side-by-side comparison of translation results.
- Interactive Web UI: A Streamlit dashboard for reviewing translations, viewing logs, and configuring the application on the fly.
- Live Configuration Reload: Change settings like the operation mode or primary model in the UI, and the background service will reload the new configuration without restarting.
- Automated Job Monitoring: A headless service watches a CSV file for new job tickets or a local "hot folder" for new file drops.
- Multi-LLM Engine: Utilizes GPT, Claude, and Gemini to perform translations, allowing for robust quality comparison.
- Complex Document Support: Extracts text from and regenerates
.docx,.pptx, and.xlsxfiles, preserving basic structure. - Advanced Workflows:
- Parallel Mode: Get translations from all LLMs simultaneously.
- Critique Mode: One LLM translates, and the others provide constructive feedback and a refined version.
- Professional Tooling:
- Glossary Support: Enforces consistent terminology via a
glossary.jsonfile.
- Colored Logging: Clean, color-coded console output and a detailed
app.logfile for easy debugging.
- Glossary Support: Enforces consistent terminology via a
This assistant is the perfect companion to the GengoWatcher-Public application. While GengoWatcher-Public finds new translation jobs, this assistant automatically processes them. By pointing this assistant to the CSV file generated by GengoWatcher, you create a fully automated pipeline: from job discovery to final, multi-model translation.
The application is now split into two main components:
- The Headless Service (
run_service.py): This is the core engine. It runs continuously in the background and contains the two worker threads that monitor for new jobs. - The User Interface (
run_ui.py): This is a separate Streamlit application that acts as the control panel and viewer. It communicates with the service via signal files in themonitor/directory.
- Python 3.9+
- Linux-Specific Dependency: The
pypercliplibrary requires a command-line copy/paste tool to function. Please install one for your distribution:- Arch Linux:
sudo pacman -S xclip - Debian/Ubuntu:
sudo apt install xclip - Fedora:
sudo dnf install xclip
- Arch Linux:
-
Clone the repository:
git clone https://github.com/tdawe1/multi-llm-translator.git cd multi-llm-translator -
Set up a Python virtual environment:
python -m venv .venv source .venv/bin/activate -
Install the required dependencies:
pip install -r requirements.txt
-
Configure your API keys:
- Create your environment file from the example:
cp .env.example .env
- Edit the
.envfile and add your secret API keys.
- Create your environment file from the example:
The application requires two separate terminals to run for interactive use.
This script runs the background workers that monitor for and process jobs.
python run_service.pyThis command launches the Streamlit web interface, which will open in your browser.
streamlit run run_ui.pyTo run the application reliably in the background and have it start automatically on boot, setting it up as a systemd user service is the recommended method.
1. Create the Service File:
Create a new file at ~/.config/systemd/user/translator.service and paste the following content into it.
Important: You must replace /home/multi-llm-translator with the absolute path to your project directory.
[Unit]
Description=Multi-LLM Translation Assistant Service
After=network.target
[Service]
# Replace with the absolute path to your project's root directory
WorkingDirectory=/home/multi-llm-translator
# Replace with the absolute path to the python executable in your .venv
ExecStart=/home/multi-llm-translator/.venv/bin/python /home/multi-llm-translator/run_service.py
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=default.target2. Manage the Service:
After creating the file, reload the systemd daemon:
systemctl --user daemon-reloadYou can now manage the service with the following commands:
- Start:
systemctl --user start translator.service - Check Status:
systemctl --user status translator.service - Stop:
systemctl --user stop translator.service - View Logs:
journalctl --user -u translator.service -f - Enable on Boot:
systemctl --user enable translator.service
Configuration can be managed in two ways:
All startup settings are controlled from your .env file.
| Setting | Options | Description |
|---|---|---|
OPERATION_MODE |
SIMPLE, PARALLEL, CRITIQUE |
Defines the translation workflow. |
PRIMARY_MODEL |
gpt, claude, gemini |
The main model to use for SIMPLE and CRITIQUE modes. |
DUMMY_MODE |
True, False |
If True, the app simulates API calls without using tokens for free testing. |
The UI sidebar allows you to change the OPERATION_MODE, PRIMARY_MODEL, and DUMMY_MODE at any time. When you click "Save and Reload Service," the UI updates the .env file and signals the background service to reload the new settings without a restart.
- Advanced Document Regeneration: Add support for preserving more complex formatting (styles, tables, images).
- Robust Job Status Tracking: Implement a more robust system (e.g., SQLite database) for tracking job status.
- Text-based UI (TUI): Create a third entry point for a fully interactive terminal dashboard.
This project is licensed under the 0BSD License. See the LICENSE file for details.