Skip to content
Snippets Groups Projects
Unverified Commit ddcf5a39 authored by Younis Bashir's avatar Younis Bashir Committed by GitHub
Browse files

- Mem0Memory Integration Issue: Update Required for Mem0 API Parameter Changes (#18066)

parent f8ed1f4a
No related branches found
No related tags found
No related merge requests found
......@@ -92,8 +92,8 @@ class Mem0Memory(BaseMem0):
context: Dict[str, Any],
api_key: Optional[str] = None,
host: Optional[str] = None,
organization: Optional[str] = None,
project: Optional[str] = None,
org_id: Optional[str] = None,
project_id: Optional[str] = None,
search_msg_limit: int = 5,
**kwargs: Any,
):
......@@ -105,7 +105,7 @@ class Mem0Memory(BaseMem0):
raise ValidationError(f"Context validation error: {e}")
client = MemoryClient(
api_key=api_key, host=host, organization=organization, project=project
api_key=api_key, host=host, org_id=org_id, project_id=project_id
)
return cls(
primary_memory=primary_memory,
......
......@@ -30,7 +30,7 @@ license = "MIT"
name = "llama-index-memory-mem0"
packages = [{include = "llama_index/"}]
readme = "README.md"
version = "0.2.2"
version = "0.3.0"
[tool.poetry.dependencies]
python = "<4.0,>=3.9"
......
from unittest.mock import patch, MagicMock
from llama_index.memory.mem0.base import Mem0Memory, Mem0Context
from llama_index.core.memory.chat_memory_buffer import ChatMessage, MessageRole
from llama_index.memory.mem0.utils import (
......@@ -14,8 +15,8 @@ def test_mem0_memory_from_client():
# Mock arguments for MemoryClient
api_key = "test_api_key"
host = "test_host"
organization = "test_org"
project = "test_project"
org_id = "test_org"
project_id = "test_project"
search_msg_limit = 10 # Add this line
# Patch MemoryClient
......@@ -28,14 +29,14 @@ def test_mem0_memory_from_client():
context=context,
api_key=api_key,
host=host,
organization=organization,
project=project,
org_id=org_id,
project_id=project_id,
search_msg_limit=search_msg_limit, # Add this line
)
# Assert that MemoryClient was called with the correct arguments
MockMemoryClient.assert_called_once_with(
api_key=api_key, host=host, organization=organization, project=project
api_key=api_key, host=host, org_id=org_id, project_id=project_id
)
# Assert that the returned object is an instance of Mem0Memory
......@@ -88,8 +89,8 @@ def test_mem0_memory_set():
# Mock arguments for MemoryClient
api_key = "test_api_key"
host = "test_host"
organization = "test_org"
project = "test_project"
org_id = "test_org"
project_id = "test_project"
# Patch MemoryClient
with patch("llama_index.memory.mem0.base.MemoryClient") as MockMemoryClient:
......@@ -101,8 +102,8 @@ def test_mem0_memory_set():
context=context,
api_key=api_key,
host=host,
organization=organization,
project=project,
org_id=org_id,
project_id=project_id,
)
# Create a list of alternating user and assistant messages
......@@ -155,8 +156,8 @@ def test_mem0_memory_get():
# Mock arguments for MemoryClient
api_key = "test_api_key"
host = "test_host"
organization = "test_org"
project = "test_project"
org_id = "test_org"
project_id = "test_project"
# Patch MemoryClient
with patch("llama_index.memory.mem0.base.MemoryClient") as MockMemoryClient:
......@@ -168,8 +169,8 @@ def test_mem0_memory_get():
context=context,
api_key=api_key,
host=host,
organization=organization,
project=project,
org_id=org_id,
project_id=project_id,
)
# Set dummy chat history
......@@ -240,8 +241,8 @@ def test_mem0_memory_put():
# Mock arguments for MemoryClient
api_key = "test_api_key"
host = "test_host"
organization = "test_org"
project = "test_project"
org_id = "test_org"
project_id = "test_project"
# Patch MemoryClient
with patch("llama_index.memory.mem0.base.MemoryClient") as MockMemoryClient:
......@@ -253,8 +254,8 @@ def test_mem0_memory_put():
context=context,
api_key=api_key,
host=host,
organization=organization,
project=project,
org_id=org_id,
project_id=project_id,
)
# Create a test message
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment