55from mem0 import AsyncMemory , Memory
66from mem0 .configs .llms .base import BaseLlmConfig
77from mem0 .llms .vllm import VllmLLM
8- from mem0 .memory .utils import remove_code_blocks
98
109
1110@pytest .fixture
@@ -89,22 +88,6 @@ def test_generate_response_with_tools(mock_vllm_client):
8988
9089
9190
92- def test_remove_thinking_tags ():
93- # with thinking tag
94- assert remove_code_blocks ('<think>abc</think>{"facts":["test fact"]}' ) == '{"facts":["test fact"]}'
95-
96- # thinking content with multiple lines
97- assert remove_code_blocks ('<think>\n abc\n </think>\n {"facts":["test fact"]}' ) == '{"facts":["test fact"]}'
98-
99- # more than one thinking tag(rare in practice)
100- assert remove_code_blocks ('<think>A</think><think>B</think>{"facts":["test fact"]}' ) == '{"facts":["test fact"]}'
101-
102- # no tag
103- assert remove_code_blocks ('{"facts":["test fact"]}' ) == '{"facts":["test fact"]}'
104-
105-
106-
107-
10891def create_mocked_memory ():
10992 """Create a fully mocked Memory instance for testing."""
11093 with patch ('mem0.utils.factory.LlmFactory.create' ) as mock_llm_factory , \
@@ -157,7 +140,7 @@ def create_mocked_async_memory():
157140 return memory , mock_llm , mock_vector_store
158141
159142
160- def test_thinking_tags_in_add_to_vector_store ():
143+ def test_thinking_tags_sync ():
161144 """Test thinking tags handling in Memory._add_to_vector_store (sync)."""
162145 memory , mock_llm , mock_vector_store = create_mocked_memory ()
163146
@@ -183,7 +166,7 @@ def test_thinking_tags_in_add_to_vector_store():
183166
184167
185168@pytest .mark .asyncio
186- async def test_async_thinking_tags_in_add_to_vector_store ():
169+ async def test_async_thinking_tags_async ():
187170 """Test thinking tags handling in AsyncMemory._add_to_vector_store."""
188171 memory , mock_llm , mock_vector_store = create_mocked_async_memory ()
189172
0 commit comments