-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
131 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
title: Memory Operations | ||
description: Understanding the core operations for managing memories in AI applications | ||
icon: "gear" | ||
iconType: "solid" | ||
--- | ||
|
||
Mem0 provides two core operations for managing memories in AI applications: adding new memories and searching existing ones. This guide covers how these operations work and how to use them effectively in your application. | ||
|
||
|
||
## Core Operations | ||
|
||
Mem0 exposes two main endpoints for interacting with memories: | ||
- The `add` endpoint for ingesting conversations and storing them as memories | ||
- The `search` endpoint for retrieving relevant memories based on queries | ||
|
||
### Adding Memories | ||
|
||
<Frame caption="Architecture diagram illustrating the process of adding memories."> | ||
<img src="../images/add_architecture.png" /> | ||
</Frame> | ||
|
||
The add operation processes conversations through several steps: | ||
|
||
1. **Information Extraction** | ||
* An LLM extracts relevant memories from the conversation | ||
* It identifies important entities and their relationships | ||
|
||
2. **Conflict Resolution** | ||
* The system compares new information with existing data | ||
* It identifies and resolves any contradictions | ||
|
||
3. **Memory Storage** | ||
* Vector database stores the actual memories | ||
* Graph database maintains relationship information | ||
* Information is continuously updated with each interaction | ||
|
||
### Searching Memories | ||
|
||
<Frame caption="Architecture diagram illustrating the memory search process."> | ||
<img src="../images/search_architecture.png" /> | ||
</Frame> | ||
|
||
The search operation retrieves memories through a multi-step process: | ||
|
||
1. **Query Processing** | ||
* LLM processes and optimizes the search query | ||
* System prepares filters for targeted search | ||
|
||
2. **Vector Search** | ||
* Performs semantic search using the optimized query | ||
* Ranks results by relevance to the query | ||
* Applies specified filters (user, agent, metadata, etc.) | ||
|
||
3. **Result Processing** | ||
* Combines and ranks the search results | ||
* Returns memories with relevance scores | ||
* Includes associated metadata and timestamps | ||
|
||
This semantic search approach ensures accurate memory retrieval, whether you're looking for specific information or exploring related concepts. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
title: Memory Types | ||
description: Understanding different types of memory in AI Applications | ||
icon: "memory" | ||
iconType: "solid" | ||
--- | ||
To build useful AI applications, we need to understand how different memory systems work together. This guide explores the fundamental types of memory in AI systems and shows how Mem0 implements these concepts. | ||
|
||
## Why Memory Matters | ||
|
||
AI systems need memory for three key purposes: | ||
1. Maintaining context during conversations | ||
2. Learning from past interactions | ||
3. Building personalized experiences over time | ||
|
||
Without proper memory systems, AI applications would treat each interaction as completely new, losing valuable context and personalization opportunities. | ||
|
||
## Short-Term Memory | ||
|
||
The most basic form of memory in AI systems holds immediate context - like a person remembering what was just said in a conversation. This includes: | ||
|
||
- **Conversation History**: Recent messages and their order | ||
- **Working Memory**: Temporary variables and state | ||
- **Attention Context**: Current focus of the conversation | ||
|
||
## Long-Term Memory | ||
|
||
More sophisticated AI applications implement long-term memory to retain information across conversations. This includes: | ||
|
||
- **Factual Memory**: Stored knowledge about users, preferences, and domain-specific information | ||
- **Episodic Memory**: Past interactions and experiences | ||
- **Semantic Memory**: Understanding of concepts and their relationships | ||
|
||
## Memory Characteristics | ||
|
||
Each memory type has distinct characteristics: | ||
|
||
| Type | Persistence | Access Speed | Use Case | | ||
|------|-------------|--------------|-----------| | ||
| Short-Term | Temporary | Instant | Active conversations | | ||
| Long-Term | Persistent | Fast | User preferences and history | | ||
|
||
## How Mem0 Implements Long-Term Memory | ||
Mem0's long-term memory system builds on these foundations by: | ||
|
||
1. Using vector embeddings to store and retrieve semantic information | ||
2. Maintaining user-specific context across sessions | ||
3. Implementing efficient retrieval mechanisms for relevant past interactions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters