MemoryClient() 用于通过 HTTP I/O 请求方式创建一个 Memory 的客户端对象。
class MemoryClient:def __init__(self,endpoint: str,api_key: str,memory_id: str,default_actor_id: Optional[str] = None,timeout: int = 10,stub: Optional[Stub] = None):self.default_memory_id = memory_idself.default_actor_id = default_actor_idself.stub = stub or HttpStub(endpoint, api_key, memory_id, timeout)
使用示例
from tdaimemory import MemoryClientEndPoint = "https://memory.tdai.tencentyun.com"ApiKey = "***************************"MemoryId = "tdai-mem-********"client = MemoryClient(endpoint=EndPoint,api_key=ApiKey,memory_id=MemoryId,default_actor_id="user-sdk-test")
参数名 | 参数含义 | 是否必须 | 获取方式 |
endpoint | 客户端所需连接 Memory 服务端的访问地址。 | 是 | |
api_key | 客户端访问 Memory 服务端的 API 密钥,用于进行身份认证。 | 是 | |
memory_id | Memory 服务端具有唯一标识的 ID。 | 是 | |
timeout | 请求超时时间。 | 否 | 单位:秒。 默认值:10。 取值范围:大于等于0。若 timeout 设置为小于0或为 null,系统会自动赋值为默认值。 |