See all freeCodeCamp.org transcripts on Youtube

youtube thumbnail

Build AI Apps with ChatGPT, DALL-E, and GPT-4 – Full Course for Beginners

4 hours 34 minutes 57 seconds

🇨🇳 Chinese

S1

Speaker 1

00:00

这个 如何 ai - chat gptd olly gpt 4 ap i tom ch ant 这个 tom 一个 线 s cri mb

S2

Speaker 2

00:13

a 大家好 c ode c amp 这个 这里 ai - 使 一些 可能 我们

S1

Speaker 1

00:28

基本 开始 各位 c amp ers 歡迎 來到 這個 你們 一些 ai - 沒有

S2

Speaker 2

00:28

我們 基本 開始 所以 你們 需要 之前 open ai api 就是 基本 v an illa javascript 一些 特別 就是 而且 很多 如果你 如何 我们 已经 s cri mb a 你可以 然后 你的 或者 如果你 喜欢 你可以

S1

Speaker 1

01:09

S2

Speaker 2

01:09

下面 我们

S1

Speaker 1

01:15

S2

Speaker 2

01:15

事情 如果你 喜欢 这个 这里 非常 如果 我的 我的 tp ch art 好的 我们 开始

S1

Speaker 1

01:35

S2

Speaker 2

01:35

gpt

S1

Speaker 1

01:38

d ali and gp t - 4 welcome to building

S2

Speaker 2

01:38

ai apps with chat gpt d ali and gp t - 4 i am super excited to bring you this course on the technology everybody is talking about we are going to study how to use the open ai api we will be using various open ai models including the latest gp t - 4 model we will be looking at prompt

S1

Speaker 1

01:58

engineering 我们 如何 使 open ai api 我们 使 open ai 包括 gpt - 4

S2

Speaker 2

01:58

我们 我们 我们 一个 我们 当然 需要 的话 我们 这个 使 gpt - 4 api 第二 目前 一个 可以 使 ap i 这个 线 ap i

S1

Speaker 1

02:28

ap i in the second project in this course now at present there is a waiting list to get your hands on the api no doubt in the near future the wait list will go and the api will be available to

S2

Speaker 2

02:28

everybody but for now while the wait list exists why not click on this screen shot which will take you through to the sign up page and you can join the waiting list there if it still exists ok so what are we going to build

S1

Speaker 1

02:41

可以 加入 如果 我們 怎麼

S2

Speaker 2

02:42

我們 ai 這個 一個 一个 我们 gpt - 4 一个 know it all

S1

Speaker 1

03:03

什么

S2

Speaker 2

03:03

我们 firebase 使 可以

S1

Speaker 1

03:11

时间 把它 to create an ask me anything chat bot called know it all and we 'll use a google firebase database so the user can persist the conversation they have with the chat bot and pick it up

S2

Speaker 2

03:11

at a later date after refreshing the browser last ly we 're going to stay with the chat bot concept but under the hood everything will be different we will enter the world of fine

S1

Speaker 1

03:21

-

S2

Speaker 2

03:21

t uning this is where we upload our own dataset and we create a chat bot that can answer specific questions

S1

Speaker 1

03:26

我们 世界 就是 我们 自己 然后 我们 一个 可以

S2

Speaker 2

03:26

问题 自己 非常 重要 如果 你想 使 问题 我们 一个 非常 就是 使 sec ret keys ap i 我们 net l ify 一个 可以 分享 我们 ap i 问题 现在 我们 没有 我们 v an illa j ava script 相信 j ava script 不是 非常 in front

S1

Speaker 1

04:11

- end projects now there are not too many prere quis ites for this course we 're going to be working in vanilla javascript and i 'll assume you have a

S2

Speaker 2

04:11

reasonable knowledge of it now the javascript in this isn 't very complicated for the most part as long as you understand the basics of a fetch request you 'll be absolutely fine and if you 're rusty on fetch requests don 't worry at all we 'll actually go through it all step by step and i don 't think you 'll have a problem a part from that we 'll be focusing fully on the ai and working through

S1

Speaker 1

04:28

it 完全 問題 如果你

S2

Speaker 2

04:29

我們 問題

S1

Speaker 1

04:29

不會 問題 我們 ai

S3

Speaker 3

04:30

問題 我是

S2

Speaker 2

04:33

我的 tom ch ant 你可以 tw itter 我的 t p chant 很好 這個 現在 開始 之前 為什麼 s cri mb a d isc ord 今天 i will 頻道 知道 開始 這個 所以 一起 d isc ord 然後 我們 直接 第一個

S3

Speaker 3

05:08

200 6

S2

Speaker 2

05:13

t erry ross io bill mars ili d enz el washington d é vu 5 美元 180 美元 你們

S1

Speaker 1

05:18

d é vu

S2

Speaker 2

05:19

相信 你們 一定 相信 你們 不會 因為 相信 你們 不會 因為 相信 你們 不會 因為 相信 你們 不會 bill mars ili sold the rights to the den zel washington film de ja vu for a record breaking

