WEBVTT

NOTE Sentence-level transcript of https://www.youtube.com/watch?v=LJ2a9nX3vlo

NOTE One cue per sentence. Cue ids are the line anchors on /transcripts/LJ2a9nX3vlo.html. A cue ends where the next begins, or 2 s after its last word.

s1
00:00:13.440 --> 00:00:14.799
Hello everyone.

s2
00:00:14.799 --> 00:00:23.199
Thank you so much for coming today and welcome to rag needs a map using graph rag to retrieve connected context.

s3
00:00:23.199 --> 00:00:34.239
So before we get started today and I know there are people who are trickling in but before we get started today I just wanted to do a quick little poll to see who is already using rag in their pipelines regular vector-based rag.

s4
00:00:34.239 --> 00:00:39.520
Okay cool perfect are there people who are already using graphbased rag in their pipelines.

s5
00:00:39.520 --> 00:00:41.520
Okay

s6
00:00:42.079 --> 00:00:44.160
got it still working on it.

s7
00:00:44.160 --> 00:00:46.239
So I see just a few people.

s8
00:00:46.239 --> 00:00:55.120
Um and for those who um are already using graph-based rag in their pipelines, could you explain what graph rag is?

s9
00:00:56.160 --> 00:00:58.480
A couple sort of.

s10
00:00:58.480 --> 00:00:58.800
Okay.

s11
00:00:58.800 --> 00:01:00.960
People are like sort of that's perfectly okay.

s12
00:01:00.960 --> 00:01:08.560
Um what we're going to do is for those who are new to the concept um this will be a sort of one-on-one graph rag um talk.

s13
00:01:08.560 --> 00:01:14.799
So, if you're already an expert, this you'll already know what we're talking about just so that you can um level set.

s14
00:01:14.799 --> 00:01:20.880
But, um all in all, I want to make sure that people know what we're going to be talking about today.

s15
00:01:20.880 --> 00:01:29.360
So, just to shortly introduce myself, my name is Ny Mlin and I'm a senior software engineer and senior developer advocate here at Neo4j.

s16
00:01:29.360 --> 00:01:45.920
Um my research focuses on graph theory, graph algorithms as well as uh context engineering while all trying to understand um the many architectures that are in place um to build out agents but also which architectures are best suited to break open this blackbox

s17
00:01:45.920 --> 00:01:52.880
phenomenon um to be able to decipher and trace and explain how artificial intelligence systems work.

s18
00:01:52.880 --> 00:02:03.920
So I um spend a lot of time thinking about AI governance and safety as well which also turns out to matter a lot when uh thinking about how your agent is making its decisions and how your agent is built.

s19
00:02:03.920 --> 00:02:19.599
Um but I've been doing this work for about a decade now and I'm excited to bring you all bring us all back to basics to try and understand uh graph rag and so this is a graph rag 101 type of workshop for those who are newer to the concept.

s20
00:02:20.319 --> 00:02:26.959
So today I have two incredible team members who are joining me as well as another team member who's joining me today.

s21
00:02:26.959 --> 00:02:31.200
I have my colleagues uh Jeremy Adams Castanas who is here in the front.

s22
00:02:31.200 --> 00:02:32.720
Jeremy's waving to everyone.

s23
00:02:32.720 --> 00:02:35.840
If you have any questions whatsoever, please ask Jeremy.

s24
00:02:35.840 --> 00:02:40.720
Um I also have my colleague Ryan Knight who is here I think somewhere.

s25
00:02:40.720 --> 00:02:41.280
Oh great.

s26
00:02:41.280 --> 00:02:43.120
Hey Ryan, great to see you.

s27
00:02:43.120 --> 00:02:50.480
So Ryan's going to be joining me and I also have a special guest, the uh the speaker for the previous session as well, Zach, who is in the back.

s28
00:02:50.480 --> 00:02:53.760
He's an incredible AI research engineer on the Neo Forj team.

s29
00:02:53.760 --> 00:02:57.280
He is also here to join us and to help out with any questions that you need.

s30
00:02:57.280 --> 00:03:07.519
So if you have any questions, just raise your hand during the uh the workshop and one of my colleagues will um will join you at your table and help you work through this.

s31
00:03:07.519 --> 00:03:13.360
So, just a couple um uh housekeeping notes before we even get started.

s32
00:03:13.360 --> 00:03:18.879
Today, we're going to be using this platform called Graph Academy in order to proceed through this workshop.

s33
00:03:18.879 --> 00:03:23.120
Has anyone signed up or used Graph Academy before or even heard of Graph Academy?

s34
00:03:23.120 --> 00:03:23.599
Okay.

s35
00:03:23.599 --> 00:03:24.720
No, not at all.

s36
00:03:24.720 --> 00:03:25.920
That's perfectly fine.

s37
00:03:25.920 --> 00:03:35.599
So, Graph Academy is our completely free forever free online learning platform where you can learn about all the concepts that I'm going to be talking about today.

s38
00:03:35.599 --> 00:03:38.239
It takes you through building out agents.

s39
00:03:38.239 --> 00:03:44.159
It takes you through learning about agentic memory, about context graphs, if you've all heard of that phrase as well.

s40
00:03:44.159 --> 00:03:48.480
Um, there are lots of different free courses that are online and completely available.

s41
00:03:48.480 --> 00:03:52.159
These are not sit back and listen to a lecturer speak courses.

s42
00:03:52.159 --> 00:03:56.319
These are handson keyboard start building type of courses.

s43
00:03:56.319 --> 00:04:01.439
So, that's the main goal for Graph Academy and it's an absolutely excellent resource for you to use.

s44
00:04:01.439 --> 00:04:03.680
Again, completely free at any time.

s45
00:04:03.680 --> 00:04:05.360
So, we're going to be using that today.

s46
00:04:05.360 --> 00:04:14.159
And what I want you all to do just so that we can start off is because we're using Graphacademy, I want you to create a Graphacademy account for me.

s47
00:04:14.159 --> 00:04:15.680
And so, it should be a quick process.

s48
00:04:15.680 --> 00:04:23.199
You're going to go to graphacademy.ne4j.com and then you can start to create this account.

s49
00:04:23.199 --> 00:04:25.600
Um, and again, these are free resources.

s50
00:04:25.600 --> 00:04:34.479
So you can take this and go um throughout your time either here at AI engineer or as you continue to learn about graph and rag.

s51
00:04:34.479 --> 00:04:39.199
I also have a link here for all of the links that we are going to be talking about today.

s52
00:04:39.199 --> 00:04:42.960
All of the um all of the notes that we have.

s53
00:04:42.960 --> 00:04:47.360
I will also at the end be able to present with you all the slides from this deck.

s54
00:04:47.360 --> 00:05:00.240
Um but um you'll go to dev.neforj.comworkshop-genai neo4j.comworkshop-genai-notes and that has all of the information that we need.

s55
00:05:00.240 --> 00:05:03.040
I'm going to go to it right now actually.

s56
00:05:03.040 --> 00:05:08.560
And you'll see here if I can I always have to fight with these things.

s57
00:05:08.560 --> 00:05:15.520
So you'll see here this is what uh the document that you go to um if you actually click that link the dash notes.

s58
00:05:15.520 --> 00:05:22.560
So here we have um a couple links that you'll see after you sign up for graphacademy.com.

s59
00:05:22.560 --> 00:05:26.000
I also want you to create a Neo Forj Aura instance.

s60
00:05:26.000 --> 00:05:27.919
This is our hosted cloud platform.

s61
00:05:27.919 --> 00:05:29.280
We're doing this all for free.

s62
00:05:29.280 --> 00:05:33.280
So please do not um uh click the instances that you're paying for.

s63
00:05:33.280 --> 00:05:35.919
I want you to click the free instance.

s64
00:05:35.919 --> 00:05:39.280
Um and so again remember that we're trying to do all this all for free.

s65
00:05:39.280 --> 00:05:40.160
Click the free instance.

s66
00:05:40.160 --> 00:05:47.360
If you want to have more um more tools in the future, then you can feel free to click the uh the professional instance or or what have you.

s67
00:05:47.360 --> 00:05:56.560
But um we're going to create a free instance um and this will allow you to to hook up to what we are going to be diving in today, Aura agents as well.

s68
00:05:56.560 --> 00:06:01.759
So building out or building out agents within the Aura platform.

s69
00:06:01.759 --> 00:06:06.149
But you can see here now I know people love a good free API key.

s70
00:06:06.149 --> 00:06:06.880
[laughter]

s71
00:06:06.880 --> 00:06:10.720
Don't worry, I did not leak my leak leak my API key here.

s72
00:06:10.720 --> 00:06:16.479
But we do have a um OpenAI API key that's going to give you access to be able to build today.

