美乳丰满人妻无码视频免费_国产成人亚洲影院在线_成在人线AV无码免费可以下载_国产乱子伦精品无码专区_日本内射

首頁(yè)> 資訊> 詳情

自動(dòng)版本的ChatGPT,AutoGPT自動(dòng)人工智能AI任務(wù)實(shí)踐(Python3.10) 全球關(guān)注

2023-04-19 02:46:55 來源:劉悅技術(shù)分享

當(dāng)我們使用ChatGPT完成某些工作的時(shí)候,往往需要多輪對(duì)話,比如讓ChatGPT分析、翻譯、總結(jié)一篇網(wǎng)上的文章或者文檔,再將總結(jié)的結(jié)果以文本的形式存儲(chǔ)在本地。過程中免不了要和ChatGPT“折沖樽俎”一番,事實(shí)上,這個(gè)“交涉”的過程也可以自動(dòng)化,AutoGPT可以幫助我們自動(dòng)拆解任務(wù),沒錯(cuò),程序能做到的事情,人類絕不親力親為。


(資料圖)

我們唯一需要做的,就是告訴AutoGPT一個(gè)任務(wù)目標(biāo),AutoGPT會(huì)自動(dòng)根據(jù)任務(wù)目標(biāo)將任務(wù)拆解成一個(gè)個(gè)的小任務(wù),并且逐個(gè)完成,簡(jiǎn)單且高效。

配置AutoGPT

先確保本地環(huán)境安裝好了Python3.10.9。

接著運(yùn)行Git命令拉取項(xiàng)目:

git clone https://github.com/Significant-Gravitas/Auto-GPT.git

隨后進(jìn)入項(xiàng)目的目錄:

cd Auto-GPT

安裝相關(guān)的依賴庫(kù):

pip3 install -r requirements.txt

安裝成功后,復(fù)制一下項(xiàng)目的配置文件:

cp .env.template .env

這里通過cp命令將配置文件模版.env.template復(fù)制成為一個(gè)新的配置文件.env。

隨后將Openai的秘鑰填入配置文件:

### OPENAI# OPENAI_API_KEY - OpenAI API Key (Example: my-openai-api-key)# TEMPERATURE - Sets temperature in OpenAI (Default: 0)# USE_AZURE - Use Azure OpenAI or not (Default: False)OPENAI_API_KEY=您的秘鑰TEMPERATURE=0USE_AZURE=False

除了Openai官方的接口秘鑰,AutoGPT也支持微軟Azure的接口。

如果希望使用微軟Azure的接口,需要將配置中的USE_AZURE設(shè)置為True,隨后復(fù)制azure.yaml.template配置模版為新的azure.yaml配置文件。

接著將微軟Azure服務(wù)的秘鑰填入azure.yaml即可。

由于微軟Azure接入Openai接口需要極其復(fù)雜的申請(qǐng)流程,這里還是直接使用OpenAI官方的接口。

當(dāng)然了,如果不想在本地裝那么多依賴,也可以通過Docker來構(gòu)建Auto-GPT的容器:

docker build -t autogpt .docker run -it --env-file=./.env -v $PWD/auto_gpt_workspace:/app/auto_gpt_workspace autogpt

這里Docker會(huì)自動(dòng)讀取項(xiàng)目中的Dockerfile配置文件進(jìn)行構(gòu)建,相當(dāng)方便。

至此,Auto-GPT就配置好了。

運(yùn)行Auto-GPT

在項(xiàng)目根目錄運(yùn)行命令:

python3 -m autogpt --debug

即可啟動(dòng)AutoGPT:

?  Auto-GPT git:(master) python -m autogpt --debug       Warning: The file "AutoGpt.json" does not exist. Local memory would not be saved to a file.Debug Mode:  ENABLEDWelcome to Auto-GPT!  Enter the name of your AI and its role below. Entering nothing will load defaults.Name your AI:  For example, "Entrepreneur-GPT"AI Name:

首先創(chuàng)建AutoGPT機(jī)器人的名字:

AI Name: v3u.cnv3u.cn here!  I am at your service.Describe your AI"s role:  For example, "an AI designed to autonomously develop and run businesses with the sole goal of increasing your net worth."v3u.cn is:

創(chuàng)建好名字以后,Auto-GPT就可以隨時(shí)為您效勞了。

首先為AutoGPT設(shè)置目標(biāo):

v3u.cn is: Analyze the contents of this article,the url is https://v3u.cn/a_id_303,and write the result to goal.txt

這里我們要求AutoGPT分析并且總結(jié)v3u.cn/a_id_303這篇文章,并且將分析結(jié)果寫入本地的goal.txt文件。

程序返回:

Enter up to 5 goals for your AI:  For example: Increase net worth, Grow Twitter Account, Develop and manage multiple businesses autonomously"Enter nothing to load defaults, enter nothing when finished.Goal 1: Using memory of type:  LocalCache

AutoGPT會(huì)告訴你可以最多拆解為五個(gè)任務(wù),我們可以自己拆解,也可以讓機(jī)器人幫助我們拆解,直接按回車,讓AutoGPT自動(dòng)拆解任務(wù)即可。

接著程序會(huì)自動(dòng)爬取這篇文章的內(nèi)容,然后使用gpt-3.5-turbo模型來進(jìn)行分析:

