AS AgentScopeAPI 手册 / API Reference

Mem0AddRequest

@JsonInclude(JsonInclude.Include.NON_NULL) public class Mem0AddRequest
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:36–468

Mem 0 添加请求,在多次调用之间保存和恢复会话与记忆数据。位于 io.agentscope.core.memory.mem0 包。核心成员包括 getMessages、setMessages、getAgentId、setAgentId、getUserId、setUserId。

Request object for adding memories to Mem0 API.

This request is sent to the Mem0 API's POST /v1/memories/ endpoint to record new memories. Mem0 will process the messages and extract memorable information using LLM-powered inference (unless infer is set to false).

The metadata fields (agentId, userId, runId, appId) are used to organize and filter memories, enabling multi-tenant and multi-agent scenarios.

The API supports v2 version which is recommended for new applications. Set version to "v2" to use the latest features.

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
Builder类class
Mem0AddRequest的构建器。
Builder for Mem0AddRequest.

构造器摘要Constructor Summary

构造器Constructor说明Description
public Mem0AddRequest()
初始化 `Mem0AddRequest` 实例。
Default constructor for Jackson.

方法摘要Method Summary

方法Method说明Description
public List<Mem0Message> getMessages()
获取消息。
Returns the messages.
public void setMessages(List<Mem0Message> messages)
设置消息。
Sets the messages.
public String getAgentId()
获取智能体标识。
Returns the agent id.
public void setAgentId(String agentId)
设置智能体标识。
Sets the agent id.
public String getUserId()
获取用户标识。
Returns the user id.
public void setUserId(String userId)
设置用户标识。
Sets the user id.
public String getAppId()
获取应用标识。
Returns the app id.
public void setAppId(String appId)
设置应用标识。
Sets the app id.
public String getRunId()
获取运行标识。
Returns the run id.
public void setRunId(String runId)
设置运行标识。
Sets the run id.
public Map<String, Object> getMetadata()
获取元数据。
Returns the metadata.
public void setMetadata(Map<String, Object> metadata)
设置元数据。
Sets the metadata.
public String getIncludes()
获取 `getIncludes`。
Returns the includes.
public void setIncludes(String includes)
设置 `setIncludes`。
Sets the includes.
public String getExcludes()
获取 `getExcludes`。
Returns the excludes.
public void setExcludes(String excludes)
设置 `setExcludes`。
Sets the excludes.
public Boolean getInfer()
获取 `getInfer`。
Returns the infer.
public void setInfer(Boolean infer)
设置 `setInfer`。
Sets the infer.
public String getOutputFormat()
获取输出格式。
Returns the output format.
public void setOutputFormat(String outputFormat)
设置输出格式。
Sets the output format.
public Map<String, Object> getCustomCategories()
获取自定义类别。
Returns the custom categories.
public void setCustomCategories(Map<String, Object> customCategories)
设置自定义类别。
Sets the custom categories.
public String getCustomInstructions()
获取自定义指令。
Returns the custom instructions.
public void setCustomInstructions(String customInstructions)
设置自定义指令。
Sets the custom instructions.
public Boolean getImmutable()
获取不可变。
Returns the immutable.
public void setImmutable(Boolean immutable)
设置不可变。
Sets the immutable.
public Boolean getAsyncMode()
获取异步模式。
Returns the async mode.
public void setAsyncMode(Boolean asyncMode)
设置异步模式。
Sets the async mode.
public Long getTimestamp()
获取时间戳。
Returns the timestamp.
public void setTimestamp(Long timestamp)
设置时间戳。
Sets the timestamp.
public String getExpirationDate()
获取 `getExpirationDate`。
Returns the expiration date.
public void setExpirationDate(String expirationDate)
设置 `setExpirationDate`。
Sets the expiration date.
public String getOrgId()
获取 `getOrgId`。
Returns the org id.
public void setOrgId(String orgId)
设置 `setOrgId`。
Sets the org id.
public String getProjectId()
获取 `getProjectId`。
Returns the project id.
public void setProjectId(String projectId)
设置 `setProjectId`。
Sets the project id.
public String getVersion()
获取版本。
Returns the version.
public void setVersion(String version)
设置版本。
Sets the version.
public String getMemoryType()
deprecated
获取记忆类型。
Gets the memory type.
public void setMemoryType(String memoryType)
deprecated
设置记忆类型。
Sets the memory type.
public static Builder builder()
static
创建新的构建器用于 Mem0AddRequest。
Creates a new builder for Mem0AddRequest.

