Multi-Agent Conversation using CrewAI

Data Science in your pocket
20 Mar 202407:19

Summary

TLDR大家好,我的新书《初学者指南:使用LLM构建生成性应用程序》已经在亚马逊上架,并且已经成为了畅销书。在视频中,我将讨论一个非常有趣的生成性AI框架——CRE AI,这是一个多代理对话框架。在这种框架中,我们可以根据问题陈述创建多个代理,例如产品经理、技术内容撰写者或工程专家。然后,我们将任务分配给这些代理集合,他们通过内部对话来提出最终解决方案,形成一个虚拟团队。CRE AI是一个非常激动人心的包,我最近在使用它,并且结果非常好。首先,我们将讨论CRE AI的不同组件,包括代理、目标、背景故事、任务定义以及集合和过程。接下来,我将展示如何使用Hugging Face Hub API加载LLM,并创建不同的代理来解决问题。我们还将看到如何通过顺序方法或层次方法来分配任务,并最终实例化一个团队并启动任务。CRE AI在处理复杂任务时表现出色,可以创建一个虚拟团队,而无需实际雇佣人员,只需擅长提示即可。

Takeaways

  • 📚 作者发布了一本名为《初学者指南:使用LLM构建生成式应用程序》的新书,目前在亚马逊上已成为畅销书。
  • 🤖 介绍了一个名为CRE AI的多代理对话框架,它允许用户根据问题创建多个代理(Agents)来共同解决问题。
  • 🌟 代理可以有不同的角色,例如产品经理、技术内容撰写者或工程师,每个代理都有自己的目标和背景故事。
  • 🔧 使用CRE AI框架时,可以通过pip安装creai包,并使用Hugging Face Hub API加载LLM模型。
  • 🛠️ 通过定义代理的角色、目标和任务,可以创建一个虚拟团队来处理复杂的任务。
  • 📈 介绍了两种使用CRE AI的方法:顺序方法和层级方法。顺序方法中,每个代理依次完成任务;层级方法中,代理可以委托其他代理完成任务。
  • 📝 举例说明了如何使用CRE AI创建两个任务:一个由研究分析师完成的分析报告,和一个由内容策略师基于报告撰写的博客文章。
  • 📊 展示了CRE AI如何通过代理间的对话和互动来生成最终的解决方案,例如列出主要的机器学习算法和撰写相关博客文章。
  • 🎯 强调了CRE AI在处理复杂任务时的能力,以及如何通过精心设计的提示来实现无需实际团队即可完成任务的优势。
  • 🚀 提及了CRE AI在未来的应用潜力,包括产品设计和技术开发讨论等更多复杂场景。
  • 💡 整个演示展示了CRE AI如何作为一个强大的工具,通过多代理合作来提高工作效率和创造力。

