Builder
public static class Builder
源码Source
io/agentscope/core/memory/mem0/Mem0LongTermMemory.java:306–438Mem0LongTermMemory的构建器。位于 io.agentscope.core.memory.mem0 包。核心成员包括 agentName、userId、runName、apiBaseUrl、apiKey、timeout。
Builder for Mem0LongTermMemory.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Builder agentName(String agentName) | 设置智能体名称。 Sets the agent name identifier. |
public Builder userId(String userId) | 设置用户标识。 Sets the user id identifier. |
public Builder runName(String runName) | 设置运行名称。 Sets the run name identifier. |
public Builder apiBaseUrl(String apiBaseUrl) | 设置Mem0 API 基类 URL。 Sets the Mem0 API base URL. |
public Builder apiKey(String apiKey) | 设置Mem0 API 密钥。 Sets the Mem0 API key. |
public Builder timeout(Duration timeout) | 设置HTTP 请求超时。 Sets the HTTP request timeout. |
public Builder apiType(Mem0ApiType apiType) | 设置Mem0 API 类型。 Sets the Mem0 API type. |
public Builder metadata(Map<String, Object> metadata) | 设置元数据。 Sets custom metadata to be stored with memories and used for filtering. |
public Mem0LongTermMemory build() | 构建Mem0LongTermMemory 实例。 Builds the Mem0LongTermMemory instance. |
方法详情Method Detail
agentName
public Builder agentName(String agentName)
设置智能体名称。
Sets the agent name identifier.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agentName | String | 智能体's 名称。The agent's name |
Builder返回当前实例,以支持链式调用。This builder
源码Source
io/agentscope/core/memory/mem0/Mem0LongTermMemory.java:322–325userId
public Builder userId(String userId)
设置用户标识。
Sets the user id identifier.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户's 标识。The user's ID |
Builder返回当前实例,以支持链式调用。This builder
源码Source
io/agentscope/core/memory/mem0/Mem0LongTermMemory.java:333–336runName
public Builder runName(String runName)
设置运行名称。
Sets the run name identifier.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
runName | String | 运行/会话名称或标识。The run/session name or ID |
Builder返回当前实例,以支持链式调用。This builder
源码Source
io/agentscope/core/memory/mem0/Mem0LongTermMemory.java:344–347apiBaseUrl
public Builder apiBaseUrl(String apiBaseUrl)
设置Mem0 API 基类 URL。
Sets the Mem0 API base URL.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
apiBaseUrl | String | API 基类 URL(类型 `String`)。The base URL (e.g., "http://localhost:8000") |
Builder返回当前实例,以支持链式调用。This builder
源码Source
io/agentscope/core/memory/mem0/Mem0LongTermMemory.java:355–358apiKey
public Builder apiKey(String apiKey)
设置Mem0 API 密钥。
Sets the Mem0 API key.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
apiKey | String | API 键(类型 `String`)。The API key for authentication (optional for local deployments without authentication) |
Builder返回当前实例,以支持链式调用。This builder
源码Source
io/agentscope/core/memory/mem0/Mem0LongTermMemory.java:367–370timeout
public Builder timeout(Duration timeout)
设置HTTP 请求超时。
Sets the HTTP request timeout.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
timeout | Duration | 超时时长。The timeout duration |
Builder返回当前实例,以支持链式调用。This builder
源码Source
io/agentscope/core/memory/mem0/Mem0LongTermMemory.java:378–381apiType
public Builder apiType(Mem0ApiType apiType)
设置Mem0 API 类型。
Sets the Mem0 API type.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
apiType | Mem0ApiType | API 类型。API type enum |
Builder返回当前实例,以支持链式调用。This builder
源码Source
io/agentscope/core/memory/mem0/Mem0LongTermMemory.java:389–392metadata
public Builder metadata(Map<String, Object> metadata)
设置元数据。
Sets custom metadata to be stored with memories and used for filtering.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
metadata | Map<String, Object> | 元数据(类型 `Map`)。Custom metadata map (can be null) |
Builder返回当前实例,以支持链式调用。This builder
源码Source
io/agentscope/core/memory/mem0/Mem0LongTermMemory.java:420–423build
public Mem0LongTermMemory build()
构建Mem0LongTermMemory 实例。
Builds the Mem0LongTermMemory instance.
Mem0LongTermMemory一种新的Mem0LongTermMemory 实例。A new Mem0LongTermMemory instance
IllegalArgumentException可能抛出 `IllegalArgumentException`。If required fields are missing
源码Source
io/agentscope/core/memory/mem0/Mem0LongTermMemory.java:431–437