Skip to content

hienphan161/translation-multi-agent-collaboration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌐 Translation Multi-Agent Collaboration

A simple translation system using multi-agent collaboration. Three AI agents work together to produce high-quality translations:

  1. 🤖 Translator Agent (OpenAI GPT-4o) - Translates content from English to target language
  2. 📝 Editor Agent (Google Gemini) - Reviews translations for grammar, phrasing, and cultural appropriateness
  3. 🔧 Technical Reviewer Agent (Google Gemini) - Ensures XML format, placeholders, and technical correctness

🚀 Setup

1. Install dependencies

pip install -r requirements.txt

2. Configure API keys

Copy the example config and add your OpenAI API key:

cp config.yaml.example config.yaml

Then edit config.yaml:

openai:
  api_key: "your-api-key-here"
  base_url: "https://api.openai.com/v1"
  model: "gpt-4o"

📁 Supported Input Formats

The system supports multiple input formats:

Format File Platform
🤖 Android XML input/strings.xml Android Mobile
🍎 iOS Strings input/strings_ios.strings iOS Mobile
🔧 Backend JSON input/strings_backend.json Backend Services
📄 Backend TOML input/strings_backend.toml Backend Services

Each format includes placeholder examples (%s, %d, {variable}, %@) to test placeholder handling.

💻 Usage

🖥️ Web UI (Streamlit)

Run the Streamlit app for a visual interface:

streamlit run app.py

Then open your browser to http://localhost:8501

Features:

  • 📁 Select input files from dropdown
  • 🌍 Choose target languages
  • 📋 View processing logs in real-time
  • 🤖 See each agent's response
  • 📦 View formatted results

⌨️ CLI

# Android XML
python main.py --path input/strings.xml

# iOS Strings
python main.py --path input/strings_ios.strings

# Backend JSON
python main.py --path input/strings_backend.json

# Backend TOML
python main.py --path input/strings_backend.toml

🌍 CLI - Specify languages

python main.py --path input/strings.xml --languages zh,ja,ko

⚙️ Custom config file

python main.py --path input/strings.xml --config my-config.yaml

⚙️ Configuration

Edit config.yaml to customize:

  • 🔑 openai: API credentials and model settings
  • 🌍 translation.languages: Default target languages
  • 📝 translation.max_editor_reviews: Maximum editor review rounds (default: 2)
  • 🔧 translation.max_technical_reviews: Maximum technical review rounds (default: 2)
  • 📁 output.directory: Output folder (default: results)
  • 🏷️ output.prefix: Output file prefix (default: v1)

🔄 How It Works

📄 Input File
    │
    ▼
🤖 [Translator Agent] ──► Produces initial translation
    │
    ▼
📝 [Editor Agent] ──► Reviews language quality
    │                   • Grammar
    │                   • Natural phrasing
    │                   • Cultural appropriateness
    ▼
🔧 [Technical Reviewer] ──► Checks technical correctness
    │                         • XML format
    │                         • Placeholders intact
    │                         • Special characters
    ▼
📦 Output File

The agents communicate through a feedback loop. If issues are found, the Translator receives feedback and revises the translation until both reviewers approve. ✅

🌍 Supported Languages

Default languages configured:

  • 🇨🇳 zh (Chinese)
  • 🇯🇵 ja (Japanese)
  • 🇰🇷 ko (Korean)
  • 🇹🇭 th (Thai)
  • 🇲🇾 ms (Malay)
  • 🇻🇳 vi (Vietnamese)
  • 🇮🇩 id (Indonesian)
  • 🇰🇭 km (Khmer)

📦 Output

Translated files are saved to the results/ folder with naming format:

{prefix}_{language}_{original_filename}

Example: v1_zh_strings.xml

About

A simple translation system using multi-agent collaboration. Three AI agents work together to produce high-quality translations: Translator Agent, Editor Agent and Technical Reviewer Agent.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages