PromptAppGPT重磅更新!AI助手0門檻開發(fā)+運(yùn)行:幾十行代碼即可實(shí)現(xiàn)AutoGPT
近日首個(gè)自研全開源自然語言低代碼GPT應(yīng)用快速開發(fā)框架PromptAppGPT迎來重要更新。
框架簡介可以參考往期文章: 真低代碼!首個(gè)基于ChatGPT的自然語言開發(fā)框架PromptAppGPT:全自動(dòng)編譯、運(yùn)行、界面生成。
項(xiàng)目網(wǎng)站:https://promptappgpt.wangzhishi.net/
項(xiàng)目代碼:https://github.com/mleoking/PromptAppGPT
PromptAppGPT框架更新后增加了對(duì)網(wǎng)頁搜索、圖片搜索、網(wǎng)頁抓取、JavaScript代碼執(zhí)行等多個(gè)重要執(zhí)行組件的內(nèi)置支持。
新的執(zhí)行組件的加入和本次其他機(jī)制優(yōu)化使得PromptAppGPT具備了幾十行低代碼實(shí)現(xiàn)AutoGPT這種AI自動(dòng)助手的能力。
更新后PromptAppGPT將AI全自動(dòng)助手的開發(fā)和運(yùn)行門檻都降到了最低: 人人都可以自然語言開發(fā), 直接打開網(wǎng)址點(diǎn)擊就可以運(yùn)行,不用安裝任何依賴組件。
本次更新增加的My AutoGPT程序就是基于PromptAppGPT開發(fā)AI全自動(dòng)助手類APP的示例。
基于PromptAppGPT 的 My AutoGPT的代碼
---
author: Leo
name: My AutoGPT
description: Use gpt and executors to autonomously achieve whatever goal you set.
gptRound: multiple
failedRetries: 2
autoRun: true
sysTask:
- executor: gpt
prompt: |
Constraints:
1. If you are unsure how you previously did something or want to recall past events, thinking about similar events will help you remember.
2. No user assistance
3. Exclusively use the commands listed in double quotes e.g. "command name"
Commands:
1. Webpage Search: "doSearchWeb", args: "query": "<keywords_to_search>"
2. Image Search: "doSearchImage", args: "query": "<keywords_to_search>"
3. Task Complete: "doCompleteTask", args: "output": "<task_output>"
Resources:
1. Internet access for searches and information gathering.
2. GPT-3.5 powered Agents for delegation of simple tasks.
Performance Evaluation:
1. Continuously review and analyze your actions to ensure you are performing to the best of your abilities.
2. Constructively self-criticize your big-picture behavior constantly.
3. Reflect on past decisions and strategies to refine your approach.
4. Every command has a cost, so be smart and efficient. Aim to complete tasks in the least number of steps.
You should only respond in JSON format as described below
Response Format:
{
"thoughts": {
"text": "thought",
"reasoning": "reasoning",
"plan": "- short bulleted\n- list that conveys\n- long-term plan",
"criticism": "constructive self-criticism",
"speak": "thoughts summary to say to user"
},
"command": {
"name": "command name",
"args": {
"arg name": "value"
}
}
}
userTask:
- trigger: doSearchWeb
executor: bingWeb
prompt: |
query: $e{"query": "(.*)"}
limit: 2
outputer: $e{RawInput} doGptNext
- trigger: doSearchImage
executor: bingImage
prompt: |
query: $e{"query": "(.*)"}
limit: 2
outputer: $e{RawInput} doGptNext
- trigger: doGptNext
executor: gpt
prompt: Determine which next command to use, and respond using the format specified above.
- trigger: doCompleteTask
executor: log
prompt: |
$i{Task Complete:@textarea=$e{"output": "(.*)"}}
- executor: gpt
prompt: |
$i{My Objectives:@textarea=Objectives:
1. Recommend the best smartphone for business professionals in 2023.
2. Explain why the smartphone is recommended and show the smartphone's image.}
代碼中,sysTask部分描述了助手需要遵守的約束(Constraints), 可以運(yùn)行的命令(Commands),可以使用的資源(Resources),性能評(píng)估方法(Performance Evaluation),輸出內(nèi)容和格式規(guī)范。
userTask部分配置了助手運(yùn)行需要的5種任務(wù)各自的觸發(fā)條件(trigger),執(zhí)行器(executor)和執(zhí)行輸入(prompt)。
My AutoGPT運(yùn)行過程
首先輸入要助手完成的目標(biāo):
1. Recommend the best smartphone for business professionals in 2023.
為商務(wù)人士推薦2023年最好的智能手機(jī)
2. Explain why the smartphone is recommended and show the smartphone's image.
解釋智能手機(jī)的推薦理由并展示手機(jī)圖片
然后點(diǎn)擊運(yùn)行。這個(gè)時(shí)候程序就開始全自動(dòng)目標(biāo)拆解和完成的過程:
第一步,調(diào)用GPT作決策判斷需要先進(jìn)行網(wǎng)頁搜索,找出2023年對(duì)于商務(wù)人士最好的智能手機(jī)列表。
第二步, 調(diào)用bingWeb搜索給出兩個(gè)網(wǎng)頁,并得出2023年商務(wù)人士最優(yōu)智能手機(jī)候選: iPhone 14 Pro Max, Samsung Galaxy S22 Ultra, Google Pixel 7 Pro, Samsung Galaxy Z Fold 4, Oppo Find X5 Pro。
第三步,調(diào)用GPT作決策判斷,下一步需要進(jìn)一步搜索上面得到兩個(gè)網(wǎng)頁(TechRepublic vs TechRadar)觀點(diǎn)的異同。
第四步,調(diào)用bingWeb獲得了兩篇報(bào)道觀點(diǎn)異同信息。
第五步,調(diào)用GPT做決策判斷,通過以上步驟輸入,GPT判斷出iPhone 14 Pro Max是2023年對(duì)商務(wù)人士最好的智能手機(jī); 然后GPT決策下一步需要調(diào)用圖像搜索來獲得這個(gè)手機(jī)的圖片。
第六步,調(diào)用bingImage搜索得出iPhone 14 Pro Max的兩張圖片。
第七步,調(diào)用GPT作決策判斷,在兩張圖片中選擇了第一張更好看的深藍(lán)色的圖片,并做出下一步?jīng)Q策是要完成任務(wù)(doCompleteTask)。
第八步,任務(wù)完成,結(jié)果推薦了iPhone 14 Pro Max手機(jī),并給出了推薦理由和手機(jī)的圖片鏈接。
我們看到基于PromptAppGPT的My AutoGPT應(yīng)用已經(jīng)展露出大語言模型對(duì)于目標(biāo)進(jìn)行自動(dòng)拆解、決策、利用工具、和綜合最終結(jié)果的能力。
更新后的PromptAppGPT帶有更多的插件和機(jī)制,將能支持低代碼開發(fā)更加智能的大語言模型應(yīng)用。
作者介紹
張長旺,高級(jí)研究員,CCF理論計(jì)算機(jī)科學(xué)技術(shù)委員會(huì)委員。 曾擔(dān)任第37屆AAAI人工智能會(huì)議(AAAI-23)的高級(jí)程序委員會(huì)(SPC)成員。
他分別于2011年和2015年獲得倫敦大學(xué)學(xué)院(UCL)的碩士和博士學(xué)位。2016年至2017年在阿里巴巴從事LBS數(shù)據(jù)挖掘,2018年至2022年在騰訊從事廣告推薦和用戶畫像。
目前的研究方向是信息檢索(搜推廣)、自然語言處理、大數(shù)據(jù)挖掘的研究與應(yīng)用。