1
00:00:00,240 --> 00:00:00,600
Okay.
好的。

2
00:00:00,600 --> 00:00:05,200
Well, it remains for us to write the the main the run function in here.
好吧，我们仍然需要在这里编写主要的 run 函数。

3
00:00:05,200 --> 00:00:11,600
I deleted the default template one that's there usually, and I'm replacing it here with a simple run.
我删除了通常存在的默认模板，并在此处通过简单的运行替换了它。

4
00:00:11,600 --> 00:00:16,440
The crew we're going to pass in the sector as technology.
我们将在该领域传递技术人员。

5
00:00:16,480 --> 00:00:18,920
We don't actually need a current date in there at all.
实际上我们根本不需要当前日期。

6
00:00:18,960 --> 00:00:19,680
That will do fine.
这样就可以了。

7
00:00:19,680 --> 00:00:26,320
We don't use current dates and the result is Stockpicker kickoff passing in the inputs.
我们不使用当前日期，结果是 Stockpicker 开始传递输入。

8
00:00:26,520 --> 00:00:30,200
And then we will print results at the end.
然后我们将在最后打印结果。

9
00:00:30,800 --> 00:00:32,440
So there we go.
我们就这样吧。

10
00:00:32,480 --> 00:00:34,080
This is our starting point.
这是我们的出发点。

11
00:00:34,160 --> 00:00:37,280
I think we should give this a whirl okay here we go.
我想我们应该尝试一下，好吧，我们开始吧。

12
00:00:37,280 --> 00:00:42,240
So we're going to bring up our terminal as usual with control and the tick.
因此，我们将像往常一样通过 Control 和勾号打开终端。

13
00:00:42,400 --> 00:00:44,760
And then we're going to go into our third folder.
然后我们将进入第三个文件夹。

14
00:00:44,760 --> 00:00:46,920
And we are going to go into the stock picker.
我们将进入选股器。

15
00:00:47,080 --> 00:00:48,520
And we're going to type crew.
我们要输入船员。

16
00:00:48,560 --> 00:00:50,840
I run to kick it off.
我跑去把它踢开。

17
00:00:51,400 --> 00:00:52,400
And now here's the thing.
现在事情是这样的。

18
00:00:52,680 --> 00:00:54,560
It's going to be interesting to watch this.
观看这个将会很有趣。

19
00:00:54,960 --> 00:01:01,040
The crew process is, by its very nature, a little bit less predictable than we might want.
就其本质而言，船员流程比我们想象的要难预测一些。

20
00:01:01,200 --> 00:01:07,160
It is autonomous and it goes off and does its own thing, and that can involve all sorts of searching
它是自主的，它会开始做自己的事情，这可能涉及各种搜索

21
00:01:07,160 --> 00:01:10,320
around and using multiple agents.
周围并使用多个代理。

22
00:01:10,360 --> 00:01:15,440
It can sometimes go back to do some news and analysts and then using the researcher, and it can take
有时可以回去做一些新闻和分析师，然后使用研究人员，这可能需要

23
00:01:15,440 --> 00:01:18,080
quite a while as it goes through its processing.
处理过程需要相当长的时间。

24
00:01:18,200 --> 00:01:22,440
And my machine is chugging away like crazy, as will yours.
我的机器正在疯狂地运转，你的也是如此。

25
00:01:22,480 --> 00:01:23,000
And it's both.
两者都是。

26
00:01:23,040 --> 00:01:28,000
The great thing, and perhaps the downside of autonomous agentic AI, that we have a bit less control
自主代理人工智能的伟大之处，也许也是它的缺点，是我们的控制力有点少

27
00:01:28,000 --> 00:01:32,120
over how this process is followed, and so I will let it do its thing.
关于如何遵循这个过程，所以我会让它做它的事情。

28
00:01:32,160 --> 00:01:35,880
I will break and come back when it completes its recommendation.
当它完成推荐时我会休息并回来。

29
00:01:36,200 --> 00:01:36,920
And here we have it.
现在我们有了它。

30
00:01:36,960 --> 00:01:40,240
It actually completed pretty much right as I was pausing there.
当我停在那里时，它实际上已经完成了。

