Skip to content

Commit 07bb7d6

Browse files
committed
Update README.md
1 parent dec68de commit 07bb7d6

File tree

1 file changed

+82
-121
lines changed

1 file changed

+82
-121
lines changed

README.md

Lines changed: 82 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1,137 +1,114 @@
1-
# Redis Memory Server
1+
# Redis Agentic Memory
22

3-
A service that provides memory management for AI applications using Redis. This server helps manage both short-term and long-term memory for AI conversations, with features like automatic topic extraction, entity recognition, and context summarization.
3+
Redis Memory Server is a high-performance and flexible server for managing
4+
short-term and long-term memory for agents using Redis. It provides both REST
5+
API endpoints and an MCP (Managed Control Plane) server interface for robust
6+
memory operations in AI applications.
47

58
## Features
69

710
- **Short-Term Memory Management**
811
- Configurable window size for recent messages
9-
- Automatic context summarization using LLMs
12+
- Automatic conversation summarization using LLMs
1013
- Token limit management based on model capabilities
1114

1215
- **Long-Term Memory**
13-
- Semantic search capabilities
16+
- Semantic search over messages
1417
- Automatic message indexing
15-
- Configurable memory retention
18+
- Topic modeling with BERTopic
19+
- Named Entity Recognition using BERT
1620

1721
- **Advanced Features**
18-
- Topic extraction using BERTopic
19-
- Named Entity Recognition using BERT
20-
- Support for multiple model providers (OpenAI and Anthropic)
22+
- Support for OpenAI and Anthropic model providers
2123
- Namespace support for session isolation
2224

23-
## Get Started
2425

25-
### Docker Compose
26+
## REST API Endpoints
2627

27-
To start the API using Docker Compose, follow these steps:
28+
The following endpoints are available:
2829

29-
1. Ensure that Docker and Docker Compose are installed on your system.
30+
- **GET /health**
31+
A simple health check endpoint returning the current server time.
32+
Example Response:
33+
```json
34+
{"now": 1616173200}
35+
```
3036

