Spaces:
Runtime error
Runtime error
wendru18
commited on
Commit
·
147ee28
1
Parent(s):
87ee9d7
first commit
Browse files- notebook.ipynb +24 -25
notebook.ipynb
CHANGED
@@ -318,73 +318,72 @@
|
|
318 |
},
|
319 |
{
|
320 |
"cell_type": "code",
|
321 |
-
"execution_count":
|
322 |
"metadata": {},
|
323 |
"outputs": [
|
324 |
{
|
325 |
"name": "stdout",
|
326 |
"output_type": "stream",
|
327 |
"text": [
|
328 |
-
"
|
329 |
-
"\n",
|
330 |
-
"['https://www.youtube.com/watch?v=G4qOiwIE_o0', 'https://www.youtube.com/watch?v=ABG-1iy07NM', 'https://www.youtube.com/watch?v=-cz4in1WY-o', 'https://www.youtube.com/watch?v=KA5FmevAzTc', 'https://www.youtube.com/watch?v=JZ7GHzkBvzs']\n",
|
331 |
"Segments generated successfully!\n",
|
332 |
"Fitting with n=5...\n",
|
333 |
"Searcher fit successfully!\n",
|
334 |
-
"Segment from '
|
335 |
-
"Timestamp: (
|
336 |
"\n",
|
337 |
-
"
|
338 |
"\n",
|
339 |
"\n",
|
340 |
"\n",
|
341 |
-
"Segment from '
|
342 |
-
"Timestamp: (
|
343 |
"\n",
|
344 |
-
"
|
345 |
"\n",
|
346 |
"\n",
|
347 |
"\n",
|
348 |
-
"Segment from '
|
349 |
-
"Timestamp: (
|
350 |
"\n",
|
351 |
-
"
|
352 |
"\n",
|
353 |
"\n",
|
354 |
"\n",
|
355 |
-
"Segment from '
|
356 |
-
"Timestamp: (
|
357 |
"\n",
|
358 |
-
"
|
359 |
"\n",
|
360 |
"\n",
|
361 |
"\n",
|
362 |
-
"Segment from '
|
363 |
-
"Timestamp: (00:
|
364 |
"\n",
|
365 |
-
"
|
366 |
"\n",
|
367 |
"\n",
|
368 |
"\n",
|
369 |
-
"
|
370 |
]
|
371 |
},
|
372 |
{
|
373 |
"data": {
|
374 |
"text/plain": [
|
375 |
-
"('
|
376 |
-
" 'Segments that might have been used to answer your question: (If you specified more segments than shown here, consider increasing your token budget)\\n\\n### Segment 1 (
|
377 |
]
|
378 |
},
|
379 |
-
"execution_count":
|
380 |
"metadata": {},
|
381 |
"output_type": "execute_result"
|
382 |
}
|
383 |
],
|
384 |
"source": [
|
385 |
"main(openAI_key=\"env\", \n",
|
386 |
-
" question=\"
|
387 |
-
" urls_text=\"\", \n",
|
388 |
" split_by_topic=False, \n",
|
389 |
" segment_length=200, \n",
|
390 |
" n_neighbours=5, \n",
|
|
|
318 |
},
|
319 |
{
|
320 |
"cell_type": "code",
|
321 |
+
"execution_count": 22,
|
322 |
"metadata": {},
|
323 |
"outputs": [
|
324 |
{
|
325 |
"name": "stdout",
|
326 |
"output_type": "stream",
|
327 |
"text": [
|
328 |
+
"What it does after extracting only the code\n",
|
329 |
+
"https://youtu.be/l_r_b38VXmQ\n",
|
|
|
330 |
"Segments generated successfully!\n",
|
331 |
"Fitting with n=5...\n",
|
332 |
"Searcher fit successfully!\n",
|
333 |
+
"Segment from 'GPT-4 Auto Coder 2 reads docs from URL links and Auto Debugs' by echohive\n",
|
334 |
+
"Timestamp: (12:01, 13:12)\n",
|
335 |
"\n",
|
336 |
+
"exact same thing we tried at first right after this neural network demonstration so look so it's finished it and ran it there we go and test input I have successfully created synthetic data set and it's given its final answer yeah it's pretty crazy so look let's just grab our instructions without any links and give it to gpt4 and see how far it goes so you didn't even know what to do but I have added return of python script for this let's see what it does now as we see here we got some code loading of the text is fine but there's nothing about link chain it just simply doesn't know what Lang chain is it doesn't know what a QA chain is it's just trying to come up with something cool as far as it knows what's best but this is not what we were looking for by the way we're gonna review the code here in a moment but all the necessary code will be available to my patreon supporters the link will be in the description now let's try it with web browsing with gpt4 this is Cape this uses gpt4 and it\n",
|
337 |
"\n",
|
338 |
"\n",
|
339 |
"\n",
|
340 |
+
"Segment from 'GPT-4 Auto Coder 2 reads docs from URL links and Auto Debugs' by echohive\n",
|
341 |
+
"Timestamp: (07:31, 08:38)\n",
|
342 |
"\n",
|
343 |
+
"was mostly right it's 95 there all you have to do is just add Dot Page content over here and a good user question and you're good to go which would have taken somehow maybe longer uh to try to figure out from the documentation alone so as we see in the first interaction it actually received an error see set the sequence up so it actually did really well this time but it got the expected string because it had a problem with the how the character text splitter creates the document because it's a tuple so it actually decide to print it see as you see it actually prints it and it understands that it has to use page contents here let's say see says I can see that the text variable contains a list of document objects I need to extract the page content and here it's actually using that text first element of the text the page content versus up here when it was receiving the error it was only trying to let's see where is it it was only trying to use the first element which is the Tuple object right here right the list\n",
|
344 |
"\n",
|
345 |
"\n",
|
346 |
"\n",
|
347 |
+
"Segment from 'GPT-4 Auto Coder 2 reads docs from URL links and Auto Debugs' by echohive\n",
|
348 |
+
"Timestamp: (08:38, 09:46)\n",
|
349 |
"\n",
|
350 |
+
"the Tuple within a list does because at the end there's some metadata actually on the third try see it was able to create a code that actually worked perfectly it actually was able to get the answer right now it's actually giving us the final answer but we can just copy this for example you do have to run this in an environment which you have all these packages installed we're going to talk about the requirements here in a moment but if you were to bring it into this test and just run this let me see we are loading our QA chain text splitter we are loading Isaac newton.text and getting first chunk is the first element's page content and we are input inputting that is the document and question is what did Isaac Newton discover me right oh I have to stop that and whenever you run this is actually a working code line chain code question over question answering over documents is you have split documents into three but we are only using the first document and Isaac Michigan discovered the laws of motion and universal gravitation so I found that this works really well\n",
|
351 |
"\n",
|
352 |
"\n",
|
353 |
"\n",
|
354 |
+
"Segment from 'GPT-4 Auto Coder 2 reads docs from URL links and Auto Debugs' by echohive\n",
|
355 |
+
"Timestamp: (04:13, 05:20)\n",
|
356 |
"\n",
|
357 |
+
"lag format and if we take a look at the documentation as we see actually in the question answering stuff not in nowhere in the two pages stuff chain type is mentioned it's only using mapreduce and we're not going to be using summarize we're saying only question answering QA chain we're not even specifying the exact name and also with the characters text splitter we're saying chunk size to 500 and also the overlap of zero and this will of course split it into multiple pieces but we said that we only want to work with the first element of that first chunk or the first element of the list so as we see so we review it we have the summarize elements we have the QA elements and the text splitter once we know we have all our elements all we have to do is just put our instructions in here I have implemented multi-line input so you can actually paste code here as well because it's a multi-line input we do have to say done and click enter and now we're entering agent executor chain so this is the fun part as you see I have heavily\n",
|
358 |
"\n",
|
359 |
"\n",
|
360 |
"\n",
|
361 |
+
"Segment from 'GPT-4 Auto Coder 2 reads docs from URL links and Auto Debugs' by echohive\n",
|
362 |
+
"Timestamp: (00:00, 01:07)\n",
|
363 |
"\n",
|
364 |
+
"hey everybody today we're gonna look at different implementation of Auto GPT which writes code debugs it automatically all while using documentation as its guidance what we're going to do is we're going to load this page this URL question answering and summarize analyze document URL and character text Splitter from blank chain and then we're going to ask and we will be using a python agent with the python Ripple which is able to execute code and gets feedback from the output and takes in user instructions to write code whatever you like let's just run this the best way to understand it is to see it when we run this code we are first greeted that the script this script will be Auto executing AI generator code this may be dangerous make sure you're observing the process we have to say accept here once we type in accept and click enter we are asked do you want to load any URLs we're going to say yes we don't have to load URLs if you don't want to you can just give it instructions without the urls I've set it up so that you can load up to three\n",
|
365 |
"\n",
|
366 |
"\n",
|
367 |
"\n",
|
368 |
+
"I could not find an answer.\n"
|
369 |
]
|
370 |
},
|
371 |
{
|
372 |
"data": {
|
373 |
"text/plain": [
|
374 |
+
"('I could not find an answer.',\n",
|
375 |
+
" 'Segments that might have been used to answer your question: (If you specified more segments than shown here, consider increasing your token budget)\\n\\n### Segment 1 (12:01 - 13:12):\\n<iframe\\n width=\"400\"\\n height=\"240\"\\n src=\"https://youtube.com/embed/l_r_b38VXmQ?start=721&end=792&controls=0\"\\n frameborder=\"0\"\\n allow=\"accelerometer; autoplay; modestbranding; encrypted-media; gyroscope; picture-in-picture\"\\n allowfullscreen\\n >\\n </iframe>\\n\\n### Segment 2 (07:31 - 08:38):\\n<iframe\\n width=\"400\"\\n height=\"240\"\\n src=\"https://youtube.com/embed/l_r_b38VXmQ?start=451&end=518&controls=0\"\\n frameborder=\"0\"\\n allow=\"accelerometer; autoplay; modestbranding; encrypted-media; gyroscope; picture-in-picture\"\\n allowfullscreen\\n >\\n </iframe>\\n\\n### Segment 3 (08:38 - 09:46):\\n<iframe\\n width=\"400\"\\n height=\"240\"\\n src=\"https://youtube.com/embed/l_r_b38VXmQ?start=518&end=586&controls=0\"\\n frameborder=\"0\"\\n allow=\"accelerometer; autoplay; modestbranding; encrypted-media; gyroscope; picture-in-picture\"\\n allowfullscreen\\n >\\n </iframe>\\n\\n### Segment 4 (04:13 - 05:20):\\n<iframe\\n width=\"400\"\\n height=\"240\"\\n src=\"https://youtube.com/embed/l_r_b38VXmQ?start=253&end=320&controls=0\"\\n frameborder=\"0\"\\n allow=\"accelerometer; autoplay; modestbranding; encrypted-media; gyroscope; picture-in-picture\"\\n allowfullscreen\\n >\\n </iframe>\\n\\n### Segment 5 (00:00 - 01:07):\\n<iframe\\n width=\"400\"\\n height=\"240\"\\n src=\"https://youtube.com/embed/l_r_b38VXmQ?start=0&end=67&controls=0\"\\n frameborder=\"0\"\\n allow=\"accelerometer; autoplay; modestbranding; encrypted-media; gyroscope; picture-in-picture\"\\n allowfullscreen\\n >\\n </iframe>\\n\\n')"
|
376 |
]
|
377 |
},
|
378 |
+
"execution_count": 22,
|
379 |
"metadata": {},
|
380 |
"output_type": "execute_result"
|
381 |
}
|
382 |
],
|
383 |
"source": [
|
384 |
"main(openAI_key=\"env\", \n",
|
385 |
+
" question=\"What it does after extracting only the code\", n_videos=5, \n",
|
386 |
+
" urls_text=\"https://youtu.be/l_r_b38VXmQ\", \n",
|
387 |
" split_by_topic=False, \n",
|
388 |
" segment_length=200, \n",
|
389 |
" n_neighbours=5, \n",
|