s73
00:06:16.479 --> 00:06:21.039
So, we wanted to make this as simple as possible for you all and is easy to get started.

s74
00:06:21.039 --> 00:06:25.919
So, we're giving you a free API key that you can use um in order to build.

s75
00:06:25.919 --> 00:06:27.759
And um we do have limits on that.

s76
00:06:27.759 --> 00:06:35.120
You can't just run up run up the bill, but um please do copy down that API key or save it on your computer.

s77
00:06:35.120 --> 00:06:47.680
again it'll be here on this document as you view it um so that you can have access to it later but I just wanted to show off this uh this document for you all um there's some different ways in order to get started with Neoforj

s78
00:06:47.680 --> 00:07:05.280
but that's all okay so while you all are working on um creating those instances and creating those accounts what we will do is just get started with some of the material that we're going to be talking about today

s79
00:07:05.280 --> 00:07:13.120
and I'm just going to give you a a short primer and then we'll actually dive into what we'll be talking about in graph academy.

s80
00:07:13.199 --> 00:07:30.880
So first of all and this will be uh something that many of you have already heard of because you're already working within uh rag and within vectorbased rag but to overcome this AI's blackbox problem right we often need knowledge itself and data itself to actually be transparent.

s81
00:07:30.880 --> 00:07:36.560
So we can see here that we have a human view of an apple right in the center.

s82
00:07:36.560 --> 00:07:42.080
And then we also have to the right the vectorzed view of an apple.

s83
00:07:42.080 --> 00:07:46.000
And so for the vectorzed view of an apple you see this series of numbers here, right?

s84
00:07:46.000 --> 00:07:49.039
It's floats for those who are engineers themselves.

s85
00:07:49.039 --> 00:07:58.639
Um but these are not necessarily human readable and human understandable um uh vectors uh unless you've actually memorized the vector view of an apple yourself.

s86
00:07:58.639 --> 00:08:05.759
Um but every single object you can represent both as a vector or or as data itself.

s87
00:08:05.759 --> 00:08:10.800
Um but every single object that exists on earth can be represented here.

s88
00:08:10.800 --> 00:08:15.199
But then on the left we see a knowledge graph view of an apple.

s89
00:08:15.199 --> 00:08:15.919
Right?

s90
00:08:15.919 --> 00:08:24.960
So this apple we can see that the apple itself it comes from a tree that the apple um has a specific body and a specific look.

s91
00:08:24.960 --> 00:08:27.120
The apple is round.

s92
00:08:27.120 --> 00:08:30.000
um this particular apple is red.

s93
00:08:30.000 --> 00:08:32.560
Um and an apple itself is a fruit.

s94
00:08:32.560 --> 00:08:34.479
We're not talking about the company.

s95
00:08:34.479 --> 00:08:47.200
So knowledge graphs can make what is understood by humans also understood by machines and it creates knowledge graphs oftentimes create a fusion of both.

s96
00:08:47.200 --> 00:08:56.000
So you're able to understand both this is both machine readable and human readable graph a view of an apple.

s97
00:08:56.000 --> 00:09:02.080
And if you're coming in late and you don't have access to these uh the materials, Jeremy and Ryan are coming around.

s98
00:09:02.080 --> 00:09:03.680
They have the QR codes.

s99
00:09:03.680 --> 00:09:11.920
Um just raise your hand and they'll come around and give you the QR code for the materials that I had just had up on the slide.

s100
00:09:13.920 --> 00:09:27.440
But most people right now you can either you'll either have your data structured as a um uh actually in structured as tables and rows or you might have your data structured in vectors like I had shown before.

s101
00:09:27.440 --> 00:09:39.519
But if you're structuring your data in tables and rows, then you have to oftent times do a number of different complex joins on that data um in order to figure out how these rows and these tables are all related to

s102
00:09:39.519 --> 00:09:46.959
and then we often understand that that is going to drastically slow down the performance of our application.

s103
00:09:46.959 --> 00:09:54.080
And we can't have that especially mo most of us um deal with the uh the San Francisco mentality move fast and break things, right?

s104
00:09:54.080 --> 00:09:58.000
just get it working halfway and then push it to production.

s105
00:09:58.000 --> 00:10:01.279
We'll figure out, you know, we'll figure out any issues going forward.

s106
00:10:01.279 --> 00:10:03.360
So, this is the slowest way to do things.

s107
00:10:03.360 --> 00:10:04.560
We don't have time for that, right?

s108
00:10:04.560 --> 00:10:05.360
We have to move fast.

s109
00:10:05.360 --> 00:10:08.560
We have to be accurate and we have to be explainable.

s110
00:10:08.560 --> 00:10:19.279
So, if you were to structure all of that same data in a knowledge graph, then the relationships and the connections and the groupings actually become much more clear.

s111
00:10:19.279 --> 00:10:32.320
So now your agent can physically hop right from one node and when I say node I mean one circle to the next circle through this relationship that we see right and the line is the relationship.

s112
00:10:32.320 --> 00:10:40.720
We can hop from one node to the next node um of information and be able to trace and explain what happened in the past.

s113
00:10:40.720 --> 00:10:42.959
That's a massive improvement, right?

s114
00:10:42.959 --> 00:10:48.880
Once you're being able to hop through nodes through things like agent memory, which I'm actually not going to get into in this talk.

s115
00:10:48.880 --> 00:10:52.079
I have a whole another talk that talks that breaks down agent memory.

s116
00:10:52.079 --> 00:11:03.839
But through this this concept of agent memory, you can now have this memory and have this context of how did that agent come to create the decision that it made in the past.

s117
00:11:03.839 --> 00:11:11.680
And so that's that's incredible for dealing like uh dealing in regulated domains um like financial use cases.

s118
00:11:11.680 --> 00:11:14.880
Um, y'all don't want Vibe Vibe banking, right?

s119
00:11:14.880 --> 00:11:16.079
Nobody wants Vibe banking.

s120
00:11:16.079 --> 00:11:19.279
You don't want your agent just having access to your money and then spending all of your money.

s121
00:11:19.279 --> 00:11:21.519
I've seen those things happen before.

s122
00:11:21.519 --> 00:11:32.160
But things like medicine as well, regulated spaces, legal spaces, this is where that um that uh context and that history and that memory is actually very very important.

s123
00:11:32.160 --> 00:11:45.120
But once you have a knowledge graph representation, your possibilities for your agent to give you that explainable, traceable, and accurate responses actually become much more improved and some might say endless.

s124
00:11:45.680 --> 00:11:52.959
So again, because this is a one-on-one workshop, I wanted to make sure that people understand the architecture of a graph-based rag system.

s125
00:11:52.959 --> 00:11:56.959
So in a normal rack pipeline, you are not using knowledge graphs, right?

s126
00:11:56.959 --> 00:11:59.120
in in the basic rag pipeline.

s127
00:11:59.120 --> 00:12:07.920
Um in a normal rag pipeline, you could take a few PDFs, for example, and then chunk them and then index those chunks using a text embedding model.

s128
00:12:07.920 --> 00:12:12.959
Um and then when it's time to query those text chunks, you get that same embedding model.

s129
00:12:12.959 --> 00:12:19.680
Then you try to fetch the top k or top x number of relevant documents and you pass that in to an LLM.

s130
00:12:19.680 --> 00:12:23.120
And then your LLM is going to give you back the final answer from those documents.

s131
00:12:23.120 --> 00:12:44.639
and and that's what the pipeline looks like for that poker usually um most likely used to right but graph rag on the other hand is fundamentally it is rag but it's where the retrieval path actually includes the knowledge graph so graph rag is where the retrieval path actually includes a knowledge graph

s132
00:12:44.639 --> 00:12:58.240
and so you'll see here the architecture is just slightly different so in the rag pipeline illustration that I showed before the normal rag pipeline did not use a knowledge graph But you see here down here, we actually have a knowledge graph incorporated into that space.

s133
00:12:58.240 --> 00:13:06.880
So when people ask me when to use rag versus graph rag, usually I like to say that we're if you're trying to answer a question that can be solved

s134
00:13:06.880 --> 00:13:12.160
um with a either a search engine, then uh for and that's the simplest term, right?

s135
00:13:12.160 --> 00:13:15.760
Then vector-based rag is actually usually sufficient.

s136
00:13:15.760 --> 00:13:20.720
However, if you want to ask a question that includes what we call these multiple hops.

s137
00:13:20.720 --> 00:13:24.720
So we saw the act the example of a knowledge graph before we saw the nodes.

s138
00:13:24.720 --> 00:13:35.200
If you're trying to do these multiple hops or at least three hops, then that's when graph rag actually becomes imperative because you're able to then see and able to then decipher

s139
00:13:35.200 --> 00:13:41.519
where the agent had to um had to hop in order to get to its answer.

