A memory management system for LLMs. [Documentation]
Direct/Native compatibility with Vercel's AI SDK - the mainstream unified llm api interface in typescript.
Join our Discord community for discussions, help and updates.
npm install memoer
import { memoer, MemoryConfig, ConversationStrategy } from "memoer";
// Create a new memory instance
const memoryConfig: MemoryConfig = {
id: "conversation-1",
systemMessage: {
role: "system",
content: "You are a helpful assistant."
},
managers: {
conversation: {
// Optional: Configure conversation strategy
strategy: ConversationStrategy.SLIDING_WINDOW,
slidingWindowSize: 10 // Number of messages to keep in context
}
}
};
// Initialize the memory
const memory = memoer.createMemory(memoryConfig);
// Add messages to the conversation
memory.conversation.add({
role: "user",
content: "Hello, how are you today?"
});
// Get optimized conversation context (affected by strategy)
const context = await memory.conversation.getContext();
// Get full conversation history regardless of strategy
const fullHistory = await memory.conversation.getFullContext();
Contributions are welcome! Please feel free to submit a Pull Request.
If you find memoer helpful, please consider:
- Giving it a star on GitHub ⭐
Apache 2.0 - See LICENSE for more information.