diff --git a/apps/docs/integrations/pipecat.mdx b/apps/docs/integrations/pipecat.mdx index 1637ce44b..728af9ecf 100644 --- a/apps/docs/integrations/pipecat.mdx +++ b/apps/docs/integrations/pipecat.mdx @@ -28,8 +28,7 @@ You can obtain an API key from [console.supermemory.ai](https://console.supermem Supermemory integration is provided through the `SupermemoryPipecatService` class in Pipecat: ```python -from supermemory_pipecat import SupermemoryPipecatService -from supermemory_pipecat.service import InputParams +from supermemory_pipecat import InputParams, SupermemoryPipecatService memory = SupermemoryPipecatService( api_key=os.getenv("SUPERMEMORY_API_KEY"), @@ -157,8 +156,7 @@ from pipecat.transports.websocket.fastapi import ( FastAPIWebsocketTransport, ) -from supermemory_pipecat import SupermemoryPipecatService -from supermemory_pipecat.service import InputParams +from supermemory_pipecat import InputParams, SupermemoryPipecatService app = FastAPI() diff --git a/packages/pipecat-sdk-python/src/supermemory_pipecat/__init__.py b/packages/pipecat-sdk-python/src/supermemory_pipecat/__init__.py index aeb190c98..8a5b8ffb0 100644 --- a/packages/pipecat-sdk-python/src/supermemory_pipecat/__init__.py +++ b/packages/pipecat-sdk-python/src/supermemory_pipecat/__init__.py @@ -40,11 +40,17 @@ get_last_user_message, ) +# Exported as a top-level name for convenience, mirroring +# supermemory_cartesia.MemoryConfig. The canonical definition stays nested on +# the service, matching Pipecat's own `Service.InputParams` convention. +InputParams = SupermemoryPipecatService.InputParams + __version__ = "0.1.1" __all__ = [ # Main service "SupermemoryPipecatService", + "InputParams", # Exceptions "SupermemoryPipecatError", "ConfigurationError", diff --git a/packages/pipecat-sdk-python/tests/test_public_exports.py b/packages/pipecat-sdk-python/tests/test_public_exports.py new file mode 100644 index 000000000..4a215d6ab --- /dev/null +++ b/packages/pipecat-sdk-python/tests/test_public_exports.py @@ -0,0 +1,39 @@ +"""The package's documented public names must be importable from its root. + +apps/docs/integrations/pipecat.mdx tells users to configure the service with +`InputParams(...)`. `InputParams` is defined as a nested class on +`SupermemoryPipecatService` (matching Pipecat's own `Service.InputParams` +convention), so it is only reachable from the package root through the alias in +`__init__.py` -- the same alias `supermemory_cartesia` provides for +`MemoryConfig`. Without it the documented quickstart fails on its import line. +""" + +from __future__ import annotations + +import unittest + +from .test_empty_profile import _install_test_stubs + +_install_test_stubs() + +import supermemory_pipecat +from supermemory_pipecat import InputParams, SupermemoryPipecatService + + +class TestPublicExports(unittest.TestCase): + def test_input_params_is_exported_from_the_package_root(self) -> None: + self.assertIn("InputParams", supermemory_pipecat.__all__) + self.assertIs(InputParams, SupermemoryPipecatService.InputParams) + + def test_documented_configuration_example_constructs(self) -> None: + params = InputParams( + mode="full", + search_limit=10, + search_threshold=0.1, + system_prompt="Based on previous conversations:\n\n", + ) + + self.assertEqual(params.mode, "full") + self.assertEqual(params.search_limit, 10) + self.assertEqual(params.search_threshold, 0.1) + self.assertEqual(params.system_prompt, "Based on previous conversations:\n\n")