Writing Better Code with Ollama

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi check this out recently the olama team released an official node.js library for olama you can find it here on GitHub I'll probably start building with it and the python equivalent soon so I thought I'd start playing around with it now here I've imported AMA and instantiated it then I call the chat endpoint with a simple system prompt and initial question so now I want to print the output this endpoint defaults to not streaming so the response will just be at Json blob with the output and some metrics about how it performed this is nice and easy but we have to wait for the full response to be done before we see anything although it's not faster or slower the response does feel faster when streaming because we start to see the content sooner so I can set stream to true and then try running it and I get an error well that's because setting stream to True sets the function to return an async generator instead of a Json blob and so we need to deal with it differently but did you notice that console log and stream is true were typed for me I just tab to accept the result which is pretty cool you can see down here in the corner I'm not using co-pilot but rather llama coder I can even add a comment here describing what I want and llama coder writes the code for me it's not always perfect but it's a good start now it's printing each of the Json blobs and I just want the tokens so I'll add message. content to the console log statement and now I have each of the words but they're on their own lines at this point I need to have a conversation with my code and with an expert to figure out how to do this without new lines and so that's where continue. Dev comes in I can select the code then press command shift M and ask a question is there an alternative to console log that doesn't add a new line and it reminds me about process.st standard out. write which is perfect perfect so I start to type it in and llama coder knows what I want and allows me to tap to complete these two extensions for vs code provide a pretty good alternative to co-pilot they aren't perfect but they're completely free and even better they work when I have no connection to the internet you might think that rarely happens but I live on an island near Seattle and to get to the mainland I have to get on a ferry and there are no cell towers in the middle of Puget Sound and the idea of just sitting there there and enjoying the tremendous view when I could be buried in code it's just Insanity so let's take a brief look at what's involved in setting this up of course you need AMA installed and up and running go to .i to learn more about doing that next install the Llama coder extension and take a look at the settings I'm using the model deep seek coder 1.3b Q4 it's nice and fast to work with and seems to do do a good job you should play around with which model works best for you if a model has better answers but takes 5 to 10 seconds to generate then I'll never see those answers setting that model to use is really all you need to configure next install continue there aren't really any settings up front that you need to set but press command shift M on Mac or control shift M on Windows and then down at the bottom you can select the model to use I've stuck with code llama but you can add any model available with AMA by just updating this Json config file take a look at the continue docks there's another setting to disable Telemetry so that it doesn't try to use the internet for anything and there's a lot more that continue can do so be sure to review the docs as well there are a few other VSS code extensions available like CBT and olama auto coder but llama coder and continue seem to work better best for me I'd also like to spend some time with Cody from Source Gra the CEO was pretty excited when AMA came out and built functionality for AMA into Cody so I'd really like to try that what do you think have you replaced co-pilot with something local I'd love to learn about your setup or if there's another config that you'd like to see please let me know in the comments thanks so much for watching [Music] goodbye [Music]
Info
Channel: Matt Williams
Views: 20,597
Rating: undefined out of 5
Keywords: artificial intelligence, copilot, vscode, ollama, python, typescript, coding, chat gpt, copilot app, copilot vscode, vscode copilot, vscode setup, vscode extensions, Best ai tools for coding, Best ai coding assistant, Best ai tool to solving coding problems, How to use ai in visual studio code
Id: NNBWmIve3fQ
Channel Id: undefined
Length: 4min 43sec (283 seconds)
Published: Fri Jan 26 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.