fix(pipecat-sdk): handle null profile object safely
This PR fixes a crash in Supermemory Pipecat memory retrieval when the API returns a null profile for a user with no stored memories. In that case, _retrieve_memories() previously accessed response.profile.static and response.profile.dynamic directly, which raised an AttributeError and caused the retrieval flow to fail.
What changed
- Added a null check around the profile object returned by the Supermemory API.
- Safely fall back to empty lists when profile is None.
- Kept search result handling defensive as well so missing search data does not break retrieval.
- Added a regression test covering the brand-new-user case where the API returns profile=None.
Why this was needed
When a user has no existing memories, the API can legitimately return profile=None. The previous implementation assumed profile always existed, which caused the Pipecat service to crash during memory retrieval and surface a MemoryRetrievalError to callers. This makes the empty-state path brittle and blocks first-time users from using the memory feature cleanly.
Behavior after this change
- Users with no stored memories no longer trigger an AttributeError.
- _retrieve_memories() now returns an empty profile structure instead of crashing.
- The downstream context enhancement flow can continue safely even when there are no memories to inject.
Verification
- Added a regression test for the null-profile path in packages/pipecat-sdk-python/tests/test_empty_profile.py.
- Verified the test passes locally with unittest.