s140
00:13:41.519 --> 00:13:51.360
But um if you're trying to do something for example source code analysis or if you're trying to have a supply chain question or anything that requires aggregation or concatenation

s141
00:13:51.360 --> 00:14:02.079
of data then uh from different documents then that's when this graph rack actually be really helpful and I'm not going to necessarily knock vectorbased rag.

s142
00:14:02.079 --> 00:14:05.680
think it is incredibly powerful for most of our use cases.

s143
00:14:05.680 --> 00:14:18.959
But here are some of the examples where vector only um rag and vector only databases they might fall short with when it comes to these things where graph and being able to traverse nodes and get that that historical context

s144
00:14:18.959 --> 00:14:20.399
um can be beneficial.

s145
00:14:20.399 --> 00:14:27.839
I'm not going to go through all of these but I wanted people to be able to see where um where the differences might lie.

s146
00:14:29.040 --> 00:14:35.120
And so all in all, when you're going to be when people ask, okay, should we use graph rag versus vector-based rag?

s147
00:14:35.120 --> 00:14:38.079
I say that using both is actually the key here.

s148
00:14:38.079 --> 00:14:40.399
We want to use both graph and vector.

s149
00:14:40.399 --> 00:14:46.959
Um and uh graph we we're not saying that graph is going to completely um uh completely replace your vector layer.

s150
00:14:46.959 --> 00:14:50.000
We're saying that if you use both, then you the benefits of both.

s151
00:14:50.000 --> 00:14:51.120
So let's add on, right?

s152
00:14:51.120 --> 00:14:55.600
Let's make sure that our agents are being as uh beneficial as possible.

s153
00:14:55.600 --> 00:14:56.000
Okay.

s154
00:14:56.000 --> 00:15:01.360
So, I'm going to pause there and we are going to go into uh Graphacademy.

s155
00:15:01.360 --> 00:15:17.760
So, for Graphacademy, the first link, graphacademy.com, we're going to go into this workshop um.ji and what I want us to do is to we're going to skip the first few sections of this.

s156
00:15:17.760 --> 00:15:22.399
So, um I have of course already done the course, but I can reset it.

s157
00:15:22.399 --> 00:15:30.320
So, we're going to continue that course and what we're going to do is we're going to skip over some of this um more introductory stuff like what is generative AI.

s158
00:15:30.320 --> 00:15:31.279
We don't need to know that.

s159
00:15:31.279 --> 00:15:33.680
If you do need to know that, that's perfectly fine as well.

s160
00:15:33.680 --> 00:15:36.639
Um but uh for this conversation, we're just going to skip down.

s161
00:15:36.639 --> 00:15:40.639
We're going to skip down to the to the graph rag section.

s162
00:15:40.639 --> 00:15:41.199
All right.

s163
00:15:41.199 --> 00:15:48.720
So, we already went through the graph rag um the retrieval process and the differences between normal rag versus graph rag process.

s164
00:15:48.720 --> 00:15:54.639
We're seeing that we're first of all we we see the typical process here which I already went through.

s165
00:15:54.639 --> 00:16:02.320
You have your retrievers, your user, your application and your LLM and then your data store which is normally um a vector store.

s166
00:16:02.320 --> 00:16:08.959
Um but then if we go down then we see a little bit of the difference um as well.

s167
00:16:08.959 --> 00:16:12.959
And what I did want to touch upon here is this concept of retrievers.

s168
00:16:12.959 --> 00:16:14.800
Many of you already know what retrievers are.

s169
00:16:14.800 --> 00:16:17.920
Just get a quick hand so I don't have to go over it.

s170
00:16:17.920 --> 00:16:20.079
Okay, well actually not as many as I thought.

s171
00:16:20.079 --> 00:16:20.800
So that's okay.

s172
00:16:20.800 --> 00:16:21.920
That's that's totally okay.

s173
00:16:21.920 --> 00:16:23.839
Let's actually go over it then quickly.

s174
00:16:23.839 --> 00:16:26.959
So a retriever is a key component of the rag process, right?

s175
00:16:26.959 --> 00:16:33.360
A retrieval is actually responsible for searching and retrieving relevant information from your external data sources.

s176
00:16:33.360 --> 00:16:37.120
And what I like to say, okay, let's let's make this um bigger.

s177
00:16:37.120 --> 00:16:38.800
Thank you so much.

s178
00:16:38.800 --> 00:16:48.320
Um what I like to say often or ways that I like to remember what retrievers are um the simple way um is that retrievers are the golden retriever, right?

s179
00:16:48.320 --> 00:16:51.279
We we all know about golden retrievers, they like to catch balls.

s180
00:16:51.279 --> 00:16:52.560
They like to catch things.

s181
00:16:52.560 --> 00:16:59.680
So a retriever is some is uh if you would think of this golden retriever likes to go and fetch the necessary information.

s182
00:16:59.680 --> 00:17:12.000
Um, and so the retriever usually takes in unstructured input like a question or a prompt like when we're using chat bots and then it searches the structured data to provide the context for the answer.

s183
00:17:12.000 --> 00:17:20.400
And so this is just a little bit about what Neoforj specifically report supports full text search vector search and then uh text or cipher retrievers as well.

s184
00:17:20.400 --> 00:17:23.360
And then we have a number of different data sources as well.

s185
00:17:23.360 --> 00:17:31.360
So those data sources in uh regular rag pipelines and processes can vary um documents, APIs, knowledge graphs as well.

s186
00:17:31.360 --> 00:17:40.880
Um but um if we were to use uh this uh this news agency chatbot for example, then the process would look like this, right?

s187
00:17:40.880 --> 00:17:45.039
A news API is going to be used to retrieve the latest articles and headlines.

s188
00:17:45.039 --> 00:17:53.760
The knowledge graph is then going to be used to understand the relationships between different topics um such as how they relate to each other in a historical context.

s189
00:17:53.760 --> 00:18:01.679
And then the document database is going to store and retrieve uh articles or reports or textual information as well.

s190
00:18:01.679 --> 00:18:08.080
So we that's just an example and a um architecture of what that could look like.

s191
00:18:08.080 --> 00:18:10.400
But let's keep going, right?

s192
00:18:10.400 --> 00:18:12.480
There's lots of different benefits to using graph rag.

s193
00:18:12.480 --> 00:18:23.679
I'll touch upon this really quickly, but one of those is um having uh richer context specifically and then improved accuracy, explanability like we had actually seen within that knowledge graph.

s194
00:18:23.679 --> 00:18:34.880
If you're able to actually um if you're able to traverse your knowledge graph um and then use that plus things like agent memory, then you can get this rich historical context

s195
00:18:34.880 --> 00:18:39.280
that's really necessary and really beneficial for building out your agents.

s196
00:18:39.280 --> 00:18:42.720
So, let's keep going.

s197
00:18:42.720 --> 00:18:49.840
And then I heard a couple people um and my colleague had went through the line a little bit earlier to see like have people built knowledge graphs before.

s198
00:18:49.840 --> 00:18:53.280
Can I get a couple hands to see has anyone built out knowledge graphs?

s199
00:18:53.280 --> 00:18:54.160
Just a few.

s200
00:18:54.160 --> 00:18:54.480
Okay.

s201
00:18:54.480 --> 00:18:55.280
Just a few.

s202
00:18:55.280 --> 00:18:55.600
Okay.

s203
00:18:55.600 --> 00:18:56.080
A little bit.

s204
00:18:56.080 --> 00:18:56.960
Yeah.

s205
00:18:56.960 --> 00:18:57.840
Okay.

s206
00:18:57.840 --> 00:18:58.160
Okay.

s207
00:18:58.160 --> 00:18:58.960
Hello world.

s208
00:18:58.960 --> 00:19:00.240
That's perfectly fine.

s209
00:19:00.240 --> 00:19:00.720
No problem.

s210
00:19:00.720 --> 00:19:02.799
This is why we're all here to learn more.

s211
00:19:02.799 --> 00:19:07.200
Um so, uh just um making sure that we understand what is a knowledge graph.

s212
00:19:07.200 --> 00:19:16.240
We went through this a little bit in the in the example, but a knowledge graph in general is a um organized representation of real world entities and their relationships.

s213
00:19:16.240 --> 00:19:21.360
So if I am a node, right, I'm a circle, I'm a node, and then my colleague Jeremy is a node as well.

s214
00:19:21.360 --> 00:19:23.120
Yes, Jeremy, we are nodes.

s215
00:19:23.120 --> 00:19:26.480
And then we actually have relationship that we are colleagues and we are friends.

s216
00:19:26.480 --> 00:19:28.799
So we have two different relationships here.

s217
00:19:28.799 --> 00:19:35.360
Um but um that is that's the simplest architecture of a um of a knowledge graph.

s218
00:19:35.360 --> 00:19:38.000
And then we can be connected to different people as well.

s219
00:19:38.000 --> 00:19:40.880
We have our colleague Zach and then another colleague Ryan.

s220
00:19:40.880 --> 00:19:43.840
There's so many different um ways, but that's just a represent.

s221
00:19:43.840 --> 00:19:47.200
It's just a representation of data in its most simplest form.

s222
00:19:47.200 --> 00:19:49.600
Um so uh what is a knowledge graph?

s223
00:19:49.600 --> 00:19:52.880
You can see here another example of that knowledge graph.

s224
00:19:52.880 --> 00:20:00.640
And so in the interest of time, I'm just going to skip down and we're going to get into this knowledge graph construction piece.

s225
00:20:00.640 --> 00:20:05.679
So for everyone who's following um we're in the um knowledge graph construction section.

s226
00:20:05.679 --> 00:20:10.400
So let's build out a knowledge graph quickly.

s227
00:20:10.400 --> 00:20:11.679
So constructing knowledge graphs.

s228
00:20:11.679 --> 00:20:18.000
In this lesson we'll review the process of constructing knowledge graphs from unstructured tests using an LLM.

s229
00:20:18.160 --> 00:20:24.880
So the overall process is making sure that we're gathering data sources and then we're chunking that information and chunking that data.

s230
00:20:24.880 --> 00:20:35.280
We're of course going to vectorize that data as well and then um extracting nodes and relationships from that and then generating the graph of course.

s231
00:20:35.280 --> 00:20:44.159
So in this example, if we wanted to construct a knowledge graph based on the Neo Forj Wikipedia page, which we can see here, we're going to gather text from that page, right?

s232
00:20:44.159 --> 00:20:47.600
Take all the text and then we're going to split that text into chunks.

s233
00:20:47.600 --> 00:20:57.600
As you can see here, we would generate embeddings and vectors from each of those chunks and then extracting the entities and the relationships using an in LLM.

s234
00:20:57.600 --> 00:21:00.799
Now, you can do that manual extraction if you wish.

s235
00:21:00.799 --> 00:21:07.280
Um but we think that um using it in an LLM can cut down on the amount of time that it takes in order to do that extraction.

s236
00:21:07.280 --> 00:21:13.679
Um and so we would send the LLM to with an appropriate prompt um a prompt example here.

s237
00:21:13.679 --> 00:21:18.880
Your task is to identify the entities and the relationships requested with the prompt from a given text.

s238
00:21:18.880 --> 00:21:26.000
And then you must generate the output um in a JSON format containing a list with JSON objects.

s239
00:21:26.000 --> 00:21:30.080
And then we would paste oh sorry parse those um entities and relationships.

s240
00:21:30.080 --> 00:21:37.919
the output into the LLM, paste that into as JSON, and then we would generate the graph from all of that.

s241
00:21:37.919 --> 00:21:43.360
So, we see here we see here Cipher, which is a query language that's optimized for graphs.

s242
00:21:43.360 --> 00:21:46.240
Has anyone used Cipher before?

s243
00:21:46.240 --> 00:21:46.720
A couple.

s244
00:21:46.720 --> 00:21:47.120
Okay.

s245
00:21:47.120 --> 00:21:47.440
All right.

s246
00:21:47.440 --> 00:21:48.480
A couple people.

s247
00:21:48.480 --> 00:21:50.670
Um, so if you're a cipher expert,

s248
00:21:50.670 --> 00:21:51.520
[laughter]

s249
00:21:51.520 --> 00:21:56.320
then I have um uh if you answer some of my questions here, I have swag as well.

s250
00:21:56.320 --> 00:22:02.240
So people as um as you are going through this workshop I want it to be more interactive than a normal workshop.

s251
00:22:02.240 --> 00:22:10.720
So I'll be asking questions and if you're brave enough to answer one of my questions live it's also being live streamed but live then I have free uh unique

s252
00:22:10.720 --> 00:22:12.000
swag for you.

s253
00:22:12.000 --> 00:22:21.280
So that includes t-shirts that includes um uh special swag that you cannot get anywhere else as well socks etc but um special swag on top of that.

s254
00:22:21.280 --> 00:22:28.559
So, um, thank you all for, uh, being willing to put yourself out on a limb and answer some questions that we might have.

s255
00:22:28.559 --> 00:22:32.000
But you'll see here, uh, lastly, an example of a generated graph.

s256
00:22:32.000 --> 00:22:36.559
So, we have a graph database was, uh, developed by Neo Forj, which is a company.

s257
00:22:36.559 --> 00:22:46.000
Um, and, uh, Neo Forj didn't, uh, develop graph databases all in general, but just Neo Forj is the graph database that was developed by Neo Forj with the company.

s258
00:22:46.000 --> 00:22:48.320
And then that's implemented in Java.

s259
00:22:48.320 --> 00:22:52.960
And quick side note, Neo for J the name comes from Neo who is matrix.

s260
00:22:52.960 --> 00:22:56.159
All right, those who know the matrix and then Neo for Java.

s261
00:22:56.159 --> 00:23:02.080
So for those who have that quick little piece, you'll know that that note about Neo forj.

s262
00:23:02.080 --> 00:23:04.720
So we can continue.

s263
00:23:08.400 --> 00:23:09.360
Ah yes.

s264
00:23:09.360 --> 00:23:11.200
Yes.

s265
00:23:11.200 --> 00:23:12.559
Go for it.

s266
00:23:12.559 --> 00:23:12.799
Yeah.

s267
00:23:12.799 --> 00:23:14.159
Yeah, let's do it.

s268
00:23:14.159 --> 00:23:14.720
Okay.

s269
00:23:14.720 --> 00:23:18.559
So um because we're at half past the hour, we want you to get the most out of this.

s270
00:23:18.559 --> 00:23:21.919
And people wanted to do building of the knowledge graph.

s271
00:23:21.919 --> 00:23:25.600
There is a on your left sidebar it says graph rag for Python.

s272
00:23:25.600 --> 00:23:27.679
That's right.

s273
00:23:27.679 --> 00:23:28.960
That link there.

s274
00:23:28.960 --> 00:23:30.559
So kind of navigate to that.

s275
00:23:30.559 --> 00:23:33.520
That will take you if you scroll down.

s276
00:23:33.520 --> 00:23:43.919
Um this is going to talk a little bit about the the graph rag for Python package an open source package that Neo4j provides for knowledge graph building and retrieval and agentic work

s277
00:23:43.919 --> 00:23:55.679
and also on this page are all the credentials you'll need for all the examples we'll be using and then um Nia you want to take it away and talk about the credentials and the GitHub code space.

s278
00:23:55.679 --> 00:23:56.559
Absolutely.

s279
00:23:56.559 --> 00:23:59.120
So let's start off uh for let's start off.

s280
00:23:59.120 --> 00:24:07.600
So, we had mentioned we're in the graph for Python section now and we want to um go scroll down and then click open in GitHub code spaces.

s281
00:24:07.600 --> 00:24:15.200
Once we open that, we're um you you're going to have to sign into GitHub if you're not already, but once we open that, we're just we're going to leave all of these

s282
00:24:15.200 --> 00:24:17.760
um uh system prompts the same.

s283
00:24:17.760 --> 00:24:19.360
And then we're going to create the code space.

s284
00:24:19.360 --> 00:24:20.640
It's going to take a little bit of time.

s285
00:24:20.640 --> 00:24:28.080
So, we're going to do a little bit a couple of things ahead of um not necessarily ahead of time, but while this is generating.

s286
00:24:28.080 --> 00:24:34.080
And so while this is generating, I just wanted to show you all that we're going to be creating this setup environment.

s287
00:24:34.080 --> 00:24:37.120
And so we're going to create a copy of this m.example.

s288
00:24:37.120 --> 00:24:39.039
And you can just click copy here.

s289
00:24:39.039 --> 00:24:45.600
And we're going to actually create that um within our um code spaces section.

s290
00:24:45.600 --> 00:24:48.080
And so this will continue.

s291
00:24:48.080 --> 00:24:50.640
Of course, Wi-Fi is not always fun, but this will continue.

s292
00:24:50.640 --> 00:25:00.080
Eventually, it's going to have an entire setup for the um uh for the folder structure, and it'll have a uh M.ample folder.

s293
00:25:00.080 --> 00:25:08.240
So, we're going to instead create a M file, and we're going to paste all of these um uh um all these credentials in.

s294
00:25:08.240 --> 00:25:20.799
And actually what we're going to do, we're not going to paste those exact credentials because what we want to do specifically is to and I had this in the notes is to create a Neo Forj Aura instance.

s295
00:25:20.799 --> 00:25:23.360
And so I had that in the notes for us to get started on.

s296
00:25:23.360 --> 00:25:25.600
So create a Neo Forj Aura instance.

