Find answers from the community

Updated 3 months ago

Knowledge graph

How does llama store the knowledge graph? Where is it being stored? What is being used to query it?
L
M
k
9 comments
The knowledge graph index stores everything in memory and then saves tk the graph_store.json file by default. We also have an integration to store in nebula too

It's used by extracting keywords from the query text. Those keywords are used to find (subj, rel, obj) triplets where the keyword matches the subject

Then optionally, the text from where that triplet is found, or just the triplet itself, is sent to the LLM to answer the query
How is the graph queried from graph_store.json? As in what is the query language used? Is it being stored as raw triplets or is it more complicated than that
Thanks for answering!
It's pretty basic actually. The LLM extracts keywords from the query. Then there is just a dictionary mapping of subj -> [list of [rel, obj]], where the keyword is used as the subj

Then the triplet is used to lookup where node it was extracted from

There are some other options that expand the search as well (I.e. using neighboring triplets, triplets that came from the same node)
Definitely take a peek at the source code if you are python fluent!
Oh wow that does sound quite basic
If you have ideas to improve this, it would be an awesome PR!

I think so far we haven't spent much time expanding the knowledge graph index compared to our vector indexes πŸ˜…

The source code for the knowledge graph is fairly straightforward πŸ™‚
Hi, there, has anyone tried the knowledgegraph demo on a local LLM (like Open LLAMA 13B)? Does it work? Or Open AI is needed. Also the results with Open AI are not deterministic, the one in the demo notebook and what I get are different.
It would be great if we can get heterogeneous sources together, like data from SQL Lite plus documents to create a knowledge graph. I know there is a way to manually add tuples (triplets) however it is unclear how we can make refer the node back again (in case of foreign keys). Also it would be great if we can get to store node information (attributes) as json.
Add a reply
Sign up and join the conversation on Discord