Q & A

  • 新书的名称是什么?

    -新书的名称是《初学者指南:使用LLM构建生成性应用程序》。

  • 新书在哪个平台发布并且表现如何?

    -新书在亚马逊(Amazon)发布,并且已经成为了畅销书,目前在亚马逊畅销书排行榜上排名第三。

  • CRE AI是什么?

    -CRE AI是一个多代理对话框架,允许用户根据问题陈述创建多个代理,这些代理可以是产品经理、技术内容撰写者或工程师等角色,并通过内部对话产生解决方案。

  • 在CRE AI中,一个代理需要哪些组件来定义?

    -一个代理需要角色(role)、目标(goal)、背景故事(backstory)、任务(task)以及是否允许委托(allow delegation)等组件来定义。

  • 如何安装CRE AI?

    -通过pip命令安装CRE AI,具体命令为`pip install creai`。

  • 在CRE AI中,什么是序列化方法和层次化方法?

    -序列化方法是给每个代理分配一个任务,然后按顺序执行。层次化方法则是允许一个代理委托任务给其他代理来完成,形成一个代理层级结构。

  • 在CRE AI中,如何创建一个任务?

    -创建任务需要指定任务列表、预期输出、代理角色等信息。例如,可以创建一个任务让研究分析师列出主要的机器学习算法,然后基于这些算法的洞察,由技术内容策略师发展出一个引人入胜的博客文章。

  • CRE AI如何帮助解决复杂任务?

    -CRE AI通过模拟一个虚拟团队,每个代理扮演不同的角色,通过内部对话和任务分配来解决复杂任务,而无需实际雇佣人员。

  • 在CRE AI中,如何使用Hugging Face Hub API加载语言模型?

    -在CRE AI中,可以使用Hugging Face Hub API加载语言模型,例如使用`gamma 2 billion`模型,但需要提供有效的API令牌。

  • CRE AI的输出结果是如何展现的?

    -CRE AI的输出结果是通过代理之间的对话和任务完成情况来展现的。例如,研究分析师代理可能会列出主要的机器学习算法,然后技术内容策略师代理会使用这些信息来撰写博客文章。

  • CRE AI可以用于哪些类型的任务?

    -CRE AI可以用于需要多个角色或专业领域知识来解决的复杂任务,如产品设计、技术讨论、内容创作等。

  • 如何启动CRE AI中的代理团队?

    -通过实例化一个团队(crew),包含所需的代理、任务和过程,然后调用`crew.kickoff`方法来启动代理团队的工作流程。

Outlines

00:00

📚 新书发布与CRE AI框架介绍

本段首先宣布了作者的新书《Pocket Beginner's Guide to Building Gen Applications Using LLM》在亚马逊上发布,并且已经成为畅销书。接着,作者介绍了一个名为CRE AI的多代理对话框架。这个框架允许用户根据问题陈述创建多个代理,例如产品经理、技术内容撰写者或工程专家。这些代理将通过内部对话来共同解决问题。CRE AI是一个令人兴奋的包,作者最近使用它并取得了良好结果。接下来,作者详细介绍了CRE AI的不同组件,包括代理(Agent)、目标(Goal)、背景故事(Backstory)和任务(Task)。此外,还展示了如何使用Python的pip安装CRE AI,并通过Hugging Face的Hub API加载了一个名为Gamma 2 Billion的LLM模型。最后,作者创建了两个代理:一个高级研究分析师和一个技术内容策略师,并为它们分配了任务,说明了CRE AI的两种工作方式:顺序方法和层次方法。

05:00

🤖 CRE AI框架的应用实例

在第二段中,作者继续展示了如何使用CRE AI框架。首先定义了两个代理和两个任务,其中第二个任务使用了第一个任务的输出。然后,作者实例化了一个团队(Crew),该团队由研究分析师和作家组成,并启动了任务。输出显示了CRE AI如何通过内部的提示和对话过程来生成内容。第一个任务是列出主要的机器学习算法,由高级研究分析师完成。第二个任务是利用第一个任务的输出来扩展博客文章。最终,技术内容策略师使用算法的提示来撰写完整的博客文章。作者强调了CRE AI在处理复杂任务方面的潜力,并且可以创建一个虚拟团队,而无需实际雇佣人员,只需通过精心设计的提示即可实现。作者还提到,将在后续的例子中展示如何使用CRE AI结合多个代理来进行产品设计和讨论。

Mindmap

Keywords

💡Generative AI

生成性人工智能(Generative AI)是指利用人工智能技术生成新的内容或数据,如文本、图像或音乐。在视频中,它被用来构建应用程序,并且是讨论的核心主题,因为它涉及到使用CRE AI框架来生成内容。

💡CRE AI

CRE AI是一个多代理对话框架,允许用户创建多个代理(agents)来解决特定的问题。视频中通过CRE AI展示了如何通过虚拟团队合作来生成内容,如博客文章和分析报告。

💡Multi-agent Framework

多代理框架(Multi-agent Framework)指的是一个系统,其中包含多个相互作用的代理,每个代理都有自己的角色和目标。在视频中,这种框架被用来模拟一个团队,每个代理负责不同的任务,共同协作解决问题。

