And welcome back to cursor. 欢迎回到光标。
And here we are in week three the crew folder. 这是第三周的船员文件夹。
How exciting. 多么令人兴奋啊。
Let's open it up to see what treasures I have in store for you. 让我们打开它，看看我为你准备了哪些宝藏。
And it's completely empty. And it's completely empty.
It won't be empty for you, but it's empty for me. 对你来说不会是空的，但对我来说却是空的。
Because this is starting from nothing. 因为这是从无到有的开始。
The way that some of you like me to do it. The way that some of you like me to do it.
Which is, uh, gonna happen this time. Which is, uh, gonna happen this time.
Because that's the way that crew works. Because that's the way that crew works.
So we will begin then by opening up a command line like this, a terminal and crew, which you'll remember 所以我们将首先打开一个像这样的命令行，一个终端和工作人员，你会记住的
is control and the tick on a mac. is control and the tick on a mac.
That is really the control button on the bottom left. 这实际上是左下角的控制按钮。
And, uh, then, uh, or it's the view menu and terminal if you're using menus. 而且，呃，那么，呃，或者如果您使用菜单，它就是视图菜单和终端。
So then what I'm going to do is I'm going to first change directory to go into the third directory. 那么我要做的就是首先更改目录进入第三个目录。
Right now we are in crew and I'm going to create a new crew project, which I do by saying crew I create Right now we are in crew and I'm going to create a new crew project, which I do by saying crew I create
crew. 全体人员。
And then the name of the project. 然后是项目的名称。
And we are going to call this project debate For reasons that will become obvious, but probably already 我们将把这个项目称为辩论 出于显而易见的原因，但可能已经
are, and it first asks us a question, and to read the question, I'll have to make this a bit larger. 是，它首先问我们一个问题，为了阅读这个问题，我必须把它放大一点。
Um, and this is because when you first create a project, it puts in place, as I mentioned, some 嗯，这是因为当你第一次创建一个项目时，正如我提到的，它会放置一些
scaffolding, some sort of basic project framework. 脚手架，某种基本的项目框架。
And in order to set that up, it wants to know which model would you like me to start with. 为了进行设置，它想知道您希望我从哪个模型开始。
So we're not necessarily fixing this, but we can start by saying open AI and we can always change it 所以我们不一定要解决这个问题，但我们可以从开放人工智能开始，我们总是可以改变它
later. 之后。
Select a model to use and we can choose GPT four or mini to keep it nice and cheap. 选择要使用的型号，我们可以选择 GPT 4 或 mini，以保持美观且便宜。
And then enter your key. 然后输入您的密钥。
Now at this point we should definitely just press enter because we already have a dot env file. 现在，我们绝对应该按 Enter 键，因为我们已经有了一个点 env 文件。
It's trying to build env files for us. It's trying to build env files for us.
We don't need that. 我们不需要那个。
We press enter and you'll see right here that it's created a bunch of files. 我们按 Enter 键，您会在这里看到它创建了一堆文件。
And I'm going to remove the terminal for a second so that we can take a look at it, because they have 我将暂时移除终端以便我们可以查看它，因为他们有
appeared over on the left. appeared over on the left.
Now one thing to get in mind is that when when you're looking at the explorer in cursor or in VSCode, Now one thing to get in mind is that when when you're looking at the explorer in cursor or in VSCode,
if there's a directory like crew that only has one other directory called debate, then it shows like 如果有一个像船员这样的目录只有一个名为“辩论”的目录，那么它会显示为
this. 这。
It doesn't bother showing multiple files, multiple folders under it. 它不会费心显示其下的多个文件、多个文件夹。
And that can be a little bit confusing. 这可能有点令人困惑。
So we might go back into the terminal and just make a new directory. 因此，我们可以返回终端并创建一个新目录。
Let's let's make a directory and call it other. 让我们创建一个目录并将其命名为 other。
And when I do that you see what just happened. And when I do that you see what just happened.
Now if we come in here, you'll see that there's both debate and there's an empty folder called other, 现在，如果我们来到这里，您会看到既有辩论，又有一个名为 other 的空文件夹，
which is going to make it a little bit easier on the eyes. which is going to make it a little bit easier on the eyes.
Okay. 好的。
So now let's have a quick look at what has crew created for us. 现在让我们快速浏览一下工作人员为我们创造的内容。
So under debate, which is the name of our crew that we're about to make a debate crew, as you've probably 因此，在辩论中，这是我们将要组建辩论队的团队的名字，正如您可能已经知道的那样
guessed, there is a folder called knowledge and that has a file user preference, and that has some guessed, there is a folder called knowledge and that has a file user preference, and that has some
stuff about the person who's the the user. stuff about the person who's the the user.
And you can change this. 你可以改变这一点。
This would be background information that would be given to the model if we made it use of it, which 如果我们使用它，这将是提供给模型的背景信息，其中
we will not. 我们不会。
So this is a sort of an example of some of the scaffolding that's created in case we need to use it. So this is a sort of an example of some of the scaffolding that's created in case we need to use it.
Then there is a folder called debate. Then there is a folder called debate.
Sorry. 对不起。
There's a folder called source. There's a folder called source.
And under that folder there is a folder called debate. 在该文件夹下有一个名为“辩论”的文件夹。
And again you're seeing it in this way in the explorer because there are no other folders other than 您再次在资源管理器中以这种方式看到它，因为除了
debate under source. 来源下的辩论。
So sorry to recap. 很抱歉重述一下。
Under crew we have a folder called debate, which is the name of of the project that has a sub folder 在船员下我们有一个名为“辩论”的文件夹，这是具有子文件夹的项目的名称
subdirectory source SLC and that has a subdirectory also with the project's name debate. subdirectory source SLC and that has a subdirectory also with the project's name debate.
And that is where we are right now. And that is where we are right now.
And this is the this is the most important directory of them all. 这是其中最重要的目录。
This this directory named the project underneath source. 这个目录将项目命名为source。
And that has a few things in it. And that has a few things in it.
It has a config directory. 它有一个配置目录。
The config directory has two YAML files agents and tasks. The config directory has two YAML files agents and tasks.
And here they are. 他们就在这里。
And they're set up with some default example code in there that we will come back and look at in just And they're set up with some default example code in there that we will come back and look at in just
a second. 一秒钟。
There is a tools folder that has just, again, some scaffolding, some some, some basic stuff here 有一个工具文件夹，里面有一些脚手架，一些基本的东西
that we might want to fill in later that we won't do this time. 我们稍后可能需要填写，但这次我们不会这样做。
And then if we come into the root folder of debate, you'll see that there is a file, a module called And then if we come into the root folder of debate, you'll see that there is a file, a module called
crew dot Pi which has a bunch of scaffolding again, and then a main dot pi. 船员点 Pi 又具有一堆脚手架，然后是一个主要点 pi。
So there we have it crew, the module, which is actually the one which brings together our crew, and 所以我们有了船员，模块，它实际上是把我们的船员聚集在一起的那个，
it has the decorators that I mentioned to you, main. 它有我向你提到的装饰器，main。
And then the two YAML files under config that has all been set up for us, ready for us to build our And then the two YAML files under config that has all been set up for us, ready for us to build our
first crew. 第一批船员。
All right. 好的。
So we are now going to go and define our YAML, our configuration for our agents and our tasks, starting 所以我们现在要定义我们的 YAML、我们的代理配置和我们的任务，开始
over here with the agents YAML file. over here with the agents YAML file.
And this contains some default some sort of scaffolding. 这包含一些默认的某种脚手架。
Some example agents that are called the researcher and the reporting analyst are the two examples that's 一些被称为研究员和报告分析师的示例代理是两个例子
given. 给予。
And we're going to change these to being what we're looking to build. 我们将把这些改变为我们想要构建的。
And of course, we're looking to build a debate team. 当然，我们正在寻求建立一个辩论队。
And in fact, we only need two agents for what we're looking to do. 事实上，我们只需要两名代理来完成我们想要做的事情。
We want an agent that will be the debater. We want an agent that will be the debater.
Our one agent is going to play both roles of being for and against the the motion. 我们的一名代理人将扮演支持和反对该动议的角色。
And then we will have a judge and those will be our two agents. 然后我们将有一名法官，他们将是我们的两名代理人。
And now we need to describe what they are. And now we need to describe what they are.
And so the, the role is the first thing that we say here. 所以，角色是我们在这里说的第一件事。
And we're going to say a compelling debater right there okay. 我们要说一位引人注目的辩手就在那里。
And now the goal is what what it's it's looking to achieve the objectives. 现在的目标是它希望实现的目标是什么。
And so let's see I'm going to actually copy across one that I did earlier. 因此，让我们看看我将实际复制我之前所做的一个。
So you don't have to watch me typing everything. So you don't have to watch me typing everything.
But we're going to present a clear argument either in favor of or against the motion. 但我们将提出支持或反对该动议的明确论据。
And the motion is and this is important, this little thing in in curly braces. 这个动作很重要，大括号里的这个小东西。
Here is where you can effectively make this a template. 您可以在这里有效地将其设为模板。
That is something that's going to get defined when you run this agent framework. 这是当您运行此代理框架时将被定义的内容。
When we end up saying, Q I run, we are going to specify what we want motion to be, and we're actually 当我们最终说“Q 我跑步”时，我们将指定我们想要的运动，而我们实际上是
going to specify that in Main.py. 将在 Main.py 中指定。
So keep that in mind. 所以请记住这一点。
In Main.py we're going to have to set what is motion, the motion of the debate. 在 Main.py 中，我们必须设置什么是议案，即辩论的议案。
The thing that we're putting forward the proposal that they will debate. 我们提出的提案他们将进行辩论。
Okay. 好的。
And so now we have a back story, which is where we set the the it's really we know that this is the 现在我们有了一个背景故事，这就是我们设定的地方，我们真的知道这就是
system prompt or a big part of it. 系统提示符或其很大一部分。
But in crew land, we want to think of this as the, as the sort of framing of this, of this agent, 但在船员领域，我们希望将其视为该特工的某种框架，
the back story. 背后的故事。
You're an experienced debater with a knack for giving concise but convincing arguments. 您是一位经验丰富的辩手，擅长给出简洁但令人信服的论点。
The motion is so on. 议案如此。
So that is the definition of our agent, our debater agent. 这就是我们的代理、辩手代理的定义。
And that will apply both for one that is presenting for an argument and against it. 这对于提出论点和反对论点的人都适用。
And of course we'll be using tasks to distinguish between them. 当然，我们将使用任务来区分它们。
But now let's define our judge. But now let's define our judge.
So we are going to give the judge a role. So we are going to give the judge a role.
And the role we will say is decide the winner of the debate. 我们要说的角色是决定辩论的胜利者。
Look at how cursor even suggests what this should be. 看看光标如何建议这应该是什么。
Let's say based on the arguments presented, let's keep it short. 让我们根据所提出的论点说，让我们保持简短。
And then the goal I will take one that I wrote earlier because it's a couple of sentences. 然后我会采用我之前写的一个目标，因为它只有几句话。
You can see that that amazingly cursor comes up with natural language. 您可以看到令人惊讶的光标出现了自然语言。
It's just great for these things already. 这对于这些事情来说已经很棒了。
So you can even define your agents just by letting cursor describe them. 因此，您甚至可以通过让光标描述代理来定义代理。
And the backstory here I'm going to copy and paste in a nice juicy backstory, and here it is. And the backstory here I'm going to copy and paste in a nice juicy backstory, and here it is.
You're a fair judge with a reputation for weighing up arguments without factoring in your own views 你是一位公正的法官，以权衡争论而不考虑自己的观点而闻名
and making a decision based purely on the merits of the argument. 并纯粹根据论点的是非曲直做出决定。
The motion is blah. 这项议案很废话。
So that's the sort of good way to set things like the backstory. 所以这是设置背景故事之类的好方法。
And again, on the one hand, one way of thinking about this is that this is the kind of backstory that 再说一次，一方面，思考这个问题的一种方式是，这是一种背景故事
an LLM is going to take into account in setting the context for this role. 法学硕士将在设置该角色的背景时考虑。
The other, more scientific way is just to always keep in mind that what Llms are doing is predicting 另一种更科学的方法是始终牢记法学硕士正在做的是预测
the most likely next token to follow an input. the most likely next token to follow an input.
And the point is that if this backstory is part of the input, then you are increasing the probability 关键是，如果这个背景故事是输入的一部分，那么你就增加了概率
that the output tokens will be consistent with this, because things that are seen at training time 输出标记将与此一致，因为在训练时看到的东西
that have that kind of backstory often predict tokens consistent with that backstory. that have that kind of backstory often predict tokens consistent with that backstory.
So that's the the more scientific way of thinking about why this tends to work really well. 因此，这是一种更科学的方式来思考为什么这种方法效果很好。
All right. 好的。
And then the final thing I'm going to add in here is you can also specify what model to use. 我要在此处添加的最后一件事是您还可以指定要使用的模型。
And you can actually you can just have GPT four or mini. 实际上，您可以只使用 GPT 4 或 mini。
Or if you want to really spell it out then you say OpenAI GPT four mini, but it assumes OpenAI by default 或者，如果您想真正拼写出来，那么您可以说 OpenAI GPT 4 mini，但默认情况下假定 OpenAI
for that model. 对于该模型。
What am I doing here? 我在这里做什么？
Model colon. 模型结肠。
There we go. 我们开始吧。
Luckily, cursor to the rescue. 幸运的是，光标来救援。
And this then is our YAML definition of the agents. 这就是我们对代理的 YAML 定义。
Next up is tasks. 接下来是任务。