diff --git a/src/crewai/cli/templates/crew/main.py b/src/crewai/cli/templates/crew/main.py index 454d28ee6..b604d8ceb 100644 --- a/src/crewai/cli/templates/crew/main.py +++ b/src/crewai/cli/templates/crew/main.py @@ -33,7 +33,8 @@ def train(): Train the crew for a given number of iterations. """ inputs = { - "topic": "AI LLMs" + "topic": "AI LLMs", + 'current_year': str(datetime.now().year) } try: {{crew_name}}().crew().train(n_iterations=int(sys.argv[1]), filename=sys.argv[2], inputs=inputs) @@ -59,6 +60,7 @@ def test(): "topic": "AI LLMs", "current_year": str(datetime.now().year) } + try: {{crew_name}}().crew().test(n_iterations=int(sys.argv[1]), eval_llm=sys.argv[2], inputs=inputs) diff --git a/src/crewai/memory/storage/mem0_storage.py b/src/crewai/memory/storage/mem0_storage.py index ccf8cc810..835788727 100644 --- a/src/crewai/memory/storage/mem0_storage.py +++ b/src/crewai/memory/storage/mem0_storage.py @@ -48,7 +48,7 @@ class Mem0Storage(Storage): self.memory = MemoryClient(api_key=mem0_api_key) else: if mem0_local_config and len(mem0_local_config): - self.memory = Memory.from_config(config) + self.memory = Memory.from_config(mem0_local_config) else: self.memory = Memory() diff --git a/tests/storage/test_mem0_storage.py b/tests/storage/test_mem0_storage.py index f9e56739f..f0c62d480 100644 --- a/tests/storage/test_mem0_storage.py +++ b/tests/storage/test_mem0_storage.py @@ -29,7 +29,7 @@ def mem0_storage_with_mocked_config(mock_mem0_memory): """Fixture to create a Mem0Storage instance with mocked dependencies""" # Patch the Memory class to return our mock - with patch("mem0.memory.main.Memory.from_config", return_value=mock_mem0_memory): + with patch("mem0.memory.main.Memory.from_config", return_value=mock_mem0_memory) as mock_from_config: config = { "vector_store": { "provider": "mock_vector_store", @@ -66,13 +66,15 @@ def mem0_storage_with_mocked_config(mock_mem0_memory): ) mem0_storage = Mem0Storage(type="short_term", crew=crew) - return mem0_storage + return mem0_storage, mock_from_config, config def test_mem0_storage_initialization(mem0_storage_with_mocked_config, mock_mem0_memory): """Test that Mem0Storage initializes correctly with the mocked config""" - assert mem0_storage_with_mocked_config.memory_type == "short_term" - assert mem0_storage_with_mocked_config.memory is mock_mem0_memory + mem0_storage, mock_from_config, config = mem0_storage_with_mocked_config + assert mem0_storage.memory_type == "short_term" + assert mem0_storage.memory is mock_mem0_memory + mock_from_config.assert_called_once_with(config) @pytest.fixture