repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | from mem0.configs import prompts |
| #2 | |
| #3 | |
| #4 | def test_get_update_memory_messages(): |
| #5 | retrieved_old_memory_dict = [{"id": "1", "text": "old memory 1"}] |
| #6 | response_content = ["new fact"] |
| #7 | custom_update_memory_prompt = "custom prompt determining memory update" |
| #8 | |
| #9 | ## When custom update memory prompt is provided |
| #10 | ## |
| #11 | result = prompts.get_update_memory_messages( |
| #12 | retrieved_old_memory_dict, response_content, custom_update_memory_prompt |
| #13 | ) |
| #14 | assert result.startswith(custom_update_memory_prompt) |
| #15 | |
| #16 | ## When custom update memory prompt is not provided |
| #17 | ## |
| #18 | result = prompts.get_update_memory_messages(retrieved_old_memory_dict, response_content, None) |
| #19 | assert result.startswith(prompts.DEFAULT_UPDATE_MEMORY_PROMPT) |
| #20 | |
| #21 | |
| #22 | def test_get_update_memory_messages_empty_memory(): |
| #23 | # Test with None for retrieved_old_memory_dict |
| #24 | result = prompts.get_update_memory_messages( |
| #25 | None, |
| #26 | ["new fact"], |
| #27 | None |
| #28 | ) |
| #29 | assert "Current memory is empty" in result |
| #30 | |
| #31 | # Test with empty list for retrieved_old_memory_dict |
| #32 | result = prompts.get_update_memory_messages( |
| #33 | [], |
| #34 | ["new fact"], |
| #35 | None |
| #36 | ) |
| #37 | assert "Current memory is empty" in result |
| #38 | |
| #39 | |
| #40 | def test_get_update_memory_messages_non_empty_memory(): |
| #41 | # Non-empty memory scenario |
| #42 | memory_data = [{"id": "1", "text": "existing memory"}] |
| #43 | result = prompts.get_update_memory_messages( |
| #44 | memory_data, |
| #45 | ["new fact"], |
| #46 | None |
| #47 | ) |
| #48 | # Check that the memory data is displayed |
| #49 | assert str(memory_data) in result |
| #50 | # And that the non-empty memory message is present |
| #51 | assert "current content of my memory" in result |
| #52 |