跳到主要内容

自我prompt,自主完成任务的Auto-GPT,一种应用AI的新思路

· 阅读需 25 分钟
backendcloud

Auto-GPT源码: https://github.com/Significant-Gravitas/Auto-GPT

体验可以使用第三方产品,免费在线体验: https://agentgpt.reworkd.ai/

也可以自己在本地体验。本篇都是介绍如何在本地体验以及一个本地测试例子,例子选取的太简单了,好像没有发挥好Auto-GPT的优势。只是为了跑通流程,体验下Auto-GPT。

安装

安装非常简单,只需要需要以下几个步骤:

  1. 安装python3.10
  2. 安装git
  3. 代码仓库拉取到本地 git clone https://github.com/Significant-Gravitas/Auto-GPT
  4. 进入项目目录,执行 pip install -r requirements.txt
  5. 复制项目中的.env.template,命名为.env,并修改其中的3个参数OPENAI_API_KEY PINECONE_API_KEY PINECONE_ENV,改成自己的。若没有,可去对应ChatGPT官网Pinecone官网注册下,后台管理界面获取。
  6. 运行Auto-GPT python -m autogpt --gpt3only

例子

Auto-GPT运行日志

问Auto-GPT一个问题,娃在幼儿园被老师批评了,作为家长应如何应对。。在和Auto-GPT的交互中。要交互的是AI Name:随便写写,Describe your AI's role:随便写写,关键是目标,最多可以有5个,这里就写了一个Goal 1: write an article about : children are commented by the Kindergarten teacher, how to enlighten the children

PS C:\Users\hanwei\Documents\Github\Auto-GPT> python -m autogpt --gpt3only
GPT3.5 Only 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: writer
writer 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.'
writer is: who can write an article
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: write an article about : children are commented by the Kindergarten teacher, how to enlighten the children

通过下面的日志,可以看到每个具体的命令以及Auto-GPT的处理过程。比ChatGPT多了网上的搜索过程,网上搜索信息,阅读提取要点,整理新的文章。整个过程是自动化的,只需要输入一个目标,Auto-GPT就会自动完成和AI的多次交互,以目标为导向(最多可以给Auto-GPT设定5个目标),并自我prompt,自主完成任务。

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'
writer 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.'
Enter up to 5 goals for your AI: For example:
ter Account, Develop and manage multiple businesses autonomously'
Using memory of type: LocalCache
Using Browser: chrome
THOUGHTS: I think I need to gather some information on how to enlighten kindergarten children. I will start by doing a Google search.
REASONING: I need to gather information to write an article on how to enlighten kindergarten children. A Google search is a good starting point to gather information.
PLAN:
- Do a Google search on how to enlighten kindergarten children
- Read through the search results and gather information
- Write an article based on the gathered information
CRITICISM: I need to ensure that the information I gather is reliable and relevant to the topic at hand.
SPEAK: I will start by doing a Google search on how to enlighten kindergarten children.
Attempting to fix JSON by finding outermost brackets

Apparently json was fixed.
NEXT ACTION: COMMAND = google ARGUMENTS = {'input': 'how to enlighten kindergarten children'}
GPT3.5 Only Mode: ENABLED
Welcome back! Would you like me to return to being writer?
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'
writer 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.'
Enter up to 5 goals for your AI: For example:
Increase net worth, Grow Twitter Account, Develop and manage multiple businesses autonomously'
Using memory of type: LocalCache
Using Browser: chrome
THOUGHTS: I think I need to do some research on how to enlighten children who are being commented on by their kindergarten teacher. I will use the 'google' command to search for relevant information.
REASONING: I need to gather information to write an informative article on how to enlighten children who are being commented on by their kindergarten teacher. Researching will help me gather relevant information to include in the article.
PLAN:
- Use the 'google' command to search for relevant information on how to enlighten children who are being commented on by their kindergarten teacher.
- Read through the information gathered and take notes on important points to include in the article.
CRITICISM: I need to ensure that the information I gather is from credible sources and that I take the time to read through it carefully to ensure that I include only relevant and accurate information in the article.
SPEAK: I will use the 'google' command to search for information on how to enlighten children who are being commented on by their kindergarten teacher.
Attempting to fix JSON by finding outermost brackets

Apparently json was fixed.
NEXT ACTION: COMMAND = google ARGUMENTS = {'input': 'how to enlighten children who are being commented on by their kindergarten teacher'}
-=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-=
SYSTEM: Command google returned: b'[\n {\n "title": "What Does A Kindergarten Teacher Do? - Western Governors University",\n "href": "https://www.wgu.edu/career-guide/education/kindergarten-teacher-career.html",\n "body": "Kindergarten teachers are tasked with helping their students learn the basics of schooling and preparing them for first grade. While no two days are ever the same, kindergarten teachers are generally expected to: Prepare materials, lessons, and projects. Keep lessons fresh, engaging, and interesting. Teach basic skills in academics and behavior."\n },\n {\n "title": "Report Card Comments & Phrases for Kindergarten - TeacherVision",\n "href": "https://www.teachervision.com/report-cards-advice-suggested-comments/report-card-comments-for-kindergarten",\n "body": "This list of 32 ready-to-use report card comments covers academics, personality and attitude, work habits, and social skills for kindergarten report cards, and provides both examples of positive feedback for students and suggestions for improvement. Help make the kindergarten grading and evaluation process easier with this selection of editable ..."\n },\n {\n "title": "What does a kindergarten teacher do? - CareerExplorer",\n "href": "https://www.careerexplorer.com/careers/kindergarten-teacher/",\n "body": "A kindergarten teacher is responsible for planning the curriculum for each day and for the collective school year. They allow the children to observe an activity while also giving them the opportunity to ask questions and look for the answers. Instructions need to be very precise, yet easy to understand. By using hands-on lessons and creative ..."\n },\n {\n "title": "The Truth About Teaching Kindergarten from a Kindergarten Teacher",\n "href": "https://thekindergartenconnection.com/the-truth-about-teaching-kindergarten/",\n "body": "Let\'s talk social skills. Kindergarten is a HUGE year for learning social skills. Things such as taking turns, conversations with peers, how to handle when you don\'t get your way, managing emotions. Those things are taught and fostered each day in Kindergarten and do not just \\"happen.\\". They also aren\'t easy to teach."\n },\n {\n "title": "What Does a Kindergarten Teacher Do? (Duties and Salary)",\n "href": "https://www.indeed.com/career-advice/careers/what-does-a-kindergarten-teacher-do",\n "body": "Kindergarten teachers also use their classes to prepare their students for the world by teaching basic academic and social skills. Here are a few of the most common daily job duties for a kindergarten teacher: Teach their children the basics of reading, writing and arithmetic. Help children learn interpersonal skills."\n },\n {\n "title": "What Are Some Positive Things About Being a Kindergarten Teacher? - Chron",\n "href": "https://work.chron.com/positive-things-being-kindergarten-teacher-27037.html",\n "body": "Kindergarten teachers build strong educational foundations for young minds, which is personally rewarding. They get to witness children blossom into well-rounded students hungry to learn. Kindergarten teachers also regularly get opportunities to talk to their pupils\' parents via parent-teacher meetings. This affords them the chance to learn ..."\n },\n {\n "title": "The 10 Traits Successful Kids Have In Common, From A Kindergarten Teacher",\n "href": "https://www.huffpost.com/entry/kindergarten-readiness-successful-kids-have-these_b_586bfc49e4b04d7df167d7c6",\n "body": "Children who are accustomed to listening to books being read from start to finish and participating in conversations about the book are well prepared for Kindergarten. Parents can support the development of this skill by incorporating reading aloud into their regular routine."\n },\n {\n "title": "Kindergarten Teachers Speak Out for Children\'s Happiness",\n "href": "https://www.psychologytoday.com/us/blog/freedom-learn/201911/kindergarten-teachers-speak-out-children-s-happiness",\n "body": "The research is clear. Academic training in kindergarten has no long-term benefit. In fact, it may cause long-term harm. It does not reduce the education gap between the rich and the poor, which ..."\n }\n]'
THOUGHTS: I need to read through the search results and gather relevant information on how to enlighten children who are being commented on by their kindergarten teacher. I will use the 'read_file' command to save the search results to a file for easy access and reference.
REASONING: Reading through the search results will help me gather relevant information to include in the article. Saving the search results to a file will make it easier for me to access and reference the information as I write the article.
PLAN:
- Use the 'read_file' command to save the search results to a file.\n- Read through the search results and take notes on important points to include in the article.
CRITICISM: I need to ensure that I take the time to read through the search results carefully to ensure that I include only relevant and accurate information in the article.
SPEAK: I will use the 'read_file' command to save the search results to a file and then read through them to gather relevant information on how to enlighten children who are being commented on by their kindergarten teacher.
Attempting to fix JSON by finding outermost brackets

