mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-08-26 00:43:07 +00:00
Port the normalized, priority-ordered (static > dynamic > search) profile deduplication into the Python SDKs, injecting one owned memory block per request that replaces the prior block rather than accumulating. Dedup is request-local (no shared state), so it stays correct under concurrency. Covers OpenAI, Agent Framework (middleware + context provider), Cartesia, and Pipecat. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
17 lines
499 B
Python
17 lines
499 B
Python
"""Tests for shared middleware utilities."""
|
|
|
|
from supermemory_openai.utils import deduplicate_memories
|
|
|
|
|
|
def test_deduplicates_normalized_fact_variants() -> None:
|
|
result = deduplicate_memories(
|
|
static=[
|
|
{"memory": "User likes Python"},
|
|
{"memory": " user likes python "},
|
|
],
|
|
dynamic=[{"memory": "[2026-08-10] USER LIKES PYTHON"}],
|
|
search_results=[],
|
|
)
|
|
|
|
assert result.static == ["User likes Python"]
|
|
assert result.dynamic == []
|