S1

Speaker 1

05:26

$

S2

Speaker 2

05:26

5 million and it went on to gross more than $ 180 million worldwide have you ever dreamed of making it big in the movies coming up with that one idea that will make you rich be yond your wild est dreams well the most successful projects start with one single idea but once you 've had that idea you need to work with it

S1

Speaker 1

05:43

一個 你的 開始 只有 一個 這個 需要

S2

Speaker 2

05:43

一起 工作 小時 工作 把它 一個 東西 或者 如果 你可以 一個 簡單 ai 工作 以前 現在 這是 非常 簡單 我們 一個 我們 就是 我們 我們 下來 10 15 然後 我們 的是 ai 就是 一個 我們 一些 一個 還有 重要 的是 我們 都是 這個 我們 這個 都是 ai 我們的 我們 ai ap i 我們 我們 如何 調 結果 以及 如何 我們 最後 我們 一個 好的

S1

Speaker 1

07:12

and how we can use examples to train the model we 'll be looking at extracting information from texts and also generating images just with words and by

S2

Speaker 2

07:12

the end of all that we 'll have a great foundation in how to use open ai in front - end projects now i want to give you a warning as we build this project the api key for open ai will be sat there on the front end and that means it 's visible any body could go in through dev t ools to the network tab and they could steal your api key now while you 're developing locally that is fine but don 't share your project with an api key or publish it to github with out ignoring the api key because that will compromise the api key now later in

S1

Speaker 1

07:44

this course 需要 你的 ap i 现在 问题 但是 不要 分享 你的 一个 ap i 一起 或者 g it hub ap i

S2

Speaker 2

07:44

因为 ap i 现在 我们 看看 如何 安全 ap i 没有 看到 注意 事情 你的 ap i 好了 我们 ht ml c ss 我們 看看 我們 已經 然後 我們 直接 ai ind ex ht ml 裡面 沒有 什麼 特別 奇怪 東西 google 我們 play f air pop p ins 然後 下面 我們 一個 header 一個 movie p itch 你可以 看到 然後 下面 一個 main 這個 第一 就是 我們 現在 看到 所有 東西 部分 就是 所有 西 你可以 看到 所以 就是 我们 你可以 看到 我们 这里 他的 我们 h t ml 已经

S3

Speaker 3

08:58

第二 部分

S2

Speaker 2

09:01

我们 这里 部分 这是 我们 ai 目前 我们 不能 看到 这个 部分 因为 如果 我们 看一下 c ss 没有 所以 我们 这个 访 就是 css 这里 很多 可能 什么 奇怪 西 不要 可以 自己 我们 不会 那么 我们 需要 的时候 index js 我們 已經 部分 javascript 已經 我們 已經 工作 我們 text area 我們 已經 這裡 看到 text area 我们 就是 现在 我们 一个 这个

S1

Speaker 1

10:07

S2

Speaker 2

10:07

这个 首先 一下 没有 西 如果 没有 的话 不了 如果 的话 这个 这个 一个 load ing g if 我们 现在 这个 一些 其實 javascript 其實 看到 最後 部分 我們 ai 我們 東西 看看

S3

Speaker 3

10:49

所以 這是 一個

S2

Speaker 2

10:51

一個 ai 只有 一個 可以 我们 s end 我们 我们 看到 一个 svg 我們 我的 現在 我們 現在 需要 開始 ai 我們 需要 ai 我們 ai 世界 之前 我們 需要 我們 如何 ai ap i 就是 我們 如何 這些 接下來 我們 看看 我們 ai api ai 一個 可以 這個 就會 直接

S1

Speaker 1

11:58

open ai api key and that means signing up so why don 't you head over to the open ai homepage and this slide is actually a click able link so if you just click on the screenshot it will take you

S2

Speaker 2

11:59

straight there now when you 're there just pause for a moment to check out some of these really beautiful images that they 've created with their d ali image generation model and we will be looking at image generation later in this course now once you 've feast ed your eyes on the

S1

Speaker 1

12:12

pictures 这里 我们 可以 看到 一些 非常 漂亮 他们 d al i 我们

S2

Speaker 2

12:12

ap i 然后 需要 然后 可以 然后 需要 你的

S1

Speaker 1

12:24

這裡 需要 然後 你可以 你的 然後 需要 現在

S2

Speaker 2

12:24

你可以 你的 a v atar 然後 view api keys 現在 他們 ap i key 一次 第一 之後 就會 這個 所以 記得 安全 地方 如果你 去了 不要 這裡 你可以 然後 所有 ap i 一樣 記得 我們 這個 看到 我的 ap i 把它 好的 这是 ap i 现在 我们 这里 我们 的话 如果 我们 这里 使 我们 一个 这里 我们 可以 看到 我們 多少 時間 一些 到了 18 美元 已經 起來 已經 差不多 完成 但是 已經 一個 所以 發現 時間 使 一個 現在 我們 ap i 我們的 第一 準備 我們 開始 現在 我們 ap i 我們 可以 開始 使 ap i 我們 完成 第一 之前 我們 需要 一個 ap i 現在 我們 可以