💡Sequential Approach

顺序方法(Sequential Approach)是一种任务执行方式,其中每个代理依次完成任务,每个任务的输出可以作为下一个任务的输入。视频中提到了这种方法,说明了如何通过顺序执行任务来生成内容。

💡Hierarchical Approach

层级方法(Hierarchical Approach)是另一种任务执行方式,允许代理委托任务给其他代理。与顺序方法不同,层级方法中代理可以分配任务给其他代理来完成。视频中通过设置`allow delegation`参数来说明这种工作方式。

💡Agent

在CRE AI框架中,代理(Agent)是指具有特定角色和目标的实体。代理可以是一个产品经理、技术内容写手或工程师等,它们通过对话和协作来完成任务。视频中展示了如何创建和配置这些代理。

💡Task

任务(Task)是代理需要完成的工作单元。在视频中,任务被用来指导代理执行特定的工作,如编写报告或博客文章。任务的输出可以作为其他任务的输入,形成内容生成的流程。

💡LLM (Large Language Model)

大型语言模型(Large Language Model,简称LLM)是人工智能中用于处理和生成自然语言文本的复杂模型。视频中提到了使用2亿参数的模型来驱动代理的行为和生成文本。

💡Crew

在CRE AI中,团队(Crew)是由多个代理组成的集合,它们共同协作来完成一个或多个任务。视频中通过创建一个包含研究员和作家的团队来展示如何通过协作生成博客文章。

💡Prompting

提示(Prompting)是在生成性AI中使用的技术,通过给模型提供输入或提示来引导其生成特定的输出。视频中强调了良好的提示对于CRE AI框架成功生成内容的重要性。

💡Blog Post

博客文章(Blog Post)是视频中用来展示CRE AI框架生成能力的一个例子。通过代理之间的协作,框架能够生成关于机器学习算法的深入分析和吸引人的博客文章。

Highlights

新书《Pocket Beginner's Guide to Building Gen Applications Using LLM》在亚马逊上发布并成为畅销书。

介绍了一个有趣的生成性AI框架CRE AI,这是一个多代理对话框架。

多代理框架可以根据问题陈述创建多个代理,如产品经理、技术内容撰写者、工程师等。

CRE AI允许创建虚拟团队,通过代理之间的对话来解决问题。

CRE AI的不同组件包括代理、角色、目标、背景故事、任务定义等。

使用pip安装CRE AI,并使用Hugging Face Hub API加载语言模型。

演示了如何创建不同的代理,如高级研究员和科技内容策略师。

展示了如何为代理分配任务,并说明了任务的顺序和层次结构方法。

CRE AI可以采用顺序方法,每个代理依次完成任务。

CRE AI也可以采用层次方法,允许代理委托任务给其他代理。

通过CRE AI,可以构建一个完整的公司场景,包括产品经理、开发者、技术领导等角色。

CRE AI在复杂任务中表现出色,可以创建虚拟团队而无需实际招聘人员。

CRE AI通过精心设计的提示和流程,可以自动处理任务。

展示了如何使用CRE AI进行产品设计和讨论,最终形成产品结构。

CRE AI的结果非常令人满意,可以在未来的示例中看到其在AMA中的应用。

CRE AI是一个令人兴奋的包,作者最近使用它并取得了良好的结果。

CRE AI可以处理复杂的任务,如产品管理和技术讨论,最终形成完整的解决方案。

CRE AI通过代理之间的对话和合作,能够生成有深度和广度的分析报告和博客文章。

Transcripts

play00:00

so hi everyone my new book lanch in your

play00:02

pocket beginner's guide to building gen

play00:04

applications using llm is out now on

play00:06

Amazon the book is already a best seller

play00:08

as you can see it is trending on hash

play00:10

three on Amazon best sellers so go grab

play00:13

your copies and find the link in the

