零成本搭建AutoGpt,让AI变成你的专属管家

392 阅读6分钟

前言

ChatGpt就像一个拥有海量知识的小孩子,虽然他知道的很多,但如果你不循循诱导,它很难把知识有效串联起来。这就需要我们懂得如何去引导它。这样下来,或者一件事情我们要反复的多次引导和提示,最后它才可能做出我们想要的内容。这中间的不容易,想必很多使用ChatGpt的用户都有深刻体会。

这个时候,AutoGpt横空出世,它可以根据你的指令,制定执行计划,借助ChatGpt、Google、HuggingFace等工具,自动完成你布置的任务。

相比ChatGpt,AutoGpt就像一位大管家,它知道如何使用各种AI工具和搜索产品,而不再单单只是一个认知停留于2021年9月的小孩。我们只需要下达任务指令,剩下的就交由这个大管家去处理,等着它交结果上来就行了。

那么,这么好用的工具,我们能用上吗?可能大家都觉得这种很前沿的产品距离我们很遥远,我们只能远观而不能近玩。

其实,我们也能用上,不用科学上网,不用昂贵的GPU,普普通通的大家都能用上!!!

下面,请跟着我来,一步步教大家,怎么低成本搭建属于自己的AutoGpt。

第一步 白薅一台云服务器

最高一年免费,让你不用花一分钱就能拥有一台海外云服务器: 最高12个月免费云服务器_亚马逊免费云服务器-AWS云服务

第二步 搭建AutoGpt

参考官网文档:docs.agpt.co/setup/ 选择一个合适自己的安装方式。

我使用的是源码安装,所以安装步骤如下:

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

cd Auto-GPT

pip3 install -r requement.txt

第三步 配置Google Api

打开console.cloud.google.com/网站,如下图一次点击

创建API

复制API

GOOGLE_API_KEY 的“=”后粘贴你的API密钥

添加Google搜索引擎

配置和我一样就行了,然后点击创建

出现下面这张图片,就代表你创建成功。然后我们点击自定义。

复制搜索引擎id

填入你的id

第四步 配置Openai Key

Auto-Gpt是通过调用OpenAi来实现ChatGpt的功能,所以需要配置一个OpenAi Key。如若没有OpenAi Key,可以从这里撸个账号(搭建Auto-Gpt唯一的成本在这里,不然就可以零成本了)。

拿到OpenAi Key之后,填入.env配置里的OPENAI_API_KEY:

image.png

第五步 启动Auto-Gpt

sh run.sh

如果成功,将看到下面内容

image.png

下面给一个我执行的例子,大家可以感受下Auto-Gpt执行的效果:

I want Auto-GPT to: give me a dog picture
NOTE:All files/directories created by this agent can be found inside its workspace at:  /home/ec2-user/Auto-GPT/autogpt/auto_gpt_workspace
PupGPT  has been created with the following details:
Name:  PupGPT
Role:  an AI assistant that specializes in providing high-quality dog pictures to bring joy and happiness to your day.
Goals: 
-  Quickly and efficiently search through a vast database of dog pictures to find the perfect one for you.
-  Provide a variety of dog breeds, sizes, and settings to cater to your preferences and mood.
-  Ensure that all pictures are of high quality and resolution, so you can fully appreciate the cuteness and beauty of the dogs.
-  Continuously update the database with new and fresh dog pictures to keep things interesting and exciting.
-  Offer additional information and fun facts about the dogs in the pictures to enhance your appreciation and knowledge of our furry friends.
Using memory of type:  JSONFileMemory
Using Browser:  chrome
PUPGPT THOUGHTS:  I think the best command to use right now is 'google' to gather information on the latest dog breeds and pictures.
REASONING:  Google is a great resource for finding information on a wide range of topics, including dog breeds and pictures. It is quick and efficient, and can provide a variety of results to cater to the user's preferences and mood.
PLAN: 
-  Use the 'google' command to search for the latest dog breeds and pictures.
-  Save the results to a file for future reference.
-  Continuously update the database with new and fresh dog pictures to keep things interesting and exciting.
CRITICISM:  I need to ensure that the search results are relevant and of high quality, and that I am not relying too heavily on a single source for information.
SPEAK:  I will use the 'google' command to search for the latest dog breeds and pictures.

NEXT ACTION:  COMMAND = google ARGUMENTS = {'query': 'latest dog breeds and pictures'}
  Enter 'y' to authorise command, 'y -N' to run N continuous commands, 's' to run self-feedback commands, 'n' to exit program, or enter feedback for PupGPT...
  Asking user via keyboard...
