AS AgentScopeAPI 手册 / API Reference

Mem0Client

public class Mem0Client
源码Source io/agentscope/core/memory/mem0/Mem0Client.java:44–279

Mem 0 客户端,封装与远端服务的连接和调用。位于 io.agentscope.core.memory.mem0 包。核心成员包括 add、search、shutdown、Mem0Client。

HTTP client for interacting with the Mem0 API.

Supports both Platform Mem0 and self-hosted Mem0 deployments:

  • Platform Mem0: Uses endpoints /v1/memories/ and /v2/memories/search/

  • Self-hosted Mem0: Uses endpoints /memories and /memories/search

By default, the client uses Platform Mem0 endpoints. To use self-hosted Mem0, specify "self-hosted" as the apiType parameter.

构造器摘要Constructor Summary

构造器Constructor说明Description
public Mem0Client(String apiBaseUrl, String apiKey)
初始化 `Mem0Client` 实例。
Creates a new Mem0Client with specified configuration (defaults to Platform Mem0).
public Mem0Client(String apiBaseUrl, String apiKey, Duration timeout)
初始化 `Mem0Client` 实例。
Creates a new Mem0Client with custom timeout (defaults to Platform Mem0).
public Mem0Client(String apiBaseUrl, String apiKey, Mem0ApiType apiType, Duration timeout)
初始化 `Mem0Client` 实例。
Creates a new Mem0Client with API type specification.

方法摘要Method Summary

方法Method说明Description
public Mono<Mem0AddResponse> add(Mem0AddRequest request)
设置添加。
Adds memories to Mem0 by sending messages for processing.
public Mono<Mem0SearchResponse> search(Mem0SearchRequest request)
设置搜索。
Searches memories in Mem0 using semantic similarity.
public void shutdown()
关闭资源并释放连接。
Shuts down the HTTP client and releases resources.

构造器详情Constructor Detail

Mem0Client

public Mem0Client(String apiBaseUrl, String apiKey)

初始化 Mem0Client 实例。

Creates a new Mem0Client with specified configuration (defaults to Platform Mem0).

参数Parameters
名称Name类型Type说明Description
apiBaseUrlStringAPI 基类 URL(类型 `String`)。The base URL of the Mem0 API (e.g., "http://localhost:8000")
apiKeyStringAPI 键(类型 `String`)。The API key for authentication (can be null for local deployments without authentication)
源码Source io/agentscope/core/memory/mem0/Mem0Client.java:71–73

Mem0Client

public Mem0Client(String apiBaseUrl, String apiKey, Duration timeout)

初始化 Mem0Client 实例。

Creates a new Mem0Client with custom timeout (defaults to Platform Mem0).

参数Parameters
名称Name类型Type说明Description
apiBaseUrlStringMem0 API的基类 URL。The base URL of the Mem0 API
apiKeyStringAPI 键(类型 `String`)。The API key for authentication (can be null for local deployments without authentication)
timeoutDuration超时时间(类型 `Duration`)。HTTP request timeout duration
源码Source io/agentscope/core/memory/mem0/Mem0Client.java:83–85

Mem0Client

public Mem0Client(String apiBaseUrl, String apiKey, Mem0ApiType apiType, Duration timeout)

初始化 Mem0Client 实例。

Creates a new Mem0Client with API type specification.

参数Parameters
名称Name类型Type说明Description
apiBaseUrlStringMem0 API的基类 URL。The base URL of the Mem0 API
apiKeyStringAPI 键(类型 `String`)。The API key for authentication (can be null for local deployments without authentication)
apiTypeMem0ApiTypeAPI 类型。API type enum
timeoutDuration超时时间(类型 `Duration`)。HTTP request timeout duration
源码Source io/agentscope/core/memory/mem0/Mem0Client.java:96–120

方法详情Method Detail

add

public Mono<Mem0AddResponse> add(Mem0AddRequest request)

设置添加。

Adds memories to Mem0 by sending messages for processing.

参数Parameters
名称Name类型Type说明Description
requestMem0AddRequest请求(类型 `Mem0AddRequest`)。The add request containing messages and metadata
返回Returns Mono<Mem0AddResponse>
返回Mono。A Mono emitting the response with extracted memories
源码Source io/agentscope/core/memory/mem0/Mem0Client.java:222–224

shutdown

public void shutdown()

关闭资源并释放连接。

Shuts down the HTTP client and releases resources.

源码Source io/agentscope/core/memory/mem0/Mem0Client.java:275–278
基于官方固定版本源码静态生成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.