mem0 icon indicating copy to clipboard operation
mem0 copied to clipboard

feat: Add RyuGraph support with full backwards compatibility for Kuzu

Open saksham115 opened this issue 3 weeks ago • 1 comments

Description

This PR adds RyuGraph as the new graph store provider while maintaining complete backwards compatibility with existing Kuzu configurations.

Background: Kuzu has been archived and is no longer maintained. RyuGraph is a community-maintained fork of Kuzu with an identical API, ensuring ongoing support and updates.

Key Changes:

  • Add ryu_memory.py as native RyuGraph implementation
  • Modify kuzu_memory.py to use RyuGraph internally (backwards compatibility wrapper)
  • Support both "kuzu" and "ryu" providers in factory and configs
  • Add deprecation warnings guiding users to migrate to "ryu" provider
  • Update dependency from kuzu>=0.11.0 to ryugraph>=25.9.0

Backwards Compatibility:

  • NO BREAKING CHANGES: Existing code using provider: "kuzu" continues to work without modification
  • The "kuzu" provider automatically uses RyuGraph under the hood
  • Deprecation warnings guide users to update at their convenience
  • No migration required - existing code benefits from RyuGraph automatically

Type of change

  • [x] New feature (non-breaking change which adds functionality)
  • [x] Documentation update

How Has This Been Tested?

  • [x] Unit Test

Test Results:

pytest tests/memory/test_kuzu.py tests/memory/test_ryu.py -v
# ======================== 10 passed, 5 warnings in 0.55s ========================

All tests pass successfully:

  • 5 tests for backwards-compatible 'kuzu' provider (shows expected deprecation warnings)
  • 5 tests for new 'ryu' provider
  • Both providers use RyuGraph internally and work correctly

Test Coverage:

  • Initialization with valid and invalid embedding dimensions
  • Adding, searching, and deleting graph entities
  • Node and edge counting
  • Graph operations with filters and metadata

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation
  • [x] My changes generate no new warnings (only expected deprecation warnings)
  • [x] I have added tests that prove my fix is effective or that my feature works
  • [x] New and existing unit tests pass locally with my changes
  • [x] Any dependent changes have been merged and published in downstream modules
  • [x] I have checked my code and corrected any misspellings

Documentation Updates

  • [x] Updated docs/changelog.mdx - Added v1.0.1 entry emphasizing backwards compatibility
  • [x] Updated docs/open-source/features/graph-memory.mdx - Added both Kuzu (deprecated) and RyuGraph sections
  • [x] Updated docs/platform/features/graph-threshold.mdx - Listed both providers
  • [x] Restored examples/graph-db-demo/kuzu-example.ipynb with deprecation notice
  • [x] Created examples/graph-db-demo/ryu-example.ipynb for new users
  • [x] Updated LLM.md and Makefile references
  • [x] Created optional migration tool with clear documentation

Files Changed

New Files:

  • mem0/memory/ryu_memory.py - Native RyuGraph implementation
  • tests/memory/test_ryu.py - Test suite for RyuGraph
  • examples/graph-db-demo/ryu-example.ipynb - Example notebook for RyuGraph
  • tools/migrate_kuzu_to_ryu.py - Optional migration script

Modified Files:

  • mem0/memory/kuzu_memory.py - Wrapper using RyuGraph internally
  • mem0/utils/factory.py - Supports both "kuzu" and "ryu" providers
  • mem0/graphs/configs.py - Keeps both KuzuConfig and RyuConfig
  • tests/memory/test_kuzu.py - Backwards compatibility tests
  • examples/graph-db-demo/kuzu-example.ipynb - Added deprecation notice
  • pyproject.toml - Updated dependency to ryugraph>=25.9.0
  • Makefile - Updated install_all target
  • Documentation files (changelog, graph-memory, graph-threshold, LLM.md)

Migration Guide for Users

For existing Kuzu users:

  • Your code continues to work without any changes
  • Optional: Update config from provider: "kuzu" to provider: "ryu" at your convenience
  • Optional: Run migration script if you want to explicitly understand the migration

For new users:

  • Use provider: "ryu" in your configuration
  • Install with: pip install "mem0ai[graph]"

Why this change?

  • Kuzu has been archived and is no longer maintained
  • RyuGraph is a community-maintained fork with ongoing support
  • Identical API ensures seamless transition
  • Users automatically benefit from maintained software
  • Future-proofs the graph store functionality

Maintainer Checklist

  • [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
  • [ ] Made sure Checks passed

saksham115 avatar Nov 06 '25 06:11 saksham115

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Nov 06 '25 06:11 CLAassistant