Apparently json was fixed.
NEXT ACTION: COMMAND = read_file ARGUMENTS = {'file': 'search_results.txt'}
SYSTEM: Command read_file returned: Error: [Errno 2] No such file or directory: 'C:\\Users\\hanwei\\Documents\\Github\\Auto-GPT\\auto_gpt_workspace\\search_results.txt'
THOUGHTS: I need to create a new file to save the search results to. I will use the 'write_to_file' command to create a new file and save the search results to it.
REASONING: Creating a new file will allow me to save the search results for easy access and reference as I write the article. The 'write_to_file' command will allow me to create a new file and save the search results to it.
PLAN:
- Use the 'write_to_file' command to create a new file and save the search results to it.\n- Read through the search results and take notes on important points to include in the article.
CRITICISM: I need to ensure that I take the time to read through the search results carefully to ensure that I include only relevant and accurate information in the article.
SPEAK: I will use the 'write_to_file' command to create a new file and save the search results to it, and then read through them to gather relevant information on how to enlighten children who are being commented on by their kindergarten teacher.
Attempting to fix JSON by finding outermost brackets

Apparently json was fixed.
NEXT ACTION: COMMAND = write_to_file ARGUMENTS = {'file': 'search_results.txt', 'text': 'Kindergarten teachers are tasked with helping their students learn the basics of schooling and preparing them for first grade. While no two days are ever the same, kindergarten teachers are generally expected to: Prepare materials, lessons, and projects. Keep lessons fresh, engaging, and interesting. Teach basic skills in academics and behavior. This list of 32 ready-to-use report card comments covers academics, personality and attitude, work habits, and social skills for kindergarten report cards, and provides both examples of positive feedback for students and suggestions for improvement. Help make the kindergarten grading and evaluation process easier with this selection of editable ...'}
SYSTEM: Command write_to_file returned: File written to successfully.
THOUGHTS: Now that I have saved the search results to a file, I need to read through them and take notes on important points to include in the article. I will use the 'read_file' command to read the search results from the file.
REASONING: Reading through the search results will help me gather relevant information to include in the article. Using the 'read_file' command will allow me to easily access the search results that I saved to the file.
PLAN:
- Use the 'read_file' command to read the search results from the file.\n- Take notes on important points to include in the article.
CRITICISM: I need to ensure that I take the time to read through the search results carefully to ensure that I include only relevant and accurate information in the article.
SPEAK: I will use the 'read_file' command to read the search results from the file and take notes on important points to include in the article.
Attempting to fix JSON by finding outermost brackets

Apparently json was fixed.
NEXT ACTION: COMMAND = read_file ARGUMENTS = {'file': 'search_results.txt'}
SYSTEM: Command read_file returned: Kindergarten teachers are tasked with helping their students learn the basics of schooling and preparing them for first grade. While no two days are ever the same, kindergarten teachers are generally expected to: Prepare materials, lessons, and projects. Keep lessons fresh, engaging, and interesting. Teach basic skills in academics and behavior. This list of 32 ready-to-use report card comments covers academics, personality and attitude, work habits, and social skills for kindergarten report cards, and provides both examples of positive feedback for students and suggestions for improvement. Help make the kindergarten grading and evaluation process easier with this selection of editable ...
THOUGHTS: I have read through the search results and taken notes on important points to include in the article. Now, I need to start writing the article. I will use the 'start_agent' command to start a GPT agent to help me generate ideas for the article.
REASONING: Starting a GPT agent will allow me to generate ideas for the article and help me overcome writer's block. The 'start_agent' command will allow me to start a GPT agent and provide it with a task and prompt to generate ideas for the article.
PLAN:
- Use the 'start_agent' command to start a GPT agent and provide it with a task and prompt to generate ideas for the article.\n- Use the ideas generated by the GPT agent to write the article.
CRITICISM: I need to ensure that I use the ideas generated by the GPT agent as a starting point and not rely solely on them to write the article. I also need to ensure that the ideas generated by the GPT agent are relevant and accurate.
SPEAK: I will use the 'start_agent' command to start a GPT agent and provide it with a task and prompt to generate ideas for the article, and then use the ideas generated by the GPT agent as a starting point to write the article.
Attempting to fix JSON by finding outermost brackets