S1

Speaker 1

13:56

使 api 我們 需要 完成 第一 f etch

S2

Speaker 2

13:56

我們 需要 api 我們 open ai 然後 doc s 可以 現在 open ai 第一

S1

Speaker 1

14:10

需要 这里 d oc s 一个 可以 现在 open ai

S2

Speaker 2

14:10

d oc s 第一 告诉 我们 完成 我们 ap i 很有 完成 我们 一下 我们 之前 可能 什么 完成 完成 open ai 比如 你想 一些 比如 你想 知道 第一 我们 这个 问题 open ai ap i 一下 一個 完成 這個 完成 當然 · open ai 世界 完成 一個 ap i 你的 我們 完成 d oc s 這裡 我們 很多 以及 一些

S1

Speaker 1

14:58

我们

S2

Speaker 2

14:58

可以 看到 一些 node js php cur l 但是 我想 的是 这个 我们 api 这里 告诉 我们 我们 可以 使 post 現在 我們 這個 我們 index js 然後 把它 一個 const ur l 一個 sc rim 我們 開始 一個 f etch 我們 開始 這個 api f etch 出來 我們 需要 f etch 然後 我們 然後 我們 完成 我們 這個 這裡 ur l 我们 开始 这个 ap i

S1

Speaker 1

15:42

所以 我们 需要 然后 我们 然后 我们 完成 然后 我们 这里

S2

Speaker 2

15:42

这个 ur l 现在 我们 需要 一个 这个 需要 如果 我们 我们 知道 告诉 我们

S1

Speaker 1

15:55

这个 我们 需要 一个 m et hod h ead ers b ody 如果 我们 d oc s 我们 知道 这个 m et hod p ost

S2

Speaker 2

15:57

告诉 我们 d oc s 没有 我们 j ava script f etch re quest 我们 一个 c ur l 我们 可以 所以 我们 我们 h ead ers 需要 一个 app lic ation j son 我们 需要 一个 ap

S1

Speaker 1

16:12

i

S2

Speaker 2

16:12

a uth or ization of bear er 所以 我们 现在 我们 需要 一个 就是 我们 open ai 需要 一个 一个 所以

S3

Speaker 3

16:34

这里 然后 j son string ify 然后

S2

Speaker 2

16:41

S1

Speaker 1

16:43

一个 open ai request needs a model and a prompt so i 'll come down here and add the body and then i 'm going to say j son string ify and i 'll pass in an object with model and

S2

Speaker 2

16:45

prompt now if we look back at this screenshot it actually gives us a model right here text - da v inci - 00 3 我們 這個 然後 一個 我們 完全 明白 我們 沒有 ai 是什麼 或者 我們 沒有 什麼 我想 的是 這個 第一 ap i 我们 然后 我们 现在 注意 ai 很多 可以 使 今天 我们 使 一个 text da v inci 00 3 这个 我们 已经 现在 我们 需要 我们 很多 现在 我们 需要 的是 之前 我们 看到 这个 我们 一个 问题 第一 的人 我们 到了 一个 就是 · 就是 这个 部分 第一 的人 就是 我们 问题 open ai api 4 时候 com plet ion neil armstrong well

S1

Speaker 1

17:57

the prompt is this part who was the first person to walk on the moon the prompt is whatever we ask the open ai api for now

S2

Speaker 2

17:57

sometimes prompts are really really simple just like this and sometimes they are really very complex as you will see a bit later in this course now they give us an example prompt in the docs say this is a test which to be honest is not very creative so instead of using that i 'm going to ask an easy but real world question for this prompt i 'm just going to say what is the capital of spain and that is all we need to do for a simple prompt we just put it in a string ok now we need to change some then s

S1

Speaker 1

18:27

这是 西 就是 我们 需要 一个 现在 我们 需要 一些

S2

Speaker 2

18:28

then 我们 j son 然后 我们 这个

S1

Speaker 1

18:35

S2

Speaker 2

18:35

然后 把它

S3

Speaker 3

18:36

我们 然后

S2

Speaker 2

18:40

我们 看到 一个 只是 我的 部分 为什么 现在 看看 不能 一些 看看 这个 看到 其实 be are r 然后 ap i 我觉得 就是 问题 我们 看到 我们 这样 我们 清楚 我们 可以 看到 这是 一个 很多 我们 这个 一些 现在 我们 需要 注意 一个 西 因为 open ai 我們 知道 世界 知道 我們 其實 所以 現在 一些 東西 我們 這個

S3

Speaker 3

19:40

这个 然后 我的 一些 西

S2

Speaker 2

19:47

一些

S3

Speaker 3

19:50

我们 然后

S2

Speaker 2

19:52

这里 我们 这里 我们 的是 现在 ai 我们 我们 c pu 就是 我们

S1

Speaker 1

20:12

的是 ai 現在 一樣 c pu

S2

Speaker 2