构造器详情Constructor Detail

Mem0AddRequest

public Mem0AddRequest()

初始化 Mem0AddRequest 实例。

Default constructor for Jackson.

源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:120–125

方法详情Method Detail

getMessages

public List<Mem0Message> getMessages()

获取消息。

Returns the messages.

返回Returns List<Mem0Message>
返回列出。Returns list.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:129–131

setMessages

public void setMessages(List<Mem0Message> messages)

设置消息。

Sets the messages.

参数Parameters
名称Name类型Type说明Description
messagesList<Mem0Message>消息列表(类型 `List`)。The messages.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:133–135

getAgentId

public String getAgentId()

获取智能体标识。

Returns the agent id.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:137–139

setAgentId

public void setAgentId(String agentId)

设置智能体标识。

Sets the agent id.

参数Parameters
名称Name类型Type说明Description
agentIdString智能体标识(类型 `String`)。The agent id.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:141–143

getUserId

public String getUserId()

获取用户标识。

Returns the user id.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:145–147

setUserId

public void setUserId(String userId)

设置用户标识。

Sets the user id.

参数Parameters
名称Name类型Type说明Description
userIdString用户标识(类型 `String`)。The user id.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:149–151

getAppId

public String getAppId()

获取应用标识。

Returns the app id.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:153–155

setAppId

public void setAppId(String appId)

设置应用标识。

Sets the app id.

参数Parameters
名称Name类型Type说明Description
appIdString应用标识(类型 `String`)。The app id.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:157–159

getRunId

public String getRunId()

获取运行标识。

Returns the run id.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:161–163

setRunId

public void setRunId(String runId)

设置运行标识。

Sets the run id.

参数Parameters
名称Name类型Type说明Description
runIdString运行标识(类型 `String`)。The run id.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:165–167

getMetadata

public Map<String, Object> getMetadata()

获取元数据。

Returns the metadata.

返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:169–171

setMetadata

public void setMetadata(Map<String, Object> metadata)

设置元数据。

Sets the metadata.

参数Parameters
名称Name类型Type说明Description
metadataMap<String, Object>元数据(类型 `Map`)。The metadata.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:173–175

getIncludes

public String getIncludes()

获取 getIncludes。

Returns the includes.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:177–179

setIncludes

public void setIncludes(String includes)

设置 setIncludes。

Sets the includes.

参数Parameters
名称Name类型Type说明Description
includesStringincludes(类型 `String`)。The includes.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:181–183

getExcludes

public String getExcludes()

获取 getExcludes。

Returns the excludes.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:185–187

setExcludes

public void setExcludes(String excludes)

设置 setExcludes。

Sets the excludes.

参数Parameters
名称Name类型Type说明Description
excludesStringexcludes(类型 `String`)。The excludes.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:189–191

getInfer

public Boolean getInfer()

获取 getInfer。

Returns the infer.

返回Returns Boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:193–195

setInfer

public void setInfer(Boolean infer)

设置 setInfer。

Sets the infer.

参数Parameters
名称Name类型Type说明Description
inferBooleaninfer(类型 `Boolean`)。The infer.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:197–199

getOutputFormat

public String getOutputFormat()

获取输出格式。

Returns the output format.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:201–203

setOutputFormat

public void setOutputFormat(String outputFormat)

设置输出格式。

Sets the output format.

参数Parameters
名称Name类型Type说明Description
outputFormatString输出格式(类型 `String`)。The output format.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:205–207

getCustomCategories

public Map<String, Object> getCustomCategories()

获取自定义类别。

Returns the custom categories.

返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:209–211

setCustomCategories

public void setCustomCategories(Map<String, Object> customCategories)

设置自定义类别。

