Skip to content

Add Neptune-DB graph store with vector store#3443

Merged
parshvadaftari merged 18 commits intomem0ai:mainfrom
acarbonetto:acarbo/add_neptune_db
Sep 18, 2025
Merged

Add Neptune-DB graph store with vector store#3443
parshvadaftari merged 18 commits intomem0ai:mainfrom
acarbonetto:acarbo/add_neptune_db

Conversation

@acarbonetto
Copy link
Copy Markdown
Contributor

Description

This feature adds a graph_store option to connect to Amazon Neptune clusters (Neptune DB). Neptune DB is more permanent storage than Neptune Analytics, which may be preferable in certain cases. However, Neptune DB lacks vector storage - and for this reason, when configured in mem0, the graph_store will store edge vectors in the vector_store.

Amazon Neptune DB can be configured, for example:
note: That collection_name is available for both the vector and graph stores.

config = {
    "embedder": {
        "provider": "aws_bedrock",
        "config": {
            "model": bedrock_embedder_model,
        }
    },
    "llm": {
        "provider": "aws_bedrock",
        "config": {
            "model": bedrock_llm_model,
            "temperature": 0.1,
            "max_tokens": 2000
        }
    },
    "vector_store": {
        "provider": "opensearch",
        "config": {
            "collection_name": "mem0ai_vector_store",
            "host": opensearch_host,
            "port": opensearch_port,
            "http_auth": auth,
            "embedding_model_dims": embedding_model_dims,
            "use_ssl": True,
            "verify_certs": True,
            "connection_class": RequestsHttpConnection,
        },
    },
    "graph_store": {
        "provider": "neptunedb",
        "config": {
            "collection_name": "mem0ai_neptune_vector_store",
            "endpoint": f"neptune-db://{neptune_host}",
        },
    },
}

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Please delete options that are not relevant.

  • Unit Test: tests/memory/test_neptune_memory.py
  • Test Script: examples/graph-db-demo/neptune-example.ipynb

Checklist:

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

Maintainer Checklist

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

@parshvadaftari
Copy link
Copy Markdown
Contributor

@acarbonetto the tests are failing and also please update the corresponing the documentation. The corresponding changes to documentation is required since this PR will introduce 2 different providers for Graphstore.


- For more details on how to connect, configure, and use the graph_memory graph store, see the [Neptune Analytics example notebook](examples/graph-db-demo/neptune-analytics-example.ipynb).

### Initialize Neptune DB
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you match the writing style with kuzu , neo4j and other graph store. This focuses on the neptunedb and some of the additional things seem irrelevant.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the details on the instance setup were necessary. A user would need to setup an instance for testing or the first time.

I will move the instance setup details under the usage header then, to match the documentation style. But I would prefer to keep these details - at least that's my perspective.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take a look at b8f45cc. I've made documentation updates and remove sub-headers, as well as simplified the documentation. Let me know if you have any further suggestions.

results.append(result)
return results

@abstractmethod
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This abstractmethod was doing too much in the base and is no longer being extended. Now, instead this method is implemented here and calls either:

  • _add_entities_by_source_cypher
  • _add_entities_by_destination_cypher
  • _add_relationship_entities_cypher
  • _add_new_entities_cypher

these 4 methods are @abstractmethods and extended in both the neptunedb.py and neptunegraph.py files.

@acarbonetto acarbonetto force-pushed the acarbo/add_neptune_db branch 2 times, most recently from b445559 to b8f45cc Compare September 17, 2025 17:05
@parshvadaftari
Copy link
Copy Markdown
Contributor

@acarbonetto Can you resolve merge conflicts?

acarbonetto and others added 18 commits September 18, 2025 13:11
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
…on name in config

Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Copy link
Copy Markdown
Contributor

@parshvadaftari parshvadaftari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@parshvadaftari parshvadaftari merged commit a015e2f into mem0ai:main Sep 18, 2025
6 of 7 checks passed
@parshvadaftari
Copy link
Copy Markdown
Contributor

@acarbonetto Thanks a lot for contributing

@acarbonetto acarbonetto deleted the acarbo/add_neptune_db branch September 18, 2025 22:49
jamebobob pushed a commit to jamebobob/mem0-vigil-recall that referenced this pull request Mar 29, 2026
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Co-authored-by: Siddhartha Sahu <dev@sdht.in>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants