任务拆解,悠然自得,自动版本的ChatGPT,AutoGPT自动人工智能AI任务实践(Python3.10)

这篇具有很好参考价值的文章主要介绍了任务拆解,悠然自得,自动版本的ChatGPT,AutoGPT自动人工智能AI任务实践(Python3.10)。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

当我们使用ChatGPT完成某些工作的时候,往往需要多轮对话,比如让ChatGPT分析、翻译、总结一篇网上的文章或者文档,再将总结的结果以文本的形式存储在本地。过程中免不了要和ChatGPT“折冲樽俎”一番,事实上,这个“交涉”的过程也可以自动化,AutoGPT可以帮助我们自动拆解任务,没错,程序能做到的事情,人类绝不亲力亲为。

我们唯一需要做的,就是告诉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就配置好了。

运行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可以更好地处理愈加复杂的任务。文章来源地址https://www.toymoban.com/news/detail-417162.html

到了这里,关于任务拆解,悠然自得,自动版本的ChatGPT,AutoGPT自动人工智能AI任务实践(Python3.10)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 拆解Spring boot:Springboot为什么如此丝滑而简单?源码剖析解读自动装配

    🎉🎉欢迎光临,终于等到你啦🎉🎉 🏅我是苏泽,一位对技术充满热情的探索者和分享者。🚀🚀 🌟持续更新的专栏 《Spring 狂野之旅:从入门到入魔》 🚀 本专栏带你从Spring入门到入魔   这是苏泽的个人主页可以看到我其他的内容哦👇👇 努力的苏泽 http://suzee.blog.csdn

    2024年03月23日
    浏览(22)
  • 三星引入ChatGPT半个月泄密3次;MidJourney V5相机镜头完整参数列表;万字长文,拆解投身大模型3个本质问题 | ShowMeAI日报

    👀 日报周刊合集 | 🎡 生产力工具与行业应用大全 | 🧡 点赞关注评论拜托啦! 据韩国媒体报道,三星电子 (Samsung Electronics) 自3月11日引入 ChatGPT 后, 在不到20天的时间里发生了三起机密信息泄漏事件 ,其中2起与半导体设备测量数据、产品良率等机密信息有关,另外1起与会

    2023年04月09日
    浏览(16)
  • Java定时任务、自动化任务调度

    Java提供了多种方式来实现定时任务,使得开发人员能够在指定的时间间隔或固定时间点执行特定的任务。本文将介绍Java中实现定时任务的几种常用方法,并探讨它们的优势和适用场景。 Java中的Timer类是最早引入的定时任务工具,它可以用于执行一次性或重复性的定时任务。

    2024年02月16日
    浏览(26)
  • ChatGPT 最佳实践指南之:将复杂任务拆分为较简单的子任务

    Split complex tasks into simpler subtasks 将复杂任务分解为较简单的子任务 Just as it is good practice in software engineering to decompose a complex system into a set of modular components, the same is true of tasks submitted to GPTs. Complex tasks tend to have higher error rates than simpler tasks. Furthermore, complex tasks can often be re-de

    2024年02月15日
    浏览(14)
  • 2023最新版本Activiti7系列-任务分配

      在指派 用户任务 的审批人时。我们是直接指派的固定账号。但是为了保证流程设计审批的灵活性。我们需要各种不同的分配方式,所以这节我们就详细的来介绍先在Activiti7中我们可以使用的相关的分配方式.   固定分配就是我们前面介绍的,在绘制流程图或者直接在流

    2024年02月09日
    浏览(23)
  • 【学习日记】【FreeRTOS】任务调度时如何考虑任务优先级——任务的自动切换

    本文开始为 RTOS 加入考虑任务优先级的自动调度算法,代码大部分参考野火。 本文主要是一篇学习笔记,加入了笔者自己对野火代码的梳理和理解。 首先我们要知道,在 RTOS 中,优先级越高、越需要被先执行的的任务的优先级的数字越大。比如优先级数字为 5 的任务就要比

    2024年02月12日
    浏览(16)
  • 4个简化IT服务台任务的ChatGPT功能

    最近几个月,ChatGPT 风靡全球,这是一个 AI 聊天机器人,使用户能够生成脚本、文章、锻炼图表等。这项技术在各行各业都有无穷无尽的应用,在本文中,我们将研究这种现代技术如何帮助服务台团队增强服务交付和客户体验。 什么是ChatGPT和LLM? ChatGPT 是由 OpenAI 开发的一种

    2024年02月12日
    浏览(17)
  • Win11集成 ChatGPT,任务栏取消分组真的回来了

    时隔两月微软如期发布了 Win11 Moments 3 更新,版本号 22621.1778 。 微软这次更新带来了许多质量更新和功能改进。 直观的改动是任务栏,网络图标在连接加密隧道时会上锁,时间显示到秒也重新回归。 日常会用到的 Alt+Tab 任务选项卡被限制到最多20个,可能是因为性能原因。

    2024年02月07日
    浏览(18)
  • 使用 Crontab 自动化任务调度

    在计算机工作中,我们经常需要自动执行某些任务。Crontab 是一个在 Linux 和类 Unix 系统上广泛使用的工具,它允许用户按照预定的时间表触发指定的命令和脚本。无论是备份数据、生成报告还是定期清理临时文件,Crontab 都可以帮助我们自动化这些任务,提高工作效率。 Cro

    2024年02月09日
    浏览(16)
  • 【AIGC】利用ChatGPT完成任务,迷你AGI控制世界来了

    多智能体代码库 CAMEL,提出了通过角色扮演框架来研究 LLM 智能体的行为和能力。 未来的社会会被通用人工智能(AGI)控制吗?当拥有多个 ChatGPT 智能体会有多可怕。 ChatGPT 已经初步展现了 AGI 的雏形,成为了各行各业工作人员的全能小助手,但如果任由其野蛮生长,不加于

    2024年02月07日
    浏览(19)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包