play00:15

description below thank so hi everyone

play00:18

today I will be talking about a very

play00:20

interesting generative AI framework that

play00:22

is cre AI which is a multi-agent

play00:24

conversational framework so what do we

play00:26

mean by a multi-agent framework in such

play00:29

a framework we can create a number of

play00:30

Agents depending upon our problem

play00:33

statement like for example an agent can

play00:35

be a product manager other agent can be

play00:38

a tech content writer the third person

play00:40

can be a great with engineering and

play00:43

eventually then we will be giving a task

play00:45

to these collection of agents and then

play00:48

they having conversation within

play00:50

themselves would be coming out with the

play00:52

final solution so this is how it it can

play00:54

be taken as a virtual team for which

play00:57

you're giving a task and eventually they

play00:59

are coming up with a Solutions on their

play01:00

own so crei is a very exciting package I

play01:03

was recently working with it and the

play01:04

results are pretty good so let's get

play01:06

started so first of all are talking

play01:08

about the different components of crei

play01:11

one is Agent where you give the what

play01:14

role that particular agent would be

play01:16

playing uh the goal of that agent and

play01:19

his backstory if it is required task

play01:22

would Define which what task you want to

play01:24

have crew would be a collection of

play01:26

agents and task and process we will

play01:28

discussing a little late so let's let's

play01:30

get started first of all you need to pip

play01:31

install creai uh once you're done with

play01:34

that so in this case I'm using a hugging

play01:36

phas Hub API for loading the llm the um

play01:40

llm that I'm using is gamma 2 billion

play01:42

model as you can see here just for

play01:44

demonstration purpose I have removed my

play01:47

API token but if you have an open API

play01:49

key that would be great this works even

play01:51

with AMA as well so that I will

play01:53

demonstrating later so here you can see

play01:56

that I loaded my LM object the rest of

play01:58

the code is quite easy to understand so

play02:00

we will be creating the different agents

play02:01

we want to have to solve the problem the

play02:04

first agent that I'm calling out is a

play02:05

senior research analyst as you can see

play02:08

there are a few things that you need to

play02:10

mention role the goal of the

play02:12

agent his backstory verbos allow

play02:16

delegation I will talking a little late

play02:18

which is related to the process and the

play02:20

llm that you're providing so here I have

play02:22

created an agent that is researcher and

play02:25

the second agent that is a tech content

play02:27

strategist right here you can see that

play02:29

the goal is to compel to write

play02:31

compelling content on Tech advancements

play02:33

you are renowned content strategist and

play02:35

again I'm providing with the llm and

play02:37

allowed allegation equals to false so uh

play02:40

basically the the entire flow in cre can

play02:43

follow two can follow two approaches one

play02:47

is a sequential approach where you give

play02:49

a problem statement and eventually the

play02:52

agents would be giving their inputs one

play02:54

by one so if for example as I'll will be

play02:56

showing you I'm creating a task list

play03:00

down major ml algorithms expected output

play03:03

is full analysis report and short bullet

play03:04

points and agent equals to researcher so

play03:07

this particular task is assigned to the

play03:10

first agent researcher and then the

play03:12

second task that I'm creating is using

play03:13

the insights provided from the first

play03:15

task develop an engaging blog that

play03:18

highlights the most significant ml

play03:19

algorithms and write a full blog post so

play03:22

basically in the first task I would be

play03:23

getting short bullet points and in the

play03:25

second task I'm expecting a full block

play03:27

post that would be expanded on the short

play03:29

bullet points for which I'm hiring the

play03:31

second agent that is a writer so in case

play03:34

of as I told you there are two

play03:35

approaches in cway that is sequential

play03:37

and hierarchal in case of sequential uh

play03:41

we would be assigning one task to each

play03:42

of the agent if you and eventually the

play03:45

subsequent agent the second task the

play03:48

agent in the second task can use the

play03:49

insights from the first task so

play03:51

basically the output of the first task

play03:53

can be used as a context in the second

play03:56

task and likewise if you move ahead in

play03:58

if you go to the third task the output

play04:00

from the first and second task can be

play04:01

used in the third task so there is a

play04:03

sequential approach the other is a

play04:05

hierarchical approach where what you can

play04:07

do you won't be mentioning um different

play04:10

tasks you would be mentioning a single

play04:11

task and eventually uh you would be

play04:14

making this particular flag allow

play04:16

delegation equals to true so by allowing

play04:19

delegation we mean that this particular

play04:21

agent can hire the other agents present

play04:24

to get the task done so for example if

play04:26

it would have been allowed delegation

play04:28

equals to false and process would have

play04:29

been hierarchical in that case this

play04:31

particular agent could have delegated a

play04:34

task of writing the content strategy of

play04:36

writing a blog post to senior research

play04:40

analyst to get me the bullet points for

play04:42

the blog So eventually it would be like

play04:44

a entire company scene where the product

play04:47

manager is talking to the developer

play04:49

providing them with task eventually the

play04:51

tech lead is asking the developer to

play04:53

develop something and eventually

play04:55

delegation can happen but in this

play04:56

particular example we are following a

play04:58

sequential approach where a task will be

play05:00

done by one person and it you can't

play05:02

delegate it to the other agents so here

play05:04

you can see that we have defined two

play05:06

agents we have defined to separate task

play05:09

and in the second task uh we would be

play05:11

taking the output from the first task

play05:12

that the short bullet points to expand

play05:15

onto the blog now we are finally

play05:17

instantiating a crew the crew would

play05:20

consist of the agents researcher and

play05:22

writer task task one and two and the

play05:24

veros and then finally we would be

play05:26

calling out crew. kickoff so if you look

play05:29

at into the output that we have got it's

play05:31

very interesting so once you see the

play05:34

first task that we have got is list down

play05:37

major ml algorithms as we mentioned here

play05:39

list on major ml

play05:41

algorithms and the working agent is

play05:43

senior research analyst So eventually

play05:45

you can see how the prompts looks like

play05:48

internally and uh going through a back

play05:52

and forth process eventually the

play05:54

research content uh the the senior

play05:56

research analyst has come up with these

play05:58

points

play06:00

finish chain supervised learning

play06:02

algorithms unsupervised learning

play06:03

algorithms and reinforcement learning

play06:05

algorithms three pointers and it has

play06:07

mentioned some algorithms within it okay

play06:09

in these particular domains these are

play06:11

the algorithms used now the tech content

play06:13

strategist would be using this input

play06:16

supervise and super reinforcement

play06:17

learning pointers to expand onto the

play06:19

final block post and here you can see

play06:22

that the entire thought process that is

play06:23

going behind the scen that is not

play06:26

visible to us now eventually if you look

play06:28

into the final output that has come up

play06:31

unveiling the mysteries of machine

play06:32

learning algorithms as you can see it is

play06:34

able to give uh the title to the blog it

play06:36

is written a introduction then expanded

play06:38

onto the pointers given and this is

play06:41

how the final output looks like so here

play06:45

you can see that how cre AI can be so

play06:48

good with complex task and where you can

play06:50

have eventually have a virtual team you

play06:52

don't need to hire anyone just be good

play06:54

with prompting and the rest of the

play06:56

things would be taken care by 3i this is

play06:58

was a very very uh easy task that I

play07:01

assigned but eventually in the coming

play07:02

examples that I will be showing with AMA

play07:05

I'll be showing you how an entire

play07:06

product design and technicalities

play07:09

discussion and finally the final

play07:11

structure can be uh can come out using

play07:14

crei using a combination of multiple

play07:17

agents thank you so much

Rate This

5.0 / 5 (0 votes)

Related Tags
CRE AI虚拟团队多代理对话机器学习内容生成技术策略产品管理技术写作框架介绍任务分配博客撰写
Do you need a summary in English?