Turn ANY FOLDER into LLM Knowledge in SECONDS

1littlecoder · Intermediate ·🧠 Large Language Models ·1y ago

Key Takeaways

The video demonstrates how to utilize Code to Prompt, a Rust-based tool, to convert any folder or code repository into LLM knowledge in seconds, leveraging tools like Cargo, GitHub, Google Gemini, and Gradio for efficient LLM prompt generation and fine-tuning.

Full Transcript

the simplest way to convert an entire code base into an llm knowledge that means an llm prompt that you can fit in an llm context window a lot of websites as part of their document started offering something called an lm. txt that works only with documentation you can't give an entire code base so in this video I'm going to show you how you can use a tool called code to prompt and then give the entire code base as an llm prompt so if you've got a model like Google Gemini with a longer context window this is Extreme helpful for you to write unit test cases documentation like whatever you want to do with the code base you can do that I'm going to show you the entire process of how you can take any GitHub repo convert them into an llm text send them to an llm and then ask some question to start with this is the tool that we're going to use which is called code to prompt it's a rust based tool I think so if you wa to install it you need to have rust available so you can also if you already have rust available you can install it from from cargo so I've got my terminal so I'm going to just do cargo install code to prompt and once I do that it technically is going to install this library from crates.io as you can see here it is getting installed while it is getting installed this is the repo that we are trying to convert into um NM Tech so this is my very old repo like I had it a few years back probably like you can see that I started the 6 years ago it's a very simple R Library that at that time was quite helpful for people to get cryptocurrency prices to do analysis at the time I'm not actively maintaining this but what we are going to try to do is we're going to use this repo convert this repo into a full-fledged llm text send it to our Google Gemini model and then ask some question either we can ask her to give a a documentation or a unit test or something that we can do with that so now we have successfully install this library at this point just type that command to see if it has been successfully installed so let's go ahead and then do code 2 prompt and as you can see here it says the following requirement arguments were not provided path that means code 2 prompt has a command successfully worked it just does not have whatever we had to give as a path so now what we can do is we can just go to this repository which is what we need to use to convert into the text llm text and we can go here and then just clone this repository I'm going to just do get clone and paste this repo so you can okay no matches for that's quite weird because I just copied the URL that's a stupid thing to do um I'm going to just go here copy this and paste it and you can see that it is copying the repo and it has copied into my current working directory so which is my home folder so if I go inside my home folder I have got a folder called coin market cap R so now what I'm going to do is I'm going to use it with the very basic setup which is just simply do code to prompt and just do coin market cap R and you can see the code has been successfully copied to the clipboard so everything that is so I can go here right now I can just go here and paste it and when I paste it as you can see here it is already available there so I'm going to just say um let me go here and then say I'm going to ask you a couple of questions about this are you ready send it and you can see that the entire thing that we have given is 101,000 tokens so 101,000 tokens very simply copied and then we have pasted into our current system prompt so and Google jini already told me yes I'm ready ask anyway okay ask away ask anyway okay I'm going to say can you give me the sample code to extract all crypto prices and make sure I can draw a bar as well first of all I'm going to see if it can understand R and it should give me the code as well so okay it is giving me the right code and uh it is giving me the code from the source code instead of just using the using the library so it is actually giving me the source code which I've written as part of the library but you can see that it understood the entire context and then it is giving us whatever we want so not every time you want to copy the code to the clipboard so you can copy the code to the clipboard and then you can save it in a notepad file or a text file but the easiest thing is to actually write a code for that so what I'm going to do is I'm going to Simply write a simple command that is going to convert the entire code into a text file an llm text file and then we're going to also save it as an output file so that it is easier for us to just use it as part of rag semantic search or even give it as part of llm text so I'm going to just do code to prompt and the repo coin Market cap R and D- output is equal to um coin um prompt. txt once I do that the code has been copied converted into a prompt and the prompt has been saved in my coin prompt. txt as you can see here the output has been saved into coin prompt. txt so that is already available for us to use so if you want you can just go see uh nanoc coin prompt. dxt and then you can see the entire content here so the entire content of the file you can just see and now you can use this txt file within your chat GPT within your rag system or if you have got like a semantic search system within your computer you can use it it'll be more effective I'm going to just exit this one more interesting thing with this is you can also get to see the number of tokens so this is also something a lot of people try to understand because if you have got a local llm setup you want to understand how many tokens your code base is going to occupy one of the easiest way to do this is if you do code to prompt and then coin market cap R and then all you have to do is you have to get the token count so you can just do dash dash tokens and then it is saying that okay we have got 85,3 194 token and uh for the chat gbt models and for the text embedding like Ada 002 and the token has been copied so this is another easy information that you can get and finally the most advanced setting that I would say is if you want to skip certain files sometimes all you want to do is you don't want to use the code prom you want to just use one particular set of files so for example this has all the r files let's say I want to just use R files I can say include is equal to dot star R so if I do this thing it will just do one R files now it's been copied I can go create a new session let me go create a new s create a prompt paste it now and um I'm going to ask some questions are you ready and you can already see here it is 16,000 tokens because we just used the r code we did not use anything else we didn't use documentation we didn't use any other file format so this is again very easy for you to take only a smaller part of the code base and then use it so overall I think this is one of the easiest ways or probably the simplest way for you to convert your entire code base into an llm prompt and this should ideally work work with any other code base as well like for example if I've got a different folder in my computer U for example recently we did the kokoro TTS implementation so I can just go here and then say code to prompt cooro and then if I do that as you can see here it's got multiple directories it took everything and everything has been copied and pasted I can go click create a new prompt paste it and once I paste it you can see that entire thing is available here so this technically works for any repo that you have got let's go here and then ask a simple question can you give me a simple description of this so I've just pasted the entire thing and I've asked it to give me a simple description okay it is breaking down breaking it down for me it's a text to speech model and it is giving me the key parts of the project and you can see different files available here and here is how it works run this thing and then it will ideally work okay fine so can can you give a me a gradio code to run this so we don't have a gradio code but because I've given this repo so it is going to actually give me a gradio code which will help us to run it as a full frontend application so in just a couple of seconds or minutes probably we managed to give an entire repo ask question about the repo and get a new code that will help us run it as a full stack application I think like you can use this creatively as much as as you want code to prompt is an amazing CLI tool that can convert any repo or any folder into an llm prompt which you can either use it as part of the current in context learning or you can save it as a text file and then use it for posterity but either way this is an amazing tool I wanted to share it with you and then let you know that this is something that you can use to improve your llm knowledge let me know what you feel about this tool if you have got any other tool that you're using for the same purpose I would love to know about it see you in another video Happy promp Day

