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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NhupP1YqDMS3K1xouqwUnf
This commit is contained in:
Agnik47 2026-08-21 22:04:49 +05:30
parent 3487666481
commit 18c2fdc28d
3 changed files with 47 additions and 4 deletions

View file

@ -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()

View file

@ -40,11 +40,17 @@ from .utils import (
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",

View file

@ -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")