Introducing DEVIKA - OpenSource AI Software Engineer | Local Install

LARRUZ walks through installing DEVIKA, an open-source AI engineer, on your machine. You'll need Bun, Ollama, Node, and Playwright. The demo runs it with Mistral and Claude 3 to generate code like printing numbers and Conway's Game of Life.
Questions this video answers
March 25, 2024
Chapters
Oh wow, it works. I'll create a step by step plan to write a Python program for the Game of Life and it's already starting looking on the web, which is pretty cool. It found the correct website, so it's going to use the Conway's Game of Life. So this is pretty neat. The VIKA is an open source project that is trying to replicate Devon from Cognition Lab, which claimed to be the first AI software engineer. And this project is getting a lot of traction and currently it's a trending project on GitHub. In this video I'll walk you through a step by step process on how to set this up on your local machine. Now the key features of is that it supports a number of different projects, so it supports proprietary models like Cloud 3, GPT4 and also local LLMs using Ollama. The code implements advanced AI planning and reasoning capabilities. It has contextual keyword extraction and it can write code as well. So just like Devin, this is supposed to have planning and reasoning engine. It also has its own terminal where it can write code and there is a browser integration as well which Divika uses to search for different things online. So the goal of this video is to walk you through a step by step process on how to set this up on your local machine and I'll show you how to use both local LLMs as well as proprietary LLMs with the but before that, a very important disclaimer from the authors. This project is currently in a very early development or experimental stage. There are a lot of unimplemented and broken features at the moment and they are welcoming contributions. And even in my own experimentations I have seen that there are quite a bit of issues, but it's a very promising project. Let's look at how to set this up for Python Package Manager. They recommend to use uv, but I'm going to be using CONDA because I have already set this up on my local machine for JavaScript. We will need to install BUN and if you're using local LLMs with the Vika then you want to set up Olam as well. So first let's install Bun for this. Just go to Bun SH and just copy this command. I'm running this on a MacBook Pro, but the same command should work for Windows and Linux as well. So first we will just copy that, run the command this will download BUN and install it on your local machine. Next we will need to download Ollama. So just go to ollama.com and then depending on your operating system Just select the appropriate download. So in this case I have already set this up on my machine, so I'm not going to do this step. Once you have those things set up, let's start the installation process. First we'll clone the GitHub repo. But instead of cloning the main repo, I'm going to actually clone this here because it integrates DuckDuckGo as a search engine. By default it uses the Bing Search API and I was having trouble with using Bing Search API, so I will just use this PR rather than the actual main repo. But hopefully this is going to be integrated soon to the main code. So I'll put a link to this specific PR in the video description. So here I'm using git clone and then providing the link to the repo. So this will clone the repo for us. Okay, so the repo is cloned. We're going to change directory. So for that we'll type CD davika and now if you type ls, this will show you the contents of this new folder. Next we are going to create a virtual environment. You can use any Python package manager. I like to use conda and the way we do it is we are going to use conda create dash n then the name of the virtual environment and then the Python version that you want to use. I already have this set up, so I'm not going to create a new virtual environment. And in order to activate it we're going to use conda, activate the vika and you can see that we are within our new virtual environment. Okay, so let's look at all the contents of the folder. Next we need to install the requirements for this project. So we're going to use pip install dash r requirements Txt. This will download all the required packages. As you can see, I have already downloaded these. You also need to install the browser access. So for that we are going to be using this playwright install and it will install all the required dependencies. So here we are going to run this. I have already set this up. Now one additional dependency that you need to install is Node on macOS. I will be using Brave to install Node JS for your operating system. You need to look at the corresponding commands and we are going to also use Brave to install npm. Okay, so once this is set up, we are all set. So next I went ahead and opened the folder or project in Visual Code Studio because I wanted to make some changes in here as well. So next we are going to CD into this UI folder. So for that we will type CD UI and you can see there are a whole bunch of files in here. So we're going to use NPM install. This will install some of the required packages in order to run the ui. And within the UI folder you will need to also run the Bun install command. Now, before starting the VCA we need to set up some configuration. So go to this config file here you can provide your Bing API key, Google Search. If you want to use Claude, you need to provide your API key here. If you want to use OpenAI models, you can provide your API keys in here. So in my case I'm going to provide all the API keys, just replace this with your API key and save the file. By default this is going to try to use either Bing or Google Search if it's searching the web. But I want to use the doctor Go. So for that I'm going to go to Source Agents and within there is this agent PY file. So within the file I'm going to go to line 67, we'll uncomment that and comment the Google Search part and just save the file. Okay, and we're going to open another terminal. So this one is going to be used for running the API. The API backend server is implemented using Flask and the front end is I think in Node. So we'll need two different terminals. So here we're going to go back to the main folder and the second one is running inside the UI folder. But we need another terminal which will run the Ollama server. So I'm going to open another terminal, I'm going to type Ollama and then serve. This will start no llama server. Okay, now within the main davika folder we want to run this dewika.PI file. So for that type python the vika.PI this will start the Flask backend server. Here you can see the server is up and running. Currently it's in the debug mode, so it's not going to show any messages. But let's go back and change that. So we're going to go to the Vika PI file and here under debug we are going to change this to true, save the file, kill the server and then let me rerun this. So we're going to run the server again and now the debug mode is on. So we're going to see all the messages that are being exchanged. So this is good. Now we're going to go to the other terminal which is inside the UI folder. So if you type in pwd, this basically gives you the path. You want to make sure that you are inside the UI folder. And now here we are going to run the bun, then run and then dev command. This will basically start our front end. So here is our front end. You need to access this local host or URL. Okay? So when you go to that URL you will see the main interface. Here's the main interface of the Vika. It's very similar to the Devon's interface that they showed in the demo. So there is a browser tab that the Vika is going to be using to search Internet. There's a terminal which is going to be used to run code. And this is the main interface that will be used to show the messages and you can communicate with the Vika. So first let's go to select project. Here you need to provide a project name. So let's call it Test. Right, so now you can see it's using the test project. Next you need to select the model. So it has support for both proprietary as well as local models. So for this test we're going to run the Mistral latest model and here you can see that it changed to Mistral. Okay, Just to see if everything works or not, we are going to start with a very simple prompt. Write a program in Python that prints numbers from 1 to 100. Let's send this message and let's see what happens. Okay, so the Vika says I create a Python program that prints numbers from 1 to 100 following these steps. So it came up with a step by step plan and you can see that it already tried to access Internet, so it opened a web browser and it's trying to access a website, which is pretty cool. So let's look at the steps. Set up a new Python file. So this is going to use an ide, then import the necessary libraries and you can see it's actually checking different websites. So from one website it moved to the other one. This is pretty cool. So basically here's the internal, I think dialogue that the week is using. So it says I'm browsing the web to search the following queries. So Python IDE setup how to create a new project in pycharm or jupyter Notebook. Right? So it's actually trying to figure out what tools it's going to need to create that program. And here's the internal monologue that the Vika is having and it actually came up with the code. This is pretty neat. Now if you go back and look at the backend. So here are all the messages that are being exchanged and you can look at the progress of what the Vika is doing. So this is pretty cool as well. Now, in this case, the code it came up with is actually correct, but I'm not sure how do we run this? I don't think it stores this anywhere. Okay. Actually you have to go to the projects and it created a folder called Test and within here it actually wrote down that code. There is a small indentation error, but other than that it actually works. So this is pretty neat. Now it's still stuck on writing code. So these are, I think, small bugs that are going to be fixed as this project evolves. But overall I think it's a good start. All right, so I'm going to create another project called Game of Life and let's ask it to write a code for the Game of Life program. Again, we're going to use the Mistral model, so I'll just select the same model. This is an example prompt that the authors of the repo have used. So I'm going to just reuse this without providing too much details. Let's see what it comes up with. Oh, wow, it works. So it says, I'll create a step by step plan to write a Python program for the Game of Life. And it's already starting looking on the web, which is pretty cool. So here is the step by step process and it found the correct website. So it's going to use the Conway's Game of Life with Python example online. So this is pretty neat. Now again, it's thinking about doing it step by step. So first of all it, it is trying to familiarize itself with Game of Life rules and concepts and it's doing online research for this. So this is pretty great. And I think it's right now doing the online research stage. Then it will set up a Python project, will create necessary files to implement and install all the required packages. Then it plans to write the function to represent the initial state of the grid and display it. And it will also write functions to calculate the next generation based on the Game of Life rules. Right. So the steps that it outlined are actually correct. And if it's, if it can do all of them, I think it will come up with a proper solution, which is pretty amazing. Now, I think this one is going to take a while. If you want to use a proprietary model like Claude 3 or GPT4, you can select them from here. Make sure that you provide the API key in the config file. I'm going to come back to it when it's done processing. I had to kill that process because it took forever. Now let's try the Haiku model from Claude. So here we selected Cloud 3 Haiku and let's call this test 2. Now we're going to use the same prompt. Write a program that implements Game of Life and let's see what the results of Haiku are. So we sent in the prompt. It says certainly I would be happy to create step by step plan. So it came up with a plan here, which actually looks pretty neat. And it already started accessing a website. This seems to be much faster now. This is pretty cool. I think it has to do with the browser that it's supposed to use. So it already found the correct Python implementation example code on a website. So this is nice here. It's supposed to keep track of token usage, but in my tests it's not updating at all. This seems to take a while to complete any process, but even for Devin's demo that Cognition Labs shared on their website, it was taking a good 20 to 30 minutes to complete different tasks. Okay, so it's been a while and it's still actually processing it, but I'll have to stop this anyways. I feel like it's a very good initial step given that Devin is not even available at all. And there is an open source alternative which you can use today. There are definitely a lot of issues with the code base, but it's under active development and if you're interested there are a whole bunch of open pull requests and if you find a feature that you want to implement, make sure to contribute to the project. That is the beauty of open source. And this is not the only project. There is another project called Open Devin. They also just pushed some code to the repo. It was just a readme in the beginning of the week. I'm going to have a quick look at opendevin as well and see how it compares to the Vika and the original Devon. Anyways, I hope you found this video useful. Thanks for watching and as always, see you in the next one.










