微信扫码
与创始人交个朋友
我要投稿
crewAI 是一个开源框架,可以编排角色扮演的 AI 智能体,通过促进协作使这些 AI 智能体无缝衔接,处理复杂问题。
本文采用的 crewAI 版本为 v0.22.5
,废话不多说,直接盘它。
pip install crewai
如果原来已经安装过,可以使用如下命令进行更新:
pip install --upgrade crewai
v0.22.5
版本已经支持使用命令 crewai create 项目名称
创建项目。
例如,我们的本地工作目录为 PythonProjects
,要创建的项目为 crewai_labs
,就可以这样进行安装:
cd PythonProjects
crewai create crewai_labs
执行成功,结果如下所示:
Creating folder crewai_labs...
- Created crewai_labs/.gitignore
- Created crewai_labs/pyproject.toml
- Created crewai_labs/README.md
- Created crewai_labs/src/crewai_labs/__init__.py
- Created crewai_labs/src/crewai_labs/main.py
- Created crewai_labs/src/crewai_labs/crew.py
- Created crewai_labs/src/crewai_labs/tools/custom_tool.py
- Created crewai_labs/src/crewai_labs/tools/__init__.py
- Created crewai_labs/src/crewai_labs/config/agents.yaml
- Created crewai_labs/src/crewai_labs/config/tasks.yaml
Crew crewai_labs created successfully!
根据生成文件 crewai_labs/README.md
中说明安装即可。
确保系统上安装了 Python 版本在 3.10 到 3.13 之间;
项目使用 Poetry
进行依赖管理;
pip install poetry
poetry.lock 文件
cd crewai_labs
poetry lock
安装依赖
cd crewai_labs
poetry install
新增 .env
文件
// 框架默认使用的是 GPT-4,后面会讲解如何自定义配置 LLM
OPENAI_API_KEY=xxx
cd crewai_labs
poetry run crewai_labs
输出信息:
// 信息太多,我就不贴了,如果出现了错误,能一眼就能看出发生了错误。
官方示例在未修改的情况下,运行完毕后会在项目根目录创建一个名为 report.md
的文件,内容是关于大型语言模型(LLMs)研究的输出结果。
我本地运行成功后生成的 report.md
内容如下:
# AI Large Language Models (LLMs): A Comprehensive Report
## Introduction
AI LLMs are machine learning models that use large volumes of data to understand and generate human language. They are increasingly being used across a wide range of industries, transforming how we translate languages, create content, analyze data, and more. Recent developments, like OpenAI's GPT-3, have resulted in models capable of generating contextually relevant texts and performing tasks such as translating languages, writing essays, answering trivia questions, and even writing poetry.
## Specific Use Cases
AI LLMs are being deployed across various sectors, each with unique applications. In healthcare, they are used for predicting patient outcomes, diagnosing diseases, and personalizing treatment plans. Finance sees its utilization for fraud detection, credit scoring, and algorithmic trading. Meanwhile, the retail sector leverages AI LLMs for demand forecasting, customer segmentation, and personalized marketing. Notably, in the automotive industry, they are integral to the development of autonomous vehicles.
## Ethical Concerns
Despite the advantages, AI LLMs present a range of ethical challenges and bias concerns. AI systems may perpetuate existing biases if trained on biased data, leading to unfair outcomes in applications like hiring or lending. Privacy concerns also exist, as AI systems often require access to large amounts of data, potentially including sensitive personal information. Accountability issues arise as well, as it can be challenging to determine responsibility when an AI system causes harm.
## Future Trends
The future of AI LLMs technology is promising. Current trends point towards more transparent AI systems that can explain their decisions, a concept known as explainable AI. There is also a growing interest in federally learning, allowing AI models to learn from decentralized data sources while preserving privacy. Research is also underway to improve the efficiency of AI models, enabling them to provide more accurate predictions with less data and computational resources.
## Market Analysis
The AI LLMs market is competitive, with key players like IBM, Google, Amazon, and Microsoft at the forefront. These companies compete based on the accuracy of their AI models, diversity of applications, and user-friendly interfaces. Partnerships are also a common strategy to enhance offerings, such as IBM's collaboration with Apple to develop healthcare applications.
## Notable Achievements
There have been many groundbreaking achievements in AI LLMs. Google's AI model, AlphaGo, defeated the world champion in the game of Go, signifying a significant milestone in AI development. OpenAI's GPT-3 has showcased impressive capabilities in natural language understanding and generation. In the medical field, several models have demonstrated performance on par with or superior to human experts for medical diagnoses.
src/crewai_labs/config/agents.yaml,在这里定义 Agents。
src/crewai_labs/config/tasks.yaml,在这里定义 Tasks。
src/crewai_labs/crew.py,在这里定义自己的逻辑、工具和参配。
src/crewai_labs/main.py,在这里定义自己的输入信息。
每个文件的内容,都比较简单,大家可以看一下 ~
主要做了一件什么事?输入一个{主题}(框架中默认主题为:AI LLMs),然后输出一份报告。
框架定义了两个 Agent:
研究人员
报告分析师
这的核心是提示词!在 .yaml
文件中,按照规范定义提示词即可。
看到这,估计大家都有了自己的想法,知道 crewAI 框架到底是干什么的了。它可以使 AI 代理能够承担角色,可以共享目标,就像一个精密运作的团队一样,共同为一个目标而努力。
个人认为,多智能体协作平台做出的东西可以颠覆目前很多的单智能体应用,好好进行任务编排,大有可为。
53AI,企业落地大模型首选服务商
产品:场景落地咨询+大模型应用平台+行业解决方案
承诺:免费场景POC验证,效果验证后签署服务协议。零风险落地应用大模型,已交付160+中大型企业
2025-01-01
2024-08-13
2024-04-25
2024-04-26
2024-03-30
2024-07-25
2024-05-10
2024-05-28
2024-04-12
2024-05-06