最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

【衍生工具篇】ChatGPT 顛覆者 Auto-GPT

2023-07-09 23:46 作者:ChatGPT云炬學(xué)長  | 我要投稿

相信最近 大家或多都聽到了 Auto-GPT 這個詞,非常的火爆。

這一節(jié)我們就來講解 Auto-GPT 相關(guān)的內(nèi)容,并幫忙大家上手體驗(yàn)

一、Auto-GPT 是什么

AutoGPT是一個開源的AI代理Python應(yīng)用程序,使用 GPT-4 作為基礎(chǔ),允許AI自主行動,完全無需用戶提示每個操作,30分鐘內(nèi)就可以完成設(shè)置,以設(shè)置和入門的簡便性在用戶中大受歡迎,目前GitHub Star量已超過42k。

簡單來說,AutoGPT 底層還是 GPT 模型。只是他使用 GPT 的方法比 ChatGPT 更近了一步。

AutoGPT最大的特點(diǎn)就在于能全自動地根據(jù)任務(wù)指令進(jìn)行分析和執(zhí)行,自己給自己提問并進(jìn)行回答,中間環(huán)節(jié)不需要用戶參與。

目前AutoGPT已經(jīng)具備的功能包括

  1. 用于搜索和信息收集的 Internet 訪問

  2. 長期和短期內(nèi)存管理

  3. 用于文本生成的 GPT-4 實(shí)例

  4. 訪問流行的網(wǎng)站和平臺

  5. ? 使用 GPT-3.5 進(jìn)行文件存儲和匯總

  6. 支持執(zhí)行腳本

如果說ChatGPT是服從用戶指令,用戶讓它干什么它就干什么,

那AutoGPT就是“自己覺得應(yīng)該干什么就干什么”,它就像是一個遇到不懂的問題能自行去百度的人類。

用戶可以為AutoGPT設(shè)定總體目標(biāo),然后讓它逐步采取措施來一一實(shí)現(xiàn)目標(biāo),這就是“AI代理”概念的由來,它完全自動執(zhí)行操作。

二、Auto-GPT和ChatGPT有什么區(qū)別

大家這一陣子使用 ChatGPT ,相信大家能感受到它的強(qiáng)大,不過還是有很多缺陷,比如字?jǐn)?shù)限制、需要一問一答沒辦法一條龍給答案;聊多了總是差那么點(diǎn)意思。

而在 Auto-GPT 面前,ChatGPT 就顯的笨笨的了。

當(dāng)我們拋出一個問題后,Auto-GPT 可以幫們我們分析,告訴我們它的想法是什么,計(jì)劃是什么,怎么做,為什么這么做,下一步要做什么。

不像 ChatGPT 直接把答案拋給我們,我們也不知道正確性。

可以先來看看官網(wǎng)的一個例子

http://mpvideo.qpic.cn/0bc3kmaaeaaap4ac2pbr6nsfau6dajjqaaqa.f10002.mp4?dis_k=921d1f801b4f9f789b5ca62120e41f09&dis_t=1681536368&play_scene=10120&auth_info=BpHm6INfekkS3s+JnV9YS2U+G2tjTGNKVigiE1kTbno/FjAaEA==&auth_key=e178b036315a08e60b6cf4c6e4686756&vid=wxv_2874820741702287362&format_id=10002&support_redirect=0&mmversion=false

三、Auto-GPT 核心是什么

AutoGPT 這類 AI agent 工作的內(nèi)部結(jié)構(gòu)與核心邏輯和我們之前學(xué)到的角色扮演在原理上是類似的,。這類項(xiàng)目絕大多數(shù)的主要創(chuàng)新還是在 prompt 層面,通過更好的提示詞來激發(fā)模型的能力,把更多原先需要通過代碼來實(shí)現(xiàn)的流程“硬邏輯”轉(zhuǎn)化為模型自動生成的“動態(tài)邏輯”。

對 AutoGPT 來說,它的核心 prompt 如下

You are Guandata-GPT, 'an AI assistant designed to help data analysts do their daily work.'Your decisions must always be made independently without seeking user assistance. Play to your strengths as an LLM and pursue simple strategies with no legal complications.

GOALS:

1. 'Process data sets'

2. 'Generate data reports and visualizations'

3. 'Analyze reports to gain business insights'

Constraints:

1. ~4000 word limit for short term memory. Your short term memory is short, so immediately save important information to files.

2. If you are unsure how you previously did something or want to recall past events, thinking about similar events will help you remember.

3. No user assistance4. Exclusively use the commands listed in double quotes e.g. "command name"

Commands:

1. Google Search: "google", args: "input": "<search>"

2. Browse Website: "browse_website", args: "url": "<url>", "question": "<what_you_want_to_find_on_website>"

3. Start GPT Agent: "start_agent", args: "name": "<name>", "task": "<short_task_desc>", "prompt": "<prompt>"

