File size: 84,956 Bytes
31b6e27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
{
 "cells": [
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import dataclasses\n",
    "import pandas as pd\n",
    "from tqdm.auto import tqdm, trange\n",
    "\n",
    "import dotenv\n",
    "import openai\n",
    "import requests"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T22:19:14.165364Z",
     "start_time": "2024-05-22T22:19:14.133654Z"
    }
   },
   "id": "134eed9b62408edc",
   "execution_count": 153
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "True"
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dotenv.load_dotenv()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T20:28:08.220256Z",
     "start_time": "2024-05-22T20:28:08.216074Z"
    }
   },
   "id": "5b95753383405dc2",
   "execution_count": 12
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "def get_youtube_title(url: str) -> str:\n",
    "    video_id = url.split(\"v=\")[-1]\n",
    "    api_url = f\"https://www.youtube.com/oembed?url=http://www.youtube.com/watch?v={video_id}&format=json\"\n",
    "    response = requests.get(api_url)\n",
    "    if response.status_code == 200:\n",
    "        data = response.json()\n",
    "        return data['title']\n",
    "    else:\n",
    "        return \"Error retrieving title\"\n",
    "\n",
    "# video_url = \"https://www.youtube.com/watch?v=4E2EbGoXlPQ\"\n",
    "# title = get_youtube_title(video_url)\n",
    "# print(title)\n"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T22:18:03.386331Z",
     "start_time": "2024-05-22T22:18:03.380694Z"
    }
   },
   "id": "826f159b67e1db55",
   "execution_count": 146
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "  0%|          | 0/17 [00:00<?, ?it/s]",
      "application/vnd.jupyter.widget-view+json": {
       "version_major": 2,
       "version_minor": 0,
       "model_id": "4302559abc764782871512856754d078"
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "links = pd.read_csv(\"links.csv\").URL.tolist()\n",
    "titles = [get_youtube_title(link) for link in tqdm(links)]"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T22:19:17.790790Z",
     "start_time": "2024-05-22T22:19:16.254979Z"
    }
   },
   "id": "25437071fe6d6477",
   "execution_count": 154
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "episodes = []\n",
    "\n",
    "for i in range(17):\n",
    "    filename = f\"transcripts/{i}.vtt\"\n",
    "    with open(filename, \"r\") as file:\n",
    "        data = file.read()\n",
    "        episodes.append(data)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T20:27:57.385211Z",
     "start_time": "2024-05-22T20:27:57.380225Z"
    }
   },
   "id": "99dd1095d28bcc31",
   "execution_count": 10
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "[2.1432059577585156,\n 0.279819313881089,\n 3.282505188621658,\n 2.076791600537175,\n 2.153216945427909,\n 1.9267488707117568,\n 1.808448296911244,\n 1.7863508729092907,\n 2.1497985593944575,\n 1.8603345134904163,\n 1.9416432670003663,\n 2.266634110609205,\n 1.9544622146258088,\n 0.2497863508729093,\n 0.5919912098644854,\n 2.005005493834697,\n 0.2887315346111586]"
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import tiktoken\n",
    "import math\n",
    "\n",
    "def num_tokens_from_string(string: str, encoding_name: str) -> int:\n",
    "    \"\"\"Returns the number of tokens in a text string.\"\"\"\n",
    "    encoding = tiktoken.get_encoding(encoding_name)\n",
    "    num_tokens = len(encoding.encode(string))\n",
    "    return num_tokens\n",
    "\n",
    "def required_chunks(text: str, max_tokens: int = 8191, encoding_name: str = \"cl100k_base\") -> int:\n",
    "    \"\"\"Returns the number of chunks required to fit the text within the token limit.\"\"\"\n",
    "    num_tokens = num_tokens_from_string(text, encoding_name)\n",
    "    num_chunks = num_tokens // max_tokens\n",
    "    if num_tokens % max_tokens != 0:\n",
    "        num_chunks += 1\n",
    "    return num_chunks\n",
    "\n",
    "def split_in_chunks(text: str) -> list[str]:\n",
    "    \"\"\"Split a text into chunks of equal number of tokens.\"\"\"\n",
    "    num_chunks = required_chunks(text)\n",
    "    encoding = tiktoken.get_encoding(\"cl100k_base\")\n",
    "    tokens = encoding.encode(text)\n",
    "    chunk_size = math.ceil(len(tokens) / num_chunks)\n",
    "\n",
    "    chunks = []\n",
    "    current_chunk = 0\n",
    "    for i, token in enumerate(tokens):\n",
    "        if i % chunk_size == 0:\n",
    "            chunks.append(\"\")\n",
    "            current_chunk += 1\n",
    "        chunks[current_chunk - 1] += encoding.decode([token])\n",
    "    \n",
    "    \n",
    "        \n",
    "    return chunks\n",
    "    "
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T20:39:04.247749Z",
     "start_time": "2024-05-22T20:39:04.182789Z"
    }
   },
   "id": "cb5d34291dd2294f",
   "execution_count": 26
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "episode_chunks = [split_in_chunks(episodes[i]) for i in range(17)]"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T21:04:52.893004Z",
     "start_time": "2024-05-22T21:04:52.658609Z"
    }
   },
   "id": "32f2bfff87abe244",
   "execution_count": 72
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "chunk_labels = [f\"Episode {i} - Chunk {j}\" for i in range(17) for j in range(len(episode_chunks[i]))]"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T21:54:17.848294Z",
     "start_time": "2024-05-22T21:54:17.843313Z"
    }
   },
   "id": "9e5d43986fc144ce",
   "execution_count": 130
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "@dataclasses.dataclass\n",
    "class Chunk:\n",
    "    text: str\n",
    "    title: str\n",
    "    video_idx: int\n",
    "    embedding: np.ndarray | None\n",
    "    link: str"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T22:39:40.273669Z",
     "start_time": "2024-05-22T22:39:40.269177Z"
    }
   },
   "id": "3a803b518ec99194",
   "execution_count": 170
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "# chunk_metadata = [\n",
    "#     {\n",
    "#         \"title\": titles[i],\n",
    "#         \"video_idx\": i,\n",
    "#         \"chunk_idx\": j,\n",
    "#         \"text\": episode_chunks[i][j],\n",
    "#         \"link\": links[i],\n",
    "#     }\n",
    "#     for i in range(17)\n",
    "#     for j in range(len(episode_chunks[i]))\n",
    "# ]\n",
    "\n",
    "chunk_metadata = [\n",
    "    Chunk(\n",
    "        title=titles[i],\n",
    "        video_idx=i,\n",
    "        text=episode_chunks[i][j],\n",
    "        link=links[i],\n",
    "        embedding=None\n",
    "    )\n",
    "    for i in range(17)\n",
    "    for j in range(len(episode_chunks[i]))\n",
    "]"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T22:39:43.632154Z",
     "start_time": "2024-05-22T22:39:43.628758Z"
    }
   },
   "id": "42fbe8399eb49e67",
   "execution_count": 171
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "chunks = sum([split_in_chunks(episodes[i]) for i in range(17)], [])"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T22:39:46.243391Z",
     "start_time": "2024-05-22T22:39:46.006589Z"
    }
   },
   "id": "419f98cac7daa965",
   "execution_count": 172
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "chunk_token_counts = [num_tokens_from_string(chunk, \"cl100k_base\") for chunk in chunks]"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T22:39:47.633546Z",
     "start_time": "2024-05-22T22:39:47.561055Z"
    }
   },
   "id": "89d7561fe100143c",
   "execution_count": 173
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "from openai import OpenAI\n",
    "client = OpenAI()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T21:25:49.514879Z",
     "start_time": "2024-05-22T21:25:49.493593Z"
    }
   },
   "id": "688c1ec3b92c3e34",
   "execution_count": 79
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "def get_batch_embeddings(texts: list[str], model=\"text-embedding-3-small\") -> np.ndarray:\n",
    "    embeddings = client.embeddings.create(input = texts, model=model)\n",
    "    np_embeddings = np.array([embeddings.data[i].embedding for i in range(len(embeddings.data))])\n",
    "    return np_embeddings\n",
    "\n",
    "def get_one_embedding(text: str, model=\"text-embedding-3-small\") -> np.ndarray:\n",
    "    embedding = client.embeddings.create(input = [text], model=model).data[0].embedding\n",
    "    return np.array(embedding)"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "b6b8a393180e343"
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "embeddings = get_batch_embeddings(chunks)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T22:40:21.603794Z",
     "start_time": "2024-05-22T22:40:21.601418Z"
    }
   },
   "id": "2249b8b7981e1914",
   "execution_count": 174
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "q_embedding = get_one_embedding(\"Which guest worked at Abercrombie and Fitch?\")"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T21:34:51.814076Z",
     "start_time": "2024-05-22T21:34:51.437910Z"
    }
   },
   "id": "26173f98e6f7d18e",
   "execution_count": 103
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "array([[ 0.05489639, -0.03947796, -0.00708231, ..., -0.0492712 ,\n        -0.0219755 ,  0.00376565],\n       [ 0.04212333, -0.04137598, -0.01890454, ..., -0.04766051,\n        -0.01154145,  0.00671765],\n       [ 0.07459503, -0.04596259, -0.05516139, ..., -0.03984053,\n        -0.00084816, -0.00865723],\n       ...,\n       [ 0.07094361, -0.04828836, -0.03882921, ..., -0.03272748,\n        -0.00387197,  0.00732427],\n       [ 0.05223813, -0.03542471, -0.05290401, ..., -0.03595741,\n         0.00376637, -0.01817847],\n       [ 0.02517771, -0.03395098, -0.05561592, ..., -0.00542056,\n         0.00621656, -0.00047452]])"
     },
     "execution_count": 180,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "embeddings"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T22:40:50.999266Z",
     "start_time": "2024-05-22T22:40:50.996608Z"
    }
   },
   "id": "a49a5f2210f865b2",
   "execution_count": 180
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "def cosine_similarity(query: np.ndarray, embeddings: np.ndarray) -> np.ndarray:\n",
    "    dot_product = np.dot(embeddings, query)\n",
    "    query_norm = np.linalg.norm(query)\n",
    "    embeddings_norm = np.linalg.norm(embeddings, axis=1)\n",
    "    return dot_product / (query_norm * embeddings_norm)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T22:41:00.824586Z",
     "start_time": "2024-05-22T22:41:00.822881Z"
    }
   },
   "id": "4fc76e627325737a",
   "execution_count": 181
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "similarities = cosine_similarity(q_embedding, embeddings)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T22:41:02.728664Z",
     "start_time": "2024-05-22T22:41:02.695358Z"
    }
   },
   "id": "5a83d151ce6edc4d",
   "execution_count": 182
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "best_chunk_idx = np.argmax(similarities)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T22:43:22.403806Z",
     "start_time": "2024-05-22T22:43:22.394255Z"
    }
   },
   "id": "fb23ecfae69da630",
   "execution_count": 191
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "Chunk(text=\"Title:\\n\\n1\\n00:00:00.380 --> 00:00:11.240\\noh I know oh no no no\\n\\n2\\n00:00:06.460 --> 00:00:11.240\\n[Music]\\n\\n3\\n00:00:13.200 --> 00:00:16.440\\nhey what's going on everybody for first\\n\\n4\\n00:00:14.820 --> 00:00:18.240\\nweek Feast I'm Sean Evans and you're\\n\\n5\\n00:00:16.440 --> 00:00:19.980\\nwatching hot ones it's the show with hot\\n\\n6\\n00:00:18.240 --> 00:00:21.779\\nquestions and even hotter wings and\\n\\n7\\n00:00:19.980 --> 00:00:23.520\\ntoday we're joined by Kid Cudi he's a\\n\\n8\\n00:00:21.779 --> 00:00:25.019\\nGrammy award-winning artist multi-hyphen\\n\\n9\\n00:00:23.520 --> 00:00:26.820\\nEntertainer and true to form he just\\n\\n10\\n00:00:25.019 --> 00:00:28.619\\ndropped a brand new album accompanied by\\n\\n11\\n00:00:26.820 --> 00:00:30.599\\nan animated TV special of the same name\\n\\n12\\n00:00:28.619 --> 00:00:32.160\\nit's called Intergalactic check out the\\n\\n13\\n00:00:30.599 --> 00:00:34.020\\nalbum wherever you get your music and\\n\\n14\\n00:00:32.160 --> 00:00:36.300\\nwatch the special which is now currently\\n\\n15\\n00:00:34.020 --> 00:00:38.460\\nstreaming on Netflix Kid Cudi welcome to\\n\\n16\\n00:00:36.300 --> 00:00:39.960\\nthe show thanks for having me man I feel\\n\\n17\\n00:00:38.460 --> 00:00:41.700\\nlike this is one of those shoots been\\n\\n18\\n00:00:39.960 --> 00:00:43.500\\nthat's been literally years in the\\n\\n19\\n00:00:41.700 --> 00:00:45.059\\nmaking yeah what's going through your\\n\\n20\\n00:00:43.500 --> 00:00:46.800\\nhead as you finally prepare to take on\\n\\n21\\n00:00:45.059 --> 00:00:49.079\\nthe hot ones gauntlet\\n\\n22\\n00:00:46.800 --> 00:00:52.620\\nI'm confident that I would make it to\\n\\n23\\n00:00:49.079 --> 00:00:54.239\\nthe end you know but I have no idea what\\n\\n24\\n00:00:52.620 --> 00:00:57.079\\nI want to experience on this journey I'm\\n\\n25\\n00:00:54.239 --> 00:01:00.739\\nreally uh really kind of nervous\\n\\n26\\n00:00:57.079 --> 00:01:00.739\\nI'm not gonna lie\\n\\n27\\n00:01:02.040 --> 00:01:11.120\\n[Music]\\n\\n28\\n00:01:13.470 --> 00:01:20.180\\n[Music]\\n\\n29\\n00:01:17.159 --> 00:01:20.180\\nyeah let's do it\\n\\n30\\n00:01:24.720 --> 00:01:27.259\\nno\\n\\n31\\n00:01:28.020 --> 00:01:32.100\\nI can eat more if I want right\\n\\n32\\n00:01:29.820 --> 00:01:34.400\\ngo ahead and I'll follow you right along\\n\\n33\\n00:01:32.100 --> 00:01:34.400\\nwith\\n\\n34\\n00:01:34.740 --> 00:01:38.840\\noh good\\n\\n35\\n00:01:36.299 --> 00:01:38.840\\noh my God\\n\\n36\\n00:01:42.000 --> 00:01:47.100\\nnice so dating back to the original man\\n\\n37\\n00:01:45.420 --> 00:01:49.619\\non the moon your albums have always had\\n\\n38\\n00:01:47.100 --> 00:01:51.180\\na cinematic Sonic quality to them so I\\n\\n39\\n00:01:49.619 --> 00:01:53.220\\ncan only imagine how cathartic it must\\n\\n40\\n00:01:51.180 --> 00:01:55.020\\nhave been for you to take Intergalactic\\n\\n41\\n00:01:53.220 --> 00:01:57.600\\nand then actually storyboard it out for\\n\\n42\\n00:01:55.020 --> 00:01:59.280\\nan animated adaptation and then costume\\n\\n43\\n00:01:57.600 --> 00:02:01.860\\ndesign it's not a discipline that you'd\\n\\n44\\n00:01:59.280 --> 00:02:03.299\\noften associate with animation but it\\n\\n45\\n00:02:01.860 --> 00:02:05.520\\nreally is at the heart of\\n\\n46\\n00:02:03.299 --> 00:02:07.680\\nintergalactic's aesthetic what role did\\n\\n47\\n00:02:05.520 --> 00:02:10.920\\nVirgil ablo play in shaping the fashion\\n\\n48\\n00:02:07.680 --> 00:02:13.800\\nof this world well um it was really like\\n\\n49\\n00:02:10.920 --> 00:02:15.480\\nI put it all on him you know I really\\n\\n50\\n00:02:13.800 --> 00:02:17.700\\nwent into this knowing that like I\\n\\n51\\n00:02:15.480 --> 00:02:19.980\\nwanted the characters to be fresh I\\n\\n52\\n00:02:17.700 --> 00:02:22.500\\ndidn't want it to be like you know a\\n\\n53\\n00:02:19.980 --> 00:02:24.300\\ntypical animated show where you see one\\n\\n54\\n00:02:22.500 --> 00:02:27.360\\ncharacter wearing the same thing every\\n\\n55\\n00:02:24.300 --> 00:02:29.700\\nepisode you know Virgil came through and\\n\\n56\\n00:02:27.360 --> 00:02:31.920\\njust put his magic sauce on it and just\\n\\n57\\n00:02:29.700 --> 00:02:33.480\\nmade you know wardrobe for each\\n\\n58\\n00:02:31.920 --> 00:02:36.420\\ncharacter in it that matched their\\n\\n59\\n00:02:33.480 --> 00:02:38.340\\npersonality I was so like happy because\\n\\n60\\n00:02:36.420 --> 00:02:40.020\\nI was like oh my God like this is the\\n\\n61\\n00:02:38.340 --> 00:02:41.220\\nbest idea I could ever came up with you\\n\\n62\\n00:02:40.020 --> 00:02:42.660\\nknow we could have been\\n\\n63\\n00:02:41.220 --> 00:02:44.580\\ncould have been in this and making some\\n\\n64\\n00:02:42.660 --> 00:02:46.560\\nreally shitty clothing you know but I\\n\\n65\\n00:02:44.580 --> 00:02:48.360\\nhave like the illest freshest\\n\\n66\\n00:02:46.560 --> 00:02:50.459\\n[\\xa0__\\xa0] alive doing this [\\xa0__\\xa0] for\\n\\n67\\n00:02:48.360 --> 00:02:52.200\\nme and it's in and it was just it was\\n\\n68\\n00:02:50.459 --> 00:02:53.510\\njust the illest man and I love him to\\n\\n69\\n00:02:52.200 --> 00:02:58.080\\ndeath of that you know\\n\\n70\\n00:02:53.510 --> 00:03:02.360\\n[Music]\\n\\n71\\n00:02:58.080 --> 00:03:02.360\\nyeah these first two I need them to go\\n\\n72\\n00:03:03.060 --> 00:03:07.019\\nso in the a man named Scott documentary\\n\\n73\\n00:03:05.099 --> 00:03:09.480\\nplaying Pats as a first working with you\\n\\n74\\n00:03:07.019 --> 00:03:11.940\\nit was so different and weird that I'd\\n\\n75\\n00:03:09.480 --> 00:03:13.739\\nfeel uncomfortable but I love it was\\n\\n76\\n00:03:11.940 --> 00:03:16.019\\nthere a watershed moment maybe it was a\\n\\n77\\n00:03:13.739 --> 00:03:18.780\\nsong maybe it was a show where it went\\n\\n78\\n00:03:16.019 --> 00:03:20.819\\nfrom this sort of experimental Bohemian\\n\\n79\\n00:03:18.780 --> 00:03:23.700\\nexercise to all of a sudden record\\n\\n80\\n00:03:20.819 --> 00:03:27.300\\nlabels and a bidding war for you I think\\n\\n81\\n00:03:23.700 --> 00:03:29.040\\nI think it was the mixtape\\n\\n82\\n00:03:27.300 --> 00:03:30.720\\nbecause the mixtape was playful and fun\\n\\n83\\n00:03:29.040 --> 00:03:32.220\\nand it was just all about like showing\\n\\n84\\n00:03:30.720 --> 00:03:34.379\\npeople I could rap and\\n\\n85\\n00:03:32.220 --> 00:03:37.500\\nyou know the album was like\\n\\n86\\n00:03:34.379 --> 00:03:41.340\\nno this is like the Oscar nominated\\n\\n87\\n00:03:37.500 --> 00:03:43.560\\nversion of an album you know I live with\\n\\n88\\n00:03:41.340 --> 00:03:45.540\\nDOT for almost three years and during\\n\\n89\\n00:03:43.560 --> 00:03:46.860\\nthis time we were making music and made\\n\\n90\\n00:03:45.540 --> 00:03:49.440\\nday and night and a number of other\\n\\n91\\n00:03:46.860 --> 00:03:51.299\\nrecords and from there and then we we\\n\\n92\\n00:03:49.440 --> 00:03:53.879\\nadded a meal and then it was just like\\n\\n93\\n00:03:51.299 --> 00:03:56.280\\nwhen I had those three guys I was I was\\n\\n94\\n00:03:53.879 --> 00:03:58.319\\ngolden and I liked even hearing from a\\n\\n95\\n00:03:56.280 --> 00:04:00.299\\nmeal when he was talking about how he'd\\n\\n96\\n00:03:58.319 --> 00:04:01.980\\nplay you beats that he prepared but you\\n\\n97\\n00:04:00.299 --> 00:04:03.180\\nwouldn't really react to those things it\\n\\n98\\n00:04:01.980 --> 00:04:05.580\\nwasn't until he would just be like\\n\\n99\\n00:04:03.180 --> 00:04:08.280\\nplaying Ascent or like pulling out old\\n\\n100\\n00:04:05.580 --> 00:04:09.959\\nrecords yeah I mean that's because you\\n\\n101\\n00:04:08.280 --> 00:04:12.379\\nknow that's the that's the [\\xa0__\\xa0] that was\\n\\n102\\n00:04:09.959 --> 00:04:15.380\\nlike the type of Records he would play\\n\\n103\\n00:04:12.379 --> 00:04:19.440\\nyou know were always like\\n\\n104\\n00:04:15.380 --> 00:04:22.199\\ninteresting and like weird you know and\\n\\n105\\n00:04:19.440 --> 00:04:24.360\\nthat was you know my [\\xa0__\\xa0] like I just\\n\\n106\\n00:04:22.199 --> 00:04:26.280\\nwanted something that didn't sound like\\n\\n107\\n00:04:24.360 --> 00:04:28.680\\nthe typical [\\xa0__\\xa0] that you would hear in\\n\\n108\\n00:04:26.280 --> 00:04:30.300\\nhip-hop you know like with ghosts like\\n\\n109\\n00:04:28.680 --> 00:04:33.120\\nyou hear ghosts you hear that sample I\\n\\n110\\n00:04:30.300 --> 00:04:35.220\\nwas like what the [\\xa0__\\xa0] you know like and\\n\\n111\\n00:04:33.120 --> 00:04:37.320\\nghost is still to this day like one of\\n\\n112\\n00:04:35.220 --> 00:04:39.000\\nmy top three favorite songs\\n\\n113\\n00:04:37.320 --> 00:04:41.280\\nyou're crushing it are you ready to move\\n\\n114\\n00:04:39.000 --> 00:04:45.139\\non to Wing number three this is Pico\\n\\n115\\n00:04:41.280 --> 00:04:45.139\\nRico here and you're doing great\\n\\n116\\n00:04:49.919 --> 00:04:51.919\\num\\n\\n117\\n00:04:54.199 --> 00:05:00.419\\nthese first three I'm good but I see\\n\\n118\\n00:04:58.320 --> 00:05:02.759\\nwhen I get down to here it's probably\\n\\n119\\n00:05:00.419 --> 00:05:04.800\\ngonna get real\\n\\n120\\n00:05:02.759 --> 00:05:06.540\\nso even as your music career exploded\\n\\n121\\n00:05:04.800 --> 00:05:07.860\\nyou've still remained a prolific actor\\n\\n122\\n00:05:06.540 --> 00:05:09.240\\nand earlier this year it was announced\\n\\n123\\n00:05:07.860 --> 00:05:11.160\\nthat you'd be making your directorial\\n\\n124\\n00:05:09.240 --> 00:05:13.740\\ndebut in an upcoming Netflix project\\n\\n125\\n00:05:11.160 --> 00:05:15.240\\ncalled Teddy what's the best audition\\n\\n126\\n00:05:13.740 --> 00:05:17.220\\ntip or note that you've ever gotten from\\n\\n127\\n00:05:15.240 --> 00:05:21.080\\nTimothy chalman I think I asked him\\n\\n128\\n00:05:17.220 --> 00:05:21.080\\nabout crying on camera once\\n\\n129\\n00:05:21.240 --> 00:05:26.340\\nyou know I've given him like audition\\n\\n130\\n00:05:23.699 --> 00:05:28.620\\ntapes that I've done before and I'm just\\n\\n131\\n00:05:26.340 --> 00:05:30.320\\nlike hell man shoot me straight you know\\n\\n132\\n00:05:28.620 --> 00:05:32.400\\nhe's always like oh it's good it's good\\n\\n133\\n00:05:30.320 --> 00:05:35.340\\nhe's like I don't know he could be lying\\n\\n134\\n00:05:32.400 --> 00:05:39.180\\nto me uh but he's always he's always\\n\\n135\\n00:05:35.340 --> 00:05:41.520\\nvery supportive in in um I know Timmy is\\n\\n136\\n00:05:39.180 --> 00:05:42.900\\na fan of me for music but I you know I\\n\\n137\\n00:05:41.520 --> 00:05:43.919\\nthink he's a fan of me as an actor as\\n\\n138\\n00:05:42.900 --> 00:05:46.580\\nwell\\n\\n139\\n00:05:43.919 --> 00:05:49.080\\nmy lips are tingling well\\n\\n140\\n00:05:46.580 --> 00:05:51.479\\na whole lot more is about to happen as\\n\\n141\\n00:05:49.080 --> 00:05:55.259\\nwe work our way down but first things\\n\\n142\\n00:05:51.479 --> 00:05:58.259\\nfirst the hot ones barbacoa\\n\\n143\\n00:05:55.259 --> 00:05:58.259\\nforeign\\n\\n144\\n00:06:00.580 --> 00:06:04.620\\n[Music]\\n\\n145\\n00:06:01.860 --> 00:06:06.900\\nI'm a two bite kind of guy\\n\\n146\\n00:06:04.620 --> 00:06:09.060\\nI respect it I know you do the same\\n\\n147\\n00:06:06.900 --> 00:06:11.100\\nthing I do so I'm trying to\\n\\n148\\n00:06:09.060 --> 00:06:13.979\\ntest you I know you're testing me\\n\\n149\\n00:06:11.100 --> 00:06:15.419\\npushing me yeah who knows maybe you'll\\n\\n150\\n00:06:13.979 --> 00:06:19.199\\nbe the only one standing by the end of\\n\\n151\\n00:06:15.419 --> 00:06:20.400\\nthis I mean maybe I'm ready but you do\\n\\n152\\n00:06:19.199 --> 00:06:22.979\\nthis you do this all the time you do\\n\\n153\\n00:06:20.400 --> 00:06:25.020\\nthis on a rig I know right but at some\\n\\n154\\n00:06:22.979 --> 00:06:26.460\\npoint I'm gonna hit that wall right I\\n\\n155\\n00:06:25.020 --> 00:06:29.759\\nmean at some point you're gonna be like\\n\\n156\\n00:06:26.460 --> 00:06:30.960\\nI'm tired of fire poopies and you're\\n\\n157\\n00:06:29.759 --> 00:06:32.580\\njust gonna say like that's what I'm\\n\\n158\\n00:06:30.960 --> 00:06:34.680\\ngonna ask you after this man sure you\\n\\n159\\n00:06:32.580 --> 00:06:36.060\\ncan ask me during whatever you know this\\n\\n160\\n00:06:34.680 --> 00:06:38.280\\ncan be this can go both ways because\\n\\n161\\n00:06:36.060 --> 00:06:41.160\\nyour brows are probably like what the\\n\\n162\\n00:06:38.280 --> 00:06:43.039\\n[\\xa0__\\xa0] you know what's fascinating is your\\n\\n163\\n00:06:41.160 --> 00:06:45.840\\nbody adjusts\\n\\n164\\n00:06:43.039 --> 00:06:47.699\\nthis long I'll go to Equinox after this\\n\\n165\\n00:06:45.840 --> 00:06:50.340\\nyou know what I mean like oh no way I'm\\n\\n166\\n00:06:47.699 --> 00:06:51.240\\nunstoppable I'm unstoppable I mean who\\n\\n167\\n00:06:50.340 --> 00:06:52.919\\nknows like I don't want to get\\n\\n168\\n00:06:51.240 --> 00:06:54.060\\noverconfident it's like an athlete you\\n\\n169\\n00:06:52.919 --> 00:06:55.919\\nknow like I think you probably have a\\n\\n170\\n00:06:54.060 --> 00:06:57.539\\nphysical prime and then you know maybe\\n\\n171\\n00:06:55.919 --> 00:07:00.660\\nthe wings will start to slow me down but\\n\\n172\\n00:06:57.539 --> 00:07:02.039\\nright now I'm good right now God age\\n\\n173\\n00:07:00.660 --> 00:07:04.500\\nlike Brady over here yeah I was like\\n\\n174\\n00:07:02.039 --> 00:07:05.350\\nSean has a stomach of Steel Man straight\\n\\n175\\n00:07:04.500 --> 00:07:08.619\\nup\\n\\n176\\n00:07:05.350 --> 00:07:08.619\\n[Music]\\n\\n177\\n00:07:08.840 --> 00:07:16.020\\nokay here we go\\n\\n178\\n00:07:11.300 --> 00:07:16.020\\nit's crunchy foreign\\n\\n179\\n00:07:19.800 --> 00:07:24.240\\ndo I always have to take two bites you\\n\\n180\\n00:07:22.319 --> 00:07:25.740\\nknow you make the rules over here you're\\n\\n181\\n00:07:24.240 --> 00:07:27.599\\nmaking the rules over here I'm just\\n\\n182\\n00:07:25.740 --> 00:07:29.099\\nfollowing along with you\\n\\n183\\n00:07:27.599 --> 00:07:30.780\\nI'm just hungry so I came in here\\n\\n184\\n00:07:29.099 --> 00:07:34.139\\nstarving\\n\\n185\\n00:07:30.780 --> 00:07:35.880\\num I don't know if that was a good idea\\n\\n186\\n00:07:34.139 --> 00:07:37.080\\nI could cut you every crane segment on\\n\\n187\\n00:07:35.880 --> 00:07:37.919\\nour show called explain that gram we're\\n\\n188\\n00:07:37.080 --> 00:07:39.539\\ngonna do a deep dive in our guest\\n\\n189\\n00:07:37.919 --> 00:07:41.880\\nInstagram interesting pictures that need\\n\\n190\\n00:07:39.539 --> 00:07:45.180\\nmore context and for you we have a theme\\n\\n191\\n00:07:41.880 --> 00:07:46.560\\nit's a Kid Cudi style retrospective so\\n\\n192\\n00:07:45.180 --> 00:07:48.479\\nwhat we've done is we've pulled some of\\n\\n193\\n00:07:46.560 --> 00:07:50.699\\nour favorite Kid Cudi fit picks and\\n\\n194\\n00:07:48.479 --> 00:07:53.039\\nwe're just curious how you react how you\\n\\n195\\n00:07:50.699 --> 00:07:55.740\\nreflect looking back on those things now\\n\\n196\\n00:07:53.039 --> 00:07:57.900\\noh my God all right laptop please Bill\\n\\n197\\n00:07:55.740 --> 00:08:00.240\\nthere we go bring it back a laptop very\\n\\n198\\n00:07:57.900 --> 00:08:01.919\\nrare thank you very much\\n\\n199\\n00:08:00.240 --> 00:08:03.780\\ndo you have a favorite memory from\\n\\n200\\n00:08:01.919 --> 00:08:05.220\\nwalking at the Palais Royal Gardens for\\n\\n201\\n00:08:03.780 --> 00:08:07.319\\nVirgil ablo's first Louis Vuitton\\n\\n202\\n00:08:05.220 --> 00:08:09.240\\ncollection yes I do\\n\\n203\\n00:08:07.319 --> 00:08:10.979\\nit just didn't feel real you know the\\n\\n204\\n00:08:09.240 --> 00:08:14.039\\nwhole thing was just like\\n\\n205\\n00:08:10.979 --> 00:08:16.860\\nyou know like a dream you know\\n\\n206\\n00:08:14.039 --> 00:08:19.500\\num and I was soaking it up so much that\\n\\n207\\n00:08:16.860 --> 00:08:22.139\\nlike uh I was walking really slow on the\\n\\n208\\n00:08:19.500 --> 00:08:23.460\\non the on the runway so like you can't\\n\\n209\\n00:08:22.139 --> 00:08:24.900\\nsee in this picture like there's like\\n\\n210\\n00:08:23.460 --> 00:08:27.319\\nall those people stacked up behind me\\n\\n211\\n00:08:24.900 --> 00:08:29.340\\nthat's a trapping Champion\\n\\n212\\n00:08:27.319 --> 00:08:31.259\\nthat's why this person's got this good\\n\\n213\\n00:08:29.340 --> 00:08:32.039\\nass photo because it was like no it was\\n\\n214\\n00:08:31.259 --> 00:08:34.620\\nlike\\n\\n215\\n00:08:32.039 --> 00:08:36.599\\n20 feet between me and the other dude in\\n\\n216\\n00:08:34.620 --> 00:08:39.779\\nfront of me like it's like right there\\n\\n217\\n00:08:36.599 --> 00:08:41.880\\nbut uh I was just uh I was really high\\n\\n218\\n00:08:39.779 --> 00:08:45.360\\nand I was just soaking it up man I was\\n\\n219\\n00:08:41.880 --> 00:08:46.800\\nlike this is a beautiful moment so yeah\\n\\n220\\n00:08:45.360 --> 00:08:48.420\\nwhat's the biggest difference between\\n\\n221\\n00:08:46.800 --> 00:08:50.100\\nworking at a vape store and working at\\n\\n222\\n00:08:48.420 --> 00:08:52.140\\nAbercrombie and Fitch and then how did\\n\\n223\\n00:08:50.100 --> 00:08:55.380\\neach shape your personal style working\\n\\n224\\n00:08:52.140 --> 00:08:59.640\\nat the Abercrombie and fish store\\n\\n225\\n00:08:55.380 --> 00:09:01.860\\nthe clothes sucked and it wasn't like it\\n\\n226\\n00:08:59.640 --> 00:09:04.380\\nwasn't like I was like\\n\\n227\\n00:09:01.860 --> 00:09:05.940\\nproud to be wearing Abercrombie and\\n\\n228\\n00:09:04.380 --> 00:09:08.100\\nFitch like their jeans were all right I\\n\\n229\\n00:09:05.940 --> 00:09:09.779\\nguess they're just right I guess but\\n\\n230\\n00:09:08.100 --> 00:09:11.160\\nwhen I worked at the base sword that was\\n\\n231\\n00:09:09.779 --> 00:09:12.839\\nthe first time I was like oh man like\\n\\n232\\n00:09:11.160 --> 00:09:15.000\\nthis is like actually some fresh [\\xa0__\\xa0]\\n\\n233\\n00:09:12.839 --> 00:09:16.019\\nbut like you know I was so poor when I\\n\\n234\\n00:09:15.000 --> 00:09:18.720\\ngot that job\\n\\n235\\n00:09:16.019 --> 00:09:22.019\\nso I didn't own any bait prior to\\n\\n236\\n00:09:18.720 --> 00:09:24.420\\nworking there so uh I literally had the\\n\\n237\\n00:09:22.019 --> 00:09:29.580\\nsame brown bathing Aid t-shirt and these\\n\\n238\\n00:09:24.420 --> 00:09:31.260\\njeans and these yellow uh Roasters and I\\n\\n239\\n00:09:29.580 --> 00:09:32.880\\nhad that for like two months that outfit\\n\\n240\\n00:09:31.260 --> 00:09:34.200\\nI used to ask my co-workers if I could\\n\\n241\\n00:09:32.880 --> 00:09:35.459\\nborrow some of their clothes and they\\n\\n242\\n00:09:34.200 --> 00:09:37.740\\nwould hold me down and let me borrow a\\n\\n243\\n00:09:35.459 --> 00:09:39.779\\nhoodie or two and working at that store\\n\\n244\\n00:09:37.740 --> 00:09:42.779\\nwas was like\\n\\n245\\n00:09:39.779 --> 00:09:44.279\\nwas like the greatest to me and at that\\n\\n246\\n00:09:42.779 --> 00:09:47.279\\ntime like it was bigger than getting a\\n\\n247\\n00:09:44.279 --> 00:09:49.019\\nrecord deal yeah you know like\\n\\n248\\n00:09:47.279 --> 00:09:50.580\\nand I really wanted the record just that\\n\\n249\\n00:09:49.019 --> 00:09:51.779\\ntime you know but it was like oh [\\xa0__\\xa0] I\\n\\n250\\n00:09:50.580 --> 00:09:54.720\\ngot the baby store I'm good you know\\n\\n251\\n00:09:51.779 --> 00:09:56.940\\nlike it just it just it was such a major\\n\\n252\\n00:09:54.720 --> 00:09:59.760\\nthing because of what it meant to the\\n\\n253\\n00:09:56.940 --> 00:10:01.200\\nculture and what it was Nigo came to the\\n\\n254\\n00:09:59.760 --> 00:10:03.060\\nstore with the Teriyaki boys one time\\n\\n255\\n00:10:01.200 --> 00:10:04.620\\nand I met them fast forward all the\\n\\n256\\n00:10:03.060 --> 00:10:07.260\\nyears later when we did the the complex\\n\\n257\\n00:10:04.620 --> 00:10:09.540\\nmagazine cover so it was like this full\\n\\n258\\n00:10:07.260 --> 00:10:12.420\\ncircle moment you know just being around\\n\\n259\\n00:10:09.540 --> 00:10:13.980\\nthe God you know it was so cool man so\\n\\n260\\n00:10:12.420 --> 00:10:16.560\\ncool\\n\\n261\\n00:10:13.980 --> 00:10:18.360\\nBill thank you very much\\n\\n262\\n00:10:16.560 --> 00:10:20.760\\nI gotta get one of those hot ones\\n\\n263\\n00:10:18.360 --> 00:10:22.980\\nt-shirts too we got you\", title='Kid Cudi Goes to the Moon While Eating Spicy Wings | Hot Ones', video_idx=7, embedding=None, link='https://www.youtube.com/watch?v=0allwd60wS4')"
     },
     "execution_count": 193,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chunk_metadata[best_chunk_idx]"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T22:43:33.004348Z",
     "start_time": "2024-05-22T22:43:33.002362Z"
    }
   },
   "id": "17610aa4135e7ec5",
   "execution_count": 193
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "Chunk(text=\"WEBVTT\\n\\n1\\n00:00:00.900 --> 00:00:03.900\\nwow\\n\\n2\\n00:00:04.440 --> 00:00:07.700\\nthis one's a winner\\n\\n3\\n00:00:13.880 --> 00:00:17.820\\nhey what's going on everybody for first\\n\\n4\\n00:00:16.139 --> 00:00:19.619\\nweek Feast I'm Sean Evans and you're\\n\\n5\\n00:00:17.820 --> 00:00:21.359\\nwatching hot ones it's the show with hot\\n\\n6\\n00:00:19.619 --> 00:00:23.279\\nquestions and even hotter wings and\\n\\n7\\n00:00:21.359 --> 00:00:24.539\\ntoday we're joined by David Blaine he's\\n\\n8\\n00:00:23.279 --> 00:00:26.100\\nknown the world over for his street\\n\\n9\\n00:00:24.539 --> 00:00:27.720\\nmagic and endurance stunts that include\\n\\n10\\n00:00:26.100 --> 00:00:29.400\\neverything from being buried alive for\\n\\n11\\n00:00:27.720 --> 00:00:30.720\\nseven days to encasing himself in a\\n\\n12\\n00:00:29.400 --> 00:00:33.059\\nblock of ice to holding his breath\\n\\n13\\n00:00:30.720 --> 00:00:34.620\\nunderwater for 17 minutes he also has a\\n\\n14\\n00:00:33.059 --> 00:00:36.239\\npair of high profile projects on the way\\n\\n15\\n00:00:34.620 --> 00:00:37.860\\nwith his documentary Adventure series\\n\\n16\\n00:00:36.239 --> 00:00:39.840\\nbeyond belief with David Blaine coming\\n\\n17\\n00:00:37.860 --> 00:00:41.520\\nsoon to Disney Plus in his sixth show\\n\\n18\\n00:00:39.840 --> 00:00:43.320\\nVegas residency with dates through the\\n\\n19\\n00:00:41.520 --> 00:00:45.480\\nremainder of the Year David Blaine\\n\\n20\\n00:00:43.320 --> 00:00:48.300\\nwelcome to the show wow thank you for\\n\\n21\\n00:00:45.480 --> 00:00:50.460\\nhaving me thank you I'm so excited to be\\n\\n22\\n00:00:48.300 --> 00:00:52.020\\nhere by the way I'm very excited to have\\n\\n23\\n00:00:50.460 --> 00:00:54.000\\nyou I know that you're someone who can\\n\\n24\\n00:00:52.020 --> 00:00:56.039\\npush themselves but how how are you\\n\\n25\\n00:00:54.000 --> 00:00:57.420\\naround spicy food I don't know how I'm\\n\\n26\\n00:00:56.039 --> 00:01:01.020\\ngonna do with them during this but that\\n\\n27\\n00:00:57.420 --> 00:01:02.640\\nis my thing but um I'll tell you so just\\n\\n28\\n00:01:01.020 --> 00:01:06.780\\nto give you an idea of how much I love\\n\\n29\\n00:01:02.640 --> 00:01:08.640\\nHot Wings my when I premiered my show\\n\\n30\\n00:01:06.780 --> 00:01:11.100\\nwhich was the only premiere of a show I\\n\\n31\\n00:01:08.640 --> 00:01:13.020\\ndid it for real or magic they wanted to\\n\\n32\\n00:01:11.100 --> 00:01:14.640\\ngo do it in a big place with the big\\n\\n33\\n00:01:13.020 --> 00:01:17.640\\nmovie screen so everybody could see it\\n\\n34\\n00:01:14.640 --> 00:01:21.240\\nyou know and I said no no no\\n\\n35\\n00:01:17.640 --> 00:01:23.820\\nwe have to Premiere at blondies at the\\n\\n36\\n00:01:21.240 --> 00:01:26.340\\npremieres in a buffalo wing Joy a Sport\\n\\n37\\n00:01:23.820 --> 00:01:29.040\\nBar Buffalo joint up Uptown in New York\\n\\n38\\n00:01:26.340 --> 00:01:30.360\\nso and nobody could hear the show but I\\n\\n39\\n00:01:29.040 --> 00:01:31.860\\nwas happy because I could eat all the\\n\\n40\\n00:01:30.360 --> 00:01:33.900\\nwings\\n\\n41\\n00:01:31.860 --> 00:01:36.680\\n[Music]\\n\\n42\\n00:01:33.900 --> 00:01:36.680\\nforeign\\n\\n43\\n00:01:42.730 --> 00:01:48.269\\n[Music]\\n\\n44\\n00:01:48.900 --> 00:01:54.799\\nso this first one is the classic chili\\n\\n45\\n00:01:51.840 --> 00:01:54.799\\nMaple Edition here\\n\\n46\\n00:01:56.220 --> 00:01:59.880\\noh great\\n\\n47\\n00:01:57.960 --> 00:02:02.220\\nvery nice\\n\\n48\\n00:01:59.880 --> 00:02:05.180\\nMaple first time trying this one hidden\\n\\n49\\n00:02:02.220 --> 00:02:05.180\\nyeah it's great\\n\\n50\\n00:02:08.340 --> 00:02:12.900\\nforeign\\n\\n51\\n00:02:09.979 --> 00:02:14.819\\nbuilding a big stage magic act in Vegas\\n\\n52\\n00:02:12.900 --> 00:02:17.580\\nI'm curious if this quote from David\\n\\n53\\n00:02:14.819 --> 00:02:20.160\\nCopperfield Rings true to you it takes\\n\\n54\\n00:02:17.580 --> 00:02:23.520\\n500 shows to get a trick right and more\\n\\n55\\n00:02:20.160 --> 00:02:25.140\\nthan a thousand to make it feel good\\n\\n56\\n00:02:23.520 --> 00:02:27.599\\nthat was one of the things that amazed\\n\\n57\\n00:02:25.140 --> 00:02:29.220\\nme about David was I went to see him\\n\\n58\\n00:02:27.599 --> 00:02:31.500\\nafter a show and it was Saturday and it\\n\\n59\\n00:02:29.220 --> 00:02:32.940\\nwas midnight and and they were all so\\n\\n60\\n00:02:31.500 --> 00:02:35.099\\nexhausted and\\n\\n61\\n00:02:32.940 --> 00:02:37.500\\num and his partner Chris says oh we've\\n\\n62\\n00:02:35.099 --> 00:02:39.599\\nwe've been here since 10 A.M\\n\\n63\\n00:02:37.500 --> 00:02:42.720\\nwe've done three shows\\n\\n64\\n00:02:39.599 --> 00:02:44.760\\nlike three shows in a day because like\\n\\n65\\n00:02:42.720 --> 00:02:48.239\\nmy show has to be like once a month or\\n\\n66\\n00:02:44.760 --> 00:02:49.680\\ntwice a month Max I said wow like how\\n\\n67\\n00:02:48.239 --> 00:02:51.180\\nmany shows are you doing every day he\\n\\n68\\n00:02:49.680 --> 00:02:53.160\\nsaid well we do three on Saturdays two\\n\\n69\\n00:02:51.180 --> 00:03:00.360\\non every other day guess how many per\\n\\n70\\n00:02:53.160 --> 00:03:03.480\\nyear 300 more 400 500 no 600 650 shows\\n\\n71\\n00:03:00.360 --> 00:03:05.519\\nthat go whoa like David like that's\\n\\n72\\n00:03:03.480 --> 00:03:08.640\\ncrazy what are you doing and he says\\n\\n73\\n00:03:05.519 --> 00:03:10.379\\nwell it takes me about 500 to get a new\\n\\n74\\n00:03:08.640 --> 00:03:12.959\\ntrick right so that's the beginning of\\n\\n75\\n00:03:10.379 --> 00:03:17.760\\nstarting to understand a new trick and I\\n\\n76\\n00:03:12.959 --> 00:03:19.920\\nwent oh I got it bingo so yeah I love\\n\\n77\\n00:03:17.760 --> 00:03:21.900\\nthat mentality and I agree and I think\\n\\n78\\n00:03:19.920 --> 00:03:23.940\\nall of my magician friends it's like a\\n\\n79\\n00:03:21.900 --> 00:03:26.640\\nthe ones that I love are just it's com\\n\\n80\\n00:03:23.940 --> 00:03:30.680\\nit's a compulsion it's all they think\\n\\n81\\n00:03:26.640 --> 00:03:33.659\\n[Music]\\n\\n82\\n00:03:30.680 --> 00:03:37.860\\nit's great yeah a little Scotch bonnet\\n\\n83\\n00:03:33.659 --> 00:03:39.120\\ntropical action in there right\\n\\n84\\n00:03:37.860 --> 00:03:40.799\\nwhen it comes to your obsession with\\n\\n85\\n00:03:39.120 --> 00:03:42.659\\nmagic I've heard you recount multiple\\n\\n86\\n00:03:40.799 --> 00:03:45.180\\norigin stories much like the Joker\\n\\n87\\n00:03:42.659 --> 00:03:47.400\\nexplaining how he got his scars who is\\n\\n88\\n00:03:45.180 --> 00:03:49.980\\nlewd Tannen and can you describe to me a\\n\\n89\\n00:03:47.400 --> 00:03:51.239\\ntypical day for a 10 year old at Tana I\\n\\n90\\n00:03:49.980 --> 00:03:52.500\\ncan't tell you about that that's funny\\n\\n91\\n00:03:51.239 --> 00:03:53.819\\nbut I'm not gonna tell you about the\\n\\n92\\n00:03:52.500 --> 00:03:55.379\\ncamp I've been talking about going to\\n\\n93\\n00:03:53.819 --> 00:03:56.340\\ntannins\\n\\n94\\n00:03:55.379 --> 00:03:59.519\\num\\n\\n95\\n00:03:56.340 --> 00:04:02.580\\nback then the store was like this Darkly\\n\\n96\\n00:03:59.519 --> 00:04:05.220\\nlit shop with all of these glass cases\\n\\n97\\n00:04:02.580 --> 00:04:08.099\\nand the glass cases had all these\\n\\n98\\n00:04:05.220 --> 00:04:09.959\\nobjects that you would die to have so\\n\\n99\\n00:04:08.099 --> 00:04:11.760\\nI'd stare at these things and just dream\\n\\n100\\n00:04:09.959 --> 00:04:14.700\\nof like oh my God what could be done\\n\\n101\\n00:04:11.760 --> 00:04:17.880\\nwith all those things but then in the\\n\\n102\\n00:04:14.700 --> 00:04:20.820\\nback room like this little side area but\\n\\n103\\n00:04:17.880 --> 00:04:23.460\\nnot in the store if you were lucky\\n\\n104\\n00:04:20.820 --> 00:04:25.740\\nthe best guys in the world would just be\\n\\n105\\n00:04:23.460 --> 00:04:28.020\\nhanging out there and so I'd sit there\\n\\n106\\n00:04:25.740 --> 00:04:31.380\\nand they would like blow my mind on stop\\n\\n107\\n00:04:28.020 --> 00:04:32.940\\nluckily by the way as a kid I only did\\n\\n108\\n00:04:31.380 --> 00:04:34.979\\nMagic to my mother and her friends\\n\\n109\\n00:04:32.940 --> 00:04:36.360\\nbecause if I did other kids they're a\\n\\n110\\n00:04:34.979 --> 00:04:39.360\\ntough audience they're gonna be like hey\\n\\n111\\n00:04:36.360 --> 00:04:41.280\\nyou're weird you know yeah you suck so I\\n\\n112\\n00:04:39.360 --> 00:04:42.479\\ndid all the magic to to my mother and\\n\\n113\\n00:04:41.280 --> 00:04:44.280\\nher friends and I thought I was good\\n\\n114\\n00:04:42.479 --> 00:04:45.720\\nbecause of their reactions and then I\\n\\n115\\n00:04:44.280 --> 00:04:49.199\\njust wanted to keep learning new things\\n\\n116\\n00:04:45.720 --> 00:04:51.300\\nto you know make make her amazed or\\n\\n117\\n00:04:49.199 --> 00:04:54.300\\nwhatever\\n\\n118\\n00:04:51.300 --> 00:04:54.300\\nforeign\\n\\n119\\n00:05:03.620 --> 00:05:06.960\\nso this is the first shoot of the new\\n\\n120\\n00:05:06.060 --> 00:05:09.479\\nseason\\n\\n121\\n00:05:06.960 --> 00:05:12.300\\nit's my first time trying the hot sauces\\n\\n122\\n00:05:09.479 --> 00:05:15.300\\nPico Rico\\n\\n123\\n00:05:12.300 --> 00:05:17.340\\nI just made my way into Mount Rushmore\\n\\n124\\n00:05:15.300 --> 00:05:19.820\\nI I hate to say this but I kind of love\\n\\n125\\n00:05:17.340 --> 00:05:22.080\\nall of them so far\\n\\n126\\n00:05:19.820 --> 00:05:23.940\\ndelicious lineup\\n\\n127\\n00:05:22.080 --> 00:05:25.380\\nso your name is synonymous with\\n\\n128\\n00:05:23.940 --> 00:05:27.360\\ndeath-defying Larger than Life\\n\\n129\\n00:05:25.380 --> 00:05:29.400\\nspectacles and to watch them from\\n\\n130\\n00:05:27.360 --> 00:05:31.620\\noutside they look like just such a pure\\n\\n131\\n00:05:29.400 --> 00:05:33.479\\nstress test and human concentration and\\n\\n132\\n00:05:31.620 --> 00:05:36.020\\nmisery but is there one that you\\n\\n133\\n00:05:33.479 --> 00:05:38.120\\ndescribe as being like the most fun\\n\\n134\\n00:05:36.020 --> 00:05:40.380\\nAscension to me\\n\\n135\\n00:05:38.120 --> 00:05:42.180\\nthat was the most one but but that's\\n\\n136\\n00:05:40.380 --> 00:05:44.280\\nbecause it was with my daughter so that\\n\\n137\\n00:05:42.180 --> 00:05:46.380\\nI worked out the hard part of it before\\n\\n138\\n00:05:44.280 --> 00:05:49.199\\nshe came to make it fun but I have to\\n\\n139\\n00:05:46.380 --> 00:05:51.620\\nsay all of them are so fun I think it's\\n\\n140\\n00:05:49.199 --> 00:05:54.060\\nsimilar to this like I think it's like\\n\\n141\\n00:05:51.620 --> 00:05:55.919\\nso it's like you go in and you're like\\n\\n142\\n00:05:54.060 --> 00:05:57.960\\nyou're going up a mountain really hard\\n\\n143\\n00:05:55.919 --> 00:05:59.280\\nbut like you're so excited about it and\\n\\n144\\n00:05:57.960 --> 00:06:02.160\\nyeah you take a couple of shots\\n\\n145\\n00:05:59.280 --> 00:06:03.720\\nobviously but but it's it's it's the\\n\\n146\\n00:06:02.160 --> 00:06:05.460\\nlike everybody says you know it's not\\n\\n147\\n00:06:03.720 --> 00:06:07.979\\nlike getting to the end it's like that\\n\\n148\\n00:06:05.460 --> 00:06:10.500\\nwhole process so yeah that process that\\n\\n149\\n00:06:07.979 --> 00:06:13.560\\nlearning curve is what keeps me excited\\n\\n150\\n00:06:10.500 --> 00:06:16.139\\nabout life so you know so I can't so\\n\\n151\\n00:06:13.560 --> 00:06:17.639\\nthey're all fun in a certain way well\\n\\n152\\n00:06:16.139 --> 00:06:18.720\\nthat actually really uh resonates with\\n\\n153\\n00:06:17.639 --> 00:06:20.460\\nme because while you're saying that is\\n\\n154\\n00:06:18.720 --> 00:06:21.840\\nlike that's exactly how I feel about\\n\\n155\\n00:06:20.460 --> 00:06:23.819\\nthese kinds of shoots where they're all\\n\\n156\\n00:06:21.840 --> 00:06:26.520\\nkind of of their own journey and then\\n\\n157\\n00:06:23.819 --> 00:06:28.020\\ntheir own experience and then as much as\\n\\n158\\n00:06:26.520 --> 00:06:29.160\\nyou can kind of figure out how things\\n\\n159\\n00:06:28.020 --> 00:06:30.479\\nare going to go there's lots of\\n\\n160\\n00:06:29.160 --> 00:06:31.740\\nvariables that you can't always test for\\n\\n161\\n00:06:30.479 --> 00:06:33.000\\nand things always go kind of sideways\\n\\n162\\n00:06:31.740 --> 00:06:35.160\\nthen you have to adapt to those things\\n\\n163\\n00:06:33.000 --> 00:06:36.539\\nand that's the stuff that I think is the\\n\\n164\\n00:06:35.160 --> 00:06:39.419\\nbest it's like when you have to deal\\n\\n165\\n00:06:36.539 --> 00:06:41.039\\nwith the unknown it's always amazing so\\n\\n166\\n00:06:39.419 --> 00:06:43.979\\nlike on stage when you get like a\\n\\n167\\n00:06:41.039 --> 00:06:45.900\\ncurveball it's like that's what that's\\n\\n168\\n00:06:43.979 --> 00:06:47.520\\nwhat separates I think like a magician\\n\\n169\\n00:06:45.900 --> 00:06:49.800\\nthat's really comfortable to a magician\\n\\n170\\n00:06:47.520 --> 00:06:52.139\\nthat's uncomfort and which makes one\\n\\n171\\n00:06:49.800 --> 00:06:53.639\\nseems great one doesn't the one that\\n\\n172\\n00:06:52.139 --> 00:06:55.740\\nseems great even though this guy might\\n\\n173\\n00:06:53.639 --> 00:06:57.539\\nbe just as practiced with the moves the\\n\\n174\\n00:06:55.740 --> 00:06:59.580\\none that seems great when performing is\\n\\n175\\n00:06:57.539 --> 00:07:02.400\\nwhen a curveball comes he's ready for it\\n\\n176\\n00:06:59.580 --> 00:07:04.740\\nhe No Matter What scenario he's hit with\\n\\n177\\n00:07:02.400 --> 00:07:06.360\\nhe can keep going and it's interesting\\n\\n178\\n00:07:04.740 --> 00:07:08.520\\nbecause the magic people don't know the\\n\\n179\\n00:07:06.360 --> 00:07:10.440\\nend result so since they don't know the\\n\\n180\\n00:07:08.520 --> 00:07:12.660\\nend it's not over until you say it's\\n\\n181\\n00:07:10.440 --> 00:07:15.419\\nover so you could be like struggling for\\n\\n182\\n00:07:12.660 --> 00:07:17.460\\n10 minutes but if the end is a monster I\\n\\n183\\n00:07:15.419 --> 00:07:19.620\\nlike that whole you know the the not\\n\\n184\\n00:07:17.460 --> 00:07:22.199\\nworking and then make it work\\n\\n185\\n00:07:19.620 --> 00:07:24.479\\nI like all these questions by the way oh\\n\\n186\\n00:07:22.199 --> 00:07:26.280\\nwell thank you very much it's kind of\\n\\n187\\n00:07:24.479 --> 00:07:28.380\\nearly on in the game you know absolutely\\n\\n188\\n00:07:26.280 --> 00:07:30.180\\neasy I have plenty I have plenty of time\\n\\n189\\n00:07:28.380 --> 00:07:35.520\\nto knock this thing off the tracks\\n\\n190\\n00:07:30.180 --> 00:07:37.979\\n[Music]\\n\\n191\\n00:07:35.520 --> 00:07:39.660\\noh right\\n\\n192\\n00:07:37.979 --> 00:07:41.759\\nlooking at your face I can tell it looks\\n\\n193\\n00:07:39.660 --> 00:07:43.979\\nlike we're four for four so far yeah\\n\\n194\\n00:07:41.759 --> 00:07:46.020\\nthere we go\\n\\n195\\n00:07:43.979 --> 00:07:47.520\\nso your new documentary series beyond\\n\\n196\\n00:07:46.020 --> 00:07:49.560\\nbelief with David Blaine has been\\n\\n197\\n00:07:47.520 --> 00:07:51.120\\ndescribed as a global Odyssey across\\n\\n198\\n00:07:49.560 --> 00:07:53.460\\nremote cultures each embedded with\\n\\n199\\n00:07:51.120 --> 00:07:55.020\\nunique histories and practices is there\\n\\n200\\n00:07:53.460 --> 00:07:56.880\\na mystical tradition that you learned\\n\\n201\\n00:07:55.020 --> 00:07:58.620\\nalong your travels that you thought was\\n\\n202\\n00:07:56.880 --> 00:08:00.180\\nmost compelling or that more people\\n\\n203\\n00:07:58.620 --> 00:08:02.280\\nshould know about\\n\\n204\\n00:08:00.180 --> 00:08:03.960\\nwell basically when I was working on\\n\\n205\\n00:08:02.280 --> 00:08:05.819\\nlearning how to\\n\\n206\\n00:08:03.960 --> 00:08:07.199\\nput a gallon of water in my stomach and\\n\\n207\\n00:08:05.819 --> 00:08:09.419\\nthen spout it out\\n\\n208\\n00:08:07.199 --> 00:08:12.120\\nI saw a little video of a guy doing it\\n\\n209\\n00:08:09.419 --> 00:08:14.340\\nin Africa and we couldn't track him down\\n\\n210\\n00:08:12.120 --> 00:08:16.979\\nhe wasn't a performer he lived in a mud\\n\\n211\\n00:08:14.340 --> 00:08:19.440\\nhut outside of Liberia by like four\\n\\n212\\n00:08:16.979 --> 00:08:21.\", title='David Blaine Does Magic While Eating Spicy Wings | Hot Ones', video_idx=0, embedding=None, link='https://www.youtube.com/watch?v=4E2EbGoXlPQ')"
     },
     "execution_count": 203,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chunk_metadata[0]"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T22:49:11.984968Z",
     "start_time": "2024-05-22T22:49:11.981848Z"
    }
   },
   "id": "57a27ede69b100d3",
   "execution_count": 203
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "SYSTEM_PROMPT = \"\"\"You are an expert trivia bot. You provide correct answers to the posed question, based on the provided context. You have access to a chunk of text from a video transcript, and you can use this information to answer the question. You also have access to some metadata about this chunk of text. All transcripts come from the podcast \"Hot Ones\", Season 19, which has a total of 17 episodes. With each answer, provide a link with a timestamp to the relevant part of the video based on the transcript.\"\"\"\n",
    "\n",
    "\n",
    "BASE_PROMPT = \"\"\"\n",
    "Question: {question}\n",
    "\n",
    "Relevant chunk of text: {text}\n",
    "This text comes from the video titled \"{title}\", which is the video number {video_number} in the dataset and can be found at the following link: {link}.\n",
    "\"\"\".strip()\n",
    "\n",
    "def get_initial_messages(question: str, chunk: Chunk):\n",
    "    \n",
    "    return [\n",
    "        {\n",
    "            \"role\": \"system\",\n",
    "            \"content\": [\n",
    "                {\n",
    "                    \"type\": \"text\",\n",
    "                    \"text\": SYSTEM_PROMPT\n",
    "                }\n",
    "            ]\n",
    "        },\n",
    "        {\n",
    "            \"role\": \"user\",\n",
    "            \"content\": [\n",
    "                {\n",
    "                    \"type\": \"text\",\n",
    "                    \"text\": BASE_PROMPT.format(\n",
    "                        question=question,\n",
    "                        text=chunk.text,\n",
    "                        title=chunk.title,\n",
    "                        video_number=chunk.video_idx,\n",
    "                        link=chunk.link\n",
    "                    )\n",
    "                }\n",
    "            ]\n",
    "        }\n",
    "    ]"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T22:52:06.159891Z",
     "start_time": "2024-05-22T22:52:06.148297Z"
    }
   },
   "id": "74d52cf861e7ec37",
   "execution_count": 213
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "def rank_chunks(question: str, embeddings: np.ndarray, model: str = \"text-embedding-3-small\") -> list[Chunk]:\n",
    "    \n",
    "    q_embedding = get_one_embedding(question, model)\n",
    "    similarities = cosine_similarity(q_embedding, embeddings)\n",
    "    \n",
    "    sorted_indices = np.argsort(similarities)[::-1]\n",
    "    return [chunk_metadata[i] for i in sorted_indices]"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T23:00:14.572225Z",
     "start_time": "2024-05-22T23:00:14.556105Z"
    }
   },
   "id": "5a21d3801088444",
   "execution_count": 225
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "ranked_chunks = rank_chunks(\"Who failed making pastries as a teenager?\", embeddings)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T23:01:06.151815Z",
     "start_time": "2024-05-22T23:01:05.838144Z"
    }
   },
   "id": "f638df0d8a430dc",
   "execution_count": 233
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " so fast and it's a\n",
      "\n",
      "420\n",
      "00:16:49.980 --> 00:16:54.180\n",
      "little trippy it gets a little trippy\n",
      "\n",
      "421\n",
      "00:16:52.139 --> 00:16:57.000\n",
      "okay\n",
      "\n",
      "422\n",
      "00:16:54.180 --> 00:16:59.100\n",
      "I'm like fully serving but I want you to\n",
      "\n",
      "423\n",
      "00:16:57.000 --> 00:17:01.079\n",
      "know and I want everyone back here to\n",
      "\n",
      "424\n",
      "00:16:59.100 --> 00:17:03.799\n",
      "know\n",
      "\n",
      "425\n",
      "00:17:01.079 --> 00:17:05.360\n",
      "I'm not scared so you shouldn't be sad\n",
      "\n",
      "426\n",
      "00:17:03.799 --> 00:17:08.600\n",
      "okay\n",
      "\n",
      "427\n",
      "00:17:05.360 --> 00:17:08.600\n",
      "I'm okay\n",
      "\n",
      "428\n",
      "00:17:09.179 --> 00:17:15.299\n",
      "but I I'm like gushing tears you have\n",
      "\n",
      "429\n",
      "00:17:13.079 --> 00:17:16.980\n",
      "just it's like the one\n",
      "\n",
      "430\n",
      "00:17:15.299 --> 00:17:18.780\n",
      "like it's like out of them believe them\n",
      "\n",
      "431\n",
      "00:17:16.980 --> 00:17:20.339\n",
      "it's out of a blue like this is a part\n",
      "\n",
      "432\n",
      "00:17:18.780 --> 00:17:21.959\n",
      "of the [ __ ] hot one Spiritual\n",
      "\n",
      "433\n",
      "00:17:20.339 --> 00:17:23.699\n",
      "Awakening\n",
      "\n",
      "434\n",
      "00:17:21.959 --> 00:17:25.880\n",
      "good\n",
      "\n",
      "435\n",
      "00:17:23.699 --> 00:17:28.679\n",
      "foreign\n",
      "\n",
      "436\n",
      "00:17:25.880 --> 00:17:31.740\n",
      "like I'm here for it okay\n",
      "\n",
      "437\n",
      "00:17:28.679 --> 00:17:34.320\n",
      "so the easiest\n",
      "\n",
      "438\n",
      "00:17:31.740 --> 00:17:37.200\n",
      "leave it it's part of it\n",
      "\n",
      "439\n",
      "00:17:34.320 --> 00:17:39.059\n",
      "I love it yes\n",
      "\n",
      "440\n",
      "00:17:37.200 --> 00:17:40.020\n",
      "no I mean it [ __ ] hurts so [ __ ]\n",
      "\n",
      "441\n",
      "00:17:39.059 --> 00:17:41.820\n",
      "bad\n",
      "\n",
      "442\n",
      "00:17:40.020 --> 00:17:45.000\n",
      "okay\n",
      "\n",
      "443\n",
      "00:17:41.820 --> 00:17:48.000\n",
      "um the easiest dollar\n",
      "\n",
      "444\n",
      "00:17:45.000 --> 00:17:49.130\n",
      "you make as an influencer I would say\n",
      "\n",
      "445\n",
      "00:17:48.000 --> 00:17:52.289\n",
      "would be\n",
      "\n",
      "446\n",
      "00:17:49.130 --> 00:17:52.289\n",
      "[Music]\n",
      "\n",
      "447\n",
      "00:17:52.320 --> 00:17:56.760\n",
      "like holding up a product on Instagram\n",
      "\n",
      "448\n",
      "00:17:54.419 --> 00:17:58.559\n",
      "taking a photo you know and posting it\n",
      "\n",
      "449\n",
      "00:17:56.760 --> 00:18:01.520\n",
      "being like hashtag ad\n",
      "\n",
      "450\n",
      "00:17:58.559 --> 00:18:01.520\n",
      "Fletcher's easy\n",
      "\n",
      "451\n",
      "00:18:03.600 --> 00:18:07.080\n",
      "um\n",
      "\n",
      "452\n",
      "00:18:05.280 --> 00:18:08.880\n",
      "I just wish people knew at home that\n",
      "\n",
      "453\n",
      "00:18:07.080 --> 00:18:10.860\n",
      "like when everybody's crying and like\n",
      "\n",
      "454\n",
      "00:18:08.880 --> 00:18:12.720\n",
      "everybody's like\n",
      "\n",
      "455\n",
      "00:18:10.860 --> 00:18:15.360\n",
      "can't get words out\n",
      "\n",
      "456\n",
      "00:18:12.720 --> 00:18:17.460\n",
      "that like this shit's serious right like\n",
      "\n",
      "457\n",
      "00:18:15.360 --> 00:18:18.660\n",
      "because I feel like even I when I used\n",
      "\n",
      "458\n",
      "00:18:17.460 --> 00:18:20.340\n",
      "to watch it I was like this shit's not\n",
      "\n",
      "459\n",
      "00:18:18.660 --> 00:18:22.380\n",
      "that serious like\n",
      "\n",
      "460\n",
      "00:18:20.340 --> 00:18:26.220\n",
      "you're a [ __ ]\n",
      "\n",
      "461\n",
      "00:18:22.380 --> 00:18:27.600\n",
      "and now I'm like no right I'm so sorry\n",
      "\n",
      "462\n",
      "00:18:26.220 --> 00:18:30.120\n",
      "um for everything\n",
      "\n",
      "463\n",
      "00:18:27.600 --> 00:18:33.000\n",
      "to the ghosts of hot ones guest pass to\n",
      "\n",
      "464\n",
      "00:18:30.120 --> 00:18:35.700\n",
      "the ghost of hot ones guest passed I'm\n",
      "\n",
      "465\n",
      "00:18:33.000 --> 00:18:37.380\n",
      "sorry for my my judgment from home you\n",
      "\n",
      "466\n",
      "00:18:35.700 --> 00:18:40.280\n",
      "were Brave\n",
      "\n",
      "467\n",
      "00:18:37.380 --> 00:18:40.280\n",
      "and I get it\n",
      "\n",
      "468\n",
      "00:18:41.910 --> 00:18:48.120\n",
      "[Music]\n",
      "\n",
      "469\n",
      "00:18:44.660 --> 00:18:51.740\n",
      "okay let's let's rock on this next one\n",
      "\n",
      "470\n",
      "00:18:48.120 --> 00:18:51.740\n",
      "is pucker butt's unique garlic\n",
      "\n",
      "471\n",
      "00:18:55.020 --> 00:18:58.140\n",
      "I don't consider myself like\n",
      "\n",
      "472\n",
      "00:18:57.179 --> 00:19:00.000\n",
      "I don't know I'm just feeling\n",
      "\n",
      "473\n",
      "00:18:58.140 --> 00:19:02.700\n",
      "particularly spiritual praying that God\n",
      "\n",
      "474\n",
      "00:19:00.000 --> 00:19:06.260\n",
      "knows what else is up there in these\n",
      "\n",
      "475\n",
      "00:19:02.700 --> 00:19:06.260\n",
      "trying times these trying times\n",
      "\n",
      "476\n",
      "00:19:11.160 --> 00:19:15.279\n",
      "foreign\n",
      "\n",
      "477\n",
      "00:19:11.990 --> 00:19:15.279\n",
      "[Music]\n",
      "\n",
      "478\n",
      "00:19:17.460 --> 00:19:21.179\n",
      "so your podcast anything goes with Emma\n",
      "\n",
      "479\n",
      "00:19:19.500 --> 00:19:23.340\n",
      "Chamberlain is an episodic thought\n",
      "\n",
      "480\n",
      "00:19:21.179 --> 00:19:25.740\n",
      "exercise where you Ponder questions that\n",
      "\n",
      "481\n",
      "00:19:23.340 --> 00:19:27.900\n",
      "range from how much privacy a celebrity\n",
      "\n",
      "482\n",
      "00:19:25.740 --> 00:19:30.360\n",
      "is entitled to to whether or not anyone\n",
      "\n",
      "483\n",
      "00:19:27.900 --> 00:19:31.799\n",
      "is actually cool as someone who's open\n",
      "\n",
      "484\n",
      "00:19:30.360 --> 00:19:33.960\n",
      "about the fact that their opinions\n",
      "\n",
      "485\n",
      "00:19:31.799 --> 00:19:36.000\n",
      "change all the time what's like the last\n",
      "\n",
      "486\n",
      "00:19:33.960 --> 00:19:37.320\n",
      "or most recent like bad take you've had\n",
      "\n",
      "487\n",
      "00:19:36.000 --> 00:19:39.059\n",
      "on your own podcast\n",
      "\n",
      "488\n",
      "00:19:37.320 --> 00:19:40.799\n",
      "I don't know to be honest like I don't\n",
      "\n",
      "489\n",
      "00:19:39.059 --> 00:19:41.820\n",
      "look at any of my anything I've ever\n",
      "\n",
      "490\n",
      "00:19:40.799 --> 00:19:43.679\n",
      "said\n",
      "\n",
      "491\n",
      "00:19:41.820 --> 00:19:45.620\n",
      "I almost throw it in the dumpster behind\n",
      "\n",
      "492\n",
      "00:19:43.679 --> 00:19:48.600\n",
      "me yeah\n",
      "\n",
      "493\n",
      "00:19:45.620 --> 00:19:50.880\n",
      "it's true right then but it might not be\n",
      "\n",
      "494\n",
      "00:19:48.600 --> 00:19:52.980\n",
      "true literally tomorrow and I try to\n",
      "\n",
      "495\n",
      "00:19:50.880 --> 00:19:55.799\n",
      "make sure everyone knows that so that\n",
      "\n",
      "496\n",
      "00:19:52.980 --> 00:19:57.720\n",
      "you know it's not like anyone's like\n",
      "\n",
      "497\n",
      "00:19:55.799 --> 00:20:00.360\n",
      "but I don't know what about that that\n",
      "\n",
      "498\n",
      "00:19:57.720 --> 00:20:03.059\n",
      "you said it's like no I'm always ebbing\n",
      "\n",
      "499\n",
      "00:20:00.360 --> 00:20:05.760\n",
      "and flowing baby and that's a good\n",
      "\n",
      "500\n",
      "00:20:03.059 --> 00:20:07.440\n",
      "that's a good place to be\n",
      "\n",
      "501\n",
      "00:20:05.760 --> 00:20:09.539\n",
      "what\n",
      "\n",
      "502\n",
      "00:20:07.440 --> 00:20:11.760\n",
      "are we going in\n",
      "\n",
      "503\n",
      "00:20:09.539 --> 00:20:13.380\n",
      "if you're ready are we last stabbing it\n",
      "\n",
      "504\n",
      "00:20:11.760 --> 00:20:15.780\n",
      "we're last stabbing it if you're ready\n",
      "\n",
      "505\n",
      "00:20:13.380 --> 00:20:18.140\n",
      "I'm just [ __ ] doing it\n",
      "\n",
      "506\n",
      "00:20:15.780 --> 00:20:22.809\n",
      "oh that's a good Shake\n",
      "\n",
      "507\n",
      "00:20:18.140 --> 00:20:22.809\n",
      "[Music]\n",
      "\n",
      "508\n",
      "00:20:22.860 --> 00:20:27.059\n",
      "how much are we doing here\n",
      "\n",
      "509\n",
      "00:20:25.200 --> 00:20:28.559\n",
      "that looks measured that is looking good\n",
      "\n",
      "510\n",
      "00:20:27.059 --> 00:20:32.160\n",
      "that is looking good yeah that's perfect\n",
      "\n",
      "511\n",
      "00:20:28.559 --> 00:20:34.679\n",
      "any more than that that is good\n",
      "\n",
      "512\n",
      "00:20:32.160 --> 00:20:36.360\n",
      "all right I'm just like taking my time\n",
      "\n",
      "513\n",
      "00:20:34.679 --> 00:20:38.700\n",
      "putting it back\n",
      "\n",
      "514\n",
      "00:20:36.360 --> 00:20:41.340\n",
      "taking my time I'll screw back on too\n",
      "\n",
      "515\n",
      "00:20:38.700 --> 00:20:42.660\n",
      "just for for you guys so it looks good\n",
      "\n",
      "516\n",
      "00:20:41.340 --> 00:20:44.600\n",
      "on the table\n",
      "\n",
      "517\n",
      "00:20:42.660 --> 00:20:47.100\n",
      "shout out to the crew\n",
      "\n",
      "518\n",
      "00:20:44.600 --> 00:20:50.580\n",
      "I'm not like stalking\n",
      "\n",
      "519\n",
      "00:20:47.100 --> 00:20:53.000\n",
      "all right and it's time to go cheers all\n",
      "\n",
      "520\n",
      "00:20:50.580 --> 00:20:53.000\n",
      "right cheers\n",
      "\n",
      "521\n",
      "00:20:53.510 --> 00:20:58.609\n",
      "[Music]\n",
      "\n",
      "522\n",
      "00:20:59.059 --> 00:21:05.100\n",
      "and while that settles nice long wind up\n",
      "\n",
      "523\n",
      "00:21:02.039 --> 00:21:07.200\n",
      "to close things out what I want to do is\n",
      "\n",
      "524\n",
      "00:21:05.100 --> 00:21:10.500\n",
      "we'll pray on your natural creative\n",
      "\n",
      "525\n",
      "00:21:07.200 --> 00:21:13.980\n",
      "instincts in aesthetic can you rearrange\n",
      "\n",
      "526\n",
      "00:21:10.500 --> 00:21:17.100\n",
      "the hot ones Gauntlet from favorite to\n",
      "\n",
      "527\n",
      "00:21:13.980 --> 00:21:19.440\n",
      "least favorite based entirely on the\n",
      "\n",
      "528\n",
      "00:21:17.100 --> 00:21:20.880\n",
      "artistic appeal of the labels\n",
      "\n",
      "529\n",
      "00:21:19.440 --> 00:21:23.039\n",
      "like which one I think is the most\n",
      "\n",
      "530\n",
      "00:21:20.880 --> 00:21:25.620\n",
      "aesthetic yeah aesthetically amazing\n",
      "\n",
      "531\n",
      "00:21:23.039 --> 00:21:27.539\n",
      "this is like actually my dream yeah of\n",
      "\n",
      "532\n",
      "00:21:25.620 --> 00:21:29.220\n",
      "an activity especially during my like\n",
      "\n",
      "533\n",
      "00:21:27.539 --> 00:21:31.020\n",
      "what I'm feeling right now although part\n",
      "\n",
      "534\n",
      "00:21:29.220 --> 00:21:33.299\n",
      "of me like wants to like\n",
      "\n",
      "535\n",
      "00:21:31.020 --> 00:21:35.280\n",
      "finish the wing to like really like do\n",
      "\n",
      "536\n",
      "00:21:33.299 --> 00:21:38.000\n",
      "it should be [ __ ] let's do it let's\n",
      "\n",
      "537\n",
      "00:21:35.280 --> 00:21:38.000\n",
      "go okay\n",
      "\n",
      "538\n",
      "00:21:38.880 --> 00:21:43.940\n",
      "what I'm so do I regret okay\n",
      "\n",
      "539\n",
      "00:21:48.840 --> 00:21:53.460\n",
      "okay I'm determined one more bite\n",
      "\n",
      "540\n",
      "00:21:50.280 --> 00:21:55.200\n",
      "incredible I'm not a baby and I want\n",
      "\n",
      "541\n",
      "00:21:53.460 --> 00:21:58.679\n",
      "everyone out there to know that I\n",
      "\n",
      "542\n",
      "00:21:55.200 --> 00:22:01.380\n",
      "[ __ ] came here and I [ __ ] did it\n",
      "\n",
      "543\n",
      "00:21:58.679 --> 00:22:04.500\n",
      "let them know this has been my dream\n",
      "\n",
      "544\n",
      "00:22:01.380 --> 00:22:06.240\n",
      "since I first started YouTube was to one\n",
      "\n",
      "545\n",
      "00:22:04.500 --> 00:22:08.640\n",
      "day come here and I'm [ __ ] finishing\n",
      "\n",
      "546\n",
      "00:22:06.240 --> 00:22:11.960\n",
      "the last week okay it was changing the\n",
      "\n",
      "547\n",
      "00:22:08.640 --> 00:22:11.960\n",
      "last one wait what yes\n",
      "\n",
      "548\n",
      "00:22:13.380 --> 00:22:17.460\n",
      "I always wanted to come on the show\n",
      "\n",
      "549\n",
      "00:22:15.720 --> 00:22:20.580\n",
      "because I've been obsessed with it since\n",
      "\n",
      "550\n",
      "00:22:17.460 --> 00:22:24.120\n",
      "it like literally came out and started\n",
      "\n",
      "551\n",
      "00:22:20.580 --> 00:22:26.640\n",
      "however long ago and I was like once I\n",
      "\n",
      "552\n",
      "00:22:24.120 --> 00:22:29.760\n",
      "[ __ ] go on hot ones\n",
      "\n",
      "553\n",
      "00:22:26.640 --> 00:22:31.919\n",
      "I like I can retire like that's always\n",
      "\n",
      "554\n",
      "00:22:29.760 --> 00:22:33.900\n",
      "been my thing\n",
      "\n",
      "555\n",
      "00:22:31.919 --> 00:22:37.020\n",
      "and so like I'm [ __ ] finishing the\n",
      "\n",
      "556\n",
      "00:22:33.900 --> 00:22:37.020\n",
      "wings okay\n",
      "\n",
      "557\n",
      "00:22:38.520 --> 00:22:44.039\n",
      "[Music]\n",
      "\n",
      "558\n",
      "00:22:41.059 --> 00:22:45.659\n",
      "Pico Rico with the cat your favorite\n",
      "\n",
      "559\n",
      "00:22:44.039 --> 00:22:47.340\n",
      "that cat is just so\n",
      "\n",
      "560\n",
      "00:22:45.659 --> 00:22:49.140\n",
      "has to go first it makes me want to buy\n",
      "\n",
      "561\n",
      "00:22:47.340 --> 00:22:53.280\n",
      "the hot sauce\n",
      "\n",
      "562\n",
      "00:22:49.140 --> 00:22:55.980\n",
      "I love when animals are on stuff next\n",
      "\n",
      "563\n",
      "00:22:53.280 --> 00:22:58.500\n",
      "we're gonna go with this one I really I\n",
      "\n",
      "564\n",
      "00:22:55.980 --> 00:23:01.260\n",
      "like the colors very inviting\n",
      "\n",
      "565\n",
      "00:22:58.500 --> 00:23:03.840\n",
      "not traditional but personal I love that\n",
      "\n",
      "566\n",
      "00:23:01.260 --> 00:23:06.780\n",
      "little branding\n",
      "\n",
      "567\n",
      "00:23:03.840 --> 00:23:08.880\n",
      "okay I really like it\n",
      "\n",
      "568\n",
      "00:23:06.780 --> 00:23:10.320\n",
      "I really like this one I mean it's you\n",
      "\n",
      "569\n",
      "00:23:08.880 --> 00:23:13.679\n",
      "guys so like\n",
      "\n",
      "570\n",
      "00:23:10.320 --> 00:23:15.720\n",
      "but I like it because it's simple and\n",
      "\n",
      "571\n",
      "00:23:13.679 --> 00:23:17.640\n",
      "effective and classic and that's exactly\n",
      "\n",
      "572\n",
      "00:23:15.720 --> 00:23:18.900\n",
      "what it is\n",
      "\n",
      "573\n",
      "00:23:17.640 --> 00:23:20.280\n",
      "for some reason it's going last like\n",
      "\n",
      "574\n",
      "00:23:18.900 --> 00:23:22.380\n",
      "don't want to offend anyone but I just\n",
      "\n",
      "575\n",
      "00:23:20.280 --> 00:23:26.059\n",
      "like feel like it reminds me of like\n",
      "\n",
      "576\n",
      "00:23:22.380 --> 00:23:26.059\n",
      "a Florida like Grandma\n",
      "\n",
      "577\n",
      "00:23:26.460 --> 00:23:30.299\n",
      "okay you know what [ __ ] him just zooming\n",
      "\n",
      "578\n",
      "00:23:28.500 --> 00:23:31.980\n",
      "through now here we go okay this one\n",
      "\n",
      "579\n",
      "00:23:30.299 --> 00:23:34.799\n",
      "reminds me of like so many this is like\n",
      "\n",
      "580\n",
      "00:23:31.980 --> 00:23:36.840\n",
      "the Burning Man Edition\n",
      "\n",
      "581\n",
      "00:23:34.799 --> 00:23:39.200\n",
      "the bomb it's effective and it's\n",
      "\n",
      "582\n",
      "00:23:36.840 --> 00:23:39.200\n",
      "accurate\n",
      "\n",
      "583\n",
      "00:23:40.679 --> 00:23:44.940\n",
      "final touches\n",
      "\n",
      "584\n",
      "00:23:42.480 --> 00:23:47.159\n",
      "final touches I'm committing to this oh\n",
      "\n",
      "585\n",
      "00:23:44.940 --> 00:23:49.320\n",
      "my God I'm done and there you have it\n",
      "\n",
      "586\n",
      "00:23:47.159 --> 00:23:51.480\n",
      "set it in stone and hang it in the\n",
      "\n",
      "587\n",
      "00:23:49.320 --> 00:23:53.520\n",
      "Louvre Emma Chamberlain taking on the\n",
      "\n",
      "588\n",
      "00:23:51.480 --> 00:23:55.559\n",
      "hot ones Gauntlet and living to tell the\n",
      "\n",
      "589\n",
      "00:23:53.520 --> 00:23:57.299\n",
      "tale now there's nothing left to do but\n",
      "\n",
      "590\n",
      "00:23:55.559 --> 00:23:59.100\n",
      "roll out the red carpet for you this\n",
      "\n",
      "591\n",
      "00:23:57.299 --> 00:24:00.299\n",
      "camera this camera this camera let the\n",
      "\n",
      "592\n",
      "00:23:59.100 --> 00:24:02.600\n",
      "people know what you have going on in\n",
      "\n",
      "593\n",
      "00:24:00.299 --> 00:24:02.600\n",
      "your life\n",
      "\n",
      "594\n",
      "00:24:02.760 --> 00:24:06.500\n",
      "um yes yes\n",
      "\n",
      "595\n",
      "00:24:04.380 --> 00:24:06.500\n",
      "thank you\n",
      "\n",
      "596\n",
      "00:24:06.960 --> 00:24:12.659\n",
      "um well I have a coffee company uh\n",
      "\n",
      "597\n",
      "00:24:10.460 --> 00:24:15.179\n",
      "chamberlaincoffee.com pick up some\n",
      "\n",
      "598\n",
      "00:24:12.659 --> 00:24:17.460\n",
      "coffee tea coffee and tea related\n",
      "\n",
      "599\n",
      "00:24:15.179 --> 00:24:19.679\n",
      "accessories I have a podcast anything\n",
      "\n",
      "600\n",
      "00:24:17.460 --> 00:24:22.440\n",
      "goes check it out new episodes all the\n",
      "\n",
      "601\n",
      "00:24:19.679 --> 00:24:23.820\n",
      "time every Thursday every week\n",
      "\n",
      "602\n",
      "00:24:22.440 --> 00:24:26.520\n",
      "um and sometimes I make YouTube videos\n",
      "\n",
      "603\n",
      "00:24:23.820 --> 00:24:32.659\n",
      "when my when it sets my soul on fire\n",
      "\n",
      "604\n",
      "00:24:26.520 --> 00:24:32.659\n",
      "thank you Sean what a day what a day\n",
      "\n",
      "605\n",
      "00:24:32.880 --> 00:24:37.080\n",
      "you did it that was so fun\n",
      "\n",
      "606\n",
      "00:24:35.159 --> 00:24:40.440\n",
      "what are you gonna tell your dad\n",
      "\n",
      "607\n",
      "00:24:37.080 --> 00:24:41.880\n",
      "that this shit's serious and and that I\n",
      "\n",
      "608\n",
      "00:24:40.440 --> 00:24:43.620\n",
      "saw in your face that you're there with\n",
      "\n",
      "609\n",
      "00:24:41.880 --> 00:24:44.760\n",
      "me right there with you you were there\n",
      "\n",
      "610\n",
      "00:24:43.620 --> 00:24:46.380\n",
      "with me oh my God I shouldn't touch\n",
      "\n",
      "611\n",
      "00:24:44.760 --> 00:24:50.360\n",
      "myself yeah be careful I did you made it\n",
      "\n",
      "612\n",
      "00:24:46.380 --> 00:24:50.360\n",
      "all the way to this point all the way up\n",
      "\n",
      "613\n",
      "00:24:50.940 --> 00:24:55.679\n",
      "that was so fun you had a good time\n",
      "\n",
      "614\n",
      "00:24:53.820 --> 00:24:58.220\n",
      "are you guys free for another hour let's\n",
      "\n",
      "615\n",
      "00:24:55.679 --> 00:24:58.220\n",
      "do it again\n",
      "\n",
      "616\n",
      "00:24:59.940 --> 00:25:04.740\n",
      "thank you so much for watching today's\n",
      "\n",
      "617\n",
      "00:25:01.919 --> 00:25:08.039\n",
      "video and hot ones fans I have a very\n",
      "\n",
      "618\n",
      "00:25:04.740 --> 00:25:10.980\n",
      "exciting announcement the hot ones Shake\n",
      "\n",
      "619\n",
      "00:25:08.039 --> 00:25:13.320\n",
      "Shack collab is finally here the hot\n",
      "\n",
      "620\n",
      "00:25:10.980 --> 00:25:16.559\n",
      "ones cheese fries the hot ones Burger\n",
      "\n",
      "621\n",
      "00:25:13.320 --> 00:25:19.140\n",
      "the hot ones chicken all made with a\n",
      "\n",
      "622\n",
      "00:25:16.559 --> 00:25:22.140\n",
      "shack sauce that includes hot ones the\n",
      "\n",
      "623\n",
      "00:25:19.140 --> 00:25:25.380\n",
      "classic along with the last dab it's\n",
      "\n",
      "624\n",
      "00:25:22.140 --> 00:25:28.080\n",
      "very spicy it's very delicious and it's\n",
      "\n",
      "625\n",
      "00:25:25.380 --> 00:25:29.820\n",
      "available for a limited time now through\n",
      "\n",
      "626\n",
      "00:25:28.080 --> 00:25:31.740\n",
      "the end of the year at Shake Shacks\n",
      "\n",
      "627\n",
      "00:25:29.820 --> 00:25:34.140\n",
      "Nationwide and via the Shake Shack app\n",
      "\n",
      "628\n",
      "00:25:31.740 --> 00:25:37.340\n",
      "be careful around your eyes and don't\n",
      "\n",
      "629\n",
      "00:25:34.140 --> 00:25:37.340\n",
      "forget to order a milkshake\n",
      "\n",
      "630\n",
      "00:25:37.490 --> 00:25:40.980\n",
      "[Music]\n"
     ]
    }
   ],
   "source": [
    "print(ranked_chunks[8].text)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T23:02:09.020859Z",
     "start_time": "2024-05-22T23:02:09.016591Z"
    }
   },
   "id": "9923b47429e89cf6",
   "execution_count": 249
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "['David Blaine Does Magic While Eating Spicy Wings | Hot Ones',\n 'Puss in Boots Can’t Feel His Tail While Eating Spicy Wings | Hot Ones',\n 'Will Ferrell Brings the Spirit to the Hot Ones Holiday Extravaganza | Hot Ones',\n 'Emma Chamberlain Has a Spiritual Awakening While Eating Spicy Wings | Hot Ones',\n 'Israel Adesanya Gives Thanks While Eating Spicy Wings | Hot Ones',\n 'Viola Davis Gives a Master Class While Eating Spicy Wings | Hot Ones',\n \"Cate Blanchett Pretends No One's Watching While Eating Spicy Wings | Hot Ones\",\n 'Kid Cudi Goes to the Moon While Eating Spicy Wings | Hot Ones',\n 'James Corden Experiences Mouth Karma While Eating Spicy Wings | Hot Ones',\n 'Zoe Saldaña Gets Scorched By Spicy Wings | Hot Ones',\n 'Kate Hudson Stays Positive While Eating Spicy Wings | Hot Ones',\n 'Paul Dano Needs a Burp Cloth While Eating Spicy Wings | Hot Ones',\n 'Cole Bennett Needs Lemonade While Eating Spicy Wings | Hot Ones',\n 'The Best Da Bomb Reactions of 2022 | Hot Ones',\n 'Sean Evans Reveals the Season 19 Hot Sauce Lineup | Hot Ones',\n 'Ramy Youssef Lives on a Prayer While Eating Spicy Wings | Hot Ones',\n 'The Best Last Dab Reactions of 2022 | Hot Ones']"
     },
     "execution_count": 250,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "titles"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T23:02:17.829084Z",
     "start_time": "2024-05-22T23:02:17.821196Z"
    }
   },
   "id": "cacd84878ab6ad25",
   "execution_count": 250
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "['Will Ferrell Brings the Spirit to the Hot Ones Holiday Extravaganza | Hot Ones',\n 'Israel Adesanya Gives Thanks While Eating Spicy Wings | Hot Ones',\n 'David Blaine Does Magic While Eating Spicy Wings | Hot Ones',\n 'The Best Last Dab Reactions of 2022 | Hot Ones',\n 'Ramy Youssef Lives on a Prayer While Eating Spicy Wings | Hot Ones',\n 'David Blaine Does Magic While Eating Spicy Wings | Hot Ones',\n 'Viola Davis Gives a Master Class While Eating Spicy Wings | Hot Ones',\n \"Cate Blanchett Pretends No One's Watching While Eating Spicy Wings | Hot Ones\",\n 'Emma Chamberlain Has a Spiritual Awakening While Eating Spicy Wings | Hot Ones',\n 'Paul Dano Needs a Burp Cloth While Eating Spicy Wings | Hot Ones',\n 'Puss in Boots Can’t Feel His Tail While Eating Spicy Wings | Hot Ones',\n 'Kate Hudson Stays Positive While Eating Spicy Wings | Hot Ones',\n 'Ramy Youssef Lives on a Prayer While Eating Spicy Wings | Hot Ones',\n \"Cate Blanchett Pretends No One's Watching While Eating Spicy Wings | Hot Ones\",\n 'Sean Evans Reveals the Season 19 Hot Sauce Lineup | Hot Ones',\n 'Will Ferrell Brings the Spirit to the Hot Ones Holiday Extravaganza | Hot Ones',\n 'David Blaine Does Magic While Eating Spicy Wings | Hot Ones',\n 'Emma Chamberlain Has a Spiritual Awakening While Eating Spicy Wings | Hot Ones',\n 'Kid Cudi Goes to the Moon While Eating Spicy Wings | Hot Ones',\n 'James Corden Experiences Mouth Karma While Eating Spicy Wings | Hot Ones',\n 'Cole Bennett Needs Lemonade While Eating Spicy Wings | Hot Ones',\n 'Zoe Saldaña Gets Scorched By Spicy Wings | Hot Ones',\n 'Kid Cudi Goes to the Moon While Eating Spicy Wings | Hot Ones',\n 'Cole Bennett Needs Lemonade While Eating Spicy Wings | Hot Ones',\n 'Kate Hudson Stays Positive While Eating Spicy Wings | Hot Ones',\n 'James Corden Experiences Mouth Karma While Eating Spicy Wings | Hot Ones',\n 'Viola Davis Gives a Master Class While Eating Spicy Wings | Hot Ones',\n 'Paul Dano Needs a Burp Cloth While Eating Spicy Wings | Hot Ones',\n 'Zoe Saldaña Gets Scorched By Spicy Wings | Hot Ones',\n 'Emma Chamberlain Has a Spiritual Awakening While Eating Spicy Wings | Hot Ones',\n 'Paul Dano Needs a Burp Cloth While Eating Spicy Wings | Hot Ones',\n 'The Best Da Bomb Reactions of 2022 | Hot Ones',\n 'Ramy Youssef Lives on a Prayer While Eating Spicy Wings | Hot Ones',\n 'Israel Adesanya Gives Thanks While Eating Spicy Wings | Hot Ones',\n 'James Corden Experiences Mouth Karma While Eating Spicy Wings | Hot Ones',\n 'Will Ferrell Brings the Spirit to the Hot Ones Holiday Extravaganza | Hot Ones',\n 'Israel Adesanya Gives Thanks While Eating Spicy Wings | Hot Ones']"
     },
     "execution_count": 242,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "[ranked_chunks[i].title for i in range(37)]"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T23:01:29.983798Z",
     "start_time": "2024-05-22T23:01:29.980897Z"
    }
   },
   "id": "bf5adb443de049c4",
   "execution_count": 242
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "messages = get_initial_messages(\"Which guest worked at Abercrombie and Fitch?\", chunk_metadata[18])"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T22:52:39.615068Z",
     "start_time": "2024-05-22T22:52:39.605327Z"
    }
   },
   "id": "281f1c603ee675af",
   "execution_count": 217
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "response = client.chat.completions.create(\n",
    "  model=\"gpt-4o\",\n",
    "  messages=messages\n",
    ")"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T22:52:46.277986Z",
     "start_time": "2024-05-22T22:52:44.003187Z"
    }
   },
   "id": "4b8c57a6fadddbf",
   "execution_count": 218
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "'The guest who worked at Abercrombie and Fitch is Kid Cudi. You can find the relevant discussion in the video at this link: [Kid Cudi on Hot Ones](https://www.youtube.com/watch?v=0allwd60wS4&t=569s).'"
     },
     "execution_count": 224,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "response.choices[0].message.content"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T22:53:05.698406Z",
     "start_time": "2024-05-22T22:53:05.693844Z"
    }
   },
   "id": "2044d01528d9ad72",
   "execution_count": 224
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "array([18, 30, 34,  1, 29,  8,  4, 10,  2, 33, 24, 17, 20, 28, 19, 35, 15,\n        7, 14,  5, 37, 22,  6, 36,  0, 26, 31, 16, 23, 25, 27, 12, 21, 13,\n        9,  3, 32, 11])"
     },
     "execution_count": 184,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.argsort(similarities)[::-1] "
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-05-22T22:41:08.721590Z",
     "start_time": "2024-05-22T22:41:08.718696Z"
    }
   },
   "id": "b8c0eea25215e336",
   "execution_count": 184
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}