20:12

就是 我們 我們 我們 東西 出來 然後 把它 我們的 我們 t ex da vin ci 00 3 it 's still shroud ed in mystery but i want you to get your hands on the keyboard start getting practice start building muscle memory before i do any more talking so let 's move on to a challenge with this next ok so back in our app we 've got an event listener right here

S1

Speaker 1

20:42

所以 我们 一个 我们 我们 一个

S2

Speaker 2

20:42

使 我们 什么 一个 我们 看到

S1

Speaker 1

20:56

這個 使 我們

S2

Speaker 2

20:56

我們 看到 我們 準備 完成 使 所以 現在 這個 if 如果 現在 這個 這個 應該 我們 這個 我們 我們的 我們 我們 現在 一個 ap i 我們 可以 這個 我們的 當然 之後 我們 使 ai 我們 使 我們的 現在 我們 ai 簡單 所以 這裡 一個

S3

Speaker 3

21:37

f etch b ot rep ly 然後

S2

Speaker 2

21:39

這裡 這個

S1

Speaker 1

21:43

S3

Speaker 3

21:44

現在

S2

Speaker 2

21:45

這裡 一個 就是 完成 這個 把它 這個 因為 這裡 我想

S3

Speaker 3

21:54

地方 所以 你的

S1

Speaker 1

21:55

就是 這個 现在 你的 时间 这里 一个 就是 完成 这个 这里 这个 因为 这里 我要

S2

Speaker 2

21:56

所以 你的 我要 一个 f etch request open ai api 已經 所有 需要 這裡 所以 自己 api 這裡 這是 url 現在 應該 一個 5 知道 怎麼 因為 我們 事情 就是 一個 現在 需要 完成 现在 开始 之前 我想 第一 如果 完成 不是 你想 或者 我们 一些 使 問題 問題 這個 的是 所以 我們 完成 第二 之前 看看 我們 需要 不要 很多 出來 這些 你的 現在 這個 我們 分鐘

S1

Speaker 1

23:08

再見 你的

S2

Speaker 2

23:08

现在 这个 希望 很好 我们 现在 一个 f etch re quest 我们 我们

S1

Speaker 1

23:24

这里 ur

S3

Speaker 3

23:24

l 这里 然后 我们

S2

Speaker 2

23:26

这个 我们 知道 这个 p

S3

Speaker 3

23:30

ost 然后 我们 需要 一个 h ead er 这个

S2

Speaker 2

23:33

一个 第一 就是 app lic ation j son 第二 一个 be ar er ap i 然后 我们 需要 需要 一个

S3

Speaker 3

23:53

一个 首先 我们 j son string ify 然后 我们 一个

S2

Speaker 2

24:02

da v inci 00 3

S3

Speaker 3

24:05

S2

Speaker 2

24:06

我要 一点 因为 我们 这样 我们 我们 一些 v enn 便 我们 可以

S3

Speaker 3

24:19

我们 j son 然后 我们

S2

Speaker 2

24:24

然后 把它

S1

Speaker 1

24:27

S2

Speaker 2

24:29

ok 我们 便 这个 我们 需要 s end 我们 已经 svg 如果 这个 我们 看到

S1

Speaker 1

24:41

我们 已经 完成 and to fire up this function all we need to do is hit the send button and we 've got the loading sv g and if i open up the console there we are

S2

Speaker 2

24:41

it looks like we 've got our completion let 's just copy and paste that into the editor and we can see we 've got these two words right here exc ited ly enthusiastic so it 's taken our prompt very very literally now the next thing that i want to do is actually get this completion to appear inside the speech bubble so i 'm just going to delete this challenge text so we 've got a little bit more room to work with now we 've already taken control of the text in the speech bubble we 've got the elements stored up here in this const movie

S1

Speaker 1

25:13

boss text 現在 這個 我們 我們 已經 我們 已經 這個

S2

Speaker 2

25:14

所以 我們 這裡 不是 東西 一個 然後 mo vie b oss t xt inner text 现在 我们 需要 完成 我们 完成 这里 所以 我们 需要

S3

Speaker 3

25:33

d ata cho ices cho

S2

Speaker 2

25:37

ices 一个 ar ray 我们 0 第一 ar ray 一个 ar ray 然后 我们 一个 text 好的 我们 需要 这个 然后 我们 看到 我们 现在 我们 问题 我们 因为 c ss 不能 这么 或者 就是 目前 情况 因为 不会 我们 这个 我们 完成 线 这里 我们 一下 首先 需要 所以 我们 可以 open ai 问题 我们 工作 但是 我们 之前 我们 需要 一下 所以

S1

Speaker 1

26:42

我們 可以 使 ai 這些 我們 工作 之前

S2

Speaker 2

26:42

我們 需要 因為 我們 使 t ex t da v inci 00 3 我們的 現在 我們 這是 一個 ai 簡單 來說 ai 一個 我们 现在 我们 这是 一个 ai

S1

Speaker 1

27:09

ai 一个 使

S2

Speaker 2

