AS AgentScopeAPI 手册 / API Reference

Mem0Message

@JsonInclude(JsonInclude.Include.NON_NULL) public class Mem0Message
源码Source io/agentscope/core/memory/mem0/Mem0Message.java:29–128

以Mem0 API格式表示消息。位于 io.agentscope.core.memory.mem0 包。核心成员包括 getRole、setRole、getContent、setContent、getName、setName。

Represents a message in the Mem0 API format.

Messages are the primary input format for Mem0's memory recording. Each message has a role (user or assistant), content, and optionally a name identifier.

Mem0 processes these messages to extract and infer memorable information, which is then stored in the vector database for future retrieval.

嵌套类摘要Nested Class Summary

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

构造器摘要Constructor Summary

构造器Constructor说明Description
public Mem0Message()
初始化 `Mem0Message` 实例。
Default constructor for Jackson deserialization.
public Mem0Message(String role, String content)
初始化 `Mem0Message` 实例。
Creates a new Mem0Message with specified role and content.
public Mem0Message(String role, String content, String name)
创建新的Mem0Message 使用角色,内容,和名称。
Creates a new Mem0Message with role, content, and name.

方法摘要Method Summary

方法Method说明Description
public String getRole()
获取角色。
Returns the role.
public void setRole(String role)
设置角色。
Sets the role.
public String getContent()
获取内容。
Returns the content.
public void setContent(String content)
设置内容。
Sets the content.
public String getName()
获取名称。
Returns the name.
public void setName(String name)
设置名称。
Sets the name.
public static Builder builder()
static
返回构建器实例。
Builder for creating Mem0Message instances.

构造器详情Constructor Detail

Mem0Message

public Mem0Message()

初始化 Mem0Message 实例。

Default constructor for Jackson deserialization.

源码Source io/agentscope/core/memory/mem0/Mem0Message.java:42

Mem0Message

public Mem0Message(String role, String content)

初始化 Mem0Message 实例。

Creates a new Mem0Message with specified role and content.

参数Parameters
名称Name类型Type说明Description
roleString角色(类型 `String`)。The role (e.g., "user", "assistant")
contentString消息内容。The message content
源码Source io/agentscope/core/memory/mem0/Mem0Message.java:50–53

Mem0Message

public Mem0Message(String role, String content, String name)

创建新的Mem0Message 使用角色,内容,和名称。

Creates a new Mem0Message with role, content, and name.

参数Parameters
名称Name类型Type说明Description
roleString角色(类型 `String`)。The role (e.g., "user", "assistant")
contentString消息内容。The message content
nameString名称(类型 `String`)。The sender's name
源码Source io/agentscope/core/memory/mem0/Mem0Message.java:62–66

方法详情Method Detail

getRole

public String getRole()

获取角色。

Returns the role.

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

setRole

public void setRole(String role)

设置角色。

Sets the role.

参数Parameters
名称Name类型Type说明Description
roleString角色(类型 `String`)。The role.
源码Source io/agentscope/core/memory/mem0/Mem0Message.java:74–76

getContent

public String getContent()

获取内容。

Returns the content.

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

setContent

public void setContent(String content)

设置内容。

Sets the content.

参数Parameters
名称Name类型Type说明Description
contentString内容(类型 `String`)。The content.
源码Source io/agentscope/core/memory/mem0/Mem0Message.java:82–84

getName

public String getName()

获取名称。

Returns the name.

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

setName

public void setName(String name)

设置名称。

Sets the name.

参数Parameters
名称Name类型Type说明Description
nameString名称(类型 `String`)。The name.
源码Source io/agentscope/core/memory/mem0/Mem0Message.java:90–92

builder

public static Builder builder()
static

返回构建器实例。

Builder for creating Mem0Message instances.

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

嵌套类详情Nested Class Detail

Builder

public static class Builder

用于Mem0Message的构建器类。位于 io.agentscope.core.memory.mem0 包。核心成员包括 role、content、name、build。

Builder class for Mem0Message.

基于官方固定版本源码静态生成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.