婚纱摄影网站大全,做网站公司,页面访问将在5秒后自动跳转,wordpress固定链接文章发布失败项目简介
MetaGPT 是一个多智能体框架#xff0c;旨在构建全球首家 “AI 软件公司”。该项目通过为 GPT 分配不同的角色#xff0c;模拟产品经理、架构师、工程师等职业#xff0c;协同完成复杂的软件开发任务。MetaGPT 将一个简单的需求转化为完整的软件开发流程#xff…项目简介
MetaGPT 是一个多智能体框架旨在构建全球首家 “AI 软件公司”。该项目通过为 GPT 分配不同的角色模拟产品经理、架构师、工程师等职业协同完成复杂的软件开发任务。MetaGPT 将一个简单的需求转化为完整的软件开发流程包括用户故事、需求分析、数据结构设计和 API 文档生成等。其核心理念是将标准操作程序SOP应用于由多智能体组成的团队使得自然语言编程成为可能。
项目地址MetaGPT on GitHub 由于项目是英文的博主在这里做一版中文教程给后来人一些参考。 关注CSDN心若为城获得计算机领域与人工智能领域的前沿技术。 博主碎碎念可跳过 打算重新做做自己这个老号高中时候开始做CSDN那会儿写的是NOIP/NOI相关的算法东西纯粹是写给自己看的现在时隔多年我也在清华站稳了脚跟在互联网开发和量化交易领域都算是小有成就了。 接下来这个号也许也不止这个号应该会做三个方向: AI新技术(或者不局限于AI)的抢先浏览会向大家说明当下热点论文、热点技术的部署等以及做一些周报或者日报。类似于AI Weekly 量化交易相关我在量化开发技术栈有着多年的开发经验也拿过一些投资比赛的奖项。可以面向应届生给出就业规划提供一些指导的同时分享一些含金量高的项目。 互联网面试相关我应该会着重于分享一些面试的底层技术面并且尽可能和2进行一些结合让大家同时能handle住两边的技术。 安装说明
只需要一行简单明了:
pip install --upgrade metagpt
# or pip install --upgrade githttps://github.com/geekan/MetaGPT.git
# or git clone https://github.com/geekan/MetaGPT cd MetaGPT pip install --upgrade -e .然后运行下面的命令
# Check https://docs.deepwisdom.ai/main/en/guide/get_started/configuration.html for more details
metagpt --init-config # it will create ~/.metagpt/config2.yaml, just modify it to your needs这样会生成一个config文件我们可以通过修改config文件来部署MetaGPT。
llm:api_type: openai # or azure / ollama / groq etc. Check LLMType for more optionsmodel: gpt-4-turbo # or gpt-3.5-turbobase_url: https://api.openai.com/v1 # or forward url / other llm urlapi_key: YOUR_API_KEYMetaGPT 支持一系列 LLM 模型。根据需要配置模型 API 密钥。 也可以配置Claude:
llm:api_type: claude # or anthropicbase_url: https://api.anthropic.comapi_key: YOUR_API_KEYmodel: claude-3-opus-20240229额外工具的使用
除了 LLM 之外我们还经常希望代理使用工具。这里将介绍这些工具的设置。
## Supported api_type: serpapi/google/serper/ddg
## serper: Visit https://serper.dev/ to get key.
## serpapi: Visit https://serpapi.com/ to get key.
## google: Visit https://console.cloud.google.com/apis/credentials to get key.
## ddg: it is free, no need to get key.
search:api_type: google # serpapi/google/serper/ddgapi_key: YOUR_API_KEYcse_id: YOUR_CSE_ID # only for googleparams:engine: google # google/bing/yahoo/baidu/yandex, check https://serpapi.com/bing-search-api for more detailsgoogle_domain: google.comgl: ushl: en使用MetaGPT、导入已有的角色
我们可以用下面的代码来导入一个产品经理。 具体更复杂的用法可以参考这个文档Tutorials
import asynciofrom metagpt.context import Context
from metagpt.roles.product_manager import ProductManager
from metagpt.logs import loggerasync def main():msg Write a PRD for a snake gamecontext Context() # The session Context object is explicitly created, and the Role object implicitly shares it automatically with its own Action objectrole ProductManager(contextcontext)while msg:msg await role.run(msg)logger.info(str(msg))if __name__ __main__:asyncio.run(main())使用MetaGPT进行数据分析与可视化
在这里官方给了一些数据可视化的官方代码。
import asyncio
from metagpt.logs import logger
from metagpt.roles.di.data_interpreter import DataInterpreter
from metagpt.utils.recovery_util import save_historyasync def main(requirement: str ):di DataInterpreter()rsp await di.run(requirement)logger.info(rsp)save_history(roledi)if __name__ __main__:requirement Run data analysis on sklearn Iris dataset, include a plotasyncio.run(main(requirement))执行上述代码后生成的计划和代码将分别保存在 data/output/current_time/plan.json 和 data/output/current_time/code.ipynb 中。
执行结果
DataInterpreter 提出了以下解决方案任务
[{task_id: 1,dependent_task_ids: [],instruction: Load the Iris dataset from sklearn.},{task_id: 2,dependent_task_ids: [1],instruction: Perform exploratory data analysis on the Iris dataset.},{task_id: 3,dependent_task_ids: [2],instruction: Create a plot visualizing the Iris dataset features.}
]DataInterpreter 能够将问题划分为逻辑任务并按照加载数据、分析数据和绘制图表的步骤运行。
DataInterpreter 写入以下代码
# ----------------------------------task1------------------------------------
from sklearn.datasets import load_iris
iris_data load_iris()
iris_data.keys()
!pip install scikit-learn
from sklearn.datasets import load_iris
iris_data load_iris()
iris_data.keys()
# ----------------------------------task2------------------------------------
import pandas as pd# Create a DataFrame from the iris dataset
iris_df pd.DataFrame(iris_data[data], columnsiris_data[feature_names])
iris_df[species] pd.Categorical.from_codes(iris_data[target], iris_data[target_names])# Summary statistics
summary_statistics iris_df.describe()# Check for missing values
missing_values iris_df.isnull().sum()(summary_statistics, missing_values)
# ----------------------------------task3------------------------------------
import matplotlib.pyplot as plt
import seaborn as sns# Use seaborns pairplot to visualize the dataset features
sns.set(stylewhitegrid, contextnotebook)
iris_pairplot sns.pairplot(iris_df, huespecies, height2.5)
plt.show()在完成任务 1 的过程中由于环境中没有安装 scikit-learn第一次执行时发生了错误。不过 DataInterpreter 可以通过安装 scikit-learn 来分析并解决这个问题。在任务 3 中 DataInterpreter 使用 seaborn 中的 pairplot 函数创建散点图矩阵该矩阵可视化数据集中不同特征之间的关系并使用颜色区分不同物种的数据点。最后使用 plt.show() 显示图表。 下图是 DataInterpreter 运行代码后绘制的图表。很明显代码成功执行并生成了漂亮的可视化表格可以帮助我们更有效地分析数据集的特征。 希望查看更多内容点这里进入官方文档查看。
总结
MetaGPT is all you need!