27:09

open ai 不同 所以 目前 兩個 gpt - 3 gpt - 3 5 gpt - 4 gpt - 4 b eta 這些 可以 還有 code x 這些 以及 可能 看到 使 没有 open ai 一个 可以 安全 这个 我们 使

S1

Speaker 1

28:50

text da v

S2

Speaker 2

28:50

inci 00 3 text ada 00 1

S1

Speaker 1

28:57

都是 所以 t x - 00 3 t x - a id a - 00 1

S2

Speaker 2

28:58

所以 便 一下 open ai 现在 q i ury bab bage a id a t x - 00 3 可能 可以 一些 所有 你想 你想 什麼 比較 便

S1

Speaker 1

29:22

可能

S2

Speaker 2

29:23

S1

Speaker 1

29:23

S2

Speaker 2

29:23

便

S1

Speaker 1

29:24

S2

Speaker 2

29:25

因为 现在 u x ap i 因為 很多 目前 我們的 沒有 我們 只是 一些 完成 我們的 我們 看到

S3

Speaker 3

29:46

時間 現在

S2

Speaker 2

29:49

可能 什麼 我的 open ai 然後 時間 所以 基本 你的 開心 它的 然後 便 看看 現在 而且 可能 所以 一些 一個 我想 非常 一個 好的 自己 我們 繼續 一個 我想 你看 非常 可以 我們 ai 第一個 特別 gp t tools com 這是 他們 p rom pt compare tool 當然 這個 一個 可以 他們 使 這個 ap i 這裡 然後 兩個 ap i

S1

Speaker 1

30:59

g pt ools com 这是 他们 当然 这个 一个 可以 他们 使 这个 你的 ap i

S2

Speaker 2

30:59

这里 然后 ap i 不同 所以 我们 open ai p ablo picasso 我们 到了

S1

Speaker 1

31:12

ap i calls side by side using different models

S2

Speaker 2

31:12

so let 's just ask open ai for a description of pablo picasso 's artistic style and there we are i 've put the same prompt on each side now for the first one i 'll use the model or engine as they call it here of text da v inci 00 3 which is the same as we 're using in our app and for the second one i 'll use text c ur y 00 1 which is one of the

S1

Speaker 1

31:25

older models 使 t xt c ur y 00 1

S2

Speaker 2

31:26

下面 這裡 很多 把它 一樣 現在 我們 可以 結果 第一個 的是 c ur ie 簡單 然後 我們 da v inci 我們 注意 大的 de vin ci 我們 比較 我們 可以 看到 這裡 5 8 1 1 我們的 我們

S1

Speaker 1

32:08

S2

Speaker 2

32:08

所以 我們 t ex ta v inci 00 3 可以 一些 使 它的 所以 很有 第二 大家 open ai 就是 open ai play ground 可以 play ground 一个 非常 你可以 一些 或者 可以 这里 自己 我們 p icas so 我們 我們 可以 看到 我們 結果 可以 不同 可以 這裡 當然 不會 看到 結果 可以 我們 這個 看看 認為 地方 時候 可以 這裡 包括 現在 node js python c

S1

Speaker 1

33:25

ur l

S2

Speaker 2

33:25

已经 node js 如果 我们 我们 可以 看到 不是 我们 已经 如果 我们 第一 require 一个 de pe nd ency 所以 目前 我们 不能 这个 我们 可以 js 很多 比如 我们 这个 但是 api 觉得 我们 我们 已经 基本 f etch 使 open ai 我们 时间 我们 一个 我们 f etch 使 open ai 準備 目前 我們 使 f etch ap i 現在 我們 事情 調 一些 open ai we 'll see you there 我们 可以 d oc s 我们 看到 这个 n ode js 我们 可以 这个 一个 我们 一个 我们 需要 open ai

S1

Speaker 1

34:46

我们

S2

Speaker 2

34:47

open ai api 我们 使 import 需要 因为 我们 没有 n ode js 工作 我们 ap i 一个 我们 一点 然后 我们 使 open ai 然后 我们 可以 我们 首先 我们 这里 一个 en v js 現在 不能 看到 這個 但是 你的 看到 一個 然後 你可以 這個 en v js 我们 可以 看到 这个 现在 因为 我们 工作 这个 完全 如果 这个 当然 g it hub 需要 但是 今天 我们 也是 我们 地方 我们

S1

Speaker 1

35:59

看看 如何

S2

Speaker 2

35:59

安全 ap i 完成 你的 然后 就可以 分享 你的 工作 使 你的 这个 en v 一个 const

S3

Speaker 3

36:12

这个 const process process 一个

S2

Speaker 2

36:17

这个 我们 一个 en v 这个 open ai api key 这个 一个 那么 这个 我们 api 所以 我们 这个 index js 现在 我们 这样 这个 我们 这个 现在 我们 api 已经

S1

Speaker 1

36:58

一个 地方 我们 这个 仿 如果 这个 一个 这个 现在 我们 ap i 已经

S2

Speaker 2