Sets the custom categories.

参数Parameters
名称Name类型Type说明Description
customCategoriesMap<String, Object>自定义类别(类型 `Map`)。The custom categories.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:213–215

getCustomInstructions

public String getCustomInstructions()

获取自定义指令。

Returns the custom instructions.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:217–219

setCustomInstructions

public void setCustomInstructions(String customInstructions)

设置自定义指令。

Sets the custom instructions.

参数Parameters
名称Name类型Type说明Description
customInstructionsString自定义指令(类型 `String`)。The custom instructions.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:221–223

getImmutable

public Boolean getImmutable()

获取不可变。

Returns the immutable.

返回Returns Boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:225–227

setImmutable

public void setImmutable(Boolean immutable)

设置不可变。

Sets the immutable.

参数Parameters
名称Name类型Type说明Description
immutableBoolean不可变(类型 `Boolean`)。The immutable.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:229–231

getAsyncMode

public Boolean getAsyncMode()

获取异步模式。

Returns the async mode.

返回Returns Boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:233–235

setAsyncMode

public void setAsyncMode(Boolean asyncMode)

设置异步模式。

Sets the async mode.

参数Parameters
名称Name类型Type说明Description
asyncModeBoolean异步模式(类型 `Boolean`)。The async mode.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:237–239

getTimestamp

public Long getTimestamp()

获取时间戳。

Returns the timestamp.

返回Returns Long
返回数值结果。Returns a numeric result.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:241–243

setTimestamp

public void setTimestamp(Long timestamp)

设置时间戳。

Sets the timestamp.

参数Parameters
名称Name类型Type说明Description
timestampLong时间戳(类型 `Long`)。The timestamp.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:245–247

getExpirationDate

public String getExpirationDate()

获取 getExpirationDate。

Returns the expiration date.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:249–251

setExpirationDate

public void setExpirationDate(String expirationDate)

设置 setExpirationDate。

Sets the expiration date.

参数Parameters
名称Name类型Type说明Description
expirationDateStringexpiration 日期(类型 `String`)。The expiration date.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:253–255

getOrgId

public String getOrgId()

获取 getOrgId。

Returns the org id.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:257–259

setOrgId

public void setOrgId(String orgId)

设置 setOrgId。

Sets the org id.

参数Parameters
名称Name类型Type说明Description
orgIdStringorg 标识(类型 `String`)。The org id.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:261–263

getProjectId

public String getProjectId()

获取 getProjectId。

Returns the project id.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:265–267

setProjectId

public void setProjectId(String projectId)

设置 setProjectId。

Sets the project id.

参数Parameters
名称Name类型Type说明Description
projectIdStringproject 标识(类型 `String`)。The project id.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:269–271

getVersion

public String getVersion()

获取版本。

Returns the version.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:273–275

setVersion

public void setVersion(String version)

设置版本。

Sets the version.

参数Parameters
名称Name类型Type说明Description
versionString版本(类型 `String`)。The version.
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:277–279

getMemoryType

public String getMemoryType()
deprecated

获取记忆类型。

Gets the memory type.

已弃用。Deprecated. 已弃用,请改用受支持的替代 API。Not in official API spec
返回Returns String
记忆类型。The memory type
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:287–290

setMemoryType

public void setMemoryType(String memoryType)
deprecated

设置记忆类型。

Sets the memory type.

已弃用。Deprecated. 已弃用,请改用受支持的替代 API。Not in official API spec
参数Parameters
名称Name类型Type说明Description
memoryTypeString记忆类型。The memory type
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:298–301

builder

public static Builder builder()
static

创建新的构建器用于 Mem0AddRequest。

Creates a new builder for Mem0AddRequest.

返回Returns Builder
一种新的构建器实例。A new builder instance
源码Source io/agentscope/core/memory/mem0/Mem0AddRequest.java:308–310

嵌套类详情Nested Class Detail

Builder

public static class Builder

Mem0AddRequest的构建器。位于 io.agentscope.core.memory.mem0 包。核心成员包括 messages、agentId、userId、appId、runId、metadata。

Builder for Mem0AddRequest.

基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.