Files
sim/apps/docs/content/docs/zh/tools/mem0.mdx
Waleed 9a6a6fdacb improvement(docs): updated with new ss, docs script updated to copy items from main app into docs for tools (#1918)
* improvement(docs): updated script to copy over icons, cleanup unnecessary pages

* updated script with auto-icon generation

* ignore translations, only icons changed

* updated images

* updated i18n.lock

* updated images
2025-11-12 01:15:23 -08:00

99 lines
3.7 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: Mem0
description: 代理内存管理
---
import { BlockInfoCard } from "@/components/ui/block-info-card"
<BlockInfoCard
type="mem0"
color="#181C1E"
/>
{/* MANUAL-CONTENT-START:intro */}
[Mem0](https://mem0.ai) 是一个专为 AI 代理设计的强大内存管理系统。它提供了一个持久的、可搜索的内存存储,使代理能够记住过去的交互、从经验中学习,并在对话和工作流执行中保持上下文。
使用 Mem0您可以
- **存储代理记忆**:保存对话历史、用户偏好和重要上下文
- **检索相关信息**:使用语义搜索找到最相关的过去交互
- **构建上下文感知代理**:使您的代理能够参考过去的对话并保持连续性
- **个性化交互**:根据用户历史和偏好定制响应
- **实现长期记忆**:创建能够随着时间学习和适应的代理
- **扩展内存管理**:满足多个用户和复杂工作流的内存需求
在 Sim 中Mem0 集成使您的代理能够在工作流执行中保持持久记忆。这允许更自然、上下文感知的交互,代理可以回忆过去的对话、记住用户偏好,并基于先前的交互进行构建。通过将 Sim 与 Mem0 连接,您可以创建能够记住和从过去经验中学习的更具人性化的代理。该集成支持添加新记忆、语义搜索现有记忆以及检索特定记忆记录。这种内存管理功能对于构建能够随着时间保持上下文、根据用户历史个性化交互并通过积累知识不断提高性能的复杂代理至关重要。
{/* MANUAL-CONTENT-END */}
## 使用说明
将 Mem0 集成到工作流程中。可以添加、搜索和检索记忆。需要 API 密钥。
## 工具
### `mem0_add_memories`
向 Mem0 添加记忆以实现持久存储和检索
#### 输入
| 参数 | 类型 | 必需 | 描述 |
| --------- | ---- | -------- | ----------- |
| `userId` | string | 是 | 与记忆关联的用户 ID |
| `messages` | json | 是 | 包含角色和内容的消息对象数组 |
| `apiKey` | string | 是 | 您的 Mem0 API 密钥 |
#### 输出
| 参数 | 类型 | 描述 |
| --------- | ---- | ----------- |
| `ids` | array | 创建的记忆 ID 数组 |
| `memories` | array | 创建的记忆对象数组 |
### `mem0_search_memories`
使用语义搜索在 Mem0 中搜索记忆
#### 输入
| 参数 | 类型 | 必需 | 描述 |
| --------- | ---- | -------- | ----------- |
| `userId` | string | 是 | 要搜索记忆的用户 ID |
| `query` | string | 是 | 用于查找相关记忆的搜索查询 |
| `limit` | number | 否 | 要返回的最大结果数 |
| `apiKey` | string | 是 | 您的 Mem0 API 密钥 |
#### 输出
| 参数 | 类型 | 描述 |
| --------- | ---- | ----------- |
| `searchResults` | array | 包含记忆数据的搜索结果数组,每个结果包含 id、数据和分数 |
| `ids` | array | 搜索结果中找到的记忆 ID 数组 |
### `mem0_get_memories`
通过 ID 或筛选条件从 Mem0 中检索记忆
#### 输入
| 参数 | 类型 | 必需 | 描述 |
| --------- | ---- | -------- | ----------- |
| `userId` | string | 是 | 要检索记忆的用户 ID |
| `memoryId` | string | 否 | 要检索的特定记忆 ID |
| `startDate` | string | 否 | 按 created_at 筛选的开始日期格式YYYY-MM-DD|
| `endDate` | string | 否 | 按 created_at 筛选的结束日期格式YYYY-MM-DD|
| `limit` | number | 否 | 要返回的最大结果数量 |
| `apiKey` | string | 是 | 您的 Mem0 API 密钥 |
#### 输出
| 参数 | 类型 | 描述 |
| --------- | ---- | ----------- |
| `memories` | array | 检索到的记忆对象数组 |
| `ids` | array | 检索到的记忆 ID 数组 |
## 注意事项
- 类别:`tools`
- 类型:`mem0`