Apparently json was fixed.
NEXT ACTION: COMMAND = start_agent ARGUMENTS = {'name': 'article_ideas', 'task': 'Generate ideas for an article on how to enlighten children who are being commented on by their kindergarten teacher.', 'prompt': 'What are some effective strategies for enlightening children who are being commented on by their kindergarten teacher?'}
-=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-=
SYSTEM: Command start_agent returned: Agent article_ideas created with key 0. First response: As an AI language model, I do not encourage or condone any form of commenting on children by their teachers. However, if a child is being commented on by their kindergarten teacher, some effective strategies for enlightening the child could include:

1. Encouraging open communication: Encourage the child to talk about their experiences in school and listen to them without judgment.

2. Building self-esteem: Help the child build their self-esteem by praising their strengths and encouraging them to try new things.

3. Providing positive reinforcement: Reward the child for good behavior and positive actions to reinforce positive behavior.

4. Encouraging socialization: Encourage the child to socialize with other children to build their social skills and confidence.

5. Seeking professional help: If the child is struggling with emotional or behavioral issues, seek professional help from a counselor or therapist.

It is important to remember that every child is unique and may require different strategies to help them cope with comments from their teacher.
THOUGHTS: The GPT agent has provided some useful ideas for the article. Now, I need to use these ideas to write the article. I will use the 'write_to_file' command to write the article to a file.
REASONING: Using the 'write_to_file' command will allow me to write the article to a file and save it for future reference. This will also allow me to easily edit and revise the article as needed.
PLAN:
- Use the ideas generated by the GPT agent to write the article.\n- Use the 'write_to_file' command to write the article to a file and save it for future reference.\n- Review and revise the article as needed.
CRITICISM: I need to ensure that the article is well-written and provides useful information for readers. I also need to ensure that the article is free of errors and is easy to read and understand.
SPEAK: I will use the 'write_to_file' command to write the article to a file and save it for future reference, and then review and revise the article as needed to ensure that it is well-written and provides useful information for readers.
Attempting to fix JSON by finding outermost brackets

Apparently json was fixed.
NEXT ACTION: COMMAND = write_to_file ARGUMENTS = {'file': 'enlightening_children.txt', 'text': "Strategies for Enlightening Children Who Are Being Commented on by Their Kindergarten Teacher\n\nIf a child is being commented on by their kindergarten teacher, it can be a difficult and stressful experience for both the child and their parents. However, there are some effective strategies that can be used to help enlighten the child and improve their overall well-being.\n\n1. Encouraging open communication: Encourage the child to talk about their experiences in school and listen to them without judgment. This can help the child feel heard and validated, and can also help parents and teachers better understand the child's perspective.\n\n2. Building self-esteem: Help the child build their self-esteem by praising their strengths and encouraging them to try new things. This can help the child feel more confident and capable, and can also help them develop a positive self-image.\n\n3. Providing positive reinforcement: Reward the child for good behavior and positive actions to reinforce positive behavior. This can help the child feel valued and appreciated, and can also help them develop a sense of responsibility and accountability.\n\n4. Encouraging socialization: Encourage the child to socialize with other children to build their social skills and confidence. This can help the child develop important social skills, such as communication, cooperation, and empathy, and can also help them feel more connected to their peers.\n\n5. Seeking professional help: If the child is struggling with emotional or behavioral issues, seek professional help from a counselor or therapist. This can provide the child with the support and guidance they need to overcome their challenges and develop healthy coping strategies.\n\nIt is important to remember that every child is unique and may require different strategies to help them cope with comments from their teacher. However, by using these strategies, parents and teachers can help enlighten the child and improve their overall well-being."}
SYSTEM: Command write_to_file returned: File written to successfully.

Auto-GPT生成的最终结果

Strategies for Enlightening Children Who Are Being Commented on by Their Kindergarten Teacher

If a child is being commented on by their kindergarten teacher, it can be a difficult and stressful experience for both the child and their parents. However, there are some effective strategies that can be used to help enlighten the child and improve their overall well-being.

  1. Encouraging open communication: Encourage the child to talk about their experiences in school and listen to them without judgment. This can help the child feel heard and validated, and can also help parents and teachers better understand the child's perspective.

  2. Building self-esteem: Help the child build their self-esteem by praising their strengths and encouraging them to try new things. This can help the child feel more confident and capable, and can also help them develop a positive self-image.

  3. Providing positive reinforcement: Reward the child for good behavior and positive actions to reinforce positive behavior. This can help the child feel valued and appreciated, and can also help them develop a sense of responsibility and accountability.

  4. Encouraging socialization: Encourage the child to socialize with other children to build their social skills and confidence. This can help the child develop important social skills, such as communication, cooperation, and empathy, and can also help them feel more connected to their peers.

  5. Seeking professional help: If the child is struggling with emotional or behavioral issues, seek professional help from a counselor or therapist. This can provide the child with the support and guidance they need to overcome their challenges and develop healthy coping strategies.