36:59

一个 地方 不同 ap i 需要 一個 地方 你的 ap i 我們 index js 我們 那個 上面 import 然後 c ur ly br aces 我们 需要 pro cess 然后 我们 需要 from 现在 我们 需要 我们 就是 sl ash en v 可以 因为 ind ex js 如果 我们 我们 已经 这个 type

S1

Speaker 1

37:36

="

S2

Speaker 2

37:37

mod ule " 所以 知道 m od ular javascript 现在 我们 所以 这个 ap i key 然后 一个 c onst ap i key 然后 process 我们 ap i key 現在 的是 這個 api

S1

Speaker 1

37:55

然後 一個 const api 然後 我們 api

S2

Speaker 2

37:56

所以 process 然後 我們 需要 en v 然後 open ai api 我們 這裡 我們 看到 我們 我們 現在 ap i 我們 地方 接下來 我們 open ai

S1

Speaker 1

38:21

我们 下一 s cr im

S2

Speaker 2

38:27

我们 open ai s cr im b ar 3 d ot 可以 s cri mb ler

S1

Speaker 1

38:41

非常 容易 3 部分 沒有

S2

Speaker 2

38:41

一個 需要 需要 open ai add s cri mb a 已经 所有 工作 如果 你在 s cri mb a 工作 可能 你在 you tube 或者 v sc ode 自己 我們 如何 s cri m 時間 使 open ai 現在 我們 已經 我們 需要 這個 兩個 我們 看看 這個 我們 需要 open ai api 第一 使 re qu ire 我们 import 所以 我们 这里 然后 import 我们 需要 con fig uration open ai api 注意 一下 ai 这里 第一 看到 现在 我们 open ai 我们 一下 我的 ty pos 第一

S1

Speaker 1

39:55

事情 第一 看到 部分 現在 我們 open ai 我們 我的

S2

Speaker 2

39:56

我們 首先 所以 這裡 const con fig uration 一个 c 这个 我们 可以 看到 这里 我们 需要 api 我们 现在 已经 需要 这里 现在 我们 需要 使 第二 open ai api 这里 一个 c onst open ai open ai api 我们 需要 这里 一个 ai ap i 所以 我们 需要 这个 这个 看到 这个 因为 之前 我们 一个 奇怪 现在 我们 可以 所以 我们 需要 这个 ur l 我们 需要 这个 ap i 这里 我们 其实 只是 这里 所以 我们 所有 这个 然后 一个 我们 这个 f etch b ot rep ly 我们 这里 很多 好了 这里 我们 这里 很多 我们

S1

Speaker 1

41:28

when you ready for that i 'll see you there so we 're going to tidy up this function a lot all we actually want to keep is the model and the prompt so

S2

Speaker 2

41:30

i 'm just going to delete everything else now i am going to keep this line right here where we update the speech bubble but i 'm just going to comment it out for now and we 'll need to make a few changes to it in a moment 所以

S1

Speaker 1

41:41

所有 東西 現在 這個 這裡 我們 只是 這裡 留言 我們 需要

S2

Speaker 2

41:41

一些 現在 這裡 一個 c onst 現在 我們 這裡 我們 可以 我們的 ai

S3

Speaker 3

41:52

api 所以 記得 我們 已經 這裡

S1

Speaker 1

41:56

一個 c onst 现在 我们 这里 我们 可以 我们 open ai api 我们

S2

Speaker 2

41:56

已经 我们 需要 告诉 使 cre ate com

S3

Speaker 3

41:59

plet ion end point 然后 他们

S2

Speaker 2

42:04

我们

S1

Speaker 1

42:07

S2

Speaker 2

42:07

一个 所以 我们 现在 我们

S3

Speaker 3

42:12

S2

Speaker 2

42:14

我们 一个 s y nt ax er ror 所以 这里 问题 现在 我们 看看 希望 你们 因为 我们 这里 使 a wait 所以 我们 需要 这个 as ync ok

S1

Speaker 1

42:40

so hopefully you figured out that because we 're using the await keyword right here we actually need this

S3

Speaker 3

42:41

function to be as ync ok

S2

Speaker 2

42:43

let 's try that again and we 're not getting any errors so i 'll press the button and there we are we 're getting our response and if we look down in the console we 're getting the completion excited passionate eager

S1

Speaker 1

42:55

我们 没有 所以 然后 我们 看到 我们 如果 我们 我们 看到 完成

S2

Speaker 2

42:55

需要 一点 我们 把它 这里 然后 所以 我们 需要

S3

Speaker 3

43:06

所以 response

S2

Speaker 2

43:09

d ata cho ices 然后 我们 0 我们 我们 看到 现在 这个 c ons ole log 可能 我们 这里 很多 如果 一些 西 c ons ole 看到 完成 一个 j ava script 如何 開始 現在 然後 這個 希望 記得 我們 可以 所以 部分 现在

S1

Speaker 1

43:57

然后 希望 你们 我们 可以 所以 部分

S2

Speaker 2

43:58

