AGI系列(7)Reflection 在 AI agent 中的应用实例

斯坦福大学教授吴恩达一直非常推崇AI Agent,之前他提出过AI Agent的四种工作模式,分别是Reflection(反思)、Tool use(工具使用)、Planning(规划)和Multi-agent collaboration(多智能体协同)。

近日,他又开源了一个翻译 AI Agent, 他认为 AI 智能体机器翻译对改进传统神经机器翻译”具有巨大潜力,尚未被完全发掘“ ,在周末的时间,写了一个演示项目。

在这里插入图片描述
开源的项目地址:https://github.com/andrewyng/translation-agent,大家可以根据Readme的提示,进行安装使用。

案例拆解

今天,我们对他的翻译Agent,做一个详细的拆解。

整体流程
在这里插入图片描述
Agent的整体流程有三个步骤:

1、根据用户给出的输入,做初始的通用翻译。

2、由AI对翻译的结果进行反思,给出修改意见

3、让AI再一次结合步骤1的初始翻译,和步骤2的修改意见,再进行最终的翻译改进。

具体的,我准备了一个示例。让AI翻译李商隐的《 夜雨寄北》:

夜雨寄北
君问归期未有期,巴山夜雨涨秋池。
何当共剪西窗烛,却话巴山夜雨时。

第一步初始翻译的结果:

Prompt:

This is an Chinese to English translation, please provide the English translation for this text. Do not provide any explanations or text apart from the translation.
Chinese: 《夜雨寄北》
君问归期未有期,巴山夜雨涨秋池。
何当共剪西窗烛,却话巴山夜雨时。
English:

这步就是简单的翻译, 声明要翻译的语言,提供要翻译的文本。

Response:

"Message in the Rainy Night to the North"
You ask when I will return, but I have not yet set a date;
The night rain on Ba Mountain swells the autumn pond.
When can we trim the candle by the western window together,
And talk again of the night rain on Ba Mountain?

第二步反思:

Prompt:

Your task is to carefully read a source text and a translation from Chinese to English, and then give constructive criticism and helpful suggestions to improve the translation. The final style and tone of the translation should match the style of English colloquially spoken in America.
The source text and initial translation, delimited by XML tags <SOURCE_TEXT></SOURCE_TEXT> and <TRANSLATION></TRANSLATION>, are as follows:

<SOURCE_TEXT>
《夜雨寄北》
君问归期未有期&#x
  • 27
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值