diff options
| author | sohamd22 <[email protected]> | 2025-10-19 22:24:00 +0000 |
|---|---|---|
| committer | sohamd22 <[email protected]> | 2025-10-19 22:24:00 +0000 |
| commit | 79f3059b2a383ca0d743dbe364dc5322c397ec56 (patch) | |
| tree | 8f189d8dc6586fe4121768573cce72d5bba6a405 /apps/docs/memory-api | |
| parent | version bump' (diff) | |
| download | supermemory-79f3059b2a383ca0d743dbe364dc5322c397ec56.tar.xz supermemory-79f3059b2a383ca0d743dbe364dc5322c397ec56.zip | |
add conversationId functionality to map to customId in ingestion (#499)
### TL;DR
Added support for conversation grouping in Supermemory middleware through a new `conversationId` parameter.
### What changed?
- Added a new `conversationId` option to the `withSupermemory` function to group messages into a single document for contextual memory generation
- Updated the middleware to use this conversation ID when adding memories, using a `customId` format of `conversation:{conversationId}`
- Created a new `getConversationContent` function that extracts the full conversation content from the prompt parameters
- Enhanced memory storage to save entire conversations rather than just the last user message
- Updated documentation and examples to demonstrate the new parameter usage
### How to test?
1. Import the `withSupermemory` function from the package
2. Create a model with memory using the new `conversationId` parameter:
```typescript
const modelWithMemory = withSupermemory(openai("gpt-4"), "user-123", {
conversationId: "conversation-456",
mode: "full",
addMemory: "always"
})
```
3. Use the model in a conversation and verify that messages are grouped by the conversation ID
4. Check that memories are being stored with the custom ID format `conversation:{conversationId}`
### Why make this change?
This enhancement improves the contextual understanding of the AI by allowing related messages to be grouped together as a single conversation document. By using a conversation ID, the system can maintain coherent memory across multiple interactions within the same conversation thread, providing better context retrieval and more relevant responses.
Diffstat (limited to 'apps/docs/memory-api')
0 files changed, 0 insertions, 0 deletions