自动版本的ChatGPT,AutoGPT自动人工智能AI任务实践(Python3.10) 全球关注
当我们使用ChatGPT完成某些工作的时候,往往需要多轮对话,比如让ChatGPT分析、翻译、总结一篇网上的文章或
当我们使用ChatGPT完成某些工作的时候,往往需要多轮对话,比如让ChatGPT分析、翻译、总结一篇网上的文章或者文档,再将总结的结果以文本的形式存储在本地。过程中免不了要和ChatGPT“折冲樽俎”一番,事实上,这个“交涉”的过程也可以自动化,AutoGPT可以帮助我们自动拆解任务,没错,程序能做到的事情,人类绝不亲力亲为。
(资料图)
我们唯一需要做的,就是告诉AutoGPT一个任务目标,AutoGPT会自动根据任务目标将任务拆解成一个个的小任务,并且逐个完成,简单且高效。
先确保本地环境安装好了Python3.10.9。
接着运行Git命令拉取项目:
git clone https://github.com/Significant-Gravitas/Auto-GPT.git
随后进入项目的目录:
cd Auto-GPT
安装相关的依赖库:
pip3 install -r requirements.txt
安装成功后,复制一下项目的配置文件:
cp .env.template .env
这里通过cp命令将配置文件模版.env.template复制成为一个新的配置文件.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设置为True,随后复制azure.yaml.template配置模版为新的azure.yaml配置文件。
接着将微软Azure服务的秘钥填入azure.yaml即可。
由于微软Azure接入Openai接口需要极其复杂的申请流程,这里还是直接使用OpenAI官方的接口。
当然了,如果不想在本地装那么多依赖,也可以通过Docker来构建Auto-GPT的容器:
docker build -t autogpt .docker run -it --env-file=./.env -v $PWD/auto_gpt_workspace:/app/auto_gpt_workspace autogpt
这里Docker会自动读取项目中的Dockerfile配置文件进行构建,相当方便。
至此,Auto-GPT就配置好了。
在项目根目录运行命令:
python3 -m autogpt --debug
即可启动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:
首先创建AutoGPT机器人的名字:
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:
创建好名字以后,Auto-GPT就可以随时为您效劳了。
首先为AutoGPT设置目标:
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分析并且总结v3u.cn/a_id_303这篇文章,并且将分析结果写入本地的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会告诉你可以最多拆解为五个任务,我们可以自己拆解,也可以让机器人帮助我们拆解,直接按回车,让AutoGPT自动拆解任务即可。
接着程序会自动爬取这篇文章的内容,然后使用gpt-3.5-turbo模型来进行分析:
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
最后将分析结果写入goal.txt文件:
这篇文章主要阐释了苹果Mac电脑可以完成机器学习和深度学习任务,并且通过深度学习框架Tensorflow的安装和运行进行了佐证,同时也对Tensorflow的CPU和GPU的两种模型训练模式进行了深度对比和测试。
一气呵成,流畅丝滑。
AutoGPT和其他 AI 程序的不同之处在于,它专门专注于在无需人工干预的情况下生成提示和自动执行多步骤任务。它还具有扫描互联网或在用户计算机上执行命令以获取信息的能力,这使其有别于可能仅依赖于预先存在的数据集的其他人工智能程序。
AutoGPT的底层逻辑并不复杂:先通过搜索引擎检索任务,然后把结果和目标丢给gpt让它给出序列化方案json,再把方案分段丢给gpt,最后用shell去创建Python文件+json.load并且执行,是一个反复递归的过程。
不能否认的是,虽然实现逻辑简单,但这无疑是一种“自我进化”的过程,相信随着时间的推移,AutoGPT可以更好地处理愈加复杂的任务。
关键词:
当我们使用ChatGPT完成某些工作的时候,往往需要多轮对话,比如让ChatGPT分析、翻译、总结一篇网上的文章或
2023年4月18日北京市冬瓜批发市场价格最新行情监测显示:2023年4月18日北京市冬瓜批发价格均价1 9元 公斤,
【挤爆!上海车展“太热了”上千企业参展特斯拉没来!新能源车企大秀肌肉】“太热了!”这是记者走在上海车
你需要的东西纱钩针枕头填充物或填料大眼钝针使用您的钩编技巧来连接各种家居装饰品。看着你只用钩针、一些
1、打开手机上的天气App。2、在天气应用的主页上,设置您的当前位置。3、然后下拉到底部,可以看到当前的气
万辰生物2022年年度董事会经营评述内容如下: 一、报告期内公司所处行业情况 公司是主要从事于食用菌
据国家突发事件预警信息发布网:南城县气象台2023年04月18日20时47分继续发布雷电黄色预警信号:6小时内我
走进江苏东台晶澳科技项目工地,塔吊林立、机械轰鸣,数十辆工程车来回穿梭,1500多名工人在作业面上绑扎钢
据中国报告大厅对2023年4月18日安徽省四氯乙烯价格最新走势监测显示:2023年4月18日安徽省四氯乙烯(含量99 9
携客云已先后完成五轮融资创业邦获悉,供应链关系管理系统携客云宣布完成数千万元B+轮融资,由隐山资本领投
现在,人工智能已经开始进入各个领域,其中包括修复老照片。随着时间的流逝,老照片可能会变得破损、模糊或
明日方舟音律联觉演出上海站即将在4月29日正式开启,这次的演出内容也是非常精彩的,预计时长有130分钟,玩
犯罪嫌疑人被抓获归案。警方供图华龙网-新重庆客户端讯(记者余志斌)26年前,在重庆市潼南区上和镇,发生
今天来聊聊关于cad2014打开图纸显示不全怎么回事,cad2014打开图纸显示不全的文章,现在就为大家来简单介绍下ca
零食是很多人喜欢吃的视食品,味道好,种类多,可以闲暇时间解馋,尤其受年轻人喜欢,不少人想要开一家零食
千味央厨4月19日公布2022年年度分红预案:以8664 24万股股本为基数,向全体股东每10股派发现金红利1 7元(含
多重继承是指一个子类继承多个父类,而这些父类本身也继承自其它类。在Python中,多重继承可以实现复杂的继
俄罗斯钓鱼4是一款免费的模拟类多人开放世界钓鱼游戏,玩家可以与朋友在游戏中尽情垂钓,官方在4月18日发布
近年来,消费品行业虽受到宏观环境的较大影响,但其发展仍旧表现出极强韧性,随着国家消费刺激政策及产业扶持
派真生物是一家腺相关病毒研发生产商,专注于快速、大规模生产高纯度、高滴度、高感染力的临床前和临床级别
4月18日,外交部发言人汪文斌主持例行记者会。有记者提问,美国务卿布林肯在G7外长会上表示,中国必须表明
17个项目集中签约逾200亿元湖北首届国际物流峰会在鄂州召开---湖北日报讯(记者戴劲松、李朝霞、周鹏)4月1
针对信用卡持卡人不同的消费需求建设更多优质消费场景,已成为各家银行抢夺信用卡市场份额的制胜法宝。4大
作为全国“东数西算”工程大湾区国家枢纽节点,广东韶关正成为大数据产业集聚的“优选之地”。
4月18日北向资金全天成交额1272 77亿元,成交净买入21 37亿元。证券时报•数据宝统计显示,4月18日沪指上涨0
Copyright 2015-2023 今日酒业网 版权所有 备案号:沪ICP备2023005074号-40 联系邮箱:5 85 59 73 @qq.com