当我们使用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=0
USE_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: ENABLED
Welcome 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.cn
v3u.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: LocalCache
Using 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 3064
The 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 steps
CRITICISM: None
NEXT 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 characters
Adding chunk 1 / 1 to memory
Summarizing chunk 1 / 1
Creating chat completion with model gpt-3.5-turbo, temperature 0.0, max_tokens 300
SYSTEM: 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: {\n "thoughts": {\n "text": "Let\'s start by browsing the article at https://v3u.cn/a_id_303 to get a better understanding of its contents.",\n "reasoning": "Browsing the article will allow us to analyze its contents and determine the appropriate next steps.",\n "plan": "- Browse the article\\n- Analyze its contents\\n- Determine the appropriate next steps",\n "criticism": "None",\n "speak": "I suggest we start by browsing the article at the given URL to analyze its contents and determine the appropriate next steps."\n },\n "command": {\n "name": "browse_website",\n "args": {\n "url": "https://v3u.cn/a_id_303",\n "question": "analyze the contents of the article"\n }\n }\n} \nResult: 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. \nHuman 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\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"
}
}
}
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可以更好地处理愈加复杂的任务。
很好奇,就使用rubyonrails自动化单元测试而言,你们正在做什么?您是否创建了一个脚本来在cron中运行rake作业并将结果邮寄给您?git中的预提交Hook?只是手动调用?我完全理解测试,但想知道在错误发生之前捕获错误的最佳实践是什么。让我们理所当然地认为测试本身是完美无缺的,并且可以正常工作。下一步是什么以确保他们在正确的时间将可能有害的结果传达给您? 最佳答案 不确定您到底想听什么,但是有几个级别的自动代码库控制:在处理某项功能时,您可以使用类似autotest的内容获得关于哪些有效,哪些无效的即时反馈。要确保您的提
我试图在一个项目中使用rake,如果我把所有东西都放到Rakefile中,它会很大并且很难读取/找到东西,所以我试着将每个命名空间放在lib/rake中它自己的文件中,我添加了这个到我的rake文件的顶部:Dir['#{File.dirname(__FILE__)}/lib/rake/*.rake'].map{|f|requiref}它加载文件没问题,但没有任务。我现在只有一个.rake文件作为测试,名为“servers.rake”,它看起来像这样:namespace:serverdotask:testdoputs"test"endend所以当我运行rakeserver:testid时
关闭。这个问题是opinion-based.它目前不接受答案。想要改进这个问题?更新问题,以便editingthispost可以用事实和引用来回答它.关闭4年前。Improvethisquestion我想在固定时间创建一系列低音和高音调的哔哔声。例如:在150毫秒时发出高音调的蜂鸣声在151毫秒时发出低音调的蜂鸣声200毫秒时发出低音调的蜂鸣声250毫秒的高音调蜂鸣声有没有办法在Ruby或Python中做到这一点?我真的不在乎输出编码是什么(.wav、.mp3、.ogg等等),但我确实想创建一个输出文件。
如何使用RSpec::Core::RakeTask初始化RSpecRake任务?require'rspec/core/rake_task'RSpec::Core::RakeTask.newdo|t|#whatdoIputinhere?endInitialize函数记录在http://rubydoc.info/github/rspec/rspec-core/RSpec/Core/RakeTask#initialize-instance_method没有很好的记录;它只是说:-(RakeTask)initialize(*args,&task_block)AnewinstanceofRake
我收到这个错误:RuntimeError(自动加载常量Apps时检测到循环依赖当我使用多线程时。下面是我的代码。为什么会这样?我尝试多线程的原因是因为我正在编写一个HTML抓取应用程序。对Nokogiri::HTML(open())的调用是一个同步阻塞调用,需要1秒才能返回,我有100,000多个页面要访问,所以我试图运行多个线程来解决这个问题。有更好的方法吗?classToolsController0)app.website=array.join(',')putsapp.websiteelseapp.website="NONE"endapp.saveapps=Apps.order("
这个问题在这里已经有了答案:关闭10年前。PossibleDuplicate:Pythonconditionalassignmentoperator对于这样一个简单的问题表示歉意,但是谷歌搜索||=并不是很有帮助;)Python中是否有与Ruby和Perl中的||=语句等效的语句?例如:foo="hey"foo||="what"#assignfooifit'sundefined#fooisstill"hey"bar||="yeah"#baris"yeah"另外,类似这样的东西的通用术语是什么?条件分配是我的第一个猜测,但Wikipediapage跟我想的不太一样。
什么是ruby的rack或python的Java的wsgi?还有一个路由库。 最佳答案 来自Python标准PEP333:Bycontrast,althoughJavahasjustasmanywebapplicationframeworksavailable,Java's"servlet"APImakesitpossibleforapplicationswrittenwithanyJavawebapplicationframeworktoruninanywebserverthatsupportstheservletAPI.ht
英文版英文链接关注公众号在“亚特兰蒂斯的回声”中踏上一段难忘的冒险之旅,深入未知的海洋深处。足智多谋的考古学家AriaSeaborne偶然发现了一件古代神器,揭示了一张通往失落之城亚特兰蒂斯的隐藏地图。在她神秘的导师内森·兰登教授的指导和勇敢的冒险家亚历克斯·默瑟的帮助下,阿丽亚开始了一段危险的旅程,以揭开这座传说中城市的真相。他们的冒险之旅带领他们穿越险恶的大海、神秘的岛屿和充满陷阱和谜语的致命迷宫。随着Aria潜在的魔法能力的觉醒,她被睿智勇敢的QueenNeria的幻象所指引,她让她为即将到来的挑战做好准备。三人组揭开亚特兰蒂斯令人惊叹的隐藏文明,并了解到邪恶的巫师马拉卡勋爵试图利用其古
华为OD机试题本篇题目:明明的随机数题目输入描述输出描述:示例1输入输出说明代码编写思路最近更新的博客华为od2023|什么是华为od,od薪资待遇,od机试题清单华为OD机试真题大全,用Python解华为机试题|机试宝典【华为OD机试】全流程解析+经验分享,题型分享,防作弊指南华为o
我想解析一个已经存在的.mid文件,改变它的乐器,例如从“acousticgrandpiano”到“violin”,然后将它保存回去或作为另一个.mid文件。根据我在文档中看到的内容,该乐器通过program_change或patch_change指令进行了更改,但我找不到任何在已经存在的MIDI文件中执行此操作的库.他们似乎都只支持从头开始创建的MIDI文件。 最佳答案 MIDIpackage会为您完成此操作,但具体方法取决于midi文件的原始内容。一个MIDI文件由一个或多个音轨组成,每个音轨是十六个channel中任何一个上的