Original Description

Turn any Code Repo or generally a folder into LLM Knowledge in Seconds! 🔗 Links 🔗 Works better for Code Repos! https://github.com/mufeedvh/code2prompt/ ❤️ If you want to support the channel ❤️ Support here: Patreon - https://www.patreon.com/1littlecoder/ Ko-Fi - https://ko-fi.com/1littlecoder 🧭 Follow me on 🧭 Twitter - https://twitter.com/1littlecoder
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from 1littlecoder · 1littlecoder · 0 of 60

← Previous Next →
1 How to create your Free Data Science Blog on Github with Fastpages from Fastai
How to create your Free Data Science Blog on Github with Fastpages from Fastai
1littlecoder
2 Making Interactive Matplotlib Plots for Data Science Visualizations on Jupyter (Python)
Making Interactive Matplotlib Plots for Data Science Visualizations on Jupyter (Python)
1littlecoder
3 Create your first Data Science Web App using R Shiny
Create your first Data Science Web App using R Shiny
1littlecoder
4 How to create a Reproducible Example in R using reprex
How to create a Reproducible Example in R using reprex
1littlecoder
5 No Code Visualization using esquisse with Tableau-like Drag and Drop GUI in R
No Code Visualization using esquisse with Tableau-like Drag and Drop GUI in R
1littlecoder
6 Scrape HTML Table using rvest and Process them for insights using tidyverse in R
Scrape HTML Table using rvest and Process them for insights using tidyverse in R
1littlecoder
7 Google Teachable Machine Learning Build No Code AI solution
Google Teachable Machine Learning Build No Code AI solution
1littlecoder
8 Create meaningful fake tidy datasets in R using fakir [#rstats Package]
Create meaningful fake tidy datasets in R using fakir [#rstats Package]
1littlecoder
9 How to enable using R Programming with Visual Studio VS Code
How to enable using R Programming with Visual Studio VS Code
1littlecoder
10 Python, Community, Books - with Abhiram R - Bangpypers Co-organizers | 1littlecoder podcast
Python, Community, Books - with Abhiram R - Bangpypers Co-organizers | 1littlecoder podcast
1littlecoder
11 Growing a Tech Community across India - Anubha Maneshwar, Founder Girlscript | 1littlecoder Podcast
Growing a Tech Community across India - Anubha Maneshwar, Founder Girlscript | 1littlecoder Podcast
1littlecoder
12 Intro to Google Colab - How to use Colab
Intro to Google Colab - How to use Colab
1littlecoder
13 Intro to Plotly Express - Complex Interactive Charts with One-Line of Python Code
Intro to Plotly Express - Complex Interactive Charts with One-Line of Python Code
1littlecoder
14 Indic NLP Python Toolkit Open Source Development - iNLTK Creator Gaurav Arora | 1littlecoder Podcast
Indic NLP Python Toolkit Open Source Development - iNLTK Creator Gaurav Arora | 1littlecoder Podcast
1littlecoder
15 Do you want a career in Data Science - Tamil Webinar
Do you want a career in Data Science - Tamil Webinar
1littlecoder
16 Android Smartphone Analysis in R [Live Coding Screencast]
Android Smartphone Analysis in R [Live Coding Screencast]
1littlecoder
17 Programmatically create Images, Memes, Watermarks using Python with imgmaker
Programmatically create Images, Memes, Watermarks using Python with imgmaker
1littlecoder
18 Kaggle Walkthrough to get you started with Data Science - Webinar
Kaggle Walkthrough to get you started with Data Science - Webinar
1littlecoder
19 Community, Corporate Job, Coding - Gnana Lakshmi T C aka Gyan, WomenWhoCode Leadership Fellow
Community, Corporate Job, Coding - Gnana Lakshmi T C aka Gyan, WomenWhoCode Leadership Fellow
1littlecoder
20 Easy ggplot2 Theme Customization with {ggeasy} | Data Visualization in R
Easy ggplot2 Theme Customization with {ggeasy} | Data Visualization in R
1littlecoder
21 Excel to R - Pivot + Bar Chart in Excel  & R using tidyverse [Live Coding]
Excel to R - Pivot + Bar Chart in Excel & R using tidyverse [Live Coding]
1littlecoder
22 Excel to R #2 - VLOOKUP in Excel to LEFT_JOIN, MERGE in R
Excel to R #2 - VLOOKUP in Excel to LEFT_JOIN, MERGE in R
1littlecoder
23 5 websites to get Free Real-World Datasets for Data Science/ML Projects
5 websites to get Free Real-World Datasets for Data Science/ML Projects
1littlecoder
24 Excel to R #3 - APPROXIMATE VLOOKUP in Excel to FUZZY LEFT_JOIN in R
Excel to R #3 - APPROXIMATE VLOOKUP in Excel to FUZZY LEFT_JOIN in R
1littlecoder
25 Correlation-alternative PPS (Predictive Power Score) Python Package Demo
Correlation-alternative PPS (Predictive Power Score) Python Package Demo
1littlecoder
26 Automated Website Screenshots in R using {webshot}
Automated Website Screenshots in R using {webshot}
1littlecoder
27 Installing Custom RStudio Theme (Synthwave85)
Installing Custom RStudio Theme (Synthwave85)
1littlecoder
28 Analyse Google Trends Search Data in R using {gtrendsR}
Analyse Google Trends Search Data in R using {gtrendsR}
1littlecoder
29 3 Tips to ask question on Stack Overflow the right way to get answers
3 Tips to ask question on Stack Overflow the right way to get answers
1littlecoder
30 Learn Data Science with R - Mini Projects - Web Scraping Zomato
Learn Data Science with R - Mini Projects - Web Scraping Zomato
1littlecoder
31 Easily make Dumbbell Chart using {ggcharts} | Data Visualization in R
Easily make Dumbbell Chart using {ggcharts} | Data Visualization in R
1littlecoder
32 GET Hackernews Front Page Results using REST API in R
GET Hackernews Front Page Results using REST API in R
1littlecoder
33 Quickly deploy ML WebApps from Google Colab using ngrok
Quickly deploy ML WebApps from Google Colab using ngrok
1littlecoder
34 Use Jupyter Notebooks within VSCode (Visual Studio Code) in 2020
Use Jupyter Notebooks within VSCode (Visual Studio Code) in 2020
1littlecoder
35 Plotly Interactive Plots as Pandas Plotting Backend df.plot()
Plotly Interactive Plots as Pandas Plotting Backend df.plot()
1littlecoder
36 Stack Overflow Developer Survey 2020 Highlights for New Programmers
Stack Overflow Developer Survey 2020 Highlights for New Programmers
1littlecoder
37 Matplotlib Animation Charts in Python using Celluloid
Matplotlib Animation Charts in Python using Celluloid
1littlecoder
38 Coding, Postwoman, Passion Project Book - Liyas Thomas Open Source Developer - 1littlecoder podcast
Coding, Postwoman, Passion Project Book - Liyas Thomas Open Source Developer - 1littlecoder podcast
1littlecoder
39 Aspiring Data Scientist, Tips on How to learn Business Domain Knowledge
Aspiring Data Scientist, Tips on How to learn Business Domain Knowledge
1littlecoder
40 Bokeh Interactive Charts as Pandas Plotting Backend df.plot_bokeh()
Bokeh Interactive Charts as Pandas Plotting Backend df.plot_bokeh()
1littlecoder
41 Easy Fast Python Pandas Summary with Sidetable | Pandas Tips & Tricks
Easy Fast Python Pandas Summary with Sidetable | Pandas Tips & Tricks
1littlecoder
42 Inception, Content Ideas, Consistency - Srivatsan Srinivasan AIEngineering YouTube Content Creator
Inception, Content Ideas, Consistency - Srivatsan Srinivasan AIEngineering YouTube Content Creator
1littlecoder
43 ggplot2 Text Customization with ggtext | Data Visualization in R
ggplot2 Text Customization with ggtext | Data Visualization in R
1littlecoder
44 Penguins Dataset Overview - iris alternative | EDA Data Visualization in R
Penguins Dataset Overview - iris alternative | EDA Data Visualization in R
1littlecoder
45 YouTube Growth Tips, Content Creation - Bhavesh Bhatt, YouTuber (Data Science & Machine Learning) #7
YouTube Growth Tips, Content Creation - Bhavesh Bhatt, YouTuber (Data Science & Machine Learning) #7
1littlecoder
46 Matplotlib Animated Bar Chart Race in Python | Data Visualization
Matplotlib Animated Bar Chart Race in Python | Data Visualization
1littlecoder
47 Simple Python GUI Development using {guietta}
Simple Python GUI Development using {guietta}
1littlecoder
48 #8 Niche, Growth, Monetization - David Langer - YouTuber Dave on Data
#8 Niche, Growth, Monetization - David Langer - YouTuber Dave on Data
1littlecoder
49 Simple Fast 3-step Python OCR using Deep Learning 40+ Languages
Simple Fast 3-step Python OCR using Deep Learning 40+ Languages
1littlecoder
50 Github New Feature Profile Summary/Mini-Resume - Profile Views
Github New Feature Profile Summary/Mini-Resume - Profile Views
1littlecoder
51 Otto ML Assistant, GPT-3 on Philosophers, Nvidia-ARM - 3 ML Tech News
Otto ML Assistant, GPT-3 on Philosophers, Nvidia-ARM - 3 ML Tech News
1littlecoder
52 What is OpenAI GPT-3 - Hype, Examples, Worries
What is OpenAI GPT-3 - Hype, Examples, Worries
1littlecoder
53 Julia 1.5, Datamuse API, Live HDR+ Pixel 4a - Machine Learning Tech News
Julia 1.5, Datamuse API, Live HDR+ Pixel 4a - Machine Learning Tech News
1littlecoder
54 Self-driving Car Engineer sentenced, arXiv Dataset, AI/ML Startup Idea - Machine Learning Tech News
Self-driving Car Engineer sentenced, arXiv Dataset, AI/ML Startup Idea - Machine Learning Tech News
1littlecoder
55 GPT-3 Explorer, Ciphey (Automated Decryption), Py-Sudoku - ML Tech News
GPT-3 Explorer, Ciphey (Automated Decryption), Py-Sudoku - ML Tech News
1littlecoder
56 How to use Advanced Google Search to extract Email Ids from Linkedin
How to use Advanced Google Search to extract Email Ids from Linkedin
1littlecoder
57 Cartoonizer Toon-IT (AI Web App), GPT-3 Advice, Android Earthquake Detection - ML Tech News
Cartoonizer Toon-IT (AI Web App), GPT-3 Advice, Android Earthquake Detection - ML Tech News
1littlecoder
58 Flow - R Package to visualize code logic, functions as a Flow Diagram
Flow - R Package to visualize code logic, functions as a Flow Diagram
1littlecoder
59 Build GPT-3-like Language Model on Google Colab with minGPT [PyTorch]
Build GPT-3-like Language Model on Google Colab with minGPT [PyTorch]
1littlecoder
60 Create a Pencil Sketch Portrait with Python OpenCV
Create a Pencil Sketch Portrait with Python OpenCV
1littlecoder

This video teaches how to leverage Code to Prompt to rapidly convert code repositories into LLM knowledge, enabling efficient questioning and retrieval of specific code or documentation. By mastering this technique, developers can significantly enhance their workflow and productivity.

Key Takeaways
  1. Install Code to Prompt via Cargo
  2. Clone a GitHub repository
  3. Use Code to Prompt to convert the repository into LLM text
  4. Copy the entire code base into the clipboard
  5. Paste the code into the Google Gemini model
  6. Use the 'code to prompt' command to get token count
  7. Exclude certain files using the 'include' parameter
💡 The Code to Prompt tool can be utilized to convert any folder or code repository into LLM knowledge in seconds, making it an invaluable asset for developers seeking to streamline their workflow and improve productivity.

Related Reads

Up next
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Watch →