Goal 1: Using memory of type:  LocalCacheUsing Browser:  chrome  Token limit: 4000  Memory Stats: (0, (0, 1536))  Token limit: 4000  Send Token Count: 936  Tokens remaining for response: 3064  ------------ CONTEXT SENT TO AI ---------------  System: The current time and date is Mon Apr 17 20:29:37 2023    System: This reminds you of these events from your past:    User: Determine which next command to use, and respond using the format specified above:    ----------- END OF CONTEXT ----------------Creating chat completion with model gpt-3.5-turbo, temperature 0.0, max_tokens 3064The JSON object is valid. THOUGHTS:  Let"s start by browsing the article at https://v3u.cn/a_id_303 to get a better understanding of its contents.REASONING:  Browsing the article will allow us to analyze its contents and determine the appropriate next steps.PLAN: -  Browse the article-  Analyze its contents-  Determine the appropriate next stepsCRITICISM:  NoneNEXT ACTION:  COMMAND = browse_website ARGUMENTS = {"url": "https://v3u.cn/a_id_303", "question": "analyze the contents of the article"}Enter "y" to authorise command, "y -N" to run N continuous commands, "n" to exit program, or enter feedback for ...Input:y-=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-= [WDM] - Downloading: 100%|████████████████████████████████████████████| 8.04M/8.04M [00:03<00:00, 2.42MB/s]Text length: 6977 charactersAdding chunk 1 / 1 to memorySummarizing chunk 1 / 1Creating chat completion with model gpt-3.5-turbo, temperature 0.0, max_tokens 300SYSTEM:  Command browse_website returned: Error: This model"s maximum context length is 4097 tokens. However, you requested 4339 tokens (4039 in the messages, 300 in the completion). Please reduce the length of the messages or completion.  Token limit: 4000  Memory Stats: (2, (2, 1536))  Token limit: 4000  Send Token Count: 1472  Tokens remaining for response: 2528  ------------ CONTEXT SENT TO AI ---------------  System: The current time and date is Mon Apr 17 20:30:19 2023    System: This reminds you of these events from your past:["Assistant Reply: {
    \"thoughts\": {
        \"text\": \"Let\"s start by browsing the article at https://v3u.cn/a_id_303 to get a better understanding of its contents.\",
        \"reasoning\": \"Browsing the article will allow us to analyze its contents and determine the appropriate next steps.\",
        \"plan\": \"- Browse the article\n- Analyze its contents\n- Determine the appropriate next steps\",
        \"criticism\": \"None\",
        \"speak\": \"I suggest we start by browsing the article at the given URL to analyze its contents and determine the appropriate next steps.\"
    },
    \"command\": {
        \"name\": \"browse_website\",
        \"args\": {
            \"url\": \"https://v3u.cn/a_id_303\",
            \"question\": \"analyze the contents of the article\"
        }
    }
} 
Result: Command browse_website returned: Error: This model\"s maximum context length is 4097 tokens. However, you requested 4339 tokens (4039 in the messages, 300 in the completion). Please reduce the length of the messages or completion. 
Human Feedback: GENERATE NEXT COMMAND JSON "]    User: Determine which next command to use, and respond using the format specified above:    Assistant: {    \"thoughts\": {        \"text\": \"Let"s start by browsing the article at https://v3u.cn/a_id_303 to get a better understanding of its contents.\",        \"reasoning\": \"Browsing the article will allow us to analyze its contents and determine the appropriate next steps.\",        \"plan\": \"- Browse the article
- Analyze its contents
- Determine the appropriate next steps\",        \"criticism\": \"None\",        \"speak\": \"I suggest we start by browsing the article at the given URL to analyze its contents and determine the appropriate next steps.\"    },    \"command\": {        \"name\": \"browse_website\",        \"args\": {            \"url\": \"https://v3u.cn/a_id_303\",            \"question\": \"analyze the contents of the article\"        }    }}      User: Determine which next command to use, and respond using the format specified above:    ----------- END OF CONTEXT ----------------Creating chat completion with model gpt-3.5-turbo, temperature 0.0, max_tokens 2528

最后將分析結(jié)果寫入goal.txt文件:

這篇文章主要闡釋了蘋果Mac電腦可以完成機(jī)器學(xué)習(xí)和深度學(xué)習(xí)任務(wù),并且通過深度學(xué)習(xí)框架Tensorflow的安裝和運(yùn)行進(jìn)行了佐證,同時(shí)也對(duì)Tensorflow的CPU和GPU的兩種模型訓(xùn)練模式進(jìn)行了深度對(duì)比和測(cè)試。

一氣呵成,流暢絲滑。

結(jié)語(yǔ)

AutoGPT和其他 AI 程序的不同之處在于,它專門專注于在無需人工干預(yù)的情況下生成提示和自動(dòng)執(zhí)行多步驟任務(wù)。它還具有掃描互聯(lián)網(wǎng)或在用戶計(jì)算機(jī)上執(zhí)行命令以獲取信息的能力,這使其有別于可能僅依賴于預(yù)先存在的數(shù)據(jù)集的其他人工智能程序。

AutoGPT的底層邏輯并不復(fù)雜:先通過搜索引擎檢索任務(wù),然后把結(jié)果和目標(biāo)丟給gpt讓它給出序列化方案json,再把方案分段丟給gpt,最后用shell去創(chuàng)建Python文件+json.load并且執(zhí)行,是一個(gè)反復(fù)遞歸的過程。

不能否認(rèn)的是,雖然實(shí)現(xiàn)邏輯簡(jiǎn)單,但這無疑是一種“自我進(jìn)化”的過程,相信隨著時(shí)間的推移,AutoGPT可以更好地處理愈加復(fù)雜的任務(wù)。

關(guān)鍵詞:

上一篇:2023年4月18日北京市冬瓜批發(fā)價(jià)格行情|世界短訊
下一篇:最后一頁(yè)