31-
2. Open a terminal in the project root directory (where the docker-compose.yml file is located).
37+
- **GET /sessions/**
38+
Retrieves a paginated list of session IDs.
39+
_Query Parameters:_
40+
- `page` (int): Page number (default: 1)
41+
- `size` (int): Number of sessions per page (default: 10)
42+
- `namespace` (string, optional): Filter sessions by namespace.
3243

33-
3. (Optional) Set up your environment variables (such as OPENAI_API_KEY and ANTHROPIC_API_KEY) either in a .env file or by modifying the docker-compose.yml as needed.
44+
- **GET /sessions/{session_id}/memory**
45+
Retrieves conversation memory for a session, including messages and context.
3446

35-
4. Build and start the containers by running:
36-
docker-compose up --build
37-
38-
5. Once the containers are up, the API will be available at http://localhost:8000. You can also access the interactive API documentation at http://localhost:8000/docs.
39-
40-
6. To stop the containers, press Ctrl+C in the terminal and then run:
41-
docker-compose down
42-
43-
Happy coding!
47+
- **POST /sessions/{session_id}/memory**
48+
Adds messages (and optional context) to a session's memory.
49+
_Request Body Example:_
50+
```json
51+
{
52+
"messages": [
53+
{"role": "user", "content": "Hello"},
54+
{"role": "assistant", "content": "Hi there"}
55+
],
56+
"context": "Optional context"
57+
}
58+
```
4459

60+
- **DELETE /sessions/{session_id}/memory**
61+
Deletes all stored memory (messages, context, token count) for a session.
4562

46-
## API Reference
63+
- **POST /sessions/{session_id}/search**
64+
Performs a semantic search on the messages within a session.
65+
_Request Body Example:_
66+
```json
67+
{
68+
"text": "Search query text"
69+
}
70+
```
4771

48-
### API Docs
72+
## MCP Server Interface
73+
Redis Memory Server also offers an MCP (Model Context Protocol) server interface powered by FastMCP, providing tool-based memory operations:
4974

50-
API documentation is available at: http://localhost:8000/docs.
75+
- **list_sessions**: Retrieve available memory sessions with optional pagination.
76+
- **get_session_memory**: Fetch memory (messages and context) for a specific session.
77+
- **add_memory**: Add messages and context to a session's memory.
78+
- **delete_session_memory**: Remove all memory data for a session.
79+
- **search_memory**: Perform semantic search across session messages.
80+
- **memory_prompt**: Generate prompts enriched with memory context and long-term memories.
5181

52-
### Endpoint Preview
82+
## Getting Started
5383

54-
#### List Sessions
55-
```http
56-
GET /sessions/
57-
```
84+
### Local Install
5885

59-
Query Parameters:
60-
- `page` (int): Page number (default: 1)
61-
- `size` (int): Items per page (default: 10)
62-
- `namespace` (string, optional): Filter sessions by namespace
63-
64-
Response:
65-
```json
66-
[
67-
"session-1",
68-
"session-2"
69-
]
70-
```
86+
1. Install the package and required dependencies:
87+
```bash
88+
pip install -e .
89+
```
7190

72-
#### Get Memory
73-
```http
74-
GET /sessions/{session_id}/memory
75-
```
91+
2. Start both the REST API server and MCP server:
92+
```bash
93+
python -m redis_memory_server.main
7694

77-
Response:
78-
```json
79-
{
80-
"messages": [
81-
{
82-
"role": "user",
83-
"content": "Hello, how are you?",
84-
"topics": ["greeting", "well-being"],
85-
"entities": []
86-
}
87-
],
88-
"context": "Optional context for the conversation",
89-
"tokens": 123
90-
}
91-
```
95+
### Docker Compose
9296

93-
#### Add Messages to Memory
94-
```http
95-
POST /sessions/{session_id}/memory
96-
```
97+
To start the API using Docker Compose, follow these steps:
9798

98-
Request Body:
99-
```json
100-
{
101-
"messages": [
102-
{
103-
"role": "user",
104-
"content": "Hello, how are you?"
105-
}
106-
],
107-
"context": "Optional context for the conversation"
108-
}
109-
```
99+
1. Ensure that Docker and Docker Compose are installed on your system.
110100

111-
Query Parameters:
112-
- `namespace` (string, optional): Namespace for the session
101+
2. Open a terminal in the project root directory (where the docker-compose.yml file is located).
113102

114-
Response:
115-
```json
116-
{
117-
"status": "ok"
118-
}
119-
```
103+
3. (Optional) Set up your environment variables (such as OPENAI_API_KEY and ANTHROPIC_API_KEY) either in a .env file or by modifying the docker-compose.yml as needed.
120104

121-
#### Delete Session
122-
```http
123-
DELETE /sessions/{session_id}/memory
124-
```
105+
4. Build and start the containers by running:
106+
docker-compose up --build
125107

126-
Query Parameters:
127-
- `namespace` (string, optional): Namespace for the session
108+
5. Once the containers are up, the API will be available at http://localhost:8000. You can also access the interactive API documentation at http://localhost:8000/docs.
128109

129-
Response:
130-
```json
131-
{
132-
"status": "ok"
133-
}
134-
```
110+
6. To stop the containers, press Ctrl+C in the terminal and then run:
111+
docker-compose down
135112

136113
## Configuration
137114

@@ -152,40 +129,23 @@ You can configure the service using environment variables:
152129
| `ENABLE_TOPIC_EXTRACTION` | Enable/disable topic extraction | `True` |
153130
| `ENABLE_NER` | Enable/disable named entity recognition | `True` |
154131

155-
## Supported Models
156-
157-
### Large Language Models
158-
159-
Redis Memory Server supports using OpenAI and Anthropic models for generation, and OpenAI models for embeddings.
160-
161-
### Topic and NER Models
162-
- **Topic Extraction**: BERTopic with Wikipedia-trained model
163-
- **Named Entity Recognition**: BERT model fine-tuned on CoNLL-03 dataset
164-
165-
> **Note**: Embedding operations use OpenAI models exclusively, as Anthropic does not provide an embedding API.
166132

167-
## Installation
133+
## Development
168134

169-
1. Clone the repository:
170-
```bash
171-
git clone https://github.com/yourusername/redis-memory-server.git
172-
cd redis-memory-server
173-
```
135+
### Installation
174136

175-
2. Install dependencies:
137+
1. Install dependencies:
176138
```bash
177139
pip install -e ".[dev]"
178140
```
179141

180-
3. Set up environment variables (see Configuration section)
142+
2. Set up environment variables (see Configuration section)
181143

182-
4. Run the server:
144+
3. Run the server:
183145
```bash
184-
python -m redis_memory_server
146+
python -m redis_memory_server.main
185147
```
186148

187-
## Development
188-
189149
### Running Tests
190150
```bash
191151
python -m pytest
@@ -199,6 +159,7 @@ python -m pytest
199159
5. Create a Pull Request
200160

201161
## License
162+
202163
This project derives from original work from the Motorhead project:
203164
https://github.com/getmetal/motorhead/
204165

0 commit comments

Comments
 (0)