Skip to content

Commit 4748726

Browse files
committed
Refine memory API documentation and enhance store creation details
1 parent 764329f commit 4748726

2 files changed

Lines changed: 77 additions & 8 deletions

File tree

docs/api/memory.md

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ GET /api/client/v1/memory/stores/:storeKey/memories?scope=user&scopeId=user-123&
9696
```
9797

9898
```json
99-
{ "memories": [...], "total": 25 }
99+
{ "items": [...], "total": 25 }
100100
```
101101

102102
| Query Parameter | Description |
@@ -167,6 +167,64 @@ POST /api/client/v1/memory/stores/:storeKey/search
167167
| `scopeId` | string || Filter by scope ID |
168168
| `tags` | string[] || Filter by tags |
169169

170+
Response:
171+
172+
```json
173+
{
174+
"memories": [
175+
{
176+
"id": "mem_123",
177+
"content": "User prefers dark mode and concise responses",
178+
"score": 0.94,
179+
"scope": "user",
180+
"scopeId": "user-123",
181+
"tags": ["preferences", "ui"],
182+
"metadata": { "source": "conversation" },
183+
"importance": 0.8
184+
}
185+
],
186+
"query": "What are the user's UI preferences?",
187+
"storeKey": "mem-agent-working-memory"
188+
}
189+
```
190+
191+
### Recall for Chat
192+
193+
```
194+
POST /api/client/v1/memory/stores/:storeKey/recall
195+
```
196+
197+
```json
198+
{
199+
"query": "What should I remember before answering?",
200+
"topK": 5,
201+
"scope": "user",
202+
"scopeId": "user-123",
203+
"maxTokens": 800
204+
}
205+
```
206+
207+
Response:
208+
209+
```json
210+
{
211+
"context": "- User prefers dark mode and concise responses",
212+
"memories": [
213+
{
214+
"id": "mem_123",
215+
"content": "User prefers dark mode and concise responses",
216+
"score": 0.94,
217+
"scope": "user",
218+
"scopeId": "user-123",
219+
"tags": ["preferences", "ui"],
220+
"metadata": { "source": "conversation" },
221+
"importance": 0.8
222+
}
223+
],
224+
"storeKey": "mem-agent-working-memory"
225+
}
226+
```
227+
170228
## Errors
171229

172230
| Status | Description |

docs/guide/memory.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,17 @@ The memory service provides semantic memory stores for AI agents — enabling th
3030
| `searchMemories()` | Semantic search |
3131
| `recallForChat()` | Chat-optimized recall with token limit |
3232

33-
## Store Configuration
33+
## Create Store Request
3434

3535
```json
3636
{
3737
"name": "Agent Working Memory",
38-
"key": "agent-memory",
3938
"vectorProviderKey": "pinecone-prod",
4039
"embeddingModelKey": "text-embedding-ada-002"
4140
}
4241
```
4342

44-
Creating a store automatically provisions a vector index.
43+
The store key is generated automatically, and creating a store provisions the backing vector index.
4544

4645
## Client API
4746

@@ -80,22 +79,31 @@ Authorization: Bearer <token>
8079
{
8180
"query": "What are the user's UI preferences?",
8281
"topK": 5,
83-
"filter": { "scope": "user" }
82+
"scope": "user",
83+
"scopeId": "user-123",
84+
"tags": ["preferences"],
85+
"minScore": 0.7
8486
}
8587
```
8688

8789
Response:
8890

8991
```json
9092
{
91-
"results": [
93+
"memories": [
9294
{
95+
"id": "mem_123",
9396
"content": "User prefers dark mode and concise responses",
9497
"score": 0.94,
98+
"scope": "user",
99+
"scopeId": "user-123",
95100
"tags": ["preferences", "ui"],
101+
"metadata": { "userId": "user-123" },
96102
"importance": 0.8
97103
}
98-
]
104+
],
105+
"query": "What are the user's UI preferences?",
106+
"storeKey": "mem-agent-working-memory"
99107
}
100108
```
101109

@@ -109,11 +117,14 @@ Authorization: Bearer <token>
109117
```json
110118
{
111119
"query": "What does this user like?",
120+
"scope": "user",
121+
"scopeId": "user-123",
122+
"topK": 5,
112123
"maxTokens": 500
113124
}
114125
```
115126

116-
The recall function is optimized for chat contexts — it retrieves relevant memories and fits them within a token budget.
127+
The recall function is optimized for chat contexts. It returns a compact `context` string together with the matched `memories`, trimmed to fit the requested token budget.
117128

118129
## Memory Properties
119130

0 commit comments

Comments
 (0)