s297
00:25:25.600 --> 00:25:30.159
And again I mentioned we should be creating a free instance specifically for this workshop.

s298
00:25:30.159 --> 00:25:32.320
You can create a professional instance as well.

s299
00:25:32.320 --> 00:25:34.720
Um, but I already have one that's set up.

s300
00:25:34.720 --> 00:25:39.120
And so this instance is um instance number three here.

s301
00:25:39.120 --> 00:25:43.200
Um, yours should say type um aura I think or free.

s302
00:25:43.200 --> 00:25:49.360
Um, but what we will do is that we're going to actually connect to set instance.

s303
00:25:49.360 --> 00:25:58.720
And so um once you do create that instance actually you'll um have a the connection details that you'll be download directly to your computer so you don't lose it.

s304
00:25:58.720 --> 00:26:04.720
And um uh what we'll do is then um connect that here.

s305
00:26:04.720 --> 00:26:04.960
Yeah.

s306
00:26:04.960 --> 00:26:08.320
And um so really there's a a fork in the road here.

s307
00:26:08.320 --> 00:26:14.640
Don't feel bad if for whatever reason uh you aren't able to create the Aura instance in time.

s308
00:26:14.640 --> 00:26:19.919
Um it'll be ideal for the last part of the exercise if you can.

s309
00:26:19.919 --> 00:26:28.400
But those other credentials we saw in Graph Academy, they're in a a small uh free instance that's within Graph Academy itself.

s310
00:26:28.400 --> 00:26:30.080
So you can use those.

s311
00:26:30.080 --> 00:26:38.480
Either way, we want to have the connection details to a Neo4j database because that's where we're going to build that knowledge graph.

s312
00:26:38.480 --> 00:26:40.240
That's right.

s313
00:26:40.240 --> 00:26:41.760
Perfect.

s314
00:26:41.760 --> 00:26:51.919
So, what I'm doing right now is I'm grabbing my um instance information and then I'm just going to paste that here into our um our graph.

s315
00:26:51.919 --> 00:26:52.720
So, perfect.

s316
00:26:52.720 --> 00:26:53.679
We see that there.

s317
00:26:53.679 --> 00:26:56.559
And then I will also grab the open AI key.

s318
00:26:56.559 --> 00:26:56.799
Yeah.

s319
00:26:56.799 --> 00:27:00.000
And I'll make this bigger as well.

s320
00:27:05.919 --> 00:27:08.799
Move this terminal down.

s321
00:27:09.200 --> 00:27:11.919
Move this out the way.

s322
00:27:11.919 --> 00:27:12.880
Perfect.

s323
00:27:12.880 --> 00:27:23.200
So, we want that OpenAI key as well that we had C that we had grabbed and we'll grab that directly from the notes.

s324
00:27:23.200 --> 00:27:29.279
So, just copy and paste the key and place it.

s325
00:27:32.480 --> 00:27:33.440
Dope.

s326
00:27:33.440 --> 00:27:33.760
All right.

s327
00:27:33.760 --> 00:27:38.799
So, this will save uh if you have autosave or you have to save it yourself.

s328
00:27:38.799 --> 00:27:39.840
And now we have this.

s329
00:27:39.840 --> 00:27:44.720
And so once we have that M file, then we're actually going to want to test our environment really quickly.

s330
00:27:44.720 --> 00:27:47.279
So we'll go down to um test environment.

s331
00:27:47.279 --> 00:27:49.200
py and we'll just run this environment.

s332
00:27:49.200 --> 00:27:58.000
You can actually if you're using VS Code and you can run it using this or you'll use run it using your um uh hopefully a Python virtual environment as well.

s333
00:27:58.000 --> 00:27:59.760
But let's make sure we do it.

s334
00:27:59.760 --> 00:28:00.080
Okay.

s335
00:28:00.080 --> 00:28:02.080
So we can see down here it's trying to connect.

s336
00:28:02.080 --> 00:28:02.399
Perfect.

s337
00:28:02.399 --> 00:28:04.559
It ran five tests and it's positive.

s338
00:28:04.559 --> 00:28:06.080
We're okay.

s339
00:28:06.080 --> 00:28:08.080
So,

s340
00:28:08.799 --> 00:28:10.640
anyone hitting a snag there?

s341
00:28:10.640 --> 00:28:17.520
If you do, make sure you're actually you've actually created av file and you're not still just in the example.

s342
00:28:17.520 --> 00:28:18.159
That's right.

s343
00:28:18.159 --> 00:28:21.600
And uh you can rename the file or create a new one.

s344
00:28:21.600 --> 00:28:30.880
And um that will essentially now we know we're connecting to the Neo4j database and our open AI key uh is successful.

s345
00:28:32.080 --> 00:28:34.000
Perfect.

s346
00:28:34.000 --> 00:28:40.080
So, Now um that the test environment is run.

s347
00:28:40.080 --> 00:28:41.760
This is successful.

s348
00:28:41.760 --> 00:28:52.000
Now we can take a look and we can see here um if you go under workshop.jai you can see here that we have a number of different solutions.

s349
00:28:52.000 --> 00:28:54.240
So we have the d the raw data itself.

s350
00:28:54.240 --> 00:29:00.320
We have solutions itself and then the agent and then the knowledgeraph builder and knowledger graph structured builder as well.

s351
00:29:00.320 --> 00:29:08.000
So we're going to click on this knowledge graph structured uh builder and it's going to build out this knowledge graph right in our Aura instance.

s352
00:29:08.000 --> 00:29:23.120
And so if you're again in VS code then we can just um p uh play that and then this process is going to take a little bit but it's actually going to generate the knowledge graph and we can see it populating live within the doj aura um aura instance

s353
00:29:23.120 --> 00:29:36.240
and so let's go over back to aura and what I've done as well as um within here so again I'm going to connect we're going to go to query

s354
00:29:37.600 --> 00:29:39.200
And we can see I've already done this.

s355
00:29:39.200 --> 00:29:41.760
So I've already pre-populated it just because it'll take some while.

s356
00:29:41.760 --> 00:29:46.880
So it's going to probably do some dduplication um based on the fact that I've already run it.

s357
00:29:46.880 --> 00:29:52.240
Um however um all of that information is going to u populate within here.

s358
00:29:52.240 --> 00:29:59.200
And then we can query this um and see what's uh what exists within the um within the instance.

s359
00:29:59.200 --> 00:30:06.240
And we can see that this knowledge graph it will the more times you query you'll see um that it actually will uh continue to populate.

s360
00:30:06.240 --> 00:30:16.080
So just right now we're just going to see what um relationships and um uh u and nodes are actually here already.

s361
00:30:16.080 --> 00:30:39.039
So we have P and then so match P done a little syntax here.

s362
00:30:39.039 --> 00:30:41.279
Oh, thank you.

s363
00:30:41.279 --> 00:30:43.200
Match P equals.

s364
00:30:43.200 --> 00:30:45.600
There we go.

s365
00:30:53.360 --> 00:30:55.360
Beautiful.

s366
00:30:57.200 --> 00:31:04.399
So now we can see and I'll sc I'll zoom in so that we can actually see what's going on here.

s367
00:31:04.799 --> 00:31:15.840
But now we can see all of these different nodes and relationships just based on the data that we had um that we had ingested into the knowledge graph.

s368
00:31:15.840 --> 00:31:19.600
And you can click on this data and you can inspect the data as well.

s369
00:31:19.600 --> 00:31:27.279
This is not just a visualization tool, but it's also specifically a query tool, a way that you can um query your data itself.

s370
00:31:27.279 --> 00:31:29.760
But this is the finished um knowledge graph.

s371
00:31:29.760 --> 00:31:31.440
Your knowledge graph will be much smaller.

s372
00:31:31.440 --> 00:31:38.399
And then the more times you run this particular query, match p equals um empty like a node actually.

s373
00:31:38.399 --> 00:31:46.960
So empty node uh d-mpt node then return that p. Um you'll if the more times you run that, the more times you'll see that that knowledge graph grow.

s374
00:31:46.960 --> 00:31:51.039
It's just uh in the query in general is just saying like show us all the nodes, right?

s375
00:31:51.039 --> 00:31:54.000
Show us all the nodes and relationships.

s376
00:31:56.720 --> 00:31:58.720
Wonderful.

s377
00:31:59.679 --> 00:32:01.679
Okay.

s378
00:32:02.880 --> 00:32:17.919
So once we've got that um those nodes and relationships and and uh for anyone who's having problems with that process um uh feel free to throw up your hand and we have colleagues who are who will come in and help you.

s379
00:32:17.919 --> 00:32:27.519
Um but once you got that um that knowledge graph beginning to generate then what we want to do is actually go in and create an agent.