4. Message GPT Agent: "message_agent", args: "key": "<key>", "message": "<message>"

5. List GPT Agents: "list_agents", args:

6. Delete GPT Agent: "delete_agent", args: "key": "<key>"

7. Clone Repository: "clone_repository", args: "repository_url": "<url>", "clone_path": "<directory>"

8. Write to file: "write_to_file", args: "file": "<file>", "text": "<text>"

9. Read file: "read_file", args: "file": "<file>"

10. Append to file: "append_to_file", args: "file": "<file>", "text": "<text>"

11. Delete file: "delete_file", args: "file": "<file>"

12. Search Files: "search_files", args: "directory": "<directory>"

13. Evaluate Code: "evaluate_code", args: "code": "<full_code_string>"

14. Get Improved Code: "improve_code", args: "suggestions": "<list_of_suggestions>", "code": "<full_code_string>"

15. Write Tests: "write_tests", args: "code": "<full_code_string>", "focus": "<list_of_focus_areas>"

16. Execute Python File: "execute_python_file", args: "file": "<file>"

17. Generate Image: "generate_image", args: "prompt": "<prompt>"

18. Send Tweet: "send_tweet", args: "text": "<text>"

19. Do Nothing: "do_nothing", args:

20. Task Complete (Shutdown): "task_complete", args: "reason": "<reason>"

Resources:

1. Internet access for searches and information gathering.

2. Long Term memory management.

3. GPT-3.5 powered Agents for delegation of simple tasks.

4. File output.

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"

}

}

}

Ensure the response can be parsed by Python json.loads

其中:

Constraints & Resources

設(shè)置局限性。例如模型的輸入 context size 有限制,所以需要把重要的信息保存到文件里。尤其在代碼生成場景中這個動作非常重要,否則無法實(shí)現(xiàn)長代碼的生成和執(zhí)行。

另外 AutoGPT 里也給模型提供了長期記憶的管理功能,當(dāng)前這類復(fù)雜 prompt 生成的解決任務(wù)的流程往往比較冗長,沒有這類長期記憶的管理很容易就會導(dǎo)致模型的輸出變得不連貫協(xié)調(diào)。

另外像默認(rèn)的模型是“沒有聯(lián)網(wǎng)”的,所有的知識只更新到訓(xùn)練數(shù)據(jù)的截止日期。所以也明確告訴模型可以通過網(wǎng)絡(luò)搜索來獲取更多時效性的外部信息

Commands

在 commands 也就是各類工具的選擇上,這里給出的選項(xiàng)非常豐富。這也是為何很多文章宣傳里提到 AutoGPT 能夠完成多種不同任務(wù)的原因之一,靈活性與通用性很高。

具體的 commands 中,可以分為幾大類,

  1. 搜索

  2. 瀏覽網(wǎng)頁相關(guān)

  3. 啟動其它的 GPT agent(啟動子任務(wù))

  4. 文件讀寫操作

  5. 代碼生成與執(zhí)行等

目前 GPT 模型對于越具體生成的表現(xiàn)就越精確和穩(wěn)定。這種“分而治之”的思路非常好。

Performance Evaluation

設(shè)置模型整體思考流程的指導(dǎo)原則,分為了幾個具體維度,包括對自己的能力與行為的匹配進(jìn)行 review,大局觀與自我反思,結(jié)合長期記憶對決策動作進(jìn)行優(yōu)化,以及盡可能高效率地用較少的動作來完成任務(wù)。

這個思考邏輯也非常符合人類的思考方式。

Response

從 response 格式上來看,也是綜合了幾種模式,包括需要把自己的想法寫出來,做一些 reasoning 獲取相關(guān)背景知識,生成有具體步驟的 plan,以及對自己的思考過程進(jìn)行 criticism 等。

這些格式的限定也是對前面思維指導(dǎo)原則的具體操作規(guī)范說明。

需要注意的是

因?yàn)?AutoGPT 生成的解決流程往往會非常冗長,耗費(fèi)的時間和 token 量都會非常大

四、本地搭建體驗(yàn) | 需要魔法

要求

  1. Python 3.8或更高版本

  2. OpenAI API密鑰

  3. 需要魔法

安裝步驟

第一步 下載 Auto gpt

在本地執(zhí)行 或者直接訪問?github.com/Significant-?,點(diǎn)擊 download zip

git clone?github.com/Significant-



第二步 安裝依賴

cd Auto-GPT

pip install -r requirements.txt

第三步 修改配置

將 .env.template重命名為.env并填寫OPENAI_API_KEY(platform.openai.com/acc?獲取自己的key)

第四步 啟動

python scripts/main.py

//可能會出現(xiàn)提示

Please run:

python -m autogpt

那就直接執(zhí)行

python -m autogpt

第四步 目標(biāo)定義



第五步 AutoGPT 理解分析



