https://github.com/getzep/graphiti Skip to content Navigation Menu Toggle navigation Sign in * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + GitHub Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions By size + Enterprise + Teams + Startups By industry + Healthcare + Financial services + Manufacturing By use case + CI/CD & Automation + DevOps + DevSecOps * Resources Topics + AI + DevOps + Security + Software Development + View all Explore + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Enterprise + Enterprise platform AI-powered developer platform Available add-ons + Advanced Security Enterprise-grade security features + GitHub Copilot Enterprise-grade AI features + Premium Support Enterprise-grade 24/7 support * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up Reseting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} getzep / graphiti Public * Notifications You must be signed in to change notification settings * Fork 8 * Star 212 Build and query dynamic, temporally-aware Knowledge Graphs help.getzep.com/graphiti License Apache-2.0 license 212 stars 8 forks Branches Tags Activity Star Notifications You must be signed in to change notification settings * Code * Issues 0 * Pull requests 0 * Actions * Security * Insights Additional navigation options * Code * Issues * Pull requests * Actions * Security * Insights getzep/graphiti This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main BranchesTags Go to file Code Folders and files Name Name Last commit Last commit message date Latest commit History 78 Commits .github .github examples examples graphiti_core graphiti_core images images signatures/version1 signatures/ version1 tests tests .env.example .env.example .gitignore .gitignore CODE_OF_CONDUCT.md CODE_OF_CONDUCT.md CONTRIBUTING.md CONTRIBUTING.md LICENSE LICENSE Makefile Makefile README.md README.md SECURITY.md SECURITY.md Zep-CLA.md Zep-CLA.md conftest.py conftest.py ellipsis.yaml ellipsis.yaml poetry.lock poetry.lock pyproject.toml pyproject.toml pytest.ini pytest.ini View all files Repository files navigation * README * Code of conduct * Apache-2.0 license * Security Graphiti Temporal Knowledge Graphs for Agentic Applications Discord Lint Unit Tests MyPy Check Open in GitHub Codespaces Graphiti builds dynamic, temporally aware Knowledge Graphs that represent complex, evolving relationships between entities over time. Graphiti ingests both unstructured and structured data, and the resulting graph may be queried using a fusion of time, full-text, semantic, and graph algorithm approaches. Graphiti temporal walkthrough Graphiti helps you create and query Knowledge Graphs that evolve over time. A knowledge graph is a network of interconnected facts, such as "Kendra loves Adidas shoes." Each fact is a "triplet" represented by two entities, or nodes ("Kendra", "Adidas shoes"), and their relationship, or edge ("loves"). Knowledge Graphs have been explored extensively for information retrieval. What makes Graphiti unique is its ability to autonomously build a knowledge graph while handling changing relationships and maintaining historical context. With Graphiti, you can build LLM applications such as: * Assistants that learn from user interactions, fusing personal knowledge with dynamic data from business systems like CRMs and billing platforms. * Agents that autonomously execute complex tasks, reasoning with state changes from multiple dynamic sources. Graphiti supports a wide range of applications in sales, customer service, health, finance, and more, enabling long-term recall and state-based reasoning for both assistants and agents. Why Graphiti? We were intrigued by Microsoft's GraphRAG, which expanded on RAG text chunking by using a graph to better model a document corpus and making this representation available via semantic and graph search techniques. However, GraphRAG did not address our core problem: It's primarily designed for static documents and doesn't inherently handle temporal aspects of data. Graphiti is designed from the ground up to handle constantly changing information, hybrid semantic and graph search, and scale: * Temporal Awareness: Tracks changes in facts and relationships over time, enabling point-in-time queries. Graph edges include temporal metadata to record relationship lifecycles. * Episodic Processing: Ingests data as discrete episodes, maintaining data provenance and allowing incremental entity and relationship extraction. * Hybrid Search: Combines semantic and BM25 full-text search, with the ability to rerank results by distance from a central node e.g. "Kendra". * Scalable: Designed for processing large datasets, with parallelization of LLM calls for bulk processing while preserving the chronology of events. * Supports Varied Sources: Can ingest both unstructured text and structured JSON data. Graphiti structured + unstructured demo Graphiti and Zep Memory Graphiti powers the core of Zep's memory layer for LLM-powered Assistants and Agents. We're excited to open-source Graphiti, believing its potential reaches far beyond memory applications. Installation Requirements: * Python 3.10 or higher * Neo4j 5.21 or higher * OpenAI API key (for LLM inference and embedding) Optional: * Anthropic or Groq API key (for alternative LLM providers) Tip The simplest way to install Neo4j is via Neo4j Desktop. It provides a user-friendly interface to manage Neo4j instances and databases. pip install graphiti-core or poetry add graphiti-core Quick Start Important Graphiti uses OpenAI for LLM inference and embedding. Ensure that an OPENAI_API_KEY is set in your environment. Support for Anthropic and Groq LLM inferences is available, too. from graphiti_core import Graphiti from graphiti_core.nodes import EpisodeType from datetime import datetime # Initialize Graphiti graphiti = Graphiti("bolt://localhost:7687", "neo4j", "password") # Initialize the graph database with Graphiti's indices. This only needs to be done once. graphiti.build_indices_and_constraints() # Add episodes episodes = [ "Kamala Harris is the Attorney General of California. She was previously " "the district attorney for San Francisco.", "As AG, Harris was in office from January 3, 2011 - January 3, 2017", ] for i, episode in enumerate(episodes): await graphiti.add_episode( name=f"Freakonomics Radio {i}", episode_body=episode, source=EpisodeType.text, source_description="podcast", reference_time=datetime.now() ) # Search the graph # Execute a hybrid search combining semantic similarity and BM25 retrieval # Results are combined and reranked using Reciprocal Rank Fusion results = await graphiti.search('Who was the California Attorney General?') [ EntityEdge( | uuid='3133258f738e487383f07b04e15d4ac0', | source_node_uuid='2a85789b318d4e418050506879906e62', | target_node_uuid='baf7781f445945989d6e4f927f881556', | created_at=datetime.datetime(2024, 8, 26, 13, 13, 24, 861097), | name='HELD_POSITION', # the fact reflects the updated state that Harris is # no longer the AG of California | fact='Kamala Harris was the Attorney General of California', | fact_embedding=[ | | -0.009955154731869698, | ... | | 0.00784289836883545 | ], | episodes=['b43e98ad0a904088a76c67985caecc22'], | expired_at=datetime.datetime(2024, 8, 26, 20, 18, 1, 53812), # These dates represent the date this edge was true. | valid_at=datetime.datetime(2011, 1, 3, 0, 0, tzinfo=), | invalid_at=datetime.datetime(2017, 1, 3, 0, 0, tzinfo=) ) ] # Rerank search results based on graph distance # Provide a node UUID to prioritize results closer to that node in the graph. # Results are weighted by their proximity, with distant edges receiving lower scores. await graphiti.search('Who was the California Attorney General?', center_node_uuid) # Close the connection graphiti.close() Documentation * Guides and API documentation. * Quick Start * Building an agent with LangChain's LangGraph and Graphiti Status and Roadmap Graphiti is under active development. We aim to maintain API stability while working on: * [*] Implementing node and edge CRUD operations * [ ] Improving performance and scalability * [ ] Achieving good performance with different LLM and embedding models * [ ] Creating a dedicated embedder interface * [ ] Supporting custom graph schemas: + Allow developers to provide their own defined node and edge classes when ingesting episodes + Enable more flexible knowledge representation tailored to specific use cases * [ ] Enhancing retrieval capabilities with more robust and configurable options * [ ] Expanding test coverage to ensure reliability and catch edge cases Contributing We encourage and appreciate all forms of contributions, whether it's code, documentation, addressing GitHub Issues, or answering questions in the Graphiti Discord channel. For detailed guidelines on code contributions, please refer to CONTRIBUTING. Support Join the Zep Discord server and make your way to the #Graphiti channel! About Build and query dynamic, temporally-aware Knowledge Graphs help.getzep.com/graphiti Topics graph agents rag llms Resources Readme License Apache-2.0 license Code of conduct Code of conduct Security policy Security policy Activity Custom properties Stars 212 stars Watchers 4 watching Forks 8 forks Report repository Releases 3 v0.2.1 - Search refactor + enhancements Latest Sep 4, 2024 + 2 releases Packages 0 No packages published Contributors 5 * @danielchalef * @paul-paliychuk * @prasmussen15 * @dependabot[bot] * @ellipsis-dev[bot] Languages * Python 99.7% * Makefile 0.3% Footer (c) 2024 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact * Manage cookies * Do not share my personal information You can't perform that action at this time.