Skip to content

Conversation

@ip9inderpreet
Copy link

Description

Add Amazon DocumentDB as a vector store provider for mem0. This enables users to use Amazon DocumentDB with vector search capabilities as their vector database backend.

Features:

  • New Amazon DocumentDB vector store implementation with HNSW index support
  • Configurable similarity metrics (cosine, euclidean, dotProduct)
  • Optional num_candidates parameter for search tuning
  • Complete documentation and example code

Fixes #3929

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (does not change functionality, e.g. code style improvements, linting)
  • Documentation update

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

  • [x ] Unit Test
  • [x ] Test Script (please provide)

Unit tests: python3 -m pytest tests/vector_stores/test_documentdb.py -v (10 tests pass)

Test Script:

import os
from mem0 import Memory

# Set AWS credentials (or use IAM role)
os.environ["AWS_REGION"] = "<your-region>"
os.environ["AWS_ACCESS_KEY_ID"] = "<your-access-key>"
os.environ["AWS_SECRET_ACCESS_KEY"] = "<your-secret-key>"

config = {
    "vector_store": {
        "provider": "amazon_documentdb",
        "config": {
            "db_name": "mem0-db",
            "collection_name": "mem0-collection",
            "embedding_model_dims": 1024,
            "mongo_uri": "mongodb://<username>:<password>@<your-cluster>.docdb.amazonaws.com:27017/?tls=true&tlsCAFile=global-bundle.pem&retryWrites=false"
        }
    },
    "embedder": {
        "provider": "aws_bedrock",
        "config": {
            "model": "amazon.titan-embed-text-v2:0"
        }
    },
    "llm": {
        "provider": "aws_bedrock",
        "config": {
            "model": "us.anthropic.claude-3-7-sonnet-20250219-v1:0",
            "temperature": 0.1,
            "max_tokens": 2000
        }
    }
}

m = Memory.from_config(config)
m.add("User likes romantic movies", user_id="user1")
results = m.search("What movies does user like?", user_id="user1")
print(results)

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

- Add DocumentDB vector store implementation with vector search support
- Add configuration class for DocumentDB settings
- Register DocumentDB in factory and config systems
- Add comprehensive tests with mocked connections
- Add documentation and example usage
- Update factory mappings for DocumentDB provider
@CLAassistant
Copy link

CLAassistant commented Jan 22, 2026

CLA assistant check
All committers have signed the CLA.

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.

Integration with Amazon DocumentDB

2 participants