diff --git a/apps/docs/integrations/livekit.mdx b/apps/docs/integrations/livekit.mdx index 20964206..585fa5ee 100644 --- a/apps/docs/integrations/livekit.mdx +++ b/apps/docs/integrations/livekit.mdx @@ -34,7 +34,7 @@ Identities that are not valid container tags are sanitized to a stable tag. Set Set the attribute in the access token your backend issues. Do not grant the caller `canUpdateOwnMetadata`, or they could change the attribute and read another caller's memory. -One call is stored as a single document. Pass the LiveKit room name as `session_id`. The document id is `lk-`, so a later update with the same id appends to that call instead of creating another. +One call is stored as a single document. Pass the LiveKit room name as `session_id`. The session id is the document's custom id, so a later update with the same id appends to that call instead of creating another. Use one `SupermemoryLiveKit` per call. If you do rebind it, turns already captured stay with the caller who said them, and memory from the earlier caller is never shown to the new one. diff --git a/packages/livekit-sdk-python/README.md b/packages/livekit-sdk-python/README.md index 6f5384b7..0b7904a4 100644 --- a/packages/livekit-sdk-python/README.md +++ b/packages/livekit-sdk-python/README.md @@ -108,7 +108,7 @@ memory = SupermemoryLiveKit( | `query` | No | Yes | You only need memories related to this turn | | `full` | Yes | Yes | Default | -One call is stored as a single document under custom id `lk-`, so a reconnect with the same session id updates that document instead of creating another. Explicit `remember` calls are separate facts, processed immediately (usually recallable within a minute), and are not tied to the call document. +One call is stored as a single document whose custom id is the session id, so a reconnect with the same session id updates that document instead of creating another. Explicit `remember` calls are separate facts, processed immediately (usually recallable within a minute), and are not tied to the call document. ### When a call becomes recallable diff --git a/packages/livekit-sdk-python/src/supermemory_livekit/memory.py b/packages/livekit-sdk-python/src/supermemory_livekit/memory.py index 26f78e3e..dde920dd 100644 --- a/packages/livekit-sdk-python/src/supermemory_livekit/memory.py +++ b/packages/livekit-sdk-python/src/supermemory_livekit/memory.py @@ -282,7 +282,7 @@ class SupermemoryLiveKit: "instant", content=text, container_tag=tag, - metadata={"source": "livekit", "kind": "explicit"}, + metadata={"platform": "livekit", "kind": "explicit"}, ), timeout=4.0, ) @@ -479,7 +479,7 @@ class SupermemoryLiveKit: content="\n".join(lines), container_tag=messages[0]["tag"], custom_id=messages[0]["custom_id"], - metadata={"source": "livekit", "kind": "conversation"}, + metadata={"platform": "livekit", "kind": "conversation"}, ) async def _add(self, dreaming: str, **kwargs: Any) -> None: @@ -498,7 +498,7 @@ class SupermemoryLiveKit: def _custom_id(self) -> str: raw = self.session_id or self._generated_session - return to_identifier(f"lk-{raw}") + return to_identifier(raw) def _detach(self) -> None: session = self._session diff --git a/packages/livekit-sdk-python/tests/test_memory.py b/packages/livekit-sdk-python/tests/test_memory.py index 5e292547..41af028d 100644 --- a/packages/livekit-sdk-python/tests/test_memory.py +++ b/packages/livekit-sdk-python/tests/test_memory.py @@ -358,9 +358,9 @@ class MemoryTests(unittest.TestCase): stored = client.added[0] self.assertEqual(stored["content"], "User: I like tea\nAssistant: Noted.") self.assertEqual(stored["container_tag"], "user_1") - self.assertEqual(stored["custom_id"], to_identifier("lk-room 1")) + self.assertEqual(stored["custom_id"], to_identifier("room 1")) self.assertNotIn("secret", stored["content"]) - self.assertEqual(stored["metadata"]["source"], "livekit") + self.assertEqual(stored["metadata"]["platform"], "livekit") self.assertEqual(stored["dreaming"], "instant") def test_close_flushes_a_trailing_user_turn(self): @@ -559,7 +559,7 @@ class MemoryTests(unittest.TestCase): asyncio.run(plugin.aclose()) self.assertEqual(len(client.added), 3) - self.assertEqual({call["custom_id"] for call in client.added}, {to_identifier("lk-room-4")}) + self.assertEqual({call["custom_id"] for call in client.added}, {"room-4"}) def test_unscoped_tools_do_not_call_the_api(self): client = FakeClient()