Building Local AI Knowledge Graphs with Neo4j and LangGraph
- Compartir esta discusión
- Copiar enlace
- Compartir en X (Twitter)
Resumen
This discussion in the Neo4j community explores building a local AI environment to reason about historical theories. The project integrates Neo4j with LangChain and LangGraph to develop agents that construct knowledge nodes from ancient linguistic corpora. It highlights the transition from traditional NLP tools like spaCy to AI-driven entity extraction for specialized historical research.
Hi, I am going on with my project, developing a local AI environment using Graphs for a model that reasons about history and theories.
I am using now a local instance of Neo4j Desktop and the Neo4j LLM Graph Builder.
I have complete the course that recomended me (Building Knowledge Graphs with LLMs).
Now I am thinking into integrated LangChain and LangGraph to implement a React Agent to translate querys and construct knowledge about new oriented investigations.
Also I am guessing if SpaCy couldn be usefull for accurately extract linguistic roots or words from ancient languages around my corpus texts such as Elengoa (a precursor to the Basque language).
Could someone point me in the right direction for the next steps? About how to integrate LangChain and LangGraphg and learn about Agents to create reasonable claims to create new knowledge node graphs.
Thanks in advantge!
Can you start by sharing a bit about what the current graph structure looks like? What's your property? What's the node? What kind of relationship do you have?
And also just one thing right away that jumped into mind is: I don't know if spaCy is going to be able to extract the ancient language. I know Spacey is very well-trained only for English. In this case, if you're looking for entity extraction, you might be better off with using AI,
Hi! For the moment is a partial graph of the first document. Is has been created with openai-o3-mini in a tiny local neo4j environment for test. There are words and meanings about etymology but you are correct that AI could do the work better with any embedded model trained in Basque language if needed than using SpaCy. The main pourpose is compare history facts of ancient events in two buckets to create corroborated historical arguments. As the deployment is all in local mode I can not use Document Intelligence and I am searching about agents for learn how to integrate all of this with maybe langGraph or something usefull. I am doing the low level work and another person, the brain in history (but noob in IT) is going to train the model. Thanks for answer!

When I was looking at the graph, I thought the first thing that popped into mind is that there are just a lot of things happening. In fact, too many things. For example, you have "place" and "location." You also have a "group" "thing". There are concepts that feel very similar, so AI wouldn't be able to tell which one is which. Tighten that first.
And to decide which one to tighten, go for the goal that you want to do. you said , "compare history facts of ancient events in two buckets to create corroborated historical arguments." Mm, it's not clear for me what exactly it is, but you probably know this better. Do you write it down on what the example would look like? For example, you would have some documents, and what you want is to find a relationship called "supports" to some claim. So maybe your graph structure should have documents, claim.
Hello!
Yes, there are redundant entities in the graph. It was created directly using Graph Builder, without a predefined schema. I believe my corpus is too extensive and complex to start cleaning it up right now; it consists of lengthy historical texts—such as the Bible, the history section of Wikipedia, books on cosmogony, myths, and so on. Do you think it’s feasible to fine-tune a graph for a corpus like that? The project's goal is to use AI to reason about a version of history we accept as true—one that differs from the official narrative—as well as to reason about distorted or mistranslated versions of historical chronicles. We also want to bypass AI bias, avoid high token costs, and have some fun along the way. Later on, we plan to make a video sharing whatever emerges from the process.
I’m new to AI and have a long road ahead, as I imagine detecting and minimizing hallucinations and echo-chamber effects won't be easy.
For now, I just want to know if this is a good strategy to start with. My next step is to use a chatbot, and I’ve thought about integrating what I have so far using LangFlow. Any ideas or help? Thanks for the reply, Louisa!
I definitely want to hear about the rest of the team.
But personally, I think you need to clean it up with a predefined schema first. I think it's okay to use AI to help you explore different ideas, different schema, different ways to do things. But if you give AI absolute no constraint, you are gonna get very unreliable answers each time, and this is gonna cost you a lot more tokens. In general, the more structure you have with AI, the better and more accurate it can be.
I think you should start from the end. Use one example and be sure about that example. For so take one instance in history, and you want the AI to be able to reason through different structure, nodes, relations, a version of the history that is true, and also be able to look at different divergence of branches and paths, and provide some alternative of it. Like, you need to have that in mind in order to anchor what AI can and cannot do.
I think one thing you should be aware of is that AI is amazing if you do it once. But if you want to do it at a scalable level, well, say you can do it for every single or a lot of the historical instances, you need to give a structure. And AI isn't going to find that structure for you unless you explicitly design it to do so.
Sometimes I will do a project where I have absolutely no idea how to start. So I just tell AI, "Hey, can you help me solve this thing?" And then sometimes AI would just come up with its own solution. To be frank, sometimes the solutions are pretty good.
But I always ask, "What did they do?"What's the structure? What's the algorithm? What's the logic? And I would ask AI to tell me step by step. Because then even in that process, you can optimize it. You can bring in your human or your partner's historical point of view and say that maybe you should optimize this or that way. But even in that specific case, I didn't ask AI to give me an answer. I asked AI to give me the framework on how they do things.