You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In multi-turn and multiple sessions, an Agent often needs to "remember what happened before": such as user preferences, historical conclusions, previously confirmed facts, etc. Blades provides Memory capabilities for storing and retrieving information across multiple Sessions, allowing the Agent to "recall" context in new conversations, thereby reducing repetitive questioning and improving consistency.
8
8
9
-
## What problem does Memory solve?
9
+
###What problem does Memory solve?
10
10
11
11
- Session / State addresses the organization and temporary data management "within the current conversation thread" (the tutorial is covered in the previous chapter).
12
12
- Memory is oriented towards "historical information across multiple sessions," which can be retrieved to assist in current responses. It can be understood as the Agent's "retrievable archive/knowledge base."
13
13
14
-
## Enabling the Agent with Memory Retrieval Capabilities
14
+
###Enabling the Agent with Memory Retrieval Capabilities
15
15
The Memory usage process in Blades can be summarized in 4 steps:
16
16
1. Create a MemoryStore (memory library)
17
17
2. Create a MemoryTool (enabling the Agent to actively retrieve memories)
18
18
3. Inject the MemoryTool into the Agent (WithTools), then run the conversation
19
19
20
-
## Creating a Memory Database
20
+
###Creating a Memory Database
21
21
22
22
NewInMemoryStore() creates an in-memory version of MemoryStore, suitable for examples and local development.
23
23
24
24
```go
25
25
memoryStore:= memory.NewInMemoryStore()
26
26
```
27
27
28
-
## Creating an Agent and Adding Memory Tools
28
+
###Creating an Agent and Adding Memory Tools
29
29
30
30
In the Agent configuration, add `memory tools` (the example uses blades.WithTools(memoryTool)), and prompt the model in the Instruction to "use the Memory tool when necessary to query memory content."
0 commit comments