by yevanchen · v0.0.2
Dify integration for mem0
This community listing does not yet include every recommended support, privacy, pricing, and permission disclosure. Review the available package permissions before installing.
Available inside your emploidai workspace after installation.
Available inside your emploidai workspace after installation.
Author: yevanchen Version: 0.0.1 Type: tool
mem0 is a memory management plugin that enables conversation history storage and retrieval for LLM applications.
pip install mem0ai
from mem0 import MemoryClient
client = MemoryClient(api_key="your-api-key")
Stores conversation history and context for users.
messages = [
{"role": "user", "content": "Hi, I'm Alex. I'm a vegetarian and I'm allergic to nuts."},
{"role": "assistant", "content": "Hello Alex! I've noted your dietary preferences."}
]
client.add(messages, user_id="alex")
Backend logic:
user_idRetrieves relevant conversation history based on queries.
query = "What can I cook for dinner tonight?"
memories = client.search(query, user_id="alex")
Backend logic:
retrieve_memory before LLM calls to provide contextadd_memory after LLM responses to store new interactionsuser_id can be customized in workflow run APIFor feature requests or discussions, contact evanchen@dify.ai