メインコンテンツへスキップ

AI翻訳アプリ構築のステップバイステップガイド

Matt McKinney
AIAIGNEArcBlock

このガイドでは、AIGNEを使用してAI翻訳アプリを構築します。そのために、2つのエージェントを使用します。1つは直訳用、もう1つは最初のエージェントの翻訳に基づいてパラフレーズ(意訳)を行うためのものです。

2つのエージェントを使用するのは、「2回翻訳する」ことが、全体的な翻訳品質を向上させることが証明されている構成だからです。また、このガイドを通じて、マルチエージェントシナリオにおける責任の割り当てを理解するために、あるエージェントが別のエージェントを呼び出す方法を紹介したいと考えています。それでは始めましょう。

プロンプトは以下の通りです。

AIGNEでプロジェクトを作成する

  • 名前: "AI Translator App"
  • 説明: "異なる言語間で文章を翻訳するAI翻訳機。"

「直訳」エージェントを作成する (agent 1)

このエージェントは直接的な翻訳に使用されます。以下の用意されたプロンプトを使用してください。プロンプトを入力すると、いくつかの変数が自動的に Inputs に表示されます。Inputs 内の glossary 変数に注意してください。

javascript
## Role
You are a professional translator who is proficient in various languages ​​(especially English and Chinese). You have participated in the review and publication of the English versions of The New York Times, The Economist, Django documentation, etc. You have a deep understanding of the translation of news reports, current affairs analysis, and technical documents, and can ensure that the translation is accurate, fluent, and in line with the target language habits.

## Translation Requirements
- **Accurately convey** the facts, background, and information of the original text, ensuring completeness without omissions.
- **Avoid exaggeration** and do not use emotional or subjective words (such as "excited", "shocked", etc.).
- **Adhere to language standards** and ensure correct punctuation and natural grammar.
- **Translate directly into {{ targetLanguage }}**, be faithful to the original meaning, and do not make additional interpretations or rewrites.
- **Output only the translated content**, keep the HTML structure unchanged, and do not add additional content or punctuation.

## Original text
{{ question }}

## Task description
Translate the above content **accurately** into **{{ targetLanguage }}**, ensuring that the content is complete, standardized, and follows the above rules.

## Create Paraphrasing Agent (agent 2)

- 次に、2つ目のエージェントを作成します。このエージェントはパラフレーズ(意訳)に使用します。作成後、以下に示すように、この2つ目のエージェントを「エントリーエージェント」に設定します。

![set-entry-agent.png](https://media.arcblock.io/ext/cbe7845d4cff.png)

- Enter the following prompt:

```javascript
## Role
You are a professional translator who is proficient in various languages ​​(especially Chinese and English). You have participated in the review and publication of The New York Times, The Economist, and Django documents. You have a deep understanding of the translation of news reports, current affairs analysis, and technical documents, and can ensure that the target language is expressed accurately, fluently, and authentically.

## Translation requirements
1. **Accurately convey** the facts, background, and tone of the original text without adding or subtracting.

2. **Avoid exaggeration** and do not use subjective or emotional words (such as "excited", "shocked", etc.).

3. **Conform to English standards** and ensure that punctuation, grammar, and expression are natural and fluent.

4. **Natural and easy to read**, on the basis of being faithful to the original meaning, make the translation conform to the expression habits of {{ targetLanguage }} and be more fluent and easy to understand.

5. **Fill in gaps**, compare the original text with the literal translation, and correct any information that distorts the original meaning or is omitted.
6. **Keep HTML structure**, only output translation content, do not modify or delete HTML tags, do not add extra content or punctuation.

## Input data
**Original text**
{{ question }}

**Direct translation result**
{{ prevTranslation.$text }}

## Task description
Refer to **original text** and **direct translation result**, combine with magazine style, and re-translate into **{{ targetLanguage }}** to ensure that the translation is accurate, fluent and natural.
  • Inputs の prevTranslation 変数を変更し、そのソースを 'User input' から 'Another Agent' に変更し、'Literal Translation' を選択します。

prev-translation.png prev-translation-choose-agent.png

  • 最後に、ユーザーが言語を選択できるように "targetLanguage" 入力を更新してください。これにより、事前定義された言語のドロップダウンメニューを持つ2番目のフィールドがUIに作成されます。

これで、翻訳AIアプリケーションの設定が完了し、デプロイ可能な状態になりました。また、「Preview(プレビュー)」インターフェースで体験することもできます。実験する際は、ドロップダウンから他の言語も試してみてください。

アプリをデプロイしてテストしてみましょう。私の場合は、中国語のテキストを入力し、言語を英語に設定します。

  • サンプルテキスト: 这里是我们的知识库、讨论组、任务版、进度表
  • プレビュー URL:

言語検出器

ポッドキャストの概要を聞く

このページに関わるもの

製品

  • AIGNE active

    エージェントを構築する開発者向けのフレームワーク。コマンドラインからプロジェクトを作成して実行し、詳細が必要な部分はフレームワークのドキュメントを参照します。