supermemory-pipecat 0.1.0__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {supermemory_pipecat-0.1.0 → supermemory_pipecat-0.1.2}/PKG-INFO +37 -25
- {supermemory_pipecat-0.1.0 → supermemory_pipecat-0.1.2}/README.md +34 -22
- {supermemory_pipecat-0.1.0 → supermemory_pipecat-0.1.2}/pyproject.toml +2 -2
- {supermemory_pipecat-0.1.0 → supermemory_pipecat-0.1.2}/src/supermemory_pipecat/__init__.py +11 -5
- supermemory_pipecat-0.1.2/src/supermemory_pipecat/service.py +504 -0
- supermemory_pipecat-0.1.2/src/supermemory_pipecat/utils.py +175 -0
- supermemory_pipecat-0.1.2/tests/test_empty_profile.py +123 -0
- supermemory_pipecat-0.1.0/src/supermemory_pipecat/service.py +0 -364
- supermemory_pipecat-0.1.0/src/supermemory_pipecat/utils.py +0 -66
- {supermemory_pipecat-0.1.0 → supermemory_pipecat-0.1.2}/.gitignore +0 -0
- {supermemory_pipecat-0.1.0 → supermemory_pipecat-0.1.2}/src/supermemory_pipecat/exceptions.py +0 -0
- {supermemory_pipecat-0.1.0 → supermemory_pipecat-0.1.2}/tests/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: supermemory-pipecat
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Supermemory integration for Pipecat - memory-enhanced conversational AI pipelines
|
|
5
5
|
Project-URL: Homepage, https://supermemory.ai
|
|
6
6
|
Project-URL: Documentation, https://docs.supermemory.ai
|
|
@@ -18,7 +18,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
18
18
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
19
|
Requires-Python: >=3.10
|
|
20
20
|
Requires-Dist: loguru>=0.7.3
|
|
21
|
-
Requires-Dist: pipecat-ai
|
|
21
|
+
Requires-Dist: pipecat-ai<2.0.0,>=0.0.98
|
|
22
22
|
Requires-Dist: pydantic>=2.10.0
|
|
23
23
|
Requires-Dist: supermemory>=3.16.0
|
|
24
24
|
Provides-Extra: dev
|
|
@@ -44,7 +44,7 @@ pip install supermemory-pipecat
|
|
|
44
44
|
```python
|
|
45
45
|
import os
|
|
46
46
|
from pipecat.pipeline.pipeline import Pipeline
|
|
47
|
-
from pipecat.
|
|
47
|
+
from pipecat.processors.aggregators.llm_context import LLMContext
|
|
48
48
|
from supermemory_pipecat import SupermemoryPipecatService
|
|
49
49
|
|
|
50
50
|
# Create memory service
|
|
@@ -54,14 +54,19 @@ memory = SupermemoryPipecatService(
|
|
|
54
54
|
session_id="conversation-456", # Optional: groups memories by session
|
|
55
55
|
)
|
|
56
56
|
|
|
57
|
+
# Use the universal LLM context supported by current Pipecat releases.
|
|
58
|
+
context = LLMContext([{"role": "system", "content": "You are a helpful assistant."}])
|
|
59
|
+
context_aggregator = llm.create_context_aggregator(context)
|
|
60
|
+
|
|
57
61
|
# Create pipeline with memory
|
|
58
62
|
pipeline = Pipeline([
|
|
59
63
|
transport.input(),
|
|
60
64
|
stt,
|
|
61
|
-
|
|
65
|
+
context_aggregator.user(),
|
|
62
66
|
memory, # Automatically retrieves and injects relevant memories
|
|
63
67
|
llm,
|
|
64
68
|
transport.output(),
|
|
69
|
+
context_aggregator.assistant(),
|
|
65
70
|
])
|
|
66
71
|
```
|
|
67
72
|
|
|
@@ -89,6 +94,7 @@ memory = SupermemoryPipecatService(
|
|
|
89
94
|
search_limit=10, # Max memories to retrieve
|
|
90
95
|
search_threshold=0.1, # Similarity threshold
|
|
91
96
|
mode="full", # "profile", "query", or "full"
|
|
97
|
+
inject_mode="auto", # "auto", "system", or "user"
|
|
92
98
|
system_prompt="Based on previous conversations, I recall:\n\n",
|
|
93
99
|
),
|
|
94
100
|
)
|
|
@@ -104,25 +110,30 @@ memory = SupermemoryPipecatService(
|
|
|
104
110
|
|
|
105
111
|
## How It Works
|
|
106
112
|
|
|
107
|
-
1. **Intercepts context frames** - Listens for `LLMContextFrame`
|
|
108
|
-
2. **Tracks conversation** -
|
|
113
|
+
1. **Intercepts context frames** - Listens for Pipecat's universal `LLMContextFrame` (and legacy 0.x frames)
|
|
114
|
+
2. **Tracks conversation** - Separates real conversation messages from tagged memory context
|
|
109
115
|
3. **Retrieves memories** - Queries `/v4/profile` API with user's message
|
|
110
|
-
4. **Injects memories** -
|
|
111
|
-
5. **Stores messages** -
|
|
116
|
+
4. **Injects memories** - Uses a system message for audio/system mode and a tagged user message otherwise
|
|
117
|
+
5. **Stores messages** - Serializes newly observed user and assistant messages through a background queue that drains during cleanup
|
|
112
118
|
|
|
113
119
|
### What Gets Stored
|
|
114
120
|
|
|
115
|
-
|
|
121
|
+
New user and assistant messages are stored as a JSON conversation segment. The
|
|
122
|
+
injected `<user_memories>` message is filtered out before storage and does not
|
|
123
|
+
advance the storage cursor.
|
|
124
|
+
|
|
125
|
+
For example, this conversation segment:
|
|
116
126
|
|
|
117
127
|
```
|
|
118
128
|
User: What's the weather like today?
|
|
129
|
+
Assistant: It's sunny today.
|
|
119
130
|
```
|
|
120
131
|
|
|
121
|
-
|
|
132
|
+
is sent to Supermemory as:
|
|
122
133
|
|
|
123
134
|
```json
|
|
124
135
|
{
|
|
125
|
-
"content": "
|
|
136
|
+
"content": "[{\"role\": \"user\", \"content\": \"What's the weather like today?\"}, {\"role\": \"assistant\", \"content\": \"It's sunny today.\"}]",
|
|
126
137
|
"container_tags": ["user-123"],
|
|
127
138
|
"custom_id": "conversation-456",
|
|
128
139
|
"metadata": { "platform": "pipecat" }
|
|
@@ -138,11 +149,9 @@ from fastapi import FastAPI, WebSocket
|
|
|
138
149
|
from pipecat.pipeline.pipeline import Pipeline
|
|
139
150
|
from pipecat.pipeline.task import PipelineTask
|
|
140
151
|
from pipecat.pipeline.runner import PipelineRunner
|
|
141
|
-
from pipecat.
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
)
|
|
145
|
-
from pipecat.transports.network.fastapi_websocket import (
|
|
152
|
+
from pipecat.processors.aggregators.llm_context import LLMContext
|
|
153
|
+
from pipecat.services.google.gemini_live.llm import GeminiLiveLLMService
|
|
154
|
+
from pipecat.transports.websocket.fastapi import (
|
|
146
155
|
FastAPIWebsocketTransport,
|
|
147
156
|
FastAPIWebsocketParams,
|
|
148
157
|
)
|
|
@@ -156,10 +165,17 @@ async def websocket_endpoint(websocket: WebSocket):
|
|
|
156
165
|
|
|
157
166
|
transport = FastAPIWebsocketTransport(
|
|
158
167
|
websocket=websocket,
|
|
159
|
-
params=FastAPIWebsocketParams(audio_out_enabled=True),
|
|
168
|
+
params=FastAPIWebsocketParams(audio_in_enabled=True, audio_out_enabled=True),
|
|
160
169
|
)
|
|
161
170
|
|
|
162
|
-
|
|
171
|
+
# Gemini Live for speech-to-speech
|
|
172
|
+
llm = GeminiLiveLLMService(
|
|
173
|
+
api_key=os.getenv("GEMINI_API_KEY"),
|
|
174
|
+
model="models/gemini-2.5-flash-native-audio-preview-12-2025",
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
context = LLMContext([{"role": "system", "content": "You are a helpful assistant."}])
|
|
178
|
+
context_aggregator = llm.create_context_aggregator(context)
|
|
163
179
|
|
|
164
180
|
# Supermemory memory service
|
|
165
181
|
memory = SupermemoryPipecatService(
|
|
@@ -167,17 +183,13 @@ async def websocket_endpoint(websocket: WebSocket):
|
|
|
167
183
|
session_id="session-123",
|
|
168
184
|
)
|
|
169
185
|
|
|
170
|
-
llm = OpenAILLMService(
|
|
171
|
-
api_key=os.getenv("OPENAI_API_KEY"),
|
|
172
|
-
model="gpt-4",
|
|
173
|
-
)
|
|
174
|
-
|
|
175
186
|
pipeline = Pipeline([
|
|
176
187
|
transport.input(),
|
|
177
|
-
|
|
188
|
+
context_aggregator.user(),
|
|
178
189
|
memory,
|
|
179
190
|
llm,
|
|
180
191
|
transport.output(),
|
|
192
|
+
context_aggregator.assistant(),
|
|
181
193
|
])
|
|
182
194
|
|
|
183
195
|
runner = PipelineRunner()
|
|
@@ -13,7 +13,7 @@ pip install supermemory-pipecat
|
|
|
13
13
|
```python
|
|
14
14
|
import os
|
|
15
15
|
from pipecat.pipeline.pipeline import Pipeline
|
|
16
|
-
from pipecat.
|
|
16
|
+
from pipecat.processors.aggregators.llm_context import LLMContext
|
|
17
17
|
from supermemory_pipecat import SupermemoryPipecatService
|
|
18
18
|
|
|
19
19
|
# Create memory service
|
|
@@ -23,14 +23,19 @@ memory = SupermemoryPipecatService(
|
|
|
23
23
|
session_id="conversation-456", # Optional: groups memories by session
|
|
24
24
|
)
|
|
25
25
|
|
|
26
|
+
# Use the universal LLM context supported by current Pipecat releases.
|
|
27
|
+
context = LLMContext([{"role": "system", "content": "You are a helpful assistant."}])
|
|
28
|
+
context_aggregator = llm.create_context_aggregator(context)
|
|
29
|
+
|
|
26
30
|
# Create pipeline with memory
|
|
27
31
|
pipeline = Pipeline([
|
|
28
32
|
transport.input(),
|
|
29
33
|
stt,
|
|
30
|
-
|
|
34
|
+
context_aggregator.user(),
|
|
31
35
|
memory, # Automatically retrieves and injects relevant memories
|
|
32
36
|
llm,
|
|
33
37
|
transport.output(),
|
|
38
|
+
context_aggregator.assistant(),
|
|
34
39
|
])
|
|
35
40
|
```
|
|
36
41
|
|
|
@@ -58,6 +63,7 @@ memory = SupermemoryPipecatService(
|
|
|
58
63
|
search_limit=10, # Max memories to retrieve
|
|
59
64
|
search_threshold=0.1, # Similarity threshold
|
|
60
65
|
mode="full", # "profile", "query", or "full"
|
|
66
|
+
inject_mode="auto", # "auto", "system", or "user"
|
|
61
67
|
system_prompt="Based on previous conversations, I recall:\n\n",
|
|
62
68
|
),
|
|
63
69
|
)
|
|
@@ -73,25 +79,30 @@ memory = SupermemoryPipecatService(
|
|
|
73
79
|
|
|
74
80
|
## How It Works
|
|
75
81
|
|
|
76
|
-
1. **Intercepts context frames** - Listens for `LLMContextFrame`
|
|
77
|
-
2. **Tracks conversation** -
|
|
82
|
+
1. **Intercepts context frames** - Listens for Pipecat's universal `LLMContextFrame` (and legacy 0.x frames)
|
|
83
|
+
2. **Tracks conversation** - Separates real conversation messages from tagged memory context
|
|
78
84
|
3. **Retrieves memories** - Queries `/v4/profile` API with user's message
|
|
79
|
-
4. **Injects memories** -
|
|
80
|
-
5. **Stores messages** -
|
|
85
|
+
4. **Injects memories** - Uses a system message for audio/system mode and a tagged user message otherwise
|
|
86
|
+
5. **Stores messages** - Serializes newly observed user and assistant messages through a background queue that drains during cleanup
|
|
81
87
|
|
|
82
88
|
### What Gets Stored
|
|
83
89
|
|
|
84
|
-
|
|
90
|
+
New user and assistant messages are stored as a JSON conversation segment. The
|
|
91
|
+
injected `<user_memories>` message is filtered out before storage and does not
|
|
92
|
+
advance the storage cursor.
|
|
93
|
+
|
|
94
|
+
For example, this conversation segment:
|
|
85
95
|
|
|
86
96
|
```
|
|
87
97
|
User: What's the weather like today?
|
|
98
|
+
Assistant: It's sunny today.
|
|
88
99
|
```
|
|
89
100
|
|
|
90
|
-
|
|
101
|
+
is sent to Supermemory as:
|
|
91
102
|
|
|
92
103
|
```json
|
|
93
104
|
{
|
|
94
|
-
"content": "
|
|
105
|
+
"content": "[{\"role\": \"user\", \"content\": \"What's the weather like today?\"}, {\"role\": \"assistant\", \"content\": \"It's sunny today.\"}]",
|
|
95
106
|
"container_tags": ["user-123"],
|
|
96
107
|
"custom_id": "conversation-456",
|
|
97
108
|
"metadata": { "platform": "pipecat" }
|
|
@@ -107,11 +118,9 @@ from fastapi import FastAPI, WebSocket
|
|
|
107
118
|
from pipecat.pipeline.pipeline import Pipeline
|
|
108
119
|
from pipecat.pipeline.task import PipelineTask
|
|
109
120
|
from pipecat.pipeline.runner import PipelineRunner
|
|
110
|
-
from pipecat.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
)
|
|
114
|
-
from pipecat.transports.network.fastapi_websocket import (
|
|
121
|
+
from pipecat.processors.aggregators.llm_context import LLMContext
|
|
122
|
+
from pipecat.services.google.gemini_live.llm import GeminiLiveLLMService
|
|
123
|
+
from pipecat.transports.websocket.fastapi import (
|
|
115
124
|
FastAPIWebsocketTransport,
|
|
116
125
|
FastAPIWebsocketParams,
|
|
117
126
|
)
|
|
@@ -125,10 +134,17 @@ async def websocket_endpoint(websocket: WebSocket):
|
|
|
125
134
|
|
|
126
135
|
transport = FastAPIWebsocketTransport(
|
|
127
136
|
websocket=websocket,
|
|
128
|
-
params=FastAPIWebsocketParams(audio_out_enabled=True),
|
|
137
|
+
params=FastAPIWebsocketParams(audio_in_enabled=True, audio_out_enabled=True),
|
|
129
138
|
)
|
|
130
139
|
|
|
131
|
-
|
|
140
|
+
# Gemini Live for speech-to-speech
|
|
141
|
+
llm = GeminiLiveLLMService(
|
|
142
|
+
api_key=os.getenv("GEMINI_API_KEY"),
|
|
143
|
+
model="models/gemini-2.5-flash-native-audio-preview-12-2025",
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
context = LLMContext([{"role": "system", "content": "You are a helpful assistant."}])
|
|
147
|
+
context_aggregator = llm.create_context_aggregator(context)
|
|
132
148
|
|
|
133
149
|
# Supermemory memory service
|
|
134
150
|
memory = SupermemoryPipecatService(
|
|
@@ -136,17 +152,13 @@ async def websocket_endpoint(websocket: WebSocket):
|
|
|
136
152
|
session_id="session-123",
|
|
137
153
|
)
|
|
138
154
|
|
|
139
|
-
llm = OpenAILLMService(
|
|
140
|
-
api_key=os.getenv("OPENAI_API_KEY"),
|
|
141
|
-
model="gpt-4",
|
|
142
|
-
)
|
|
143
|
-
|
|
144
155
|
pipeline = Pipeline([
|
|
145
156
|
transport.input(),
|
|
146
|
-
|
|
157
|
+
context_aggregator.user(),
|
|
147
158
|
memory,
|
|
148
159
|
llm,
|
|
149
160
|
transport.output(),
|
|
161
|
+
context_aggregator.assistant(),
|
|
150
162
|
])
|
|
151
163
|
|
|
152
164
|
runner = PipelineRunner()
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "supermemory-pipecat"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.2"
|
|
8
8
|
description = "Supermemory integration for Pipecat - memory-enhanced conversational AI pipelines"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -31,7 +31,7 @@ classifiers = [
|
|
|
31
31
|
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
32
32
|
]
|
|
33
33
|
dependencies = [
|
|
34
|
-
"pipecat-ai>=0.0.98",
|
|
34
|
+
"pipecat-ai>=0.0.98,<2.0.0",
|
|
35
35
|
"supermemory>=3.16.0",
|
|
36
36
|
"pydantic>=2.10.0",
|
|
37
37
|
"loguru>=0.7.3",
|
|
@@ -25,22 +25,28 @@ Example:
|
|
|
25
25
|
```
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
|
-
from .
|
|
28
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
29
|
+
|
|
29
30
|
from .exceptions import (
|
|
30
|
-
|
|
31
|
+
APIError,
|
|
31
32
|
ConfigurationError,
|
|
32
33
|
MemoryRetrievalError,
|
|
33
34
|
MemoryStorageError,
|
|
34
|
-
APIError,
|
|
35
35
|
NetworkError,
|
|
36
|
+
SupermemoryPipecatError,
|
|
36
37
|
)
|
|
38
|
+
from .service import SupermemoryPipecatService
|
|
37
39
|
from .utils import (
|
|
38
|
-
get_last_user_message,
|
|
39
40
|
deduplicate_memories,
|
|
40
41
|
format_memories_to_text,
|
|
42
|
+
get_last_user_message,
|
|
41
43
|
)
|
|
42
44
|
|
|
43
|
-
|
|
45
|
+
try:
|
|
46
|
+
__version__ = version("supermemory-pipecat")
|
|
47
|
+
except PackageNotFoundError:
|
|
48
|
+
# Source-tree fallback; built wheels always use package metadata above.
|
|
49
|
+
__version__ = "0.1.2"
|
|
44
50
|
|
|
45
51
|
__all__ = [
|
|
46
52
|
# Main service
|