The Problem
Building knowledge graphs in real time is a pain. Traditional methods often require complete recomputation of the graph for every data change, which is inefficient and slow. This becomes especially burdensome in dynamic environments where AI agents need to quickly adapt to new information without losing historical context.
What This Does
Enter Graphiti. This framework provides a way to continuously integrate user interactions and data into a coherent knowledge graph without the need for a full refresh. You can find the core functionality in the graphiticore directory, where the graphiti.py file defines the main class for graph management.
Graphiti supports a variety of databases as drivers—like Neo4j and FalkorDB—through files such as neo4jdriver.py and falkordbdriver.py. The structure allows for easy querying and updating, which means you can run complex searches with minimal overhead. Want to test your queries? The docker-compose.test.yml file sets up a testing environment that you can spin up with Docker in no time.
Real-World Use
Imagine you're building an AI that manages customer interactions for an e-commerce platform. You could use Graphiti to create a knowledge graph that tracks user preferences and past purchases. Start by integrating data from your customer database into a graph using quickstart/quickstartneo4j.py. Then, when a customer asks, "What were my last three purchases?" you can quickly query the graph for that information without needing to recompute it every time a new purchase is made.
The Bottom Line
Graphiti is solid for anyone needing to create dynamic knowledge graphs without the usual pain points. It's particularly useful for AI applications that require real-time updates. However, if you're working on a small project or something that doesn't need extensive graph capabilities, this might be overkill. Overall, if you’re serious about building interactive AI systems, it’s worth a look.