Introducing Weave-CLI: The easiest way to manage your vector DB | Max Maximilien, AI By the Bay 2025
So, first thing is that I used to be uh at IBM for more than I can count, more years than I can count. And I literally left uh uh October 31st um after uh what amount to a lot of years mainly because after all this time you know big companies you get tired of it. Um hopefully none of you get offended by me saying this and also it's just AI is so much fun. There's so much going on that I want to be part of it. So I'm new founder. That's why you see my badge has all things scratched up. But I go by Max and during my time at IBM just as an introduction I worked on many different things but um during the pandemic uh well I'll say this um my I did a PhD in computer science 20 years ago and it was on AI agents and of course when AI and agents started to become real again like two or three years ago after Chad GPT was released it was an awakening because a lot of the things that I was doing in my PhD, you had to imagine now they were real. So I started getting involved in this and uh of course I'm a huge proponent of open source
So what I'm going to talk to you about today is completely open source uh under the MIT license. So you could actually go and use it, modify it. You don't have to tell me. Obviously if you want to be part of the community, I'd welcome that. So that's kind of like a brief introduction. So, let's get into it. There's a lot of demos uh and interaction. Uh we'll do it all live
So, hopefully everything works. Um but let me give you kind of like a quick introduction on the topic. So, um one of the things that you'll realize when you start wanting to build agents that do actually useful stuff for your domain is that you have to give them context on that domain. And of course there's many ways to do this. Uh but the interaction with agents right now is mostly through natural language. So some you user like when you use chat GPT you give it a question and it has to come up with an answer for you. So how does it do this? Um so most of the way you actually give it context is through some kind of a semantic search. So you take the question and you do a search and you find documents or data that's related to the question or the the the the prompt and then you can feed that into the agent, right? So that's kind of what people are doing now
And you can do this through something called a vector database and there are many different ones. Uh right now the market is actually projected to grow to $10 billion uh in the next uh I guess you know five years and it I would say that a lot of the vector database that exists right now um they are very uh they're they're in two camps. There's a camp of sort of quite native vector databases. So things like milv8 uh they were built straight from the bottom up to be to be a vector database but lots of other u existing databases are essentially adding vector support. So you can for instance use superbase which is pretty much posgress and they have a vector support. Uh MongoDB also has that now um and also even radius has support for vector database. So vector databases it's almost going to become or it's it is becoming kind of the norm for all databases and part of the reason is because of this growth of AI agents and also things like rag where you do um some kind of an agent that understands um a set of documents that you give it and when you ask it question it can actually use those documents to answer your question. So it understands I guess it has its brain in the LLM and then the data comes from the documents that you give it and it's a very nice use case but of course you want to make it as clear and as correct as possible
If you're dealing with a domain let's say legal domain and you want to have documents around that domain. If your domain is let's say retail then or like a retailer which I'm working with then you want the documents to come from that particular retailer right so that's where it becomes quite interesting to be able to build your vector database with documents that came from the domain that you're dealing with now of course the process of doing this without going too much in the details is that you have to take the documents you break it into small pieces so you chunk it and then you embed add uh the document. So what is that? It's basically creating think of it as a a uh collection or or vector of numbers on that document. So this embedding allows you or these vectors that you're creating for each one of your chunk allows you to essentially create a space. So now you have a space with all these vectors. So when somebody ask you a question or like when the agent needs to find the documents that are most relevant to that vector, what they're doing is they're using techniques to essentially match a vector for the question or the prompt to the vector space. And then the idea would be um the vector your vector and the vector of the document that's closest to your vector uh have a distance and that distance either maximize or minimize and you can use that to essentially find the vector that's closest to you. So there's tons of algorithm on this
Um the the the simplest one is to do cosine similarity where you essentially compute the cosine of one vector to the other vector and then use that number to tell you which one are the closest. Uh but there's lots of improvements over that. So things like for instance trying to cluster the vectors so that you don't have to go and search the entire space. you can just find the centrid of the clusters and then from that centrid you only look through the vectors that are closest to that centrid. So there's tons of techniques and the point of telling you all this is not so much to give you kind of a lecture on this. Maybe you know better than me but the idea is that there are many ways to essentially compute the similarity so that when you do a search you get the best documents and I don't think that's going to change too much because there's not really one uh algorithm that's going to solve all those problems. And part of the pro part of the issue is that human language is so complex that your query and the documents that you're trying to find from the query don't necessarily match perfectly, right? There's lots of context that you leave out. So it won't be able to necessarily find everything
However, if you cluster for instance, you may be able to find the documents two or three levels deep or you may be able to find other documents that are related and then find future on. So for instance things like graph database allows you to sort of infer what the data should be should have been right. So the point here is to say that there's many different ways to essentially search that vector space and build it as well. So it's not just searching it it's also being able to build it so that when you search you're efficient because obviously if you if you did a query and it took five minutes to get a result even if the result is perfect that's not useful right so it has to also be fast. So what people start doing now is you do a little bit of a hybrid solution. So you not only do a semantic search which is what the vector search is but you also do like BM25 search which is really well known in the industry and if you have enough terms you can actually find very precisely the document that's being uh you know sort of that would be important for that result. So when you start doing those hybrid search you get better results. Okay
So that's cool, but you now have to build those hybrid search, right? So in addition to assuming that you're doing the right search, there's also the fact that you have to prepare your data correctly so that you can do those searches. So it's the embedding, it's the chunking of the data. It's dealing with let's say multimodal data because you know let's say you have a PDF, it might have images in it, it might have table. So how do you deal with those different types of datas? So that's also kind of another of those kind of financial issues. So what I built and this is what I we're going to talk about. So the rest of the talk is going to be hands-on demo is came out of I should say first came out of building a bunch of rag solution inside IBM and dealing with the variety of different documents that I had to deal with. So the last year I spent working in the quantum division of IBM even though I'm not a quantum quantum scientist. I was part of that team and the data of course with quantum is very specific uh around not only quantum physics but also uh computing and programming and so on and you start realizing that the basic solution for rag doesn't necessarily work or at least it works but it doesn't give you the optimal solution
So you start discovering that you need to explore different way of ways of embedding different ways of chunking. So that for instance when you have a long piece of document when you chunk the I the the situation could be that you divide let's say by 10. So you now have 10 chunks of the document, but the reality is that you're not going to find a perfect overlap for each one of those uh 10 documents and the context from one document kind of spills over to the next one or maybe is like three level down. So how do you deal with all that? Right? So the chunking algorithm becomes important and as well as the search, right? So all of that kind of led me to the I guess the realization that I needed a way to explore many different vector databases as they were coming up many different algorithms and different types of chunking and different types of embedding. So that's kind of the basic problem that I had. And then the last thing is as I realized um you know part of the problem is this constant processing of the data and constant testing and so on that uh and I hope I don't offend anybody but I've programmed in every language but Python is the slowest I programmed in and uh okay I lost the screen. So yeah, there we go. So I needed a way to be able to do this fast, right? Like process documents all the time, searching them, testing, and so on in a very fast pipeline
And the Python tools that I was using were just horrible. So I built this thing called weave CLI. So let me first show you the the where you can go and check it out. And I'd love for you to give me a star. This is about a month old. Uh, so it's relatively new, but you can see lots of activities because I've been sort of thinking about this for a long time. It's under the MIT license. Everything's there
We've had already five releases. I'm pretty much the only contributor. I definitely use AI and it's written in Go and that has a lot to do with why it's so fast. Okay. And we have many databases supported already and we'll talk about some some of this. So, let me just get into the demo. Okay. So the it's a CLI so you can just do weave-h and you can see um the the different collection of groups of commands
So you can do collection management, document management, configuration and then embeddings. Um so first thing you do is you have to configure it. I already configured it for uh a set of databases. So let's look at what I have. So you can say weave config list and it will tell you the the databases that you have configured and you can see I have we cloud. So this is wev8 is open source but you can use wev8 the company which can host your database. So obviously every one of those databases have a similar notion where you can have it locally or you can have it in the cloud. Milvvis is also one of those native vector databases
Uh, and I have it locally here. And then Superbase is not a vector database. It's just a regular relational database, but it's one of those databases that has been catching fire because they make the process of using it very very easy. It's well understood because it's a relational database. Uh, it's based on Postgress. So it's pretty decent and good and fast and it's also uh super cheap to start with. So so that's one of the advantage of of I mean the other ones are cheap too but in terms of you know if you had existing database that you were using you can migrate to superbase pretty easily but they also added uh vector support with pg vector which is an extension of postgress. Anyways, so I have all three of these
Um, so what can you do? Uh, and we'll we'll go back to configuration because obviously to get started you have to configure things. So I can tell you uh the details for that after. So assuming you have those databases configured what else? What can you do? So uh the way vector database works is you create and most of them follow the same concept. You create a collection. So it's kind of like a bucket and then you add documents to that bucket chunking it embedding and then you can now query. Okay. So it's very straightforward process. Obviously if you can add stuff you can modify you can delete and so on
Okay. So first thing we'll do is we'll say we've u collections list. So when you do that uh with CLI will essentially uh find all collection from your different uh databases and you can see here it found 30 from UVA cloud because that's kind of the database I've been using the the longest and then you can see it found local and and you can see it tells you which embedding was used for that uh collection. So of course then what are the embeddings? You can say we've embeds and of course like everything else you can say dash h and then it will tells you it tells you the different you know uh options. So in this case we'll say we've embeds uh list and we can say um I think there's a way for you to tell it uh what are the the the compatibility. So, let's see if I can find it. Hold on. Embeds
Ah, hold on. And then I think it's compatibility embed. Hold on. list and then you can say show compatibility and that will tell you the compatibility for the list. So for instance, you can see here that these embeddings that are supported by basically OpenAI uh support they're it's probably one of the most um compatible embedding and obviously the embedding is converting your data into some a vector and not all data look the same. So you want to figure out what data you have and what embedding you should be using. There's a default for each one uh you know of the databases. But you know that's something to explore
Another thing that's important is to notice that this is an open AAI embedding. So what does that mean? Well, it means it came from OpenAI and it requires you to have an OpenAI key to to use it. Uh so they have not made that public but there is a huge number of public uh embeddings uh algorithms that you can use like hoging face has a few um AWS and so on. And the notion here is to be aware that it exists. Hopefully your data is not so specialized that um default embeddings don't work but if you start seeing that the results are not good then the first thing to do is to start looking oh could I explore with a different embedding okay so showed you the list and that will keep going as we add more database to it what can you do next so next thing you can do is you can uh for instance um see the documents in your database right or in your collection. So first let's look at the collections again and you'll see that in wev8 and superbase I have a weave docs. So this is basically a little test collection that I use and you can see I use the default embedding and I think for superbase is open AI that I use like text to vector. Okay so with that I can now list the documents inside that right
So I can say docs sorry let's list ls and then uh say for instance you can list things on one database or it can try to find all the that collection different database. So it will tell it right. So we'll tell it that we want uh superbase. So basically lists all the documents in a collection called weave docs but only on my superbase configuration and this is live. So it goes and it finds them and you can see the documents show you the content and then also the metadata and you can see there's like 18 content. Why is that? Well because there's eight basically chunked it, right? it chunk the document. But that's kind of nice, but it's not very um friendly because you don't know right like let's say there was a thousand chunks where did they came from? So what you can do is you can do uh uh d-verirtual. So create a virtualize for me uh uh response and then dash s or d- summary to summarize it
So what that's going to do is it's going to go through your chunks and it's going to group them and tells you that I have a readme user guide and right. So for instance I can add a new one uh new document. So you can see so I have a to-dos here right so let's add that so you can say weave docs create and then we're going to pass it in weave docs and then of course we're going to put the to-dos uh to-do and then I want to add it to superbase and I'm going to accept the default chunking and default embedding but if you wanted to change ose d-sp specify. So what it's doing here, it's going to take that that document, it's going to chunk it into two because I think the default is like 500 characters or 5,000 sorry uh characters and then uh add it. So now if we list it again, right, it should add that to-dos. Cool. All right. So what else can you do? Because remember you can deal with different databases and I have the same collection and many database
So I can just say we here and you can see it will get me the collection and we and you can see we has different documents in it. But what else could you do? You can query. So you can do something like um so the query is by collection. So you say calls Q and then you pass it the name of the database the collection sorry um and then you give it a string and that string can be one charact um one word but it could also be a complete uh sentence and it's going to search it. And what's cool is that it doesn't just search and tell you what the documents are. It gives you a score and you can see that all of these are related to a document that I have uh that is a Leica document like my camera like uh Alexi was saying also we're a huge fan of Leas. So of course this is kind of nice but if you were using this in let's say in an agent uh you want the data in a way that you can process it. So what you can do is you can say d-json and it will return JSON version
So now you can parse that JSON and do some fancy stuff with it, right? And you can see it gives you the scores and so on. But when you do it without the JSON, it gives you additional information like for instance you can see that because you're doing a vector search uh the scores are not going to be like 10 1.0, right? Uh so anything that's usually higher than um like lower than.3 is usually that it doesn't find any search but anything bigger than.5 is usually a decent uh match. Of course we could do more searches and and try but let me show you more features. Um so um another another thing you can do and you know Obviously, we've is flexible to work with different databases as I mentioned and you can see that the process of dealing with all those databases is the same. So, I'm kind of unifying all those databases, right? And, uh, that's kind of cool, but you need to learn it, right? Um, like anything else, uh, I built an MCP around it. So, now we have an MCP server for all the commands so that you can now have agents. um call weave. So I thought, okay, but that's kind of cool, but what could we do to help humans, not just agents, is to say, okay, well, what you could do is instead of knowing that to list a collection, you have to say calls ls da da da, you could just query, right? So what that does is it goes to a collection of agents that I have in we in we've cli essentially execute and even some scripts and it will go through the process of creating you know giving you an answer and the question can be pretty complex
I'm using open AI in here uh and I think it's GPT uh 4.0 but you can change it to claude. You just have to also include your API key obviously. And you can see I I also included metrics because I I was working with the the guys from um OPIC uh in a in a hackathon to tell you how much it cost you. And you can see here it's like 1 cent. And most of the questions are about 1 cent. They're pretty cheap because they're not going like thousands and thousands of tokens. They're like 5,000 tokens. So it's about that price
Uh, and then I also figured, well, if you're going to help humans, you should give them tips and recommendations. So, obviously I need to format this a little bit better, but the idea is that I give you kind of anticipate what the next step is going to be, what the recommendations are. I tell you all the details of, you know, how long it took you and of course your your answer. Um, and of course I was thinking, well, that's kind of cool because people can now query at the natural language, but then I remembered a lot of what I'm doing right now, um, I mean, I started using cursor like a year and a half ago and then gradually realized, you know, I just need a CLI. So, I love Claude and all the different CLIs that exist like AMP and and uh, I think Amazon has one out called Kilo and I think Google has one also. So, I was like, h, I'll build my own. So if you call weave without anything it's in interaction mode. So in this mode you can actually start asking a question just like you would do with claude and it will respond
So for instance we had the question of listing the collections but you can say hey show me the collections that are empty. So it's going to be a little bit more complex query because it not only has to find the collection but it also has to find the ones that are empty. And of course you can do more complex things and it will actually ask you you you give me permission uh just like claude right like so for instance if you tell it go find documents in this directory and add them to this collection like a complex query like this it will actually do it but it will ask you for permission and so on and you can see it's going to all the collections and finding the ones that are empty and listing them and then you can ask it more questions. So it's a complete solution for you to deal with your vector database in a fashion that um is I guess you could say uniform but also I hope you appreciate it's also uh quite fast. Uh I think before doing this I had a series of Python script for my databases and [clears throat] again not hating on Python but this was a hund times faster than uh Python. Now obviously for some queries it'll be different and I think part of the reason is because you're doing you have to load the entire Python environment every single time right it takes quite a bit whereas here it's go and it's super fast I mean there's a reason go exists okay so if you haven't looked into go or rust uh these are type language they're compiled you have one binary so um it's basically weave and let's say And it's like 60 meg, right? And that that includes everything including OpenAI agents. I think I have like six agents because I have one to understand a query because like if you ask it a question that is not vector database, it will say I don't know like it's not only going to answer question on vector database. So with that I have 30 seconds left
Let me stop [laughter] and see if you have questions or if you want me to explore more. I'm happy to to answer as many questions. >> Thank you so much for that wonderful talk and yeah, we're we're open it up for questions. I'll just bring you the mic over >> and of course connect with me. I'll I'll put this and then I'll switch to uh to to to the command line if if there's any questions. So let me put my QR code. So this is the the project and then this is my LinkedIn. I'd love to connect with you
So just send me a connection on LinkedIn and of course you know go to the project and give it a star. I really appreciate it. So with that >> uh thank you for the talk. I think there's a absolutely need to make the approach and use of vectivate that it was easier. Whoever can make it easier the better. But from my own experience after the chunking and figuring out how to overlap >> uh most of the people who want to do this are at least from my experience have been the rack crew. >> Yeah. at a very specific just like you said about quantum computing they're very very specific and more than anything else it's that domain jargon that seems to trip things up so >> switching between different embedded encoders between uh open AAI and AWS didn't do very much uh what ended up happening is that if I can get enough document it was better to just cook one up using espert right so then you have an encoder that's very very specific to the document you're trying to deal with
>> Right. >> So, uh >> I don't support that yet to add your own vector embedding. But, you know, >> no, I mean it'd be even better if you could actually cook one for us, right? >> Oh, like automatically understand >> automatically generate an expert for us, right? Because it's so specific to that jargon. >> I'm not going to say it's impossible because >> No, no, no. But that that's that's the first thing. and and god knows I completely agree with your uh statement about the slowness of Python right I think because he went so broad >> nobody gave too much thought about the optimization >> so most of us who don't want to mix and match languages we tried to do the >> most heavy lifting uh with GPU optimization right so from personal experience and I don't work for milless but that's the only company that I know that you know because the nature of the vector you can do so much things faster if you can get uh GPU startups right so >> you know >> I I think Python is just shoveling stuff around so now even like a lot of the data you're talking about >> pandas all that stuff can be run on GPU so >> it seems to make a huge world of difference if you minimize the number of data touches so that that would help a lot And and uh uh last but not least, back to the rag. It's not so much the work, it's the document curation. You want to try to answer specific question and it doesn't really do a good job of figuring out what's the most important document
So you end up having >> these uh bundles of document that you created that you're going to use to do certain uh rag uh boosts. So the other thing that might be really really helpful is that if you can help automate that curation. So if you only know ahead of time you're going to have n different types of Q&A you're going to support >> if you can not only crop properly classify but as the new information comes up which is the number one reason why you want to run rag in the first place that kind of like curation can also be automated you know. >> Yeah. Yeah. Excellent points. Um I'll definitely I mean first is join the community. Uh it's open source right? So if you feel free to to start a discussion on these things
Uh I think with AI I wouldn't be surprised for instance what the first suggestion you had about you know could I just in we cli if you use it to do all your documents and to do a bunch of queries uh try to figure out the best uh embedding for instance I think that's totally possible I mean we could we could probably explore that >> sorry Joe we need to start preparing for the next speaker. Thank you so much. >> We can talk after definitely. Any last question? Any one more >> since anybody else? No. >> All right. Thank you so much everyone. Thank you so much, Max. All right
Let's prepare for next speaker.