How to Build Things with Jev & OpenJevs — Transcript
Full transcript
- 0:00All right, so in this video, I want to
- 0:02jump in and actually show building
- 0:04something with Jev. Some of the actual
- 0:06decisions you need to make about how
- 0:08you're going to use it, some of the
- 0:09techniques of how you can use it, and
- 0:11some of the benefits and challenges that
- 0:12you're going to see along the way. So,
- 0:14I'm going to start off with a very quick
- 0:15recap, but then I'm going to jump in to
- 0:18building a model router. So, the whole
- 0:21idea here is that this is something that
- 0:23will be an endpoint that you run
- 0:24locally. It can then interpret what you
- 0:27send to that endpoint via Jev or via an
- 0:31open Jev like we'll look at later on.
- 0:33And then it can decide what sort of
- 0:35category is this, and what model should
- 0:37it be sent to. Can also decide whether
- 0:40you've got PII, private identifiable
- 0:43information in there, so that we could
- 0:45have it set up to not send to the cloud
- 0:47for that, so that always gets sent to
- 0:49something locally. So, I'm going to try
- 0:50and focus on a few different models in
- 0:52here, but locally I'm going to run a lot
- 0:54of this with just the mini CPM 52B. Now,
- 0:57I'm running this on my machine with an
- 0:59endpoint, but you could be running this
- 1:00with LM Studio, you could be running
- 1:02this with Ollama, totally up to you. And
- 1:05then for the cloud models, I'm going to
- 1:06focus on a few models there, but mostly
- 1:08I'm going to be using the DeepSeek V 4.1
- 1:10Flash there. To make it a bit more fun,
- 1:14also, what I'm serving locally is the
- 1:17latest Qwen image 2.1. So, this
- 1:20literally just came out yesterday as I'm
- 1:22recording this. It's a really nice model
- 1:24that can do a whole bunch of different
- 1:25kinds of things like image generation,
- 1:27image editing, et cetera. Probably the
- 1:30only thing that sucks about it at the
- 1:31moment is the license currently that
- 1:33it's basically a non-commercial license.
- 1:35But, I'm going to show you how our
- 1:37system will be able to make images,
- 1:39interpret images, do different automated
- 1:42calls to lots of LLMs that are out
- 1:44there. All right, so a quick recap. If
- 1:46you missed my first video on it, Jev is
- 1:48from Type Safe AI, and they call it a
- 1:51system one model. It doesn't generate
- 1:53text at all. You give it a state, which
- 1:55is basically just whatever you want to
- 1:57have judged, and then you give it a set
- 1:59of typed questions. And what comes back
- 2:02are typed answers with probabilities as
- 2:05well. The cool thing is that then you
- 2:06can use that for your code to basically
- 2:08make conditional logic decisions on. So,
- 2:11that's basically just all your sort of
- 2:12if-else statements, right? If the choice
- 2:15comes back this, then I do this. If the
- 2:17probability of this is higher than this
- 2:19percent, then I'm going to do this. So,
- 2:21we don't have to worry about a model
- 2:23outputting good JSON and basically
- 2:25getting the prompt right to have it
- 2:27comply with everything that we want. And
- 2:29it really should come back in somewhere
- 2:31around the 70 to 500 ms range. And
- 2:35remember the cool thing for this is it
- 2:36doesn't charge you anything for output
- 2:38tokens at all, and it only charges you 4
- 2:41cents per million input tokens. A nice
- 2:44way of thinking about this is that you
- 2:45can kind of think of it as an if
- 2:47statement that understands language.
- 2:50Now, in Jev and most of the open Jev
- 2:52clones, there are three kinds of
- 2:54questions you can ask it. The first is
- 2:57choice. So, you just basically give it a
- 2:59set of options, it picks one, and you
- 3:01get a probability for each option plus a
- 3:04confidence value. So, in many ways
- 3:06that's like your categories, right? You
- 3:08use it to basically categorize things
- 3:10into different classes. The second is
- 3:12score. This is where you've got some
- 3:14kind of ordered levels from sort of low
- 3:15to high and up to 10 of them, and it can
- 3:18then basically give you a position on a
- 3:20scale that you've determined. Again,
- 3:22that's with confidence. The third type
- 3:25is a null, which is really just like a
- 3:27yes or no question, right? You basically
- 3:29just ask it a question, you give it your
- 3:32input, it will come back saying yes or
- 3:34no. Can also be thought of as true or
- 3:36false going on here. And yet again, that
- 3:39will also give you a probability that
- 3:41that answer is yes, so that if you take
- 3:43the inverse of that, you've got the
- 3:45probability of no. All right, so how is
- 3:47all of this going to map out onto a
- 3:49router? Turns out pretty neatly. So, you
- 3:51can think of choice being the
- 3:53categorization, what kind of task is
- 3:56this? Is it chit-chat? Is it code? Is it
- 3:58asking for an image? And we could have a
- 4:01whole bunch of different things like
- 4:03that. We've then got it basically where
- 4:05it picks a lane, right? And then Jev is
- 4:07going to basically pick the lane. So,
- 4:09chit-chat is going to go into a small
- 4:11model running locally. If it's code
- 4:13though, that's going to go out to the
- 4:15deep seek model on Open Router. If it's
- 4:17an image request, that's going to go to
- 4:19Quen image 2.1, which is also running on
- 4:22my machine. The second one for score is
- 4:25we can actually ask something like how
- 4:27hard is this? So, within a lane, that
- 4:30decides whether the little model can
- 4:32handle it. So, remember the little model
- 4:34that we're using is MiniCPM 52B, right?
- 4:37A tiny 2B model. So, that will decide if
- 4:40that can handle it or if it needs to go
- 4:42up a tier to a much better model. And
- 4:44then thirdly, we've got the null, which
- 4:46is the gate. Does this contain private
- 4:48or client data in any way? If that comes
- 4:51back as high, the whole thing has to
- 4:54stay local, no matter what. And at the
- 4:55start, I'm going to be using Jev to
- 4:57actually do all of these. But later on,
- 4:59we can switch to one of the open Jevs,
- 5:01so that literally if it is PII, it never
- 5:04actually leaves our machine even to go
- 5:06to Jev. But at the start, I'm going to
- 5:07say, "Okay, we trust Jev. We just don't
- 5:10trust the big frontier lab model
- 5:12providers." The other cool thing is that
- 5:14all three questions are going to go in
- 5:16one request against the same state. And
- 5:19Jev evaluates
- 5:21So, asking three things, and we could
- 5:22actually even add in more, is going to
- 5:24cost you pretty much the same time as
- 5:26asking one. But because you get a
- 5:28confidence back, the router can know
- 5:31when it's unsure if the confidence type
- 5:33is low. So, you don't guess, you just
- 5:35fall back to a safe default. Now, as you
- 5:38see, I'm going to point out right from
- 5:39the start that there is one thing in
- 5:41here, if I'm sending your prompt to
- 5:43TypeSafe to ask whether it's private,
- 5:45I've kind of already leaked it, right?
- 5:47So, later on in the video, I'm going to
- 5:49swap out Jev for one of the open
- 5:51versions running locally, so that the
- 5:53whole router is actually just running on
- 5:55my machine. So, let's jump in and have a
- 5:57look at how this actually gets built.
- 5:59Right, so let me give you a little demo
- 6:02of what this can do. You can see here,
- 6:04if I basically just fill out a prompt
- 6:07and I send that off, this is going to
- 6:10basically have Jev decide whether this
- 6:14should go to a local model, whether it
- 6:16should go to DeepSeek 4.1, whether it
- 6:18should go to an image model. So, if we
- 6:20come over here and look, we can see the
- 6:22models that I've got set up at here is
- 6:24we've got a MiniCPM 5-2B,
- 6:27that's fully local, that's running here
- 6:29at the moment. I've then got the Qwen
- 6:32Image 2.1, which again is fully local
- 6:35running here. And then I've got the
- 6:37DeepSeek 4.1 Flash model. Now, that's on
- 6:40OpenRouter, so any of the ORs are
- 6:42OpenRouter. I've also got it set up if
- 6:44we want to use something like a DeepSeek
- 6:46Flash plus web in there. And if we want
- 6:48to, we can even turn on Opus 5 in here
- 6:51for something that's going to be really
- 6:52hard. Now, if I wanted to, I could run
- 6:54DeepSeek 4.1 Flash locally. I am
- 6:56actually sort of halfway through
- 6:57recording a video all about DeepSeek 4.1
- 7:01and the DeepSeek harness and how all
- 7:03those things go together and how you can
- 7:04do it all locally. I could also run a
- 7:06local VLM if I wanted to in here. But
- 7:09the idea is at the moment we're using
- 7:11Jev to basically split all these up. I
- 7:14can come in here and actually, you can
- 7:15see I can pick the models separately.
- 7:18So, if I wanted to run this just to this
- 7:19model all the time, no problem. You can
- 7:22see super fast there, it's guaranteed to
- 7:24go local. If I wanted to do that and
- 7:26just run it to DeepSeek, I can do that,
- 7:29right? And then obviously it's going to
- 7:31take longer cuz it's going to the cloud.
- 7:33It's going to decide if it needs some
- 7:34thinking, it's going to then stream the
- 7:36response back. But really what we want
- 7:38is auto, right? This is where Jev is
- 7:41going to basically monitor the whole
- 7:44thing and decide what it is that we
- 7:48want. So now you can see, okay, if I do
- 7:50the hey, how's it going? Really this is
- 7:52a simple request, right? We would expect
- 7:55that this is going to basically go to
- 7:57the local model. And sure enough, it
- 7:59went to the local model. Now, if we come
- 8:02in here and actually look at the
- 8:03requests, you can see that the
- 8:04difficulty here here was basically zero,
- 8:07that it was really there was no private
- 8:09information in there and that the lane
- 8:12or the category that it decided that
- 8:14this response should go to was the small
- 8:16model, right? And it did all of that and
- 8:19Jev basically did all of that in 331
- 8:23million there. All right, now if I give
- 8:24it something a little bit harder, you
- 8:25can see, okay, I'm going to get it to
- 8:27write a Python code to deduplicate
- 8:30stuff. So this is actually still a
- 8:31pretty kind of simple thing, but we've
- 8:33got this now being routed to Deep Seek
- 8:36as opposed to doing it locally. And this
- 8:38is basically because everything that
- 8:40I've put in here around code should
- 8:43actually go to the Deep Seek model. So
- 8:44now if I come in and actually look at
- 8:46Jev, I can see for this last run what
- 8:50actually happened. So the difficulty
- 8:52went up, so this was more difficult than
- 8:55chit-chat because it's not like off the
- 8:57charts sort of difficult. So if we look
- 8:59here, we can actually see what is
- 9:01actually getting sent to Jev. Here we've
- 9:04got the state with the actual prompt in
- 9:05there, etc. You can see the questions.
- 9:08So for choice, uh choice is going to
- 9:11have the instructions of what is the
- 9:13latest user message asking the assistant
- 9:15to do, judge the latest message in the
- 9:18context of the conversation. And then
- 9:20the criteria basically tells us, okay,
- 9:22we've got one class that's chit-chat,
- 9:25one class that's simple question, one
- 9:27class that's rewrite or summarize, one
- 9:29class that's code, one class that's
- 9:31reasoning or analysis, and then one
- 9:34class that's image for doing image
- 9:36generation. At the same time, we've also
- 9:38got score. How much model capability
- 9:41does a good answer need? And we can see
- 9:43we've got trivial, we've got easy, we've
- 9:45got moderate, we've got hard. And you
- 9:47can see you kind of got definitions for
- 9:48those. So, trivial is a small 2B model
- 9:51handles it easily, right? Greetings,
- 9:53one-line facts, tiny edits, that kind of
- 9:56thing. And then it goes right up to sort
- 9:58of like a frontier, right? Needs the
- 9:59best model available, research-grade
- 10:02reasoning, large systems, et cetera. For
- 10:04the privacy stuff, we've got a null,
- 10:07right? So, the instruction here is does
- 10:09this conversation contain personal,
- 10:11confidential, client, financial,
- 10:13medical, credential data, such as API
- 10:16keys, passwords, anything like that? And
- 10:18then we've basically got true that it
- 10:20contains real secrets, and false, which
- 10:23it's it's not sensitive data at all. So,
- 10:26that's one that we'll sort of come back
- 10:27and look at. We've got another null in
- 10:29there for deciding whether it needs web
- 10:31stuff or not. If we look at what comes
- 10:33back, that you can see from this the
- 10:35choice was code, which makes sense cuz
- 10:37we asked for code, right? And we can see
- 10:40that it really has come back like a 100%
- 10:42for code in there. By the looks of it,
- 10:45it's kind of decided that it's worked
- 10:47out its probabilities there and its
- 10:49confidence. And then we can see for
- 10:50private and for web there. Let's try one
- 10:53that actually is sort of private. So,
- 10:56okay, here I've put a fake API key in
- 10:58and it's not going to do anything if you
- 11:00want to use it. So, here we can see
- 11:02straight away it detected that this was
- 11:06local and was private. If we come across
- 11:08and we look at the actual message here,
- 11:10we can see straight away now difficulty
- 11:12is not super difficult, but we've got
- 11:15private. So, this is determined that
- 11:17okay, this is going to have to stay
- 11:19local for this case in here. And you can
- 11:22see the same thing if we put in like a
- 11:24person's name or something or their
- 11:25phone number or something. Again, it
- 11:27straight away picks up PII, right? So,
- 11:30PII is your private identifiable
- 11:32information, extracts that, it assigns
- 11:35it to the local model. And we can see
- 11:37that if we come in here, we've got the
- 11:38private coming through at like 0.96.
- 11:42So, that's what's driving the code at
- 11:44the back end to actually check all this
- 11:45out. So, this is the architecture of how
- 11:48all this works, right? We've got our
- 11:50browser, so what you're seeing here is a
- 11:52Next.js UI app, right? Just kind of
- 11:55simple app. It's then sending to a fast
- 11:59API server. So, this is a server that's
- 12:01running locally on my machine. So, fast
- 12:04API is just a nice way to build a simple
- 12:07sort of Python API in here.
- 12:10You can see that with one call, it will
- 12:12basically do the deciding, and then
- 12:14we'll do the routing. It can then stream
- 12:16back to us from the winner. We've got a
- 12:18fallback in there. We can log everything
- 12:20to SQLite if we want to have everything
- 12:22log in there, and we've got health
- 12:24checks going on.
- 12:26And then you can see we've got
- 12:26compatible endpoints. So, that's just
- 12:28the standard OpenAI API for calling
- 12:31models on OpenRouter, etc. And we're
- 12:33using that for both Jev, but also for
- 12:36MiniCPM, which is running on SG Lang as
- 12:39a local model here. I'm pretty sure
- 12:40that's the DFlash version I've got going
- 12:42there. And then we've got for the
- 12:44DeepSeek model in the cloud, and we've
- 12:46got the Quen image model in here. So,
- 12:48the way it works is it basically asks
- 12:51Jev, right? It gets a decision. It works
- 12:54out what it needs from that, and then it
- 12:55decides a lane. And these lanes are sort
- 12:58of pre-configured. They've got an order
- 13:01of preference that they go through this.
- 13:02Now, if I turned on the actual DeepSeek
- 13:05in the spark, we could actually run that
- 13:07locally. You can see for hard here, if
- 13:10I've got Claude Opus on, that will route
- 13:12to Opus first up, as opposed to just
- 13:14routing to DeepSeek. That's the key
- 13:16thing that I've got there. And then you
- 13:18can see we've just got our sort of
- 13:19conditional logic in here of that what's
- 13:22going to actually happen as we go
- 13:24through this. So, if it's greater than
- 13:26.6, we're going to go for a web-enabled
- 13:28model. If the prompt is over 16,000
- 13:31tokens, we can set it to go for a
- 13:33general model. We can do a whole bunch
- 13:35of different rules in here. We've got
- 13:36the privacy flag. If it's above 0.5,
- 13:39we're going to go for a local model,
- 13:41etc. And you can see at the same time
- 13:42I'm logging everything out and storing
- 13:44everything. So, I'm storing the Jev
- 13:46decisions in here. I'm storing the the
- 13:48SQLite messages, and I'm even storing
- 13:51images in here. So, you can see that now
- 13:53if I ask it to make an image, it's
- 13:56worked out that, okay, it should be
- 13:57using a Qwen image in here. It's going
- 14:00off. It's generating on the machine
- 14:03here, and we're going to get an image
- 14:04back showing in here. And you can see
- 14:06sure enough, there's our sandy-colored
- 14:09mancoo. Now, actually the way this is
- 14:11set up, we're actually doing some prompt
- 14:13rewriting in here. So, this is obviously
- 14:15one of the things that all the different
- 14:17sort of image services use is that
- 14:20they'll take your simple prompt, which
- 14:22in this case was this, and they'll
- 14:24rewrite it, right? Now, in this case
- 14:26we're using just the MiniCPM model to
- 14:29rewrite it. Could actually probably use
- 14:30a better model to rewrite it and to get
- 14:33a nicer rewriting. You can see, okay,
- 14:35this is basically run it. You can see
- 14:37that it's added some stuff to it like a
- 14:39sunlit meadow, some other stuff in there
- 14:41to the actual prompt. So, that's how it
- 14:43all sort of comes together like that.
- 14:45The other thing too is that I put in
- 14:47here a tools registry. So, you can see
- 14:50I've actually set it up so that the Qwen
- 14:52image was actually a tool thing in here.
- 14:54And you can see also that we've got our
- 14:57judge, right? Which is what we've got
- 14:59here. We can actually make our judge
- 15:02both the web version, or we can even try
- 15:05doing it with one of the open-source
- 15:07versions. So, in a second we'll try that
- 15:09with Sem if for being the sort of local
- 15:12Jev as opposed to the web one. You can
- 15:15see here we can also change out the
- 15:17routing thresholds. So, remember Jev is
- 15:19delivering back probabilities, etc., and
- 15:22stuff like that. So, that's something
- 15:23that we can play with in here. And I've
- 15:25got some other little sort of simple
- 15:26things for like putting in a system
- 15:28prompt in there. All right, we've moved
- 15:30now to the open Jev one, and we can see
- 15:32this here, right? So, let's try again
- 15:36now with our privacy one and see, okay,
- 15:39is the Sem if model able to do it? And
- 15:42you see, it was so quick. It's fully
- 15:44local. It's worked it out. Let's come in
- 15:46and actually look at our judge. And you
- 15:48see that the format going in and coming
- 15:50back is slightly different, but it's
- 15:52still doing the exact same kind of
- 15:54thing. We've got this difficulty, we've
- 15:56got the private, we've got the lanes
- 15:58going on there. And you can see in this
- 16:00case, it was 88 milliseconds running
- 16:02through all of this. Let's ask it to do
- 16:04a search on the web for this. So, this
- 16:07should be using the open router with the
- 16:10web version of this, and you can see,
- 16:13sure enough, it's using DuckDuckGo in
- 16:14there. We've basically got this going
- 16:16through, and you can see, sure enough,
- 16:18we've got our response back going
- 16:20through this. So, the idea here was just
- 16:22to show you a real-world example of
- 16:24using Jev, and you could use either the
- 16:27web-based Jev, which obviously is going
- 16:30to be better at generalization most of
- 16:33the time, especially for harder kinds of
- 16:35things, or you could use one of the open
- 16:37ones. In this case, I was using Sem if
- 16:40in here. You can see that this is
- 16:41basically been gating all the models
- 16:43that we have here. Now, if I come in
- 16:45here, you can see I can change the
- 16:47thresholds and stuff like that, but we
- 16:48can look at some of the stats just from
- 16:50a little bit since I restarted this
- 16:52last. That it's done 53 requests. It's
- 16:55answered 75% of them locally, right? We
- 16:58can see that, yes, sure enough, we've
- 17:00spent money, but this is what we've
- 17:01spent both, not just on Jev, but also on
- 17:04Deep Seek with these requests. And we
- 17:07can see that this is how much we've
- 17:08saved by having 75% of the requests be
- 17:11local in this case. So, depending on
- 17:14whether we've got Jev configured or Sem
- 17:16if configured, we can see what the
- 17:18actual response times are going to be
- 17:20coming back here. And we can see how
- 17:22many of the prompts were actually
- 17:24private in here. I've been showing you
- 17:26these are sort of one-shot prompts, but
- 17:27we can actually do a full sort of chat
- 17:29in here as well. Now, you could
- 17:31configure this that if you started out
- 17:33with something really hard, and we were
- 17:35using Opus, if we were actually doing
- 17:38sort of a long conversation going here,
- 17:41we'd probably want to use the caching
- 17:43and stay on the Claude Opus. So, that
- 17:46would be pretty easy to take this and
- 17:48configure this up. The idea that I'm
- 17:49trying to show you here is just building
- 17:52a sort of real-world use case, either
- 17:54using the Jev model itself, or using one
- 17:56of the open versions of this. So, let me
- 17:59know in the comments if there are other
- 18:00sort of use cases that you would like to
- 18:02see me do something like this. And also
- 18:04sort of what you're actually looking at
- 18:06using this for yourself. My plan is
- 18:08actually to get a second channel up in
- 18:10the next couple of days, which is going
- 18:12to be probably a lot more code
- 18:13intensive. So, what I might do is just
- 18:15record a walk-through of showing the
- 18:17actual code behind these, and I'll put
- 18:20the code up on GitHub and stuff like
- 18:21that. If people are interested to play
- 18:23with it and try it out, etc. For me, the
- 18:25biggest takeaway I would say is whether
- 18:27you're using the Jev model in the cloud,
- 18:29or whether you're using one of the open
- 18:31local versions of this, this really
- 18:33enables you to do a lot of rethinking of
- 18:36how you actually build and structure
- 18:38these kinds of different agentic use
- 18:41cases now, these kinds of things where
- 18:43you want to be able to save on tokens,
- 18:45but you want to make sure that you've
- 18:47got these decisions happening really
- 18:49quickly, and can be scaled for a tiny
- 18:52amount of money here. The funny thing is
- 18:54when I went back and looked at the demos
- 18:56that I did the other day in one of the
- 18:57videos, the entire demos that I did in
- 19:01the video cost less than 1 cent. So,
- 19:04this is a huge way to basically save
- 19:06money and compute, whether you're
- 19:07basically just doing everything fully
- 19:09local, or whether you're using the cloud
- 19:11version as well. Anyway, as always, if
- 19:13you found the video useful, please click
- 19:14like and subscribe, and I will talk to
- 19:16you in the next video. Bye for now.
About this transcript
This page contains the full transcript of How to Build Things with Jev & OpenJevs by Sam Witteveen, generated from the public captions YouTube serves with the video. The transcript has 3,932 words across 527 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.