s380
00:32:27.519 --> 00:32:29.679
Oh I see a couple hands right behind.

s381
00:32:29.679 --> 00:32:34.240
Um, so you might not already see this agents um section.

s382
00:32:34.240 --> 00:32:37.760
If you do not, let me see your hand in your um thing.

s383
00:32:37.760 --> 00:32:38.240
Okay?

s384
00:32:38.240 --> 00:32:41.200
But I do know a couple people probably are not there yet.

s385
00:32:41.200 --> 00:32:48.640
Um, but if you don't see this agent section, what I want you to do is to go to your organization, your NearJ organization.

s386
00:32:48.640 --> 00:32:51.440
Um, and then we're going to click all organizations.

s387
00:32:51.440 --> 00:32:58.880
And what we're going to do is we're just going to enable um, Jedi um, capabilities onto this organization here.

s388
00:32:58.880 --> 00:33:02.480
And so we're in this new organization.

s389
00:33:03.200 --> 00:33:04.399
Then we'll go to settings.

s390
00:33:04.399 --> 00:33:14.159
I already have it enabled, but for those who don't know how to enable it or have never used Neo forj A or before, um here we have um you're going to click these two.

s391
00:33:14.159 --> 00:33:19.200
They'll be um they'll be grayed out, but I want you to click them in order to enable them.

s392
00:33:19.200 --> 00:33:28.080
So generate AI assistance, generative AI assistance, and then Aura agent specifically because we're going to be building out an agent today.

s393
00:33:29.519 --> 00:33:32.559
So, oh, got a couple hands.

s394
00:33:32.559 --> 00:33:34.559
Perfect.

s395
00:33:36.399 --> 00:33:40.240
So, once we have that organization, we're going to go back to our specific organization.

s396
00:33:40.240 --> 00:33:43.279
We're going to go back to our instance.

s397
00:33:44.240 --> 00:33:48.399
We're going to open our instance within query mode.

s398
00:33:49.200 --> 00:33:54.399
See our agent um see our knowledge graph populating.

s399
00:33:54.399 --> 00:33:56.640
And then we're going to click here, agents.

s400
00:33:56.640 --> 00:33:59.519
and this agent here.

s401
00:33:59.519 --> 00:34:04.000
So, I already have an agent here, but what we're going to do is you are going to create an agent.

s402
00:34:04.000 --> 00:34:11.440
So, I'm going to create an agent from scratch and we're going to tie that agent to this specific instance.

s403
00:34:11.440 --> 00:34:20.320
It should autoop populate based on the latest instance that you had created and we will configure.

s404
00:34:25.760 --> 00:34:37.200
And so what we want this agent to do, uh, we're going to call this agent, we're going to call it a, um, uh, genai fundamentals.

s405
00:34:37.839 --> 00:34:46.639
Um, actually, we'll call it graph rag Graph rag fundamentals agent.

s406
00:34:51.359 --> 00:34:52.240
Perfect.

s407
00:34:52.240 --> 00:35:17.359
And then for the description uh to describe this agent, we're going to say that this agent provides um forj graph rag information grounded in this specific graph academy course that we have.

s408
00:35:25.680 --> 00:35:44.160
So we have this agent and again for those who are following along it's going to uh provide neo forj graph information grounded in this specific graph academy course and then lastly we're going to um provide the instruction for that agent here.

s409
00:35:44.160 --> 00:35:55.359
So um that instruction will be that um and we can really just copy paste and what I'll do is I'll also include this in the geni notes section so that you can all see it.

s410
00:35:57.280 --> 00:36:00.400
I'll go over to the notes.

s411
00:36:04.720 --> 00:36:19.119
But this is an easy way to um create your agent agent description for you all so that you can copy and paste it and have your agent actually be working with us here.

s412
00:36:19.119 --> 00:36:22.720
And if you have questions, please feel free to put up your hands.

s413
00:36:22.720 --> 00:36:23.200
Okay.

s414
00:36:23.200 --> 00:36:26.480
So, we'll just copy that over to our agent as well.

s415
00:36:26.480 --> 00:36:31.040
We have the um instruction and then we're going to keep everything pretty much the same.

s416
00:36:31.040 --> 00:36:40.079
the instance um agent location as well and then internal and what we want to do.

s417
00:36:42.960 --> 00:36:43.760
Perfect.

s418
00:36:43.760 --> 00:36:48.079
Is um create that agent.

s419
00:36:51.599 --> 00:36:53.680
But actually, do we want to Yeah.

s420
00:36:53.680 --> 00:36:54.160
Okay.

s421
00:36:54.160 --> 00:36:58.880
So, before we create that agent, we're actually going to try and um add similarity search to it.

s422
00:36:58.880 --> 00:37:13.440
So if you don't already have um um similarity search added to your agent or vector search or vector insects is specifically added to your agent then we actually have to do that in order for this u this prompt to come up.

s423
00:37:13.440 --> 00:37:18.960
So you'll get a separate prompt that says um vector search is necessary in order to um to do that.

s424
00:37:18.960 --> 00:37:23.520
So, where we get a good a good place to get that information, we're going to close out this.

s425
00:37:23.520 --> 00:37:24.960
Oh, we can keep it open.

s426
00:37:24.960 --> 00:37:32.000
But what we're going to do is we're going to go to um the Python um Python section.

s427
00:37:32.000 --> 00:37:37.920
There is another let's see in the graph for Python section.

s428
00:37:37.920 --> 00:37:38.400
Here we go.

s429
00:37:38.400 --> 00:37:43.440
And I'm going to paste this into the uh notes for you all as well.

s430
00:37:45.920 --> 00:37:48.720
I gotta love being in full screen mode.

s431
00:37:48.720 --> 00:37:49.440
Come on.

s432
00:37:49.440 --> 00:37:51.440
Come on.

s433
00:37:51.440 --> 00:37:54.079
I'mma just I might just exit out full screen.

s434
00:37:54.079 --> 00:37:56.079
Okay.

s435
00:37:56.079 --> 00:37:57.680
And let me paste this for you all.

s436
00:37:57.680 --> 00:37:59.200
So, we're going to create a vector index.

s437
00:37:59.200 --> 00:38:02.560
So, we want to go to this link here.

s438
00:38:03.040 --> 00:38:06.079
Create vector index.

s439
00:38:06.079 --> 00:38:07.280
Cool.

s440
00:38:07.280 --> 00:38:08.560
And that's what you're going to do.

s441
00:38:08.560 --> 00:38:14.640
You want to click that link and that allows you to um that just gives you a sample code um in order to create the vector index.

s442
00:38:14.640 --> 00:38:18.640
And I'll show you where we're going to put that information right now.

s443
00:38:18.880 --> 00:38:21.440
So we have this create a vector index here.

s444
00:38:21.440 --> 00:38:33.520
You're just going to copy that and then we're going to include that.

s445
00:38:35.040 --> 00:38:41.599
So for the vector index and I'm going to ask Jeremy, do you remember where oh where we put our um vector index?

s446
00:38:41.599 --> 00:38:41.839
Yes.

s447
00:38:41.839 --> 00:38:42.079
Right.

s448
00:38:42.079 --> 00:38:45.040
Right in as the cipher query window.

s449
00:38:45.040 --> 00:38:45.680
Yes, you're right.

s450
00:38:45.680 --> 00:38:46.480
You're absolutely right.

s451
00:38:46.480 --> 00:38:47.119
Okay.

s452
00:38:47.119 --> 00:38:50.000
So, let's go back.

s453
00:38:54.800 --> 00:38:57.280
So, we'll go out of here.

s454
00:38:57.280 --> 00:39:00.079
So, this will depend on which instance you're using.

s455
00:39:00.079 --> 00:39:06.560
If you're using an Aura instance, you're going to go in your Aura console into the query interface.

s456
00:39:06.560 --> 00:39:09.520
So, you might want to either open another window.

s457
00:39:09.520 --> 00:39:10.160
Yep.

s458
00:39:10.160 --> 00:39:14.560
So, you can leave your agent or you'll have to close your agent for a minute and go to query,

s459
00:39:14.560 --> 00:39:15.280
right?

s460
00:39:15.280 --> 00:39:17.520
And then you can create that vector index.

s461
00:39:17.520 --> 00:39:23.119
So just like Jeremy had mentioned, we're going to actually paste that vector index right here in the cypher query window.

s462
00:39:23.119 --> 00:39:29.680
And so you'll run that and then you will see that we'll um extend this.

s463
00:39:29.680 --> 00:39:36.000
Okay, this command and this I think it's this is specifically because I had already no successful.

s464
00:39:36.000 --> 00:39:37.119
Oh yeah, it already exists.

s465
00:39:37.119 --> 00:39:37.520
Exactly.

s466
00:39:37.520 --> 00:39:38.880
Because I had already run this.