这样 现在 之前 c ss 不是 这么 完成 我们 我们 已经 看到 open ai 现在 的是 如何

S1

Speaker 1

44:23

S2

Speaker 2

44:23

所以 我想 open ai 我们 但是 我们 之前 我们 s cri mb a 我们 所以 下一 如果 你在 s cri mb a 工作 或者 已经 你可以 下一 然后 直接

S1

Speaker 1

44:52

好了 我们 开始 就可以 下一 直接 準備 好了 我們 開始 我們

S2

Speaker 2

44:56

看看 如何 vs code ai 首先 我們 這個 s cr im 需要 s cr im ber 需要 這個 c og 一個 一個 zip 需要 你的 pc 這個 pack age 然後 v sc ode

S1

Speaker 1

45:22

S2

Speaker 2

45:22

這個 所以 只是 一個 這個 一個 非常 當然 你可以 把它 你想 現在 這個 裡面 這個 read me for a reason 我們 看看 基本 告訴 我們 我們 需要 n pm install n pm start 我們 需要 這個 然後 我們 看到 這個

S3

Speaker 3

45:53

這裡

S2

Speaker 2

45:55

我們 可以 n pm install 比較 一點 大家 可以 n pm install 事情 完成 之後 這裡 你可以 n pm start 一次 事情 最後 這個

S1

Speaker 1

46:14

S2

Speaker 2

46:14

看到 這個 所以 現在 這裡 這個 我們 需要 這個 這個 你的 ip 這個 p ort 所以 這個 p ort 5 17 3 現在 你可以 你的 ip 然後 這個 這個 p ort 容易 這個 mac comm and wind ows cont rol 然後 這個 就會 然後 就會 你的 你的 你可以 看到 l ocal host 但是 ip 我們 ai 開始 工作 我想 一點 我們 有一 這個 我們 需要 把它 一點 個人 比較 喜歡 把它 可能 地方 所以 這個 地方

S3

Speaker 3

47:16

一下 好吧

S2

Speaker 2

47:18

感覺 這樣 使 完全 重要 我們 個人 ai 目前 我們 一個 比較 基本 多少 所以 我們 一個 如果 我们 s end 我们 看到 一个 谢谢 我们 可以 自己 我想 这个 现在 的是 使 如果 没有 如果 的话 svg 我们 第一 我也 把它 f etch b ot 如果 我們 個人 那麼 我們的 需要 使 東西 所以 我們 東西 把它

S3

Speaker 3

48:21

使 然後 我們

S2

Speaker 2

48:23

使 我們 f etch b ot 所以 我们 把它 一个 使 然后 我们 使 我们 f etch bot 然后 我们 把它 f etch bot 一个 因为 一个

S3

Speaker 3

48:32

现在

S2

Speaker 2

48:35

就是 现在 现在 这里 把它 这个 因为 这个 所以 我想 這個 ai 一個 需要 分鐘 現在 我們 可以 這個 這個 一個 可能 這個 ai 這是 當然 你可以 不要 你想 什麼 in verted

S1

Speaker 1

49:28

comm as or speech marks to signal to open ai that this is a chunk of text that you 're referring to with the rest of the prompt and of course you can experiment with the wording but don 't be afraid to just ask for what you

S2

Speaker 2

49:29

want there 's not one correct way of writing this prompt and afterwards i 'll show you my way now just before you do that i 'm going to do you a favor i 'm actually going to break the rules again and add a line of code here that we haven 't talked about yet now i want to do that

S1

Speaker 1

49:43

一個 這個 然後 大家 我的 現在 這個 之前 一個 然後 我們

S2

Speaker 2

49:43

這樣 因為 知道 我們 已經 很多 我們 已經 很多 但是 沒有 時間 所以 這個 因為 如果 沒有 這個 非常 然後 我們 所以 現在 的是 這個

S3

Speaker 3

50:03

max tok ens 60

S2

Speaker 2

50:07

現在 不要 這個

S3

Speaker 3

50:09

這個 我們

S1

Speaker 1

50:17

看看

S2

Speaker 2

50:20

希望 這裡 完全

S1

Speaker 1

50:26

這個 ok so hopefully you managed to do that just fine so i 'm going to come

S2

Speaker 2

50:26

in here and i 'm going to completely replace this prompt and what i 'm going to say is this g ener ate a short message to enthusi astically say outline sounds interesting and that you need some minutes to think about it m ention one aspect of the sentence so you 'll have noticed that i 've put outline in inverted comm as

S1

Speaker 1

50:42

一个 很有 需要 一个 部分

S2

Speaker 2

50:43

ai 明白 我想 另外 希望 open ai

S1

Speaker 1

50:52

S2

Speaker 2

50:52

当然 我们 需要

S3

Speaker 3

50:56

好的

S2

Speaker 2

50:59

我们 一个 线

S3

Speaker 3

51:02

这里

S2

Speaker 2

51:05

线 一个 我们

S1

Speaker 1

51:10

一個 然後 一個

S2

Speaker 2