可以看到 AutoPGT 會對我們給的目標(biāo)進(jìn)行分析,告訴我們它是怎么思考的,原因是什么,計(jì)劃是什么,以及接下來要做什么

我們只需要在 Input 那輸入 Y 即可,AutoGPT就會繼續(xù)執(zhí)行

第六步 結(jié)果查看

最終結(jié)束后會在 Auto-GPT/auto_gpt_workspace 目錄下存放結(jié)果,直接查看即可

五、Google colab 一鍵搭建 | 需要魔法 (無魔法直接下拉看第六章)

如果我們不想在本地搭建,我們可以直接白嫖 Google colab 的資源來搭建

可以直接參考?colab.research.google.com



六、如何添加Google搜索

如果我們的 apikey 還是 3.5,但是我們希望使用google 搜索的話,我們可以在 AutoGPT 中配置google的key

獲取key

前往 Google Cloud Console?console.cloud.google.com

如果沒有帳戶,請創(chuàng)建一個并登錄。

通過點(diǎn)擊頁面頂部的“選擇項(xiàng)目”下拉菜單并點(diǎn)擊“新建項(xiàng)目”來創(chuàng)建一個新項(xiàng)目。給它一個名字,然后點(diǎn)擊“創(chuàng)建”。

前往API和服務(wù)控制臺(console.cloud.google.com)并點(diǎn)擊“啟用API和服務(wù)”。搜索“自定義搜索API”,然后點(diǎn)擊它,然后點(diǎn)擊“啟用”。

前往憑據(jù)頁面(console.cloud.google.com)并點(diǎn)擊“創(chuàng)建憑據(jù)”。選擇“API密鑰”。

復(fù)制API密鑰并將其設(shè)置為電腦上名為GOOGLE_API_KEY的環(huán)境變量。請參見下面的環(huán)境變量設(shè)置。

/Auto-GPT/.env 文件

### GOOGLE

# GOOGLE_API_KEY - Google API key (Example: my-google-api-key)

# CUSTOM_SEARCH_ENGINE_ID - Custom search engine ID (Example: my-custom-search-engine-id)

GOOGLE_API_KEY=API_KEY

CUSTOM_SEARCH_ENGINE_ID=6110d25e77cbd45de

獲取 Google ENGINE_ID

前往自定義搜索引擎頁面(cse.google.com/cse/all)點(diǎn)擊“添加”。

選擇搜索整個網(wǎng)絡(luò)或特定站點(diǎn)。

創(chuàng)建完搜索引擎后,點(diǎn)擊“控制臺”,然后點(diǎn)擊“基礎(chǔ)”。復(fù)制“搜索引擎ID”,并配置在環(huán)境變量中

/Auto-GPT/.env 文件

### GOOGLE

# GOOGLE_API_KEY - Google API key (Example: my-google-api-key)

# CUSTOM_SEARCH_ENGINE_ID - Custom search engine ID (Example: my-custom-search-engine-id)

CUSTOM_SEARCH_ENGINE_ID=GENINE_ID

每日免費(fèi)自定義搜索配額最多允許100次搜索。要增加此限制,您需要將結(jié)算帳戶分配給該項(xiàng)目,以從每日最多10K搜索中獲利。

七、替代方案 | 不需要魔法

AgentGPT: Autonomous AI in your browser

雖然目前只能設(shè)置一個目標(biāo),不過體驗(yàn)也是足夠的



八、一些限制

目前來看 Auto-GPT 還是不夠成熟的,雖然它的理念非常好,但還是有很多的限制

  1. 雖然通過把記錄存儲在文件中實(shí)現(xiàn)長期記憶,但每次處理的次數(shù)依然會有限制

  2. 使用的 token 也非常高。因?yàn)榘阉械挠涗浂即鎯υ谖募凶鳛楹罄m(xù)的分析使用(那就必然會非常頻繁的和ChatGPT 交互)

  3. 能不能跑出來結(jié)果往往和定義的 Goal 有關(guān)。很多時候跑不出來結(jié)果,會導(dǎo)致死循環(huán)

  4. 一旦定義了 Goal ,在整個交互過程中只能繼續(xù)或退出,沒有調(diào)教的余地

所以,還是讓子彈再飛一會兒,大家可以先嘗嘗鮮


【衍生工具篇】ChatGPT 顛覆者 Auto-GPT的評論 (共 條)

分享到微博請遵守國家法律
济南市| 梓潼县| 泰兴市| 增城市| 旌德县| 三台县| 南宫市| 丹棱县| 凤山县| 乌苏市| 财经| 灌南县| 英德市| 视频| 姜堰市| 茂名市| 水城县| 新龙县| 林芝县| 昌都县| 南郑县| 岐山县| 福泉市| 香格里拉县| 商丘市| 获嘉县| 文成县| 塔河县| 中超| 清河县| 北川| 林芝县| 白水县| 岳池县| 桃源县| 兴化市| 永济市| 铜川市| 罗山县| 黄梅县| 广水市|