s467
00:39:38.880 --> 00:39:45.359
What you're going to do, you're going to create, you're going to run that command and then it will actually show you the vector index that has been created.

s468
00:39:45.359 --> 00:39:56.720
So once you have that vector index already created, then you can then go into the um agent section and then uh access that prompt that we saw there.

s469
00:39:56.720 --> 00:39:58.880
So I'm going to do the same thing again.

s470
00:39:58.880 --> 00:40:06.800
Create from scratch, configure, and we're going to do the same thing.

s471
00:40:07.200 --> 00:40:07.920
Graph rag.

s472
00:40:07.920 --> 00:40:08.640
Great.

s473
00:40:08.640 --> 00:40:10.160
Autopop populate.

s474
00:40:10.160 --> 00:40:11.599
Beautiful description.

s475
00:40:11.599 --> 00:40:13.119
Yep.

s476
00:40:13.119 --> 00:40:13.680
Beautiful.

s477
00:40:13.680 --> 00:40:16.960
And then we have that same prompt.

s478
00:40:22.320 --> 00:40:23.359
Sweet.

s479
00:40:23.359 --> 00:40:26.480
And then we're going to do the add tool section.

s480
00:40:26.480 --> 00:40:27.920
Now, similarity search.

s481
00:40:27.920 --> 00:40:32.000
Now you should be able to see this uh the same prompt.

s482
00:40:32.000 --> 00:40:44.880
But for this similarity search tool, we're going to create this tool which will say we're going to search this lesson content and be able to actually gather insights from this lesson without having to take the lesson.

s483
00:40:44.880 --> 00:40:47.680
Search lesson content.

s484
00:40:48.720 --> 00:40:54.000
Um and then we have a description that I'll also paste as well.

s485
00:40:57.839 --> 00:40:58.800
And I'll paste that.

s486
00:40:58.800 --> 00:41:02.880
Make sure that you all have that description as well.

s487
00:41:04.400 --> 00:41:09.359
Similarity search description.

s488
00:41:12.400 --> 00:41:12.880
Perfect.

s489
00:41:12.880 --> 00:41:16.960
So now it's in the notes so that you can also use it.

s490
00:41:19.200 --> 00:41:24.560
And then we're going to select the V vector index specifically that we had just created that is chunk embedding.

s491
00:41:24.560 --> 00:41:29.359
We're going to say we're going to use about the top five um uh as well.

s492
00:41:29.359 --> 00:41:32.800
And then we're going to select our embedding provider that's open AI.

s493
00:41:32.800 --> 00:41:36.560
The embedding model we're just going to use text embedding three small.

s494
00:41:36.560 --> 00:41:37.359
It's perfectly fine.

s495
00:41:37.359 --> 00:41:40.480
And then the default dimensions is 1536.

s496
00:41:40.480 --> 00:41:50.560
And then we want to make sure that we are uh returning this connected graph data which is very very important especially because we're using this uh graph interface.

s497
00:41:50.560 --> 00:41:59.920
So we're going to return this graph data and what you want to do we can use natural language here but you can also use cipher specifically but um cipher

s498
00:41:59.920 --> 00:42:05.440
for this cipher query um we have there's a cipher query that we already have.

s499
00:42:05.440 --> 00:42:08.400
I'm trying to remember where it is.

s500
00:42:08.400 --> 00:42:09.599
Oh is there a light mode?

s501
00:42:09.599 --> 00:42:11.119
That's a great question.

s502
00:42:11.119 --> 00:42:14.480
Oh, because it is so hard to see.

s503
00:42:14.560 --> 00:42:17.359
Yeah, let make it bigger.

s504
00:42:18.000 --> 00:42:20.000
Awesome.

s505
00:42:22.720 --> 00:42:35.119
So, for this cipher query, we're going to take this cipher here, and I'll make sure to paste it for you all.

s506
00:42:35.599 --> 00:42:39.280
This is the cipher query that we're going to use.

s507
00:42:47.839 --> 00:42:55.119
So, it's it's um Oh, actually, I should just paste the actual cipher query itself, not just a link to the cipher query.

s508
00:42:55.119 --> 00:42:57.119
Cool.

s509
00:42:58.960 --> 00:42:59.440
All right.

s510
00:42:59.440 --> 00:43:03.359
So, here's the cipher that we're going to include in our agent.

s511
00:43:03.359 --> 00:43:07.280
And what we're going to do is we're going to paste that in our Aura agent here.

s512
00:43:07.280 --> 00:43:18.720
same cipher query don't change anything but the the point here is if you look at the cipher query we need that cipher query to include nodes you can see here nodes and then scores

s513
00:43:18.720 --> 00:43:37.119
as well so nodes and then scores or similarity and so we can see that this cipher query specifically uses nodes and scores within its query um but this is a very helpful query and I'll also make sure that I link where we got that query as well for you small

s514
00:43:37.119 --> 00:43:40.480
just so you can have it for later.

s515
00:43:40.480 --> 00:43:40.960
Perfect.

s516
00:43:40.960 --> 00:43:41.359
All right.

s517
00:43:41.359 --> 00:43:43.200
Now, we can create this agent, right?

s518
00:43:43.200 --> 00:43:46.480
Or we can add this specific tool.

s519
00:43:47.760 --> 00:43:48.400
All right.

s520
00:43:48.400 --> 00:43:50.079
So, we have everything here.

s521
00:43:50.079 --> 00:43:52.480
We're going to use internal which is for free.

s522
00:43:52.480 --> 00:44:00.240
Um, we have these two tools, search lesson content, and then the similarity search and then the natural language for cipher tool.

s523
00:44:00.240 --> 00:44:02.640
And we're going to create the agent.

s524
00:44:02.640 --> 00:44:07.280
So we can see graph fundamentals agent right here.

s525
00:44:09.200 --> 00:44:12.240
So we no longer have to configure it.

s526
00:44:12.240 --> 00:44:16.880
But if you need to um as we were building out that knowledge graph, you can update that agent.

s527
00:44:16.880 --> 00:44:20.319
You can press that update agent which will take in all the information from the knowledge graph.

s528
00:44:20.319 --> 00:44:28.480
So now we can have a chat with that specific agent and we can ask different uh questions with regard to um that agent.

s529
00:44:28.480 --> 00:44:31.119
And I wish I can slide this over but I can't but that's okay.

s530
00:44:31.119 --> 00:44:40.319
So these particular questions we can ask lots of different questions um and um you can now learn anything that is actually in the graph academy course.

s531
00:44:40.319 --> 00:44:58.079
So for example, we have information about um how does um temperature for example uh affect a LLM and this will take in all the information based on the knowledge graph that we had created within Neo4j

s532
00:44:58.079 --> 00:45:03.520
and only that information within the knowledge graph in order to um give you an answer.

s533
00:45:03.520 --> 00:45:06.079
And I'll make sure that I

s534
00:45:06.079 --> 00:45:06.560
Here we go.

s535
00:45:06.560 --> 00:45:15.839
The fun thing is uh for folks that go back later and look in that data directory, you'll notice that all those PDF files were from an intro to Genai

s536
00:45:15.839 --> 00:45:17.280
course in Graph Academy.

s537
00:45:17.280 --> 00:45:17.760
That's right.

s538
00:45:17.760 --> 00:45:20.960
So we trained this on Graph Academy in Graph Academy.

s539
00:45:20.960 --> 00:45:21.920
Kind of meta but

s540
00:45:21.920 --> 00:45:22.880
exactly it works.

s541
00:45:22.880 --> 00:45:24.240
No, that's perfect.

s542
00:45:24.240 --> 00:45:28.560
And like like Jeremy had mentioned, all this information is trained on Graph Academy.

s543
00:45:28.560 --> 00:45:33.760
So you have all the information within graph academy at your fingertips here within this agent itself.

s544
00:45:33.760 --> 00:45:38.880
But it answered that um temperature is a parameter that controls the amount of randomness in the generated text.

s545
00:45:38.880 --> 00:45:39.119
Right?

s546
00:45:39.119 --> 00:45:48.640
You have tire temperature, lower temperature and what that um is based on and then as well as the sources of information where you can learn more um within graph academy as well.

s547
00:45:48.640 --> 00:45:58.000
But you don't you not only are able to ask about the content of the graph academy but you're able to do things like get that aggregated information um based on graph academy as well.

s548
00:45:58.000 --> 00:46:14.800
Um, so we can ask questions um like how many lessons are there in this course and so usually when you're building out agents they or when you're building out rag pipelines they're often pretty bad at doing this like I had mentioned this aggregation and concatenation

s549
00:46:14.800 --> 00:46:28.720
piece but um let's see we can see that within this specific course there are 30 different lessons and it's actually 15 lessons but it's counting 30 right now because I had rerun run the um

