Transcription: OpenAgents Episode 023 - Embedding our Codebase
June 9, 2026 ยท View on GitHub
Source: https://twitter.com/OpenAgentsInc/status/1725948809593638971 Wiki source: https://raw.githubusercontent.com/wiki/OpenAgentsInc/openagents/Video-Series.md Media title: OpenAgents - Episode 023: Embedding our Codebase We create vector embeddings for a... Upload date: 20231118 Transcription model: mlx-whisper/mlx-community/whisper-tiny Generated at: 2026-06-01T20:39:02Z
Machine-generated transcript. Review speaker labels and wording before using this as quote-grade source material.
[00:00] Christopher David: All right.
[00:06] Christopher David: So next we want Ferry to respond to this comment.
[00:10] Christopher David: Now please use the additional context to make an implementation plan based on your suggestion
[00:15] Christopher David: here, which is let's roll this out in stages, starting with a basic credit for memory objects,
[00:21] Christopher David: then adding the retrieval mechanisms based on the current situation and finally optimize the process using the principles of
[00:26] Christopher David: the importance of elements.
[00:27] Christopher David: All right.
[00:28] Christopher David: So, basic credit for memory objects, you know, data models, what I want to be able to feed in is at least like the database migration,
[00:37] Christopher David: the model definitions, and maybe the tests of the what we have,
[00:43] Christopher David: expect out thus far in the wiki and implemented conversation message file, file embeddings.
[00:58] Christopher David: So, the context this relevant is code in this code base.
[01:04] Christopher David: So, I don't want to do that manually.
[01:07] Christopher David: I want to do that in a repeatable process of like passing relevant context.
[01:17] Christopher David: So, we're going to want to apply the same idea from our
[01:26] Christopher David: regular implementation in the earlier videos where we built a machine readable understandings of text data by storing them as vectors.
[01:39] Christopher David: So, chunking it up, storing the embedding next to the content for retrieval fee as similarity search.
[01:49] Christopher David: So, ideally, when generating an answer before just passing the conversation to the prompt,
[02:02] Christopher David: we pass the conversation as well as some additional context, the digital context being things that the agent will use to generate the response.
[02:11] Christopher David: Same ideas, the retrieval augmented generation.
[02:13] Christopher David: We're going to do retrieval augmented generation.
[02:17] Christopher David: Instead of just having the thing or retrieving from BAPDF, it's going to be code.
[02:24] Christopher David: So, we need to index our code.
[02:34] Christopher David: We could have something that is a function that we run like indexes are entire code base.
[02:42] Christopher David: Particularly while we don't have a fully optimized embeddings workflow, like we're still kind of doing a bunch of retries.
[02:48] Christopher David: I probably want to minimize that and focus maybe on a particular folder.
[02:52] Christopher David: Like for the first demo, maybe we'll start by kind of just embedding a few of the files like the app slash models.
[03:01] Christopher David: Folder.
[03:02] Christopher David: See how that starts, how that begins.
[03:12] Christopher David: Let's mark this out in a feature test.
[03:21] Christopher David: What are we going to need to do?
[03:24] Christopher David: We're going to need to embed our code base.
[03:40] Christopher David: Let's do this.
[03:48] Christopher David: So what are we going to do?
[03:51] Christopher David: Create embeddings from entire code base.
[03:59] Christopher David: That might be later.
[04:00] Christopher David: First we do like create embeddings from a folder.
[04:08] Christopher David: Create embeddings from a file.
[04:21] Christopher David: This seems like going to appropriate starting point.
[04:37] Christopher David: Let's add a file.
[04:47] Christopher David: Hard code.
[04:52] Christopher David: App models.
[05:08] Christopher David: Agent.
[05:17] Christopher David: File equals.
[05:32] Christopher David: That's interesting.
[05:40] Christopher David: Yeah, I guess we could use the file model for that.
[05:44] Christopher David: If the file doesn't have to be something that's uploaded, it could have a path.
[05:56] Christopher David: Is that the correct syntax?
[06:05] Christopher David: That's important.
[06:27] Christopher David: Open the file and read its text contents into a variable.
[06:50] Christopher David: Let's add a work.
[07:00] Christopher David: What is it?
[07:02] Christopher David: We can read the contents of the file.
[07:08] Christopher David: We've already set up file has embeddings.
[07:18] Christopher David: Maybe we want to do like.
[07:38] Christopher David: Create embeddings for the file.
[07:48] Christopher David: Create embeddings.
[07:54] Christopher David: Create embeddings.
[08:04] Christopher David: Create embeddings.
[08:19] Christopher David: Create.
[08:28] Christopher David: Create.
[08:37] Christopher David: That's not the right information.
[08:44] Christopher David: First, we need to open the file.
[09:00] Christopher David: Let's make sure we still have that.
[09:17] Christopher David: We need to create embeddings.
[09:47] Christopher David: We have an embedding.
[10:08] Christopher David: We're creating one embedding.
[10:21] Christopher David: We're creating one embedding.
[10:36] Christopher David: We're creating one embedding.
[10:51] Christopher David: We can imagine that we'll also want to do like maybe the commit.
[11:03] Christopher David: Does that work?
[11:09] Christopher David: Yes, it does.
[11:13] Christopher David: We're building up classes and models.
[11:28] Christopher David: We're creating one embedding.
[11:43] Christopher David: Let's make sure that that works.
[12:12] Christopher David: It's not a good idea.
[12:52] Christopher David: We can create embeddings for a file.
[13:16] Christopher David: We can create embeddings for a folder.
[13:34] Christopher David: We can create embeddings for a file.
[13:44] Christopher David: We can create embeddings for a file.
[14:03] Christopher David: We can create embeddings for a file.
[14:20] Christopher David: We can create embeddings for a file.
[14:50] Christopher David: We can create embeddings for a file.
[15:05] Christopher David: We can create embeddings for a file.
[15:33] Christopher David: We can create embeddings for a file.
[15:48] Christopher David: We can create embeddings for a file.
[16:18] Christopher David: We can create embeddings for a file.
[16:33] Christopher David: We can create embeddings for a file.
[17:03] Christopher David: We can create embeddings for a file.
[17:28] Christopher David: We can create a file for each.
[17:58] Christopher David: We can create embeddings for a file.
[18:13] Christopher David: We can create embeddings for a file.
[18:28] Christopher David: We can create embeddings for a file.
[18:58] Christopher David: We can create embeddings for a file.
[19:19] Christopher David: We can create embeddings for a file.
[19:49] Christopher David: We can create embeddings for a file.
[19:59] Christopher David: So it doesn't actually need to return anything here.
[20:17] Christopher David: I assert that the number of files is equal to number of embeddings.
[20:25] Christopher David: Okay.
[20:28] Christopher David: And let's add a little thing here that says,
[20:31] Christopher David: oh, print our creating embeddings for.
[20:50] Christopher David: Oh, not spinning out the output.
[20:52] Christopher David: There's like some, it doesn't log as you go.
[20:55] Christopher David: You have to like do some flush thing.
[21:01] Christopher David: Okay, creating embeddings for add models agent add models artifact
[21:08] Christopher David: conversation embedding file by step task user.
[21:13] Christopher David: So that may be enough for our purposes currently.
[21:32] Christopher David: Can create embeddings from a folder.
[21:40] Christopher David: Passes.
[21:45] Christopher David: Okay.
[21:46] Christopher David: And then, so next let's do a script that we can run that creates embeddings from folders
[21:55] Christopher David: that we specify that will be relevant for this.
[22:02] Christopher David: Query.
[22:04] Christopher David: And we'll do that to generate the embeddings.
[22:07] Christopher David: That would be good.
[22:08] Christopher David: So I think from that point for this video then we'll do the query in the next video.
[22:12] Christopher David: Okay, open agents local.
[22:15] Christopher David: Let's wipe our database.
[22:22] Christopher David: So we should have zero embeddings here.
[22:26] Christopher David: And let's go to a new artisan command called just embed folders.
[22:43] Christopher David: What does call this embed?
[22:48] Christopher David: Great vector embeddings from folders.
[22:53] Christopher David: And we'll say the folders that we want to do will be app models.
[23:13] Christopher David: Database migrations.
[23:23] Christopher David: Let's go back and think about a basic pride for memory objects.
[23:33] Christopher David: Crad I guess implies controllers.
[23:38] Christopher David: I'll actually don't know if it's going to traverse sub directories.
[23:52] Christopher David: I think between the models and the migrations it'll have enough.
[24:08] Christopher David: Oh, it's also do the unit tests because that's the best kind of explanation of what each thing kind of actually does.
[24:18] Christopher David: Test slash units.
[24:28] Christopher David: Then.
[24:48] Christopher David: All right, so we'll at least get.
[25:12] Christopher David: And then we'll go to a console log.
[25:17] Christopher David: Once.
[25:20] Christopher David: It goes to each folder. Okay.
[25:25] Christopher David: So we're starting with zero embeddings.
[25:29] Christopher David: And let's see what happens.
[25:33] Christopher David: PHP artisan embed.
[25:36] Christopher David: You use.
[25:42] Christopher David: App services better.
[25:48] Christopher David: Okay, hey, there we got some console and doggies.
[25:55] Christopher David: You did so nice.
[25:59] Christopher David: Oh, that's so nice.
[26:05] Christopher David: Oh, my goodness.
[26:20] Christopher David: Look how smooth that was.
[26:23] Christopher David: Yes, yes, yes, yes.
[26:27] Christopher David: Okay, so now we have machine readable.
[26:31] Christopher David: Like.
[26:33] Christopher David: Vector. So we knew we could do searching over the.
[26:38] Christopher David: Like model code that we have gosh, we do more.
[26:41] Christopher David: So easy. Maybe we'll do controllers too. Let's do a little bit more app.
[26:46] Christopher David: HTTP, TP controllers. That is a sub folder. I'll be curious to see.
[26:52] Christopher David: What happens with that one.
[26:55] Christopher David: Ah, is a directory. Great.
[27:01] Christopher David: I'm going to go to the.
[27:04] Christopher David: Actually, just ask.
[27:07] Christopher David: Our friend, jet GPT was the best way to handle this.
[27:11] Christopher David: Fix this.
[27:15] Christopher David: I'm going to go to the.
[27:18] Christopher David: Actually, let's just ask.
[27:20] Christopher David: Our friend, jet GPT was the best way to handle this.
[27:24] Christopher David: Fix this.
[27:27] Christopher David: To avoid erroring on directories. Let's skip sub directories.
[27:42] Christopher David: We write my code until I get our agents working them. Our agents will do it.
[27:57] Christopher David: Yeah, so the if is file.
[28:21] Christopher David: That works.
[28:23] Christopher David: I think.
[28:42] Christopher David: Read me.
[28:52] Christopher David: I think that's fine for now. So we've got the relevant code.
[28:56] Christopher David: In that case.
[28:59] Christopher David: We should probably skip over sensitive files like if I embed the root directory.
[29:17] Christopher David: Okay, I think that's fine for now. So we've got the relevant code.
[29:22] Christopher David: We can always pass in the reading separately.
[29:26] Christopher David: So we've got the models database migrations with all of the fields.
[29:33] Christopher David: We've got the unit tests and the migrations might actually be difficult between the unit tests and the models that might be not.
[29:41] Christopher David: But we'll play this and as well as the controllers.
[29:44] Christopher David: Okay, so we have indexed all of the relevant code.
[29:48] Christopher David: That's good for this video.
[29:52] Christopher David: In the next video, we will search over that using our ragging mutation and pass that to ferry to generate the response.