From 18c2fdc28dc689713233387135301c94e5b58594 Mon Sep 17 00:00:00 2001 From: Agnik47 <140933190+Agnik47@users.noreply.github.com> Date: Fri, 21 Aug 2026 22:04:49 +0530 Subject: [PATCH] fix(pipecat): export InputParams from the package root The documented Pipecat quickstart fails on its second line: from supermemory_pipecat.service import InputParams ImportError: cannot import name 'InputParams' from 'supermemory_pipecat.service' `InputParams` is a nested class on `SupermemoryPipecatService` (service.py:54), matching Pipecat's own `Service.InputParams` convention, so it is not a module-level name in `.service` and never has been. Nothing in the package exposed it, so every reader who copied the config example from docs.supermemory.ai hit an ImportError before reaching any Supermemory call. `supermemory_cartesia` -- the sibling SDK with the identical nested-config shape -- already solves this with an explicit alias: # Export MemoryConfig as a top-level class for convenience MemoryConfig = SupermemoryCartesiaAgent.MemoryConfig Pipecat was the only one of the two missing it. Adds the matching alias plus `__all__` entry, and points the two documented imports at the package root where it now lives. The nested `SupermemoryPipecatService.InputParams` form used by the package README keeps working unchanged. Adds tests/test_public_exports.py, which fails with the original ImportError if the alias is removed. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01NhupP1YqDMS3K1xouqwUnf --- apps/docs/integrations/pipecat.mdx | 6 +-- .../src/supermemory_pipecat/__init__.py | 6 +++ .../tests/test_public_exports.py | 39 +++++++++++++++++++ 3 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 packages/pipecat-sdk-python/tests/test_public_exports.py 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")