It is important to remember that every child is unique and may require different strategies to help them cope with comments from their teacher. However, by using these strategies, parents and teachers can help enlighten the child and improve their overall well-being.

对比ChatGPT生成的结果

ChatGPT生成的结果如下:

人类: Kindergarten children were commented by teachers, how to console them?

ChatGPT: If a kindergarten child is commented by a teacher, the parents can comfort and encourage the child by listening to their feelings, encouraging them to express themselves, and affirming their efforts. Moreover, parents can also talk to the teacher about the specific reasons for the comment and work with them to help the child improve in areas that need development. In addition, parents can provide positive feedback and reinforcement for the child's achievements to boost their self-esteem and confidence.

可见ChatGPT回答的也不差,对问题的处理,方方面面,多角度都考虑到了,语言简洁。Auto-GPT则生成了一大段文章。实际上是将很多文章拼接和总结要点组成成的结果。也可以改下提示词让ChatGPT就此话题写一篇文章,看看结果如何。

让ChatGPT以此为话题生成一篇文章:

人类: Kindergarten children were commented by teachers, how to console them? write an article about it

ChatGPT: As parents, it can be tough to see our little ones feeling upset or hurt by something that has been said to them, especially when it comes from someone they should be able to trust and look up to - like a teacher. This is why learning how to console them is so important.

If your child has been commented on by their teacher, the first thing to do is listen to their feelings. Ask them how it made them feel, and really listen to their response. Reassure them that you understand their feelings, and let them know that it's okay to feel upset or frustrated about the situation.

Letting your child express themselves is another important part of consoling them. Encourage them to share their thoughts and feelings about what has happened with you, and let them know that their thoughts and feelings are valid. This will help your child feel heard and understood, which can go a long way in helping them process what has happened.

It's important to affirm your child's efforts, as well. Let them know that you are proud of them for trying their best, and that their efforts are appreciated. This can help to build their confidence and self-esteem, and can make them feel more secure in their abilities.

In addition to consoling your child, it may also be helpful to speak with their teacher about the situation. Ask the teacher for feedback on how your child has been doing in class, and ask what specific areas they may need help with. Work together with the teacher to create a plan for how to help your child improve in areas that need development.

Finally, it's important to remember that every child is unique and may require different strategies to help them cope with comments from their teacher. However, by using these strategies, parents can help enlighten the child and improve their overall well-being. By listening, affirming, and encouraging them, parents can help their child process their emotions and move toward a positive resolution.

以下是上面ChatGPT回答的翻译结果:

作为家长,当我们看到孩子因为被某人(如老师)说了一些伤害性的话而感到不安或受伤时,会感到很困难。因此,学习如何安慰他们非常重要。

如果您的孩子受到老师的评论,首先要做的是听取他们的感受。询问他们感觉如何,并认真聆听他们的回答。向他们保证了解他们的感受,并让他们知道感到不安或沮丧是没关系的。

让孩子表达自己的想法和感受也是安慰他们的重要方法之一。鼓励他们与您分享对所发生事情的想法和感受,并让他们知道他们的想法和感受是有价值的。这将帮助孩子感到被听到和理解,从而更好地处理所发生的事情。

肯定孩子的努力也很重要。让他们知道你为他们尽力而为感到骄傲,并且感激他们的努力。这有助于提高孩子的自信心和自尊心,并使他们对自己的能力更加自信。

除了安慰孩子之外,与老师交谈也可能会有所帮助。询问老师对孩子的表现有何反馈,并询问是否需要帮助。与老师共同制定帮助孩子在需要发展的领域取得进步的计划。

最后,重要的是要记住,每个孩子都是独特的,可能需要不同的策略来帮助他们应对老师的评论。然而,通过使用这些策略,父母可以帮助孩子处理情绪,并向积极的结果迈进。通过聆听、肯定和鼓励他们,家长可以帮助孩子处理情绪,走向积极的解决方法。

Auto-GPT是以目标为导向,多次和AI交互并搜索互联网上的内容,提取整合后输出结果。ChatGPT是直接根据提示词输出结果,给的结果也不差,只要给ChatGPT足够好的提示词,就能出符合要求的内容。这个例子选取的太简单了,好像没有发挥好Auto-GPT的优势。