Aider : the production ready AI coding assistant you've been waiting for

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to code with JV I'm excited about what I've got for you today it is a production ready AI powered coding assistant I've started integrating it into my daily workflow and I'm seeing it lots of other people online saying the same thing first AI powered assistant that they're actually using for production work day to day let's dive into it it's called Ida Ada hey Ida I'm going with Ida I don't know I'm guessing it's a portmento of AI encoder it is a CLI tool you run it in your terminal it's powered by open AIS apis so gpt4 GPT three and a half plans to integrate it with others over time I've seen some tickets about playing around with Claude which means you're burning credits when you use it but it's well worth it it's tightly integrated with Git which means it is committing to get for you and it can do not just create sample code but it can perform operations like ad unit tests refactor move this at a particular function change it to this the tasks you do day-to-day coding you can start to do those things but it is tightly integrated with Git which is sort of a plus and a minus but I think that's why it's getting cut through is just its usability it's being updated maintained Paul who leads the project lovely responsive on GitHub new features coming out I'm seeing issues resolved every day it's looking good enough that I actually went ahead and integrated it with my favorite editor more on that in a bit the guides are excellent really good tips about how to use it great installation tips so I won't go through a full install for you but I'll just give you some pointers one of the things about this approach of sending requests to open AI is that every time you send requests you've got to give chat GPT the information about your code base this is a lot of what Ida does it gives you tools for managing what information you send to chatgpt each time you talk to it it is a pip module so just pip install either chat we'll get it into your code base you might want to wrap it in an environment or I've just installed it globally because I use it everywhere it also uses a feature called ctags which is old Tech initially used for coding editors to know the types of function you've got in your code Etc to enhance Ides you don't need to use C tags but if you do it performs better this is where ctags creates a summary of all your functions that are used that can be passed to really summarize your entire code base and help catch EBT give you better responses it needs to have the Json flag I had actually uninstall my original version of C tags which was exuberance tags and then I had to replace it with universal C tags so at get install Universal C tags got me the right version to integrate in once you've done that then you just need to have an open AI key saved in your environment in the right format and you're good to go I'm in a new folder here let's open it in vs code this is a useful way of just seeing what's happening in the code as we go let's launch it so either no Flags it will start to initialize a git repo because like I said it's tightly coupled with Git and the reason is because it can change your files on you and sometimes it can make bad mistakes you don't want putting it in git is a way of making sure you can quickly unroll anything it does for you because if you've got something that isn't git and either trashes it you might lose some data you can run it with a no get flag if you want it's got some extensive Flags hopefully let's have a look at that so if you go either help you'll see all the things you can do like don't use it with Git turn off auto commits you can start to change the themes and everything in there you can start to change which model you're using a lot of options here so quite a full featured application let's turn it back on but it'll tell you what model it's using it will tell you whether it's using C tags or not and it's going to use a thousand tokens as its quota for how much space the C tags can take up you can modify that like most things in it type help and you'll see the commands you can run in the program now just by doing this starting at making a git repo it's gone and made all these hidden files up here first thing you want to do get that into a git ignore the tool is quite sensitive to the state of your git so if you fire it up with uncommitted changes like I said before it's going to try and protect you by making sure everything that it touches is saved and get before it does anything so it can seem a bit annoying but once you realize it's there to protect your files you can roll with it if we type in tokens it's got a system message and it's got a repository map so this is where you can start to see how many tokens it's using every time you make a chat it will store that summary of it so that it continues to be aware of previous discussions like a good chatbot would anything you type here is just an instruction to GPT please create a hello like so I find gbd4 there's a bit of lag with it coming back three and a half it's much faster but not as good so here it's saying let's make a Hello World file let's do a print do you want me to add the file yep it's edited it we have ourselves a file we've got the hello world oh one tip I wouldn't actually run it in the terminal in vs code I'd run it in a separate window because the terminal gets quite stuttery in the output's not as good here we've got this right hand hello world no surprises that's not that notable let's look at our git history you'll see it's actually very verbose in the git history when you've got Auto commits turned on so every time you do a chat message by default it will save something into your git history and you'll be able to see what the chat was what the response was Etc I think the innovation of this tool was like let's get the output in diffs and let's put those diffs straight into git that's what's turned up from just I wouldn't really use it to actually this is functional enough like I said before you can turn off auto commits if you want to have more control over what your git history looks like if you type help you'll see there are some things like commit diff Etc undo hey I don't like what you just did that commit is gone dropping hello world all right thank you and now it's gone in step back so if it makes a change you don't like you can just do undo roll back all right that's a starting point if you've got either minus three now you're in GPT three and a half mode and the difference is some of it's Financial so gbd4 three cents a thousand tokens AK window three and a half a tenth the price twice the number of tokens but you've got to be a lot more precise when you're using three and a half and give it smaller tasks right what should we try and make I've made pong before maybe we can do naughts and Crosses yeah see what it can do eye level very abstract task here we can see it is checking the win playing the game malformed response right up I'm in three and a half the speed was giving that away let's see how three and a half did at this job print board check win play game maybe it was good enough but this is one of the advantages of a tool like this is switching between your models based off the task you've got to hand if I was watching gpt4 to that it's more expensive tons slower is what bothers me more you're watching a tick tick tick three and a half spins it out quite quickly so maybe that was a fortunate mistake lots and Crosses oh yeah into a row 0.0 into the column it looks like it's a two-player game and we've got one five one five it busts it doesn't have error handling in it but hey it's a step in the right direction let's see how three and a half goes at changing this one of the things you now if I type tokens you'll see that token count has gone up because it's got the code itself it's also got chat history if you type clear you can remove your chat history it forgets about what you've been talking about if you type drop it is going to remove context that it sends down to it this is what I mean by having a lot of control over the context you send your AI tools on every query but I'm happy with that for now let's go with a Next Step let's add some error checking for bad input now let's have a look at what the app looks like I'm gonna go five hey that's wrong so that is a reasonable task and I wonder if it gets the win condition right zero zero like so I want to do two zero right okay and now let's have a race zero one all right who's going to win damn got it wrong okay I'm beating myself and I it's confusing on things so I'm gonna go two two play X win so it's got a win Condition it's a naughts and Crosses game we're probably talking about a cent of credits to make a simple start like this now that's all well and good let's start to see how it handles multiple files a typical task I do here is like actually let's get your display logic and your business logic out let's see if I can refactor this into multiple files it's got themes where you can mess with the colors to make them all visible in different contexts it's making a board.py and it's making a game.py we've got our game we've got our board and noughts and Crosses it is left untouched so it looks like it's just made two new ones I might do a git log where I can actually see notice that three and a half has less verbose git commits okay so it's made those changes if we go python game Etc so it looks like the game's still playable and it's refactored that out this is where it started to create files look at this it's got a board it's got a print board it's an update it's a whole board class and here is a game code which has got a bunch of the game things which uses the board class you can give it instructions like please move to functional programming please translate into another language and it can start to do tasks like this quite quickly and this is all on three and a half we haven't even touched the powerful model yet and it's still doing useful work in this toy domain few more things you can look at here the reason I went to multiple files is a bit of less LS these are the files in chat ah I don't think we need noughts and Crosses anymore drop it and now the token count will be just these files here you can also do things like is a chat history useful probably not clear now the chat history is gone and just those files are in there so as you're coding you can start to control the tokens because maybe you want to control the costs on the expensive models though I was coding for hours and spent like five six bucks before seeing this tool I was like oh yeah AI tools are coming for programmers it's going to affect us you know it's affecting us already I'm using chat GPT mostly even GitHub Copart I found is only okay after seeing this I'm starting to form the view that like six months from now 12 months from now if someone is paying you to write code and you are not using this tool you are probably doing them a disservice unless there's a good reason not to be using AI tools such as private code bases organizational policy Etc otherwise I think you are wasting your clients money if you type all the stuff out and you don't lean on these types of tools they're getting to that level of utility and Ida's still early it's still got bugs I still got things that are being worked out but fast forward six months 12 months from now I think you need to be using it which is interesting to get to such a strong Viewpoint search quickly but who knows what will happen let's actually try and ship a real feature remember how I said I integrated it with my favorite editor which is of course Vim I've been using Vim for 20 years and I love it so much and it's just become ingrained in how I work one of the things about them is it's a personalized coding environment which you configure to work the way you want I want it to work with Ida so I build a plugin to do so here is the plugin so fast it's pretty vanilla at the moment it doesn't do much apart from if I open up a code base so I'm in them now and I've got the this is the the main guts of the plugin all it really does is say hey if I type a keyboard shortcut it opens up either in a separate window I can close out of it quite quickly and easily but I can also hit a different keyboard shortcut and now I've opened it in silent mode so it's not doing Auto commits or a different one and now I'm using dvd3 so with a couple of keystrokes it's firing up different models of Ida in the code base and that that's enough for me to prefer using it in Vim as opposed to having a separate terminal window running just that flexibility to shift the commands quite quickly if I have a look at my Ida plugin this is where I can quickly set up different keyboard shortcuts to open either with whatever Flags I want whatever models I want that's a good starting point but let's do something more because one of the biggest drags about Ida is manually managing what you want to send and how what I would like to do is when I'm in a file and I open it up I go LS here it doesn't have any files in its context it doesn't know about the file I was just in be pretty easy to send it it's just a command line argument so that's what I'll do I'm going to go and say add either I'm adding in the I might add the docs as well if you look at some of the issues which are interesting there is one around automatic file context window management so like how does it drop files when you don't need them how to add them as you need them without you having to manually do it as much putting smarts in there there was another one for learn from documentation wouldn't it be nice to have a slash research command in there and give it a URL or give it a name of a library and it went and hoovered up the information online and smartly Managed IT and sent the right bits to chat GBC as you need those features it will just lift this up to the next level of Awesomeness so I just want to make it a little nibble on this one for my particular use case which is instead of having to manually add things in there let's have it automatically manage some of them to do that GPT needs to know a little bit about the command line tool it doesn't know anything about Ida it knows about this code here but that's got limited info in it so what I might do is if I just go either help like so I have just made a little text file which is a file which can be added to either itself which has the command line tool interfaces on it and I think you can do this where you copy and paste documentation just stick it in there without any improvements to the tool you can quickly start to do things where you add them in yourself although one problem here is if you do this and I try and go add it's not going to find it because it only knows about stuff in Git it won't add anything unless it's in git because it wants to protect you so if we go here like this or I'm in main we don't want to do a main I'm calling this a auto add buffer I'll probably throw that away once I finish this code base but just as an example of how things need to be and get to use it it's a stepping stone and now I haven't had to refresh either it just looks in real time to see is it allowed to edit help text now I can see it knows about the help docs it knows about the documentation which I don't think is actually going to help it and this is the game of like oh what does chat chipity need to know to do this job similar to if I had an intern or a junior programmer I'd ask myself what do they need to know to do this work go look at these docs and so on and sort of cultivating someone else to succeed is a little bit of the skill I think you need to get the most out of these AI tools let's drop and I don't need the doctor thing now we can start to give it some tasks what I want it to do is automatically add the buffers to the window when we open it so when I open either I'm going to use automatically to add all the buffer files and also check to see if actually I'll do it step by step because if you give it too many tasks it gets a bit overloaded if you give it smaller tasks it's more likely to get it right less likely to have to redo work and let's see what it does here you can probably see the speed difference between four and three and a half it is modifying this existing function and I didn't have a huge amount of code here but this is the code it's saying change this function oh and let's go and do some things where I'm mapping over the buffers in Vim a buffer is sort of like all the files that you have opened I'll show you about them in a second it's added them and now it's made a commit reload it now I've got this code in here so testing Vim plugins well that's the thing in itself I'm just going to re-update it this is updating all of them but I think I might actually need to restart the whole thing yeah I know it seems like you're trying to talk to close and open files with them sorry chat GPT but thank you for the input I find that my biggest problem with them is that I use it so much I often type it's shortcuts into other contexts where it doesn't help let's have a look here and let's get Lua open now did it work look at that so with that change this is a useful feature I'll be shipping this to the repo Zone which is up here at either.nvim if anyone else is a Vim User it's automatically adding that context hey that's an improvement I would nearly ship this but we need to do a bit more testing first because I can quickly load this context I'm just closing either again I open it when I need it buffers in them if I go call an LS it's saying I've got two open buffers at the moment I've got the Ida lure and I've got the terminal which was open before because the buffers are not the windows that are open they're basically any files you have opened in this session if I open up the readme and now if I go back to the other one I've only got one file open but I have multiple buffers open and it will send them all to Ida whenever I load it up which is kind of a feature but what if I did something like this add new file.text open we've got stuff in it now I have got a new file it's not in git that's going to make Ida sad and if I go to here I've got these buffers open wonder what's going to happen open it up either adding okay well that's not too bad new file and oh look at that term thing probably needs to filter that out I think I might get that term filter in there I'm going to yeah I think that is going to be I'm just going to do term slash like that it's a bit of a hack but I think that will start to improve things a little bit so again this is the speed of gbd4 a little bit slower I'm interested in use cases where you can do another task while it's doing its thing but also the other thing I find when using this in practice is that you want to start having small files and you want to start having small functions it makes it easier for Ida to cherry pick the parts of the code not have to send down the whole file and regenerate the whole file which is where it gets slow and wasteful and burns extra tokens but that's also a good practice for a developer in general I'd be advising my juniors to do that I like that it encourages you in that sort of practice it looks like it's filtering things if not match add it to the but that looks like a pretty safe bit here if we go back to the Lua file it's got the if it doesn't match and save it's already committed to git which means I can do a packer update this is just reloading the plugin itself in Vim now we've got our texting for mute text file and lure sure it looks like add a new file I'm guessing when I did that save it committed new text file it's no longer an uncommitted file yeah oh we can do something classy let's go here and I'm just going to go and use new DOT text yeah proper development okay let's get new new DOT text open stuff okay only now this means I've got a buffer open with term it means that I've got one that's uncommitted and I've got two which are committed let's see how it behaves add new file yep I want to add it and all right that's a feature I'm happy with that I'm going to commit it and go from there hopefully that gives you an idea about how you can start to use this tool for production work you're controlling the files that you're sending down you're starting to drop them add them when you want you reset your chat you can have them in a separate terminal integrate it into your idea if you can hopefully this shows you how you can start to integrate external things which chat CBD doesn't know about is for now just get them into a file in your system call it AI docs or whatnot I've been teaching programmers for 10 years now and one of the first things I'd encourage people to think about is you're writing your code for two audiences there's the programmers and there's the computer it needs to work for both if you just make it work for the computer but it's hard for programmers to read well that's the liability it's not useful if it just works for the programmers but it doesn't work for the computer well that's a bug it's broken non-functional I think now we have to start writing for three audiences human programmers AI programmers and the computer executing the code I'm really interested and excited to see how this changes our development practices as first step here is well I'm starting to curate some documentation in this repo only only for the AI programmer I'm not going to read that help file and try and figure things out I can just get it when I need it I can curate what I send down to chat EBT and extend its capabilities beyond what it's trained for that just opens up utility straight away when we start building features on top of this such as Hoover up this website stick it into a vector Store Cherry pick the stuff you want incorporate it into a knowledge base that's where I just think these tools are going to supercharge every developer which is why I'm going as far to say I think everyone needs to be using these if you're a developer who sells your time for code you should start looking at this Tech now because I think right now it can save your clients money right now it can make you more productive Etc which is pretty exciting to see because this is a sort of a play repo I do have the auto commits on which I don't love I'm kind of curious to see what does it feel like to have these heavy Auto commits in there does it become useful for someone else this is one of the things I actually really liked about the auto commit stuff was GPT three and a half is writing these commits and it's doing a better job than I would most of the time I think that idea of the AI capturing your intent turning into a get message that's a feature in its own right oh I need to update the documentation I wonder if Aida can help with that you betcha let's just update the readme for starters oh check this out if you go run here I might go to main it's getting this output from a command line and it's just dropping in the chat it's added an extra chat message and it's showing you the git difference will it guess my intent show that it's changed some files a new block new code it was guessing that I wanted to change the code but it was checking before making the change which was polite what I want to do now is I want you to change the readme and to mention that it will automatically add open buffets see how it does it so high level of objective and again I'm not thinking too much about where should I put it here it's going for the usage section and talk about doing dreary tasks for you updating documentation how often do you not do that well enough because it's not as fun as coding here it is no to automatically add the open buffers to the Windows command that's good what I think I'd like there were some tips for people who might not be as familiar with buffers in them so maybe even a buff to do with the quote or something like that again this is thinking about just maybe let's make a bit more useful this is where I find it starts to get slower is if you've got a big chunk of text that it's changing and also a bit inefficient it's regenerating the old text and then it's generating the new text and it starts to go a bit slower there I still think this is beating me if I was trying to write that myself I wouldn't be done yet it's updated the readme I'd go and do a final check on this and also I'd say please update the change log or x a second do I have to change log in here no so it's not too hard to add files manually in Ida and also I find sometimes when it needs a file I will ask for it and say hey you're the one update the change log can you please add it to this session what do I want to do please add a new battery it's actually doing what I said but I'm just going to fix this myself but that's a typo it's not worth getting it to hit things over there don't need either anymore so escape with the window let's get the change log up and I will manually stick in with version two like this foreign buffers and Vim to the readme file let's go here and just do a change log I am fixing I will actually do some cleaning up with this git history but hey that's a feature ready to push that's it for today as always like or subscribe if you like the video comments below if you want to see any extensions on this I'm quite Keen to ship some features on the Ido project itself and to keep this neovin plugin going if you want to jump in hey the more people who swam this tool I think the faster it gets better for everyone have a lovely day
Info
Channel: Learn Code With JV
Views: 7,991
Rating: undefined out of 5
Keywords:
Id: zddJofosJuM
Channel Id: undefined
Length: 24min 40sec (1480 seconds)
Published: Mon Jul 17 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.