def test_repeated_secondary_history(
    _mock_get_text_embeddings: Any,
    _mock_get_text_embedding: Any,
    vector_memory_initial_msgs: List[ChatMessage],
) -> None:
    """Test event where historical messages exist in both secondary and primary."""
    # Arrange
    vector_memory = VectorMemory.from_defaults(
        vector_store=None,
        embed_model=MockEmbedding(embed_dim=5),
        retriever_kwargs={"similarity_top_k": 1},
    )
    vector_memory.set(vector_memory_initial_msgs)
    composable_memory = SimpleComposableMemory.from_defaults(
        primary_memory=ChatMemoryBuffer.from_defaults(),
        secondary_memory_sources=[vector_memory],
    )
    composable_memory.set(vector_memory_initial_msgs)

    # act
    retrieved_msgs = composable_memory.get("What does Jerry like?")

    # assert
    assert len(retrieved_msgs) == 2
    assert retrieved_msgs == vector_memory_initial_msgs
Test event where historical messages exist in both secondary and primary.
llama-index-core/tests/agent/memory/test_simple_composable.py