s550
00:46:28.720 --> 00:46:36.079
uh the knowledge graph builder which had the initial 15 lessons and then I reran that builder which created the 30 different lessons.

s551
00:46:36.079 --> 00:46:45.599
So if we were to um then check within Aura make sure where we are.

s552
00:46:45.839 --> 00:46:46.400
Oh yeah.

s553
00:46:46.400 --> 00:46:59.680
So, if we were to go back and just uh query, right, we're outside of this and we were to just like figure out how many lessons, then we could see that it would actually give us the correct number.

s554
00:46:59.680 --> 00:47:03.359
And you can even just click on the lesson no type on the left as well.

s555
00:47:03.359 --> 00:47:04.160
That's right,

s556
00:47:04.160 --> 00:47:06.480
for the cheat code.

s557
00:47:06.480 --> 00:47:11.359
So, we'll see the correct answer, which is the 15 lessons here within this space.

s558
00:47:11.359 --> 00:47:19.440
And then the um uh the because I had reran that but I did not repopulate that within the within the thing.

s559
00:47:19.440 --> 00:47:26.319
So it says 15 lessons which is how many lessons are in the um or within this graph academy course.

s560
00:47:26.319 --> 00:47:34.319
So Nia I had some folks that were wondering now that we've gone kind of end to end we built a knowledge graph from some raw data.

s561
00:47:34.319 --> 00:47:42.160
We were hooked up an agent that can use this now using graph rag combination of vector and cipher queries.

s562
00:47:42.160 --> 00:47:47.280
They were wondering could we look at the code that does this really quick

s563
00:47:47.280 --> 00:47:53.839
and so um could we look at the code of that knowledger graph structured builder file

s564
00:47:53.839 --> 00:47:57.680
and just just do a quick walk through just so we see the elements of it.

s565
00:47:57.680 --> 00:47:58.480
Absolutely.

s566
00:47:58.480 --> 00:48:02.720
So let's go into our um knowledge graph structured builder.

s567
00:48:02.720 --> 00:48:03.280
Perfect.

s568
00:48:03.280 --> 00:48:08.480
So here is all the code that's that's creating and generating this knowledge graph in itself.

s569
00:48:08.480 --> 00:48:12.480
So we're seeing and I'll try to make it as big as possible without also cutting.

s570
00:48:12.480 --> 00:48:14.160
I would like to do a word wrap.

s571
00:48:14.160 --> 00:48:14.640
Um

s572
00:48:14.640 --> 00:48:16.720
I think you can hide the uh the left hand.

s573
00:48:16.720 --> 00:48:19.119
Oh yes, absolutely.

s574
00:48:19.119 --> 00:48:19.599
Perfect.

s575
00:48:19.599 --> 00:48:20.240
All right.

s576
00:48:20.240 --> 00:48:26.319
So we can see that here um that we are importing all of our necessary um uh portions.

s577
00:48:26.319 --> 00:48:32.960
So OpenAI LLM, the OpenAI embeddings, the simple KG pipeline which is our simple knowledge graph pipeline.

s578
00:48:32.960 --> 00:48:35.280
um as well as fixed size splitter.

s579
00:48:35.280 --> 00:48:45.680
But we have here which is our Neo Forj driver which is pretty much your um your core and when we say driver we really do mean driver the thing that's generating all of this right.

s580
00:48:45.680 --> 00:48:50.400
So we're connecting to our um our graph database using that Neoraj driver.

s581
00:48:50.400 --> 00:48:52.559
It's the simplest way in order to get connected.

s582
00:48:52.559 --> 00:48:54.720
But then we see here that we have the LLM.

s583
00:48:54.720 --> 00:48:58.720
We're stating that that LLM is actually the OpenAI LLM that we have here.

s584
00:48:58.720 --> 00:49:02.880
We have our embedders here as well which is those open AI embeddings.

s585
00:49:02.880 --> 00:49:15.200
And then we are of course going to use that text splitter fix um fixed size um splitter and we have that chunk size being um 500 and then a choke overlap just in case we miss anything from those specific chunks.

s586
00:49:15.200 --> 00:49:17.040
And then we have some sample node types.

s587
00:49:17.040 --> 00:49:28.720
So those node types here remember nodes are the circles um and then we have relationships but the nodes here are technology concept example process um challenge and benefit.

s588
00:49:28.720 --> 00:49:34.640
And then we have relationship types that we think are really important to this uh this knowledge graph.

s589
00:49:34.640 --> 00:49:46.240
So these relationship types we are populating but we want those relationships to focus on this related to piece the part of used in etc. And then we can see that these patterns

s590
00:49:46.240 --> 00:49:51.920
these patterns um which is this node relationship node pattern that we're seeing here.

s591
00:49:51.920 --> 00:50:01.119
Um and so we have for example technology related to specific technology right or example used in specific uh technology.

s592
00:50:01.119 --> 00:50:13.920
So then after we we've put all of that sample information we can see that this knowledge graph builder is taking in this knowledge graph pipeline and all the information in order to generate the knowledge graph itself.

s593
00:50:13.920 --> 00:50:25.839
I mean, and that's re really a cool part here is that of course we we did Graph Academy data here and a schema appropriate for that, but most of you will be using like a bunch of documents from your business or whatever.

s594
00:50:25.839 --> 00:50:28.960
And you can use the LLM to help you figure out the right schema.

s595
00:50:28.960 --> 00:50:36.880
But once you got it, that using that schema like that will guide the LLM so it won't just make up new node and relationship types.

s596
00:50:36.880 --> 00:50:38.000
It'll stick to that.

s597
00:50:38.000 --> 00:50:38.960
That's right.

s598
00:50:38.960 --> 00:50:39.839
Excellent.

s599
00:50:39.839 --> 00:50:50.960
So then we can see that we're taking in those uh CS we have different CSV files within our data as well right under data a different CSV file as well as all the general PDFs

s600
00:50:50.960 --> 00:50:58.240
from um this lesson and then it's going to parse that CSV um and then create and generate that knowledge graph all in all.

s601
00:50:58.240 --> 00:51:06.960
So that's the background behind this builder this knowledge graph builder that's using graph rag on the back end in order to create the knowledge graph that we saw within

s602
00:51:06.960 --> 00:51:08.720
um Aura.

s603
00:51:08.720 --> 00:51:09.760
Perfect.

s604
00:51:09.760 --> 00:51:11.359
All right.

s605
00:51:11.359 --> 00:51:12.400
Yeah.

s606
00:51:12.400 --> 00:51:17.359
Um, so that is what we wanted to show you all today um, for Genai.

s607
00:51:17.359 --> 00:51:21.440
I'll finish off with a couple last slides and a couple calls to action as well.

s608
00:51:21.440 --> 00:51:23.920
These are some last some benefits of using graph rag.

s609
00:51:23.920 --> 00:51:28.480
Again, I had mentioned higher accuracy, easier development, and then explanability.

s610
00:51:28.480 --> 00:51:38.480
But all in all, the best places to learn more about graph and graph rag is Graph Academy where you'll see all of these different um, resources completely free and hands-on courses.

s611
00:51:38.480 --> 00:51:45.680
um cipher fundamentals if you want to become an expert at cipher um and uh building out knowledge graphs and context graphs.

s612
00:51:45.680 --> 00:52:01.520
And then on Tuesday or yes on Tuesday of this week um we are actually going to be or Wednesday um but on July 1st we're going to be having a meetup down at the digital garage in San Francisco from 5 to 8. Please feel free to join us and please feel free to register.

s613
00:52:01.520 --> 00:52:04.400
Just make sure you come by our booth if you want to register for that meetup.

s614
00:52:04.400 --> 00:52:20.559
We're going to have some incredible experts within the graph and knowledge graph space including our founder and CEO Emil Efim who is going to be there and you can ask him different questions about building knowledge graphs as well as the technical team myself Jeremy Zach um we're all going to be there to answer your questions about your

s615
00:52:20.559 --> 00:52:21.680
use cases.

s616
00:52:21.680 --> 00:52:26.079
Um but this specific talk is about teaching the why behind decisions.

s617
00:52:26.079 --> 00:52:29.119
So context graph decisions that are being made.

s618
00:52:29.119 --> 00:52:34.640
And then please feel free to come by and see us at booth um P3 which is right by the Microsoft booth.

s619
00:52:34.640 --> 00:52:37.280
Um we'll be there to answer any questions that you have.

s620
00:52:37.280 --> 00:52:38.880
And thank you so much for coming today.

s621
00:52:38.880 --> 00:52:40.411
We appreciate it.

s622
00:52:40.411 --> 00:52:40.559
[applause]

s623
00:52:40.559 --> 00:52:42.720
Thank you.

s624
00:52:56.786 --> 00:52:58.786
[music]