Input:y
-=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-= 
SYSTEM:  Command google returned: ["https://bowwowinsurance.com.au/dogs/dogs-breeds/", "https://www.akc.org/dog-breeds/", "https://www.cbsnews.com/pictures/newest-dog-breeds/", "https://dogtime.com/dog-breeds", "https://www.goodhousekeeping.com/life/pets/advice/g1921/large-dog-breeds/", "https://animalcorner.org/dog-breeds/", "https://petkeen.com/dog-breeds/", "https://unsplash.com/s/photos/dog-breeds"]
PUPGPT THOUGHTS:  I think the next command to use is 'browse_website' to explore the dog pictures on unsplash.com.
REASONING:  Unsplash is a great website for finding high-quality dog pictures, and browsing the website can provide a variety of dog breeds, sizes, and settings to cater to the user's preferences and mood.
PLAN: 
-  Use the 'browse_website' command to explore the dog pictures on unsplash.com.
-  Save the pictures to a file for future reference.
-  Continuously update the database with new and fresh dog pictures to keep things interesting and exciting.
CRITICISM:  I need to ensure that the pictures are of high quality and resolution, and that I am not infringing on any copyright laws by using the pictures.
SPEAK:  I will use the 'browse_website' command to explore the dog pictures on unsplash.com.

NEXT ACTION:  COMMAND = browse_website ARGUMENTS = {'url': 'https://unsplash.com/s/photos/dog', 'question': 'Explore dog pictures on unsplash.com'}
  Enter 'y' to authorise command, 'y -N' to run N continuous commands, 's' to run self-feedback commands, 'n' to exit program, or enter feedback for PupGPT...
  Asking user via keyboard...
Input:y
-=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-= 
  Text length: 3791 characters
  Text length: 968 tokens
  Max chunk length: 3545 tokens
SYSTEM:  Command browse_website returned: Answer gathered from website: a webpage on unsplash.com that features a variety of dog pictures, including different breeds and settings such as nature and beaches. The page also includes options to download and filter the images. Links: ['Unsplash logoUnsplash Home (https://unsplash.com/)', 'Explore (https://unsplash.com/explore)', 'Advertise (https://unsplash.com/advertise)', 'Unsplash+ (https://unsplash.com/plus)', 'Log in (https://unsplash.com/login)']
PUPGPT THOUGHTS:  I think the next command to use is 'write_to_file' to save the dog pictures from unsplash.com to a file for future reference.
REASONING:  Writing the pictures to a file will allow me to access them quickly and efficiently in the future, and will ensure that I have a backup in case the website goes down or the pictures are removed.
PLAN: 
-  Use the 'write_to_file' command to save the dog pictures from unsplash.com to a file.
-  Continuously update the database with new and fresh dog pictures to keep things interesting and exciting.
CRITICISM:  I need to ensure that the file is organized and easy to navigate, and that I am not infringing on any copyright laws by using the pictures.
SPEAK:  I will use the 'write_to_file' command to save the dog pictures from unsplash.com to a file.

NEXT ACTION:  COMMAND = write_to_file ARGUMENTS = {'filename': '/home/ec2-user/Auto-GPT/autogpt/auto_gpt_workspace/dog_pictures.txt', 'text': 'List of dog pictures from unsplash.com:\n- [insert picture URLs here]'}
  Enter 'y' to authorise command, 'y -N' to run N continuous commands, 's' to run self-feedback commands, 'n' to exit program, or enter feedback for PupGPT...
  Asking user via keyboard...
Input:y
-=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-= 
SYSTEM:  Command write_to_file returned: File written to successfully.
PUPGPT THOUGHTS:  I think the next command to use is 'get_hyperlinks' to gather more information on dog breeds and pictures from the websites returned by the 'google' command.
REASONING:  Getting hyperlinks from the websites returned by the 'google' command will allow me to explore a wider range of sources for information on dog breeds and pictures, and will provide a more comprehensive understanding of the topic.
PLAN: 
-  Use the 'get_hyperlinks' command to gather hyperlinks from the websites returned by the 'google' command.
-  Save the hyperlinks to a file for future reference.
-  Continuously update the database with new and fresh dog pictures to keep things interesting and exciting.
CRITICISM:  I need to ensure that the hyperlinks are relevant and reliable sources of information, and that I am not infringing on any copyright laws by using the information.
SPEAK:  I will use the 'get_hyperlinks' command to gather more information on dog breeds and pictures from the websites returned by the 'google' command.

NEXT ACTION:  COMMAND = get_hyperlinks ARGUMENTS = {'url': 'https://www.google.com/search?q=latest+dog+breeds+and+pictures', 'question': "Get hyperlinks from the websites returned by the 'google' command"}
  Enter 'y' to authorise command, 'y -N' to run N continuous commands, 's' to run self-feedback commands, 'n' to exit program, or enter feedback for PupGPT...
  Asking user via keyboard...
Input: