1
00:00:03,540 --> 00:00:03,930
Okay.

2
00:00:03,930 --> 00:00:10,020
So in this first lesson we are going to introduce the OpenAI API.

3
00:00:10,050 --> 00:00:17,310
We are going to work in a similar way than the way we have used in previous blocks.

4
00:00:17,310 --> 00:00:24,720
So we are going to divide our screen and we will be able to show the slides you have and also the notebooks

5
00:00:24,720 --> 00:00:27,120
you have in the attached documentation.

6
00:00:27,210 --> 00:00:28,230
So.

7
00:00:29,180 --> 00:00:34,640
First things to say, uh, about, uh, the OpenAI API.

8
00:00:35,650 --> 00:00:44,020
Remember that one of the reasons a long chain became popular initially is that it was seen as a simpler

9
00:00:44,020 --> 00:00:47,980
and more plural alternative to OpenAI's API.

10
00:00:48,010 --> 00:01:00,310
So when OpenAI launched ChatGPT in November 2022, the artificial intelligence engineers went to the

11
00:01:00,310 --> 00:01:01,930
OpenAI API.

12
00:01:02,200 --> 00:01:06,280
And what we saw there is this is difficult to learn.

13
00:01:08,480 --> 00:01:17,990
At the same time, land changed very, very quickly, offered us an easier way to learn about TLM applications

14
00:01:17,990 --> 00:01:26,360
and also a way to work with multiple LM models, not just ChatGPT, but other alternatives.

15
00:01:26,360 --> 00:01:30,710
So most of us, we said, okay, Lansing seems very interesting.

16
00:01:30,710 --> 00:01:37,070
You know, it's a it's a faster, quicker, easier way to use ChatGPT in our applications.

17
00:01:37,070 --> 00:01:37,700
Excellent.

18
00:01:38,960 --> 00:01:45,260
But this trend might change due to three factors.

19
00:01:46,130 --> 00:01:47,060
First.

20
00:01:47,450 --> 00:01:54,200
Until now, OpenAI's ChatGPT model is by far the most used.

21
00:01:54,620 --> 00:02:03,080
So at this moment, the value of land chain as a multimodal framework virtually makes no sense.

22
00:02:03,650 --> 00:02:08,509
So the second advantage of land chain, the first one is okay, it's it's easier.

23
00:02:08,509 --> 00:02:09,440
It's simple.

24
00:02:10,550 --> 00:02:15,740
But the second advantage is okay, I can use land chain for different LM models.

25
00:02:16,400 --> 00:02:22,430
If I learn in the OpenAI API, it is only for this LM model.

26
00:02:22,430 --> 00:02:28,550
If I want to use llama two or Mistral or Falcon, I will need to learn another API.

27
00:02:28,580 --> 00:02:34,970
So why not use land chain that is able to communicate with all LM models, right?

28
00:02:36,280 --> 00:02:40,030
But during the first year of LLM applications.

29
00:02:40,810 --> 00:02:47,620
Virtually 99% of professional LLM applications are using ChatGPT.

30
00:02:48,890 --> 00:02:54,590
So some AI engineers they want their.

31
00:02:54,590 --> 00:03:04,310
So why use long chain or lambda index if I am not using different LM models, I am just using ChatGPT.

32
00:03:04,310 --> 00:03:12,020
So why not just learn how to communicate directly with ChatGPT using the OpenAI API?

33
00:03:13,540 --> 00:03:20,170
Second question with the adoption of the new long chain expression language.

34
00:03:20,320 --> 00:03:20,860
Uh.

35
00:03:23,050 --> 00:03:27,520
Persian lantern is becoming more complex.

36
00:03:27,520 --> 00:03:31,690
So the first advantage of long chain was simplicity.

37
00:03:32,590 --> 00:03:38,770
And now they are making their language more complex with the second version, what they call an gene

38
00:03:38,770 --> 00:03:39,640
expression language.

39
00:03:39,640 --> 00:03:43,420
So it's like Wu and Chen is not so easy anymore.

40
00:03:43,420 --> 00:03:45,400
And at the same time.

41
00:03:46,560 --> 00:03:50,070
At the Deaf Day in November 2023.

42
00:03:50,520 --> 00:03:56,970
OpenAI has launched a simpler and more versatile version of its API.

43
00:03:57,570 --> 00:03:59,190
So one.

44
00:04:00,170 --> 00:04:04,250
ChatGPT is used in 99% of applications.

45
00:04:04,730 --> 00:04:05,540
Two.

46
00:04:06,590 --> 00:04:11,780
OpenAI API is more simple and more versatile than ever.

47
00:04:13,180 --> 00:04:19,870
If you consider these two factors, you will probably jump into OpenAI API.

48
00:04:20,550 --> 00:04:23,970
But there is a another factor.

49
00:04:23,970 --> 00:04:28,020
In my opinion, this is the most important one you need to have in mind.

50
00:04:29,490 --> 00:04:35,520
OpenAI has decided to close part of their API.

51
00:04:35,520 --> 00:04:36,360
So.

52
00:04:37,320 --> 00:04:38,670
Do you remember?

53
00:04:38,670 --> 00:04:41,820
I think we have been talking about that before.

54
00:04:41,850 --> 00:04:46,860
Do you remember when Apple launched a their computers?

55
00:04:47,070 --> 00:04:51,210
Apple computers were the only computers you couldn't open.

56
00:04:52,010 --> 00:05:00,110
So with any other PC personal computer, you could open the the computer and change different parts,

57
00:05:00,110 --> 00:05:03,800
etc. and extend your computer with the Apple computers.

58
00:05:03,800 --> 00:05:05,330
You couldn't do that.

59
00:05:05,420 --> 00:05:06,320
It was impossible.

60
00:05:06,320 --> 00:05:11,630
They close, uh, the it was impossible to look under the hood if you if you want.

61
00:05:12,440 --> 00:05:17,540
This is the same thing that engineers are finding with OpenAI.

62
00:05:18,470 --> 00:05:22,400
Some parts of the OpenAI API are closed.

63
00:05:23,090 --> 00:05:25,880
Do you remember when we talked about the llama index?

64
00:05:25,880 --> 00:05:31,040
And I told you the most interesting part of llama index is the optimizing section.

65
00:05:31,580 --> 00:05:40,910
This is what you cannot do with OpenAI, and that is the main reason why artificial intelligence engineers

66
00:05:40,910 --> 00:05:46,340
are hesitant to use the OpenAI API.

67
00:05:47,520 --> 00:05:50,610
And this is our impression, of course.

68
00:05:50,640 --> 00:05:57,150
What we are feeling is that a most engineers are saying, no, no, no, I prefer to have a higher degree

69
00:05:57,150 --> 00:06:03,480
of control of my applications using long chain or a lambda index.

70
00:06:04,680 --> 00:06:13,860
Because until now, a OpenAI, the OpenAI API is perceived a more closed to engineers.

71
00:06:15,920 --> 00:06:25,670
So it is important for you to understand that just because the OpenAI API, excuse me, can do something

72
00:06:25,910 --> 00:06:29,270
does not mean it is the best way to do it.

73
00:06:30,320 --> 00:06:34,760
Because one it is closed in some areas.

74
00:06:34,760 --> 00:06:37,910
Two it can be very expensive.

75
00:06:39,790 --> 00:06:40,690
And.

76
00:06:43,190 --> 00:06:45,980
I would say these are the two main reasons.

77
00:06:46,400 --> 00:06:47,210
One.

78
00:06:49,290 --> 00:06:56,130
Using the new functionalities of OpenAI implies having a lesser degree of knowledge and control over

79
00:06:56,130 --> 00:06:57,120
the settings.

80
00:06:58,350 --> 00:07:02,700
To using the new functionalities of OpenAI can be very expensive.

81
00:07:05,550 --> 00:07:07,110
So with that in mind.

82
00:07:08,240 --> 00:07:12,860
Sometimes OpenAI A has been the choice.

83
00:07:12,860 --> 00:07:20,630
I would say many times OpenAI API has been the choice of artificial intelligence engineers during 2023.

84
00:07:21,170 --> 00:07:27,440
So it is very important for you to pay attention at this API and to see if in the future things are

85
00:07:27,440 --> 00:07:34,190
going to change, or if, depending on the characteristics of your project, this is going to be the

86
00:07:34,190 --> 00:07:35,390
best choice for you.

87
00:07:36,320 --> 00:07:44,150
So in this initial lesson, we are a taking a quick look at the API.

88
00:07:44,300 --> 00:07:45,050
We.

89
00:07:45,050 --> 00:07:53,390
In this initial lesson, we are going to present the main changes that OpenAI has introduced in the

90
00:07:53,390 --> 00:08:02,270
API since the dev day of November 2023, as well as their impact for developers of LM applications.

91
00:08:02,600 --> 00:08:05,390
In the next lesson, we will.

92
00:08:06,160 --> 00:08:12,040
Do a little, uh, a brief review of OpenAI's API as a whole.

93
00:08:12,040 --> 00:08:19,750
And in the last lesson, we are going to talk about one of the elements of the API, which is the most

94
00:08:19,750 --> 00:08:26,380
used or has been the most used during the first year, which is the OpenAI functions.

95
00:08:26,380 --> 00:08:27,040
Okay.

96
00:08:27,040 --> 00:08:29,500
So one important thing.

97
00:08:31,310 --> 00:08:34,669
As we did with Lama index.

98
00:08:35,390 --> 00:08:43,940
The the approach that we are recommending you is to go directly to open AI documentation.

99
00:08:44,930 --> 00:08:47,960
This is the this is the way we we do.

100
00:08:48,200 --> 00:08:50,000
This is how we work.

101
00:08:50,030 --> 00:08:53,660
Uh, on a daily basis as artificial intelligence engineers.

102
00:08:53,660 --> 00:09:01,310
And this is what you should do as well if you learn a framework by online courses.

103
00:09:02,450 --> 00:09:03,110
It.

104
00:09:03,110 --> 00:09:09,170
Your knowledge is going to become obsolete very early, especially with these kinds of new frameworks.

105
00:09:09,170 --> 00:09:11,090
They are evolving on a daily basis.

106
00:09:11,090 --> 00:09:19,190
So the best thing you can do is first, and this is why we must do with most AI engineers do this.

107
00:09:19,190 --> 00:09:26,150
We go to a course, we get an introduction from the course, we get the main concepts from the course,

108
00:09:26,150 --> 00:09:29,120
we get some main examples from the course.

109
00:09:29,120 --> 00:09:37,310
And then we go into the frameworks documentation and we dig deeper and we practice practice practice

110
00:09:37,310 --> 00:09:40,700
from the frameworks documentation okay.

111
00:09:40,700 --> 00:09:50,060
So these lessons we have extracted for you are just a soft landing into the main documentation okay.

112
00:09:50,060 --> 00:09:52,970
To make it easier for you that approach.

113
00:09:52,970 --> 00:10:02,540
But our recommendation and our teaching to the future artificial intelligence engineers is use this

114
00:10:02,540 --> 00:10:04,580
approach if you want.

115
00:10:04,580 --> 00:10:05,270
It is easier.

116
00:10:05,270 --> 00:10:14,510
What is the problem with the documentation, uh, of the frameworks I we told you before with Lama index,

117
00:10:14,510 --> 00:10:18,500
usually they are very technical.

118
00:10:18,500 --> 00:10:25,700
So usually it is very difficult and ugly to go there, uh, for the first time.

119
00:10:25,700 --> 00:10:34,760
So it is more friendly to go to a simple course, you know, just to understand the main, the main

120
00:10:34,760 --> 00:10:36,140
concepts of the framework.

121
00:10:36,140 --> 00:10:40,460
And then after that you go into the framework documentation itself.

122
00:10:40,460 --> 00:10:46,040
This is what I do 99% of the times, and this is the way I recommend you to do as well.

123
00:10:46,490 --> 00:10:51,440
So first approach to the OpenAI.

124
00:10:52,070 --> 00:10:58,310
The main changes introduced by OpenAI in November 2023.

125
00:10:58,340 --> 00:10:59,930
You have here a list.

126
00:10:59,990 --> 00:11:05,750
And in this notebook you already have, you have some examples regarding that.

127
00:11:05,750 --> 00:11:17,540
So first thing, they announce that the context window of ChatGPT is going to increase and it's going

128
00:11:17,540 --> 00:11:20,720
to be a longer than ever.

129
00:11:20,720 --> 00:11:28,760
You can now upload one full book up to 300 pages and make questions about it.

130
00:11:28,760 --> 00:11:29,300
Excellent.

131
00:11:29,300 --> 00:11:31,250
It's like a Rag application, right?

132
00:11:31,250 --> 00:11:33,260
But what is the trick?

133
00:11:33,260 --> 00:11:41,420
You can do this if you have the ChatGPT for turbo version, which is right now a very expensive version.

134
00:11:41,420 --> 00:11:45,200
So do you remember when I told you that OpenAI.

135
00:11:46,150 --> 00:11:54,610
Receive an investment of $10,000 million from Microsoft, and that this, of course, creates a dependency

136
00:11:54,610 --> 00:11:55,180
there.

137
00:11:55,180 --> 00:12:03,970
So OpenAI, some of the moves that OpenAI is doing is, is they are signaling the big enterprise companies

138
00:12:03,970 --> 00:12:05,560
as customers and users.

139
00:12:05,560 --> 00:12:13,390
So they say, yes, we have a much better context window, but it's going to be for our big customers.

140
00:12:14,130 --> 00:12:16,200
So this is interesting in some cases.

141
00:12:16,410 --> 00:12:27,240
GPT three five has also, you know, uh, better context window now, but very far from the GPT four

142
00:12:27,240 --> 00:12:27,600
turbo.

143
00:12:29,040 --> 00:12:39,480
Second, uh, interesting thing, uh, before the last API version, you have to work with OpenAI functions

144
00:12:39,480 --> 00:12:40,500
one by one.

145
00:12:40,500 --> 00:12:44,400
Now you can call multiple multiple functions at once.

146
00:12:44,400 --> 00:12:45,930
Here you have an example.

147
00:12:46,230 --> 00:12:51,240
This is this is the most interesting functionality of the this API right now.

148
00:12:52,240 --> 00:12:57,070
A OpenAI functions give you the ability to.

149
00:12:58,050 --> 00:13:03,960
Basically define what do you want ChatGPT to do?

150
00:13:04,140 --> 00:13:06,870
So in the functions you are.

151
00:13:07,780 --> 00:13:15,640
Defining whatever you want to do on top of the default functionality of ChatGPT.

152
00:13:15,670 --> 00:13:23,020
So this has a huge potential, and this has been very, very interesting for AI engineers during this

153
00:13:23,020 --> 00:13:24,010
first year.

154
00:13:24,430 --> 00:13:28,420
We are still in a very early stage, but this is super interesting.

155
00:13:28,420 --> 00:13:35,800
This you can do this from long chain and lambda index, but at the end of the day they are using the

156
00:13:36,010 --> 00:13:37,570
functionality of OpenAI.

157
00:13:37,600 --> 00:13:43,090
So I recommend you and I will repeat this in the third lesson.

158
00:13:43,090 --> 00:13:47,170
I will recommend you to study this section here.

159
00:13:47,170 --> 00:13:47,920
Function calling.

160
00:13:47,920 --> 00:13:51,370
Because there you are going to find very interesting examples as well.

161
00:13:51,820 --> 00:13:56,110
So now function calling can be multiple.

162
00:13:56,530 --> 00:14:06,940
Now you can uh, convert their uh answers of ChatGPT into Json format.

163
00:14:06,940 --> 00:14:12,910
If you remember, this is something we could do with long chain and lambda index.

164
00:14:13,630 --> 00:14:14,650
Do you remember.

165
00:14:15,300 --> 00:14:21,990
So as you can see, OpenAI is entering in the space of long chain and laminar.

166
00:14:22,140 --> 00:14:27,990
So OpenAI OpenAI is saying, oh, so people are using long chain Alma index because of this?

167
00:14:27,990 --> 00:14:31,020
No, I'm going to make it available from my API.

168
00:14:31,050 --> 00:14:37,470
So they are threatening a long chain and Lamar index with this kind of moves.

169
00:14:38,730 --> 00:14:48,240
Another thing assistance OpenAI is calling assistance a what long chain is calling agents.

170
00:14:48,830 --> 00:14:50,900
Why these different names?

171
00:14:51,920 --> 00:15:03,290
Probably because a OpenAI doesn't want to associate themselves with the hype around agents.

172
00:15:03,290 --> 00:15:11,750
So during the first year of applications, agents were a little bit, I would say a.

173
00:15:14,170 --> 00:15:22,060
Um, I think they generated a little frustration because the expectations were extremely high.

174
00:15:22,360 --> 00:15:29,710
Uh, frameworks like Island Chain told you you can do whatever you want with agents, but this was only

175
00:15:29,710 --> 00:15:30,610
for demos.

176
00:15:30,610 --> 00:15:37,330
If you want to go into professional, uh, applications, it's too early for agents.

177
00:15:37,330 --> 00:15:42,430
So it it has created a little degree of frustration.

178
00:15:42,430 --> 00:15:49,570
And maybe because of that, uh, OpenAI has decided to use a different name, so they call it assistance.

179
00:15:49,570 --> 00:15:50,950
Very interesting.

180
00:15:51,400 --> 00:15:59,980
The documentation you are going to find in the, in the, in the, uh, OpenAI documentation about assistance.

181
00:15:59,980 --> 00:16:01,510
Very interesting.

182
00:16:01,750 --> 00:16:08,380
A little bit too early, but they are and they are, uh, presenting some very interesting use cases

183
00:16:08,380 --> 00:16:11,830
there regarding the C parameter.

184
00:16:11,830 --> 00:16:14,170
Well, we mention it here.

185
00:16:14,170 --> 00:16:17,950
Uh, in my opinion, it's not very, uh, significant.

186
00:16:17,950 --> 00:16:25,960
The, the well, take a look at the, the examples we provide you here in the notebook about the assistance

187
00:16:25,960 --> 00:16:31,450
and the rag assistant, etc., with the, with the seed.

188
00:16:32,080 --> 00:16:33,400
Uh, I is not here.

189
00:16:33,400 --> 00:16:34,000
Let's see.

190
00:16:35,020 --> 00:16:35,860
Thing is.

191
00:16:38,080 --> 00:16:40,300
Uh, yeah, with the seed parameter.

192
00:16:41,110 --> 00:16:46,120
If you are familiar with traditional machine learning, probably you are familiar with the seed parameter

193
00:16:46,120 --> 00:16:46,690
there.

194
00:16:46,690 --> 00:16:57,460
So we use the seed parameter in order to fix the random, uh, element of our machine learning exercise.

195
00:16:58,650 --> 00:17:06,780
OpenAI is trying to do the same thing here is not 100% reliable, but most of the time it works, so

196
00:17:06,780 --> 00:17:07,890
it's good for testing.

197
00:17:07,890 --> 00:17:09,329
Just a quick note about that.

198
00:17:09,329 --> 00:17:12,180
In my opinion, it's not very relevant right now for you.

199
00:17:12,180 --> 00:17:15,630
But we we we made this note here.

200
00:17:15,630 --> 00:17:24,180
And finally, uh, some of the new things OpenAI has introduced in the API is more versatility.

201
00:17:24,390 --> 00:17:26,369
And regarding multimodality.

202
00:17:26,369 --> 00:17:31,020
So you will find here some interesting things about vision.

203
00:17:32,260 --> 00:17:35,290
Speech, text to speech, etc..

204
00:17:35,290 --> 00:17:35,560
Right?

205
00:17:35,560 --> 00:17:37,660
So this is another interesting point.

206
00:17:37,660 --> 00:17:45,370
In the next lesson, we are going to talk in more detail about the API of OpenAI.

