了解更多·加入Discord·Demo·OpenMemory
?具有可扩展的长期记忆→建筑生产的AI代理→
⚡ +26%的准确性与OpenAI内存•更快91%•90%的令牌少90%
研究亮点
- +机车基准上的OpenAI内存的准确性为26%
- 比全文快91%的响应速度,可确保低延展性
- 与全文相比,令牌使用率低90% ,削减成本而没有折衷
- 阅读完整的纸
介绍
mem0 (“ MEM-Zero”)用智能存储层增强了AI助手和代理,从而实现了个性化的AI交互。它记得用户的偏好,适应个人需求,并随着时间的流逝而不断学习 - 客户支持聊天机器人,AI助手和自治系统的理想。
关键功能和用例
核心功能:
- 多层内存:无缝保留具有自适应个性化的用户,会话和代理状态
- 开发人员友好:直观的API,跨平台SDK和一个完全管理的服务选项
应用程序:
- AI助手:一致,上下文丰富的对话
- 客户支持:召回过去的门票和用户历史记录
- 医疗保健:跟踪患者的偏好和个性化护理历史
- 生产力与游戏:根据用户行为的自适应工作流程和环境
快速入门指南
在我们的托管平台或自托管软件包之间进行选择:
托管平台
自动更新,分析和企业安全,在几分钟内启动并运行。
- 在mem0平台上注册
- 通过SDK或API键嵌入存储层
自托(开源)
通过PIP安装SDK:
pip install mem0 ai通过NPM安装SDK:
npm install mem0 ai基本用法
mem0需要LLM才能发挥作用,而来自OpenAI的GPT-4O-Mini默认为默认值。但是,它支持各种LLM;有关详细信息,请参阅我们支持的LLMS文档。
第一步是实例化内存:
mem0 import Memory
openai_client = OpenAI()
memory = Memory()
def chat_with_memories(message: str, user_id: str = "default_user") -> str:
# Retrieve relevant memories
relevant_memories = memory.search(query=message, user_id=user_id, limit=3)
memories_str = "n".join(f"- {entry['memory']}" for entry in relevant_memories["results"])
# Generate Assistant response
system_prompt = f"You are a helpful AI. Answer the question based on query and memories.nUser Memories:n{memories_str}"
messages = [{"role": "system", "content": system_prompt}, {"role": "user", "content": message}]
response = openai_client.chat.completions.create(model="gpt-4o-mini", messages=messages)
assistant_response = response.choices[0].message.content
# Create new memories from the conversation
messages.append({"role": "assistant", "content": assistant_response})
memory.add(messages, user_id=user_id)
return assistant_response
def main():
print("Chat with AI (type 'exit' to quit)")
while True:
user_input = input("You: ").strip()
if user_input.lower() == 'exit':
print("Goodbye!")
break
print(f"AI: {chat_with_memories(user_input)}")
if __name__ == "__main__":
main()">
from openai import OpenAI from mem0 import Memory openai_client = OpenAI () memory = Memory () def chat_with_memories ( message : str , user_id : str = "default_user" ) -> str : # Retrieve relevant memories relevant_memories = memory . search ( query = message , user_id = user_id , limit = 3 ) memories_str = " n " . join ( f"- { entry [ 'memory' ] } " for entry in relevant_memories [ "results" ]) # Generate Assistant response system_prompt = f"You are a helpful AI. Answer the question based on query and memories. n User Memories: n { memories_str } " messages = [{ "role" : "system" , "content" : system_prompt }, { "role" : "user" , "content" : message }] response = openai_client . chat . completions . create ( model = "gpt-4o-mini" , messages = messages ) assistant_response = response . choices [ 0 ]. message . content # Create new memories from the conversation messages . append ({ "role" : "assistant" , "content" : assistant_response }) memory . add ( messages , user_id = user_id ) return assistant_response def main (): print ( "Chat with AI (type 'exit' to quit)" ) while True : user_input = input ( "You: " ). strip () if user_input . lower () == 'exit' : print ( "Goodbye!" ) break print ( f"AI: { chat_with_memories ( user_input ) } " ) if __name__ == "__main__" : main ()
有关详细的集成步骤,请参见QuickStart和API参考。
?集成与演示
- 带有内存的CHATGPT :由mem0提供动力的个性化聊天(现场演示)
- 浏览器扩展名:跨Chatgpt,困惑和Claude(Chrome Extension)存储回忆
- Langgraph支持:使用Langgraph + mem0构建客户机器人(指南)
- CREWAI集成:使用mem0定制Crewai输出(示例)
文档和支持
- 完整文档:https://docs.mem0.ai
- 社区:不和谐·Twitter
- 联系人:创始人@ mem0 .ai
引用
现在,我们有一张纸可以引用:
mem0,
title={ mem0 : Building Production-Ready AI Agents with Scalable Long-Term Memory},
author={Chhikara, Prateek and Khant, Dev and Aryan, Saket and Singh, Taranjeet and Yadav, Deshraj},
journal={arXiv preprint arXiv:2504.19413},
year={2025}
}">
@article { mem0 , title = { mem0 : Building Production-Ready AI Agents with Scalable Long-Term Memory } , author = { Chhikara, Prateek and Khant, Dev and Aryan, Saket and Singh, Taranjeet and Yadav, Deshraj } , journal = { arXiv preprint arXiv:2504.19413 } , year = { 2025 } }
⚖️许可证
Apache 2.0 - 有关详细信息,请参见许可证文件。
下载源码
通过命令行克隆项目:
git clone https://github.com/mem0ai/mem0.git