ReMeLongTermMemory
public class ReMeLongTermMemory implements LongTermMemory
io/agentscope/core/memory/reme/ReMeLongTermMemory.java:66–306Re Me Long Term 记忆,在多次调用之间保存和恢复会话与记忆数据。位于 io.agentscope.core.memory.reme 包,实现 LongTermMemory。核心成员包括 record、retrieve、builder。
Long-term memory implementation using ReMe as the store.
This implementation integrates with ReMe, a memory layer for AI applications that provides persistent, searchable memory storage using LLM-powered memory extraction.
Key Features:
-
LLM-powered memory extraction and inference
-
Workspace-based memory isolation
-
Automatic memory summarization from conversation trajectories
-
Reactive, non-blocking operations
Memory Isolation: Memories are organized by userId (mapped to ReMe's workspace_id), enabling multi-tenant scenarios where different users maintain separate memory contexts.
Usage Example:
`// Create memory instance
ReMeLongTermMemory memory = ReMeLongTermMemory.builder()
.userId("task_workspace")
.apiBaseUrl("http://localhost:8002")
.build();
// Use in ReActAgent
ReActAgent agent = ReActAgent.builder()
.name("Assistant")
.model(model)
.longTermMemory(memory)
.longTermMemoryMode(LongTermMemoryMode.BOTH)
.build();
`
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Builder | 类class | ReMeLongTermMemory的构建器。 Builder for ReMeLongTermMemory. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Mono<Void> record(List<Msg> msgs) | 设置记录。 Records messages to long-term memory. |
public Mono<String> retrieve(Msg msg) | 按查询检索相关文档。 Retrieves relevant memories based on the input message. |
public static Builder builder()static | 创建新的构建器用于 ReMeLongTermMemory。 Creates a new builder for ReMeLongTermMemory. |
方法详情Method Detail
record
public Mono<Void> record(List<Msg> msgs)
设置记录。
Records messages to long-term memory.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 列出的消息到。List of messages to record |
Mono<Void>io/agentscope/core/memory/reme/ReMeLongTermMemory.java:108–168retrieve
public Mono<String> retrieve(Msg msg)
按查询检索相关文档。
Retrieves relevant memories based on the input message.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msg | Msg | 消息到使用 as 搜索查询。The message to use as a search query |
Mono<String>io/agentscope/core/memory/reme/ReMeLongTermMemory.java:209–244builder
public static Builder builder()
创建新的构建器用于 ReMeLongTermMemory。
Creates a new builder for ReMeLongTermMemory.
Builderio/agentscope/core/memory/reme/ReMeLongTermMemory.java:251–253嵌套类详情Nested Class Detail
Builder
public static class BuilderReMeLongTermMemory的构建器。位于 io.agentscope.core.memory.reme 包。核心成员包括 userId、apiBaseUrl、timeout、build。
Builder for ReMeLongTermMemory.