51:11

我們 我們 到了 一個 非常 完成 如果 只是 一下 看到 我們 一個 我們 我們 我們的 就是 我們 現在 我們

S1

Speaker 1

51:28

com plet ion and if you just read through that you can see that is actually like we 're interacting with a human it 's being convers ational it 's referring to our idea and that is exactly what we want now down in the console we 've

S2

Speaker 2

51:29

got the response and just bear with me while i copy and paste something from there now before i explain why i 've done that i 'm just going to actually use the same idea again but this time i 'm going to remove this line of

S1

Speaker 1

51:42

code 這裡 一些 東西 現在 為什麼 這樣

S2

Speaker 2

51:42

這個 之前 之前 已經 所以 我說 一個

S1

Speaker 1

51:49

S2

Speaker 2

51:49

我們

S3

Speaker 3

51:53

看看 什麼 我們 看到 我们

S2

Speaker 2

51:55

到了 但是 一个 线 一个 然后 我的 现在 只是 西 我们 可以 看到 第一 完成 我们 第二 完成 所以

S1

Speaker 1

52:28

我們 完成 原因 第二 完成 不是 完全 完成 我們 完成 原因 所以 來說 完成 原因

S2

Speaker 2

52:28

open ai 沒有 我們 所有 最後 我們 看到 完成 59 第一 完成 16 第二 所以 我們 事情 完成 現在 一個 應該 知道 我們 可以 完成 一定 max tok ens 我們 开始 使 max tok ens 我们 open ai 一個 t oken 以及 這個 60 意思 下一 影片 我們 t oken max t oken 準備 開始 我們 t oken max t oken 我們 知道 我們 這個 60 max t oken ok

S1

Speaker 1

53:27

我们 t ok ens ma x t ok ens 我们 知道 我们 60

S2

Speaker 2

53:28

ma x t ok ens ap i 我们 很多 我们 知道 如果 我们 ma x t ok ens 我们 而且 就是 我们 现在 看到 那么 到底 什么 情况 t ok ens 什么 t ok ens open ai 使 事情 可能 因为 但是 我们 工作 所以 我们 需要 可能 觉得 意思 一个 其实 不是 那么 75 % 所以 100 t oken 75 所以 我們 這個 f etch 60 t oken 我們 40 我們 沒有 使 這個 16 我們 看到 我們的 需要 來說 所以 這是 一個 重要 如果 沒有 你的 完成 所以 text 所以 現在 可能 ok 一個 t oken text 為什麼 需要 好的 你的 max t oken 不會 問題 就是 如果 你看 一個 如果 你看 一個 ai 其實 所有 你的 所以 可能 一個 t oken 但是 為什麼 可以 知道 t oken 可以 一個 而且 需要 時間 一個 如果你 就可以 當然 非常 重要 一個 為什麼 現在 我們 需要 max tok ens 重要 max tok ens 我們 我們 看到 我們 一個

S1

Speaker 1

56:16

ai

S2

Speaker 2

56:16

max tok ens 怎麼 使 我們 應該 把它 ai 我們 所以 可能 需要 一點 api 那麼 我們 如何 我們 我們 我们 open ai 我们 其实 我们 我们 max t oken 60 只是 所以 我们 这个 我们 一些 現在 我想 繼續 所以 我們 開始 下一 ap i 就是 我們的 一個 準備 我們 開始 我們

S1

Speaker 1

57:26

我们 可以 这里 一个 我们 好了 我们

S2

Speaker 2

57:26

开始 我们 已经 到了 现在 我们 把它 一个 我们 这里 一个

S3

Speaker 3

57:36

f etch s yn ops ys 当然 一个 as ync

S2

Speaker 2

57:43

完成 我们 这个 我們的 使 完成 就會 出來 下面 出來 如果 我們 看看 h t ml 這裡 一個 部分 包括 所有 下面 這個 包括 目前 這個

S1

Speaker 1

58:13

部分 所有 这个 下面 所有 目前 这个

S2

Speaker 2

58:13

def ault 如果 我们 ind ex c ss 然后 我们 现在 那个 现在 下面 所以 f etch s yn ops ys 现在 的是 这个 我们 这里 id 然后 我们 就可以 这里 工作 所以 我们

S3

Speaker 3

58:40

document get e

S2

Speaker 2

58:42

lement by id 然后 id output - text 我們 我們 api 我們 可以 這裡 直接 這個 因為 一個 情況 我們 open ai 一個 一個 現在 這個 裡面 這裡

S1

Speaker 1

59:10

open ai 一个 一个 现在 这个

S2

Speaker 2

59:11

然后 我们 第一

S3

Speaker 3

59:15

然后

S2

Speaker 2

59:17

因为 需要

S3

Speaker 3

59:20

当然

S2

Speaker 2

59:23

我们 把它 一个 然后 现在 大的 把它 这里 我想 一个 ap i max t oken 一个 使 当然 我们 这个

S1

Speaker 1

59:53

S2

Speaker 2

59:53

不要