31
00:01:40,280 --> 00:01:41,280
So it was quite quick.
所以速度很快。

32
00:01:41,320 --> 00:01:46,480
It made a decision to recommend anthropic and it says, which was interesting because it was OpenAI
它决定推荐人类，它说，这很有趣，因为它是 OpenAI

33
00:01:46,520 --> 00:01:52,680
that was doing this, this processing, which is and it turns down a couple of a security company,
就是这样做，这个处理，它拒绝了几家安全公司，

34
00:01:52,720 --> 00:02:00,970
Peregrine and a crypto company, circle, and we can look in our outputs folder where we'll see that
Peregrine 和一家加密货币公司，圈起来，我们可以在输出文件夹中看到

35
00:02:00,970 --> 00:02:03,090
this decision is shown.
显示此决定。

36
00:02:03,090 --> 00:02:06,930
And we'll also find a research list here.
我们还将在这里找到一份研究列表。

37
00:02:07,170 --> 00:02:10,250
And also the trending companies list.
还有热门公司名单。

38
00:02:10,250 --> 00:02:15,210
And these of course are in the JSON format that conforms to our schema.
当然，这些都是符合我们模式的 JSON 格式。

39
00:02:15,210 --> 00:02:22,450
So we are seeing here the proper formatted results because we required that by using structured outputs.
因此，我们在这里看到了正确格式化的结果，因为我们需要使用结构化输出。

40
00:02:22,570 --> 00:02:26,970
And so despite my misgivings about the autonomous framework it actually performed really well.
因此，尽管我对自主框架心存疑虑，但它实际上表现得非常好。

41
00:02:26,970 --> 00:02:28,970
It did just go through the process.
它确实只是经历了这个过程。

42
00:02:28,970 --> 00:02:29,730
It should do.
应该可以。

43
00:02:29,970 --> 00:02:35,650
The manager that we'd set up had some autonomy in how it assigned out the tasks, but it did so well
我们设立的经理在如何分配任务方面拥有一定的自主权，但它做得很好

44
00:02:35,650 --> 00:02:41,450
and as a result, we did indeed achieve a stock pick recommendation, which is not intended for real
结果，我们确实实现了选股推荐，但并不是真正的目的

45
00:02:41,450 --> 00:02:45,410
trading decisions, which is in this case for anthropic.
交易决策，在这种情况下是人为的。

46
00:02:45,650 --> 00:02:50,010
All right, it's time to make our solution have a few more bells and whistles.
好吧，是时候让我们的解决方案增加一些附加功能了。

47
00:02:50,650 --> 00:02:52,410
First of all, we're going to add a tool.
首先，我们要添加一个工具。

48
00:02:52,650 --> 00:02:58,570
You'll see if you look in the source folder in the stock picker folder that's generated for you that
您会看到，如果您查看为您生成的股票选择器文件夹中的源文件夹，

49
00:02:58,570 --> 00:03:03,810
there's already a folder called tools that the people at Cru have kindly made for us.
Cru 的工作人员已经为我们制作了一个名为“tools”的文件夹。

50
00:03:03,810 --> 00:03:10,530
And there's one in there called Custom Tool that has a kind of typical layout for these sorts of, of
那里有一个叫做“自定义工具”的工具，它具有一种针对此类的典型布局，

51
00:03:10,570 --> 00:03:10,890
tools.
工具。

52
00:03:10,890 --> 00:03:16,250
And we are going to change the name of custom tool, and we're going to make it into push tool.
我们将更改自定义工具的名称，并将其变成推送工具。

53
00:03:16,370 --> 00:03:19,210
So let's do rename and make this a push.
因此，让我们重命名并推动它。

54
00:03:19,850 --> 00:03:21,650
Hang on click there.
等一下，点击那里。

55
00:03:21,690 --> 00:03:22,570
Try that again.
再试一次。

56
00:03:22,730 --> 00:03:27,690
Rename to push underscore tool dot pi.
重命名为推送下划线工具点 pi。

57
00:03:28,290 --> 00:03:35,490
So the way that it works if we look in here is that you'll see that there is a when you set up a custom
因此，如果我们查看这里，您会发现当您设置自定义时，它的工作方式是

58
00:03:35,490 --> 00:03:43,210
tool you have to first describe using a pedantic object, the schema of what will be passed in to your
您必须首先使用迂腐的对象来描述工具，即将传递给您的工具的模式

59
00:03:43,210 --> 00:03:44,170
custom tool.
自定义工具。

60
00:03:44,290 --> 00:03:51,290
And then you end up writing an underscore run method, which is going to take that schema as its parameters.
然后您最终编写了一个下划线运行方法，该方法将采用该模式作为其参数。

61
00:03:51,570 --> 00:03:56,330
So to make that feel more real, I'm going to, uh, actually implement that.
因此，为了让这种感觉更加真实，我将，呃，实际实施它。

62
00:03:56,330 --> 00:04:01,090
And let's just start with a couple of, uh, imports here and now.
现在让我们从一些，呃，导入开始。

63
00:04:01,090 --> 00:04:07,970
So we're going to have a push notification input which will be a subclass of base model.
因此，我们将有一个推送通知输入，它将成为基本模型的子类。

64
00:04:08,130 --> 00:04:13,330
And we're going to change the description that this is uh what is the meaning of this input.
我们将更改描述，即这个输入的含义是什么。

65
00:04:13,330 --> 00:04:16,090
It's going to be a message to be sent.
这将是一条要发送的消息。

66
00:04:16,890 --> 00:04:21,050
Sorry to be sent to the user okay.
抱歉发送给用户好吗。

67
00:04:21,690 --> 00:04:25,330
And now instead of an argument we're going to say message.
现在我们不再说争论，而是说消息。

68
00:04:25,490 --> 00:04:26,770
That's what we're going to call it.
这就是我们所说的。

69
00:04:26,770 --> 00:04:31,610
And the description will be the message to be sent to the user.
描述将是要发送给用户的消息。

70
00:04:31,890 --> 00:04:33,090
That seems pretty clear.
这看起来很清楚。

71
00:04:33,490 --> 00:04:33,850
Okay.
好的。

72
00:04:33,890 --> 00:04:38,370
So that is then defining the schema for our tool.
这就是为我们的工具定义架构。

73
00:04:38,410 --> 00:04:44,090
It's in other words this here is actually going to be message to to correspond with that.
换句话说，这里实际上是与此相对应的消息。

74
00:04:44,090 --> 00:04:47,850
That's what we will run when the tool is invoked.
这就是我们在调用该工具时将运行的内容。

75
00:04:48,290 --> 00:04:50,130
So or invoked rather than invoked.
所以还是调用而不是调用。

76
00:04:50,370 --> 00:04:53,490
So uh we will um give it a name.
所以呃我们会给它一个名字。

77
00:04:53,490 --> 00:04:56,820
So first of all we should change the class to be push notification tool.
所以首先我们应该将类更改为推送通知工具。

78
00:04:56,860 --> 00:04:57,340
There we go.
我们开始吧。

79
00:04:57,340 --> 00:04:57,660
Thank you.
谢谢。

80
00:04:57,700 --> 00:04:58,180
Cursor.
光标。

81
00:04:58,380 --> 00:05:08,260
The name let's say is going to be send a push notification and the description is going to be this tool
假设名称将发送推送通知，描述将是此工具

82
00:05:08,820 --> 00:05:11,460
is used to send a push notification to the user.
用于向用户发送推送通知。

83
00:05:11,460 --> 00:05:12,940
That seems pretty decent to me.
这对我来说似乎相当不错。

84
00:05:13,140 --> 00:05:13,820
Okay.
好的。

85
00:05:14,140 --> 00:05:16,540
And the schema for the args.
以及参数的架构。

86
00:05:16,580 --> 00:05:20,220
This is where we say what kind of arguments do we need you to pass in.
这就是我们需要你传入什么样的参数的地方。

87
00:05:20,380 --> 00:05:23,940
Well, that's exactly the schema that we've just defined right here.
嗯，这正是我们刚刚在这里定义的模式。

88
00:05:24,100 --> 00:05:28,220
So it is something which just has a single argument message.
所以它只有一个参数消息。

89
00:05:28,380 --> 00:05:29,140
And there you go.
就这样吧。

90
00:05:29,180 --> 00:05:34,660
You see we've written a run method with a single input message.
您会看到我们编写了一个带有单个输入消息的运行方法。

91
00:05:34,980 --> 00:05:39,620
And that is going to actually send a push notification.
这实际上会发送推送通知。

92
00:05:39,820 --> 00:05:41,940
And how do we send a push notification.
以及我们如何发送推送通知。

93
00:05:41,940 --> 00:05:45,420
We use the fabulous Pushover tool.
我们使用神奇的 Pushover 工具。

94
00:05:45,420 --> 00:05:52,140
And hopefully in your environment you have Pushover user and Pushover token set in your env file from
希望在您的环境中您的 env 文件中设置了 Pushover 用户和 Pushover 令牌

95
00:05:52,140 --> 00:05:57,860
prior week and then I just used I've just pasted in exactly the same code we have from the prior week,
前一周，然后我刚刚粘贴了与前一周完全相同的代码，

96
00:05:58,020 --> 00:06:03,780
and we will push this message to the user and then return that that was okay.
我们会将此消息推送给用户，然后返回表示没问题。

97
00:06:04,220 --> 00:06:07,460
So that is our push notification tool.
这就是我们的推送通知工具。

98
00:06:07,460 --> 00:06:08,860
Now we have to put it to good use.
现在我们必须好好利用它。

99
00:06:09,580 --> 00:06:11,260
Well this should be pretty easy actually.
嗯，这实际上应该很容易。

100
00:06:11,300 --> 00:06:18,580
We're back in the crew.py module and we add in an import to import in the push notification tool.
我们回到crew.py模块，并添加一个导入以导入到推送通知工具中。

101
00:06:18,900 --> 00:06:22,020
Now which of our agents do we want to be able to do this.
现在我们希望我们的哪些代理能够做到这一点。

102
00:06:22,180 --> 00:06:29,380
We want the stock picker agent to be the one that will have this power the stock picker.
我们希望选股代理人成为拥有选股权力的人。

103
00:06:29,980 --> 00:06:33,340
You can see cursor of course already tells us that's exactly what we want.
当然你可以看到光标已经告诉我们这正是我们想要的。

104
00:06:33,380 --> 00:06:36,820
We want the stock picker to be able to call the push notification tool.
我们希望选股器能够调用推送通知工具。

105
00:06:36,820 --> 00:06:38,060
That's as simple as that.
就这么简单。

106
00:06:38,380 --> 00:06:38,940
All right.
好的。

107
00:06:38,940 --> 00:06:40,860
With that, let's go and run this.
有了这个，让我们开始运行它。

108
00:06:40,900 --> 00:06:42,300
We'll do that right away.
我们会立即这样做。

109
00:06:42,300 --> 00:06:44,540
We will bring up this.
我们会提出这一点。

110
00:06:44,780 --> 00:06:47,140
We will clear what we have here.
我们会清理这里的东西。

111
00:06:47,380 --> 00:06:52,260
And we will just call, cry, run and give it a whirl.
我们只会打电话、哭泣、奔跑并尝试一下。

112
00:06:52,300 --> 00:06:53,620
Let's see what happens.
让我们看看会发生什么。

113
00:06:53,980 --> 00:06:56,460
I will let this run and I'll be right back.
我会让这件事继续下去，我很快就会回来。

114
00:06:56,980 --> 00:06:58,020
And here we go.
我们开始吧。

115
00:06:58,060 --> 00:06:59,180
It's completed.
完成了。

116
00:06:59,180 --> 00:07:04,180
It's this time recommending circle, which was one of the runners up last time.
这次推荐的是上次的亚军之一的circle。

117
00:07:04,380 --> 00:07:11,420
And I can assure you, you can see it right here that I did indeed get a push notification about the,
我可以向您保证，您可以在这里看到我确实收到了有关以下内容的推送通知：

118
00:07:11,420 --> 00:07:14,180
the the opportunity, which is great.
机会，这真是太好了。

119
00:07:14,180 --> 00:07:15,420
So it is working.
所以它正在发挥作用。

120
00:07:15,660 --> 00:07:19,620
And that then is the extra piece that we've added into this.
这就是我们添加到其中的额外部分。

121
00:07:19,620 --> 00:07:25,620
So just to recap, we built this agent framework and the three things that are different than the way
回顾一下，我们构建了这个代理框架以及与方式不同的三件事

122
00:07:25,620 --> 00:07:26,460
we've done it before.
我们以前已经做到了。

123
00:07:26,580 --> 00:07:29,060
First of all we've used structured outputs.
首先，我们使用了结构化输出。

124
00:07:29,060 --> 00:07:34,380
So we've required that tasks respond conforming to a JSON schema that we set.
因此，我们要求任务响应符合我们设置的 JSON 模式。

125
00:07:34,780 --> 00:07:40,220
Secondly, instead of using the sequential process, we use the hierarchical process, which means that
其次，我们不使用顺序过程，而是使用分层过程，这意味着

126
00:07:40,220 --> 00:07:46,500
we can either pass in an LLM by model name or by passing in an agent that will take care of assigning
我们可以通过模型名称传递 LLM，也可以传递负责分配的代理

127
00:07:46,500 --> 00:07:47,980
the tasks to the agents.
给代理的任务。

128
00:07:47,980 --> 00:07:48,700
And we did that.
我们做到了。

129
00:07:48,700 --> 00:07:52,030
And we saw, I think, both the good and the bad of doing so.
我认为，我们看到了这样做的好处和坏处。

130
00:07:52,310 --> 00:07:57,670
And then thirdly, we added a custom tool, a tool that we wrote ourselves.
第三，我们添加了一个自定义工具，一个我们自己编写的工具。

131
00:07:57,670 --> 00:07:58,870
And it's a familiar one.
这是一个熟悉的。

132
00:07:58,870 --> 00:08:00,670
It was to send a push notification.
是为了发送推送通知。

133
00:08:00,670 --> 00:08:05,790
And we armed an agent with that ability and it pulled it off successfully.
我们为特工配备了这种能力，并且成功地完成了任务。

134
00:08:06,190 --> 00:08:10,150
And so that then is wraps up this week's project.
本周的项目就到此结束。

135
00:08:10,150 --> 00:08:11,430
And I'll see you for the wrap up.
总结会见。

136
00:08:11,910 --> 00:08:13,110
I think I might have just said that.
我想我刚才可能已经说过了。

137
00:08:13,110 --> 00:08:14,430
That wraps up this week's project.
本周的项目就这样结束了。

138
00:08:14,470 --> 00:08:16,270
Of course, it wraps up this day's project.
当然，今天的项目就到此结束了。

139
00:08:16,270 --> 00:08:17,430
We've got lots more to go.
我们还有很多事情要做。

140
00:08:17,470 --> 00:08:21,830
And in fact, tomorrow and in the next day before we move on to the next project, I do want to add
事实上，明天和后天，在我们继续下一个项目之前，我确实想补充一点

141
00:08:21,830 --> 00:08:24,670
one more bell and whistle to this project too.
这个项目还有一个附加功能。

142
00:08:24,710 --> 00:08:29,870
So we're not completely through with the stock picker either, so stay tuned for that.
因此，我们还没有完全完成股票选择器的工作，所以请继续关注。

143
00:08:29,870 --> 00:08:34,550
But again, to recap, we just did structured outputs, custom tools and hierarchical process.
但再次回顾一下，我们只是做了结构化输出、定制工具和分层流程。

144
00:08:34,750 --> 00:08:40,670
And tomorrow we're going to we are going to add a little bit extra to stock picker but then also work
明天我们将为选股器添加一点额外的内容，然后也可以工作

145
00:08:40,670 --> 00:08:44,150
on the next project, the developer agent.
在下一个项目上，开发商代理。

146
00:08:44,150 --> 00:08:45,990
And I'm really excited about that one.
我对此感到非常兴奋。

147
00:08:46,030 --> 00:08:48,550
Good old crew is coming through strong.
优秀的老船员正在坚强地度过。

148
00:08:48,590 --> 00:08:49,310
See you then.
到时候见。
