t0ken-memoryx 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MemoryX
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,115 @@
1
+ Metadata-Version: 2.4
2
+ Name: t0ken-memoryx
3
+ Version: 1.0.0
4
+ Summary: MemoryX Python SDK - 让 AI Agents 轻松拥有持久记忆
5
+ Home-page: https://t0ken.ai
6
+ Author: MemoryX Team
7
+ Author-email: MemoryX Team <support@t0ken.ai>
8
+ License: MIT
9
+ Project-URL: Homepage, https://t0ken.ai
10
+ Project-URL: Documentation, https://docs.t0ken.ai
11
+ Project-URL: Repository, https://github.com/CensorKo/MemoryX
12
+ Project-URL: Issues, https://github.com/CensorKo/MemoryX/issues
13
+ Keywords: memory,ai,agent,llm,cognitive,memoryx
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.7
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
26
+ Requires-Python: >=3.7
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Dynamic: author
30
+ Dynamic: home-page
31
+ Dynamic: license-file
32
+ Dynamic: requires-python
33
+
34
+ # MemoryX Python SDK
35
+
36
+ 让 AI Agents 轻松拥有持久记忆
37
+
38
+ ## 快速开始
39
+
40
+ ```python
41
+ from memoryx import connect_memory
42
+
43
+ # 自动注册并连接
44
+ memory = connect_memory()
45
+
46
+ # 存储记忆
47
+ memory.add("用户喜欢深色模式")
48
+
49
+ # 搜索记忆
50
+ results = memory.search("用户偏好")
51
+ ```
52
+
53
+ ## 功能特性
54
+
55
+ - 🔧 **自动注册** - Agent 自动注册,无需手动配置
56
+ - 💾 **永久存储** - 记忆永久保存到向量数据库
57
+ - 🔍 **智能搜索** - 基于语义的相似度搜索
58
+ - 🏷️ **认知分类** - 自动分类为情景/语义/程序/情感/反思记忆
59
+ - 🔒 **隐私安全** - 机器隔离,验证码认领机制
60
+
61
+ ## 完整示例
62
+
63
+ ```python
64
+ from memoryx import connect_memory
65
+
66
+ # 连接记忆系统
67
+ memory = connect_memory()
68
+
69
+ # 存储不同类型的记忆
70
+ memory.add(
71
+ content="用户是Python开发者",
72
+ category="semantic" # 语义记忆
73
+ )
74
+
75
+ memory.add(
76
+ content="用户昨天去了北京",
77
+ category="episodic" # 情景记忆
78
+ )
79
+
80
+ # 列出所有记忆
81
+ memories = memory.list(limit=10)
82
+
83
+ # 搜索相关记忆
84
+ results = memory.search("用户职业")
85
+ for item in results["data"]["data"]:
86
+ print(f"- {item['content']}")
87
+
88
+ # 删除记忆
89
+ memory.delete("memory_id_here")
90
+
91
+ # 获取认领验证码
92
+ code = memory.get_claim_code()
93
+ print(f"认领验证码: {code}")
94
+ ```
95
+
96
+ ## 安装
97
+
98
+ ```bash
99
+ pip install memoryx
100
+ ```
101
+
102
+ ## 认领机器
103
+
104
+ Agent 注册后,访问 [t0ken.ai/agent-register](http://t0ken.ai/agent-register) 输入验证码认领这台机器。
105
+
106
+ ## 文档
107
+
108
+ 详细文档请访问: https://docs.t0ken.ai
109
+
110
+ ## 开源
111
+
112
+ MemoryX 是开源项目,欢迎贡献代码!
113
+
114
+ - GitHub: https://github.com/CensorKo/MemoryX
115
+ - 许可证: MIT
@@ -0,0 +1,82 @@
1
+ # MemoryX Python SDK
2
+
3
+ 让 AI Agents 轻松拥有持久记忆
4
+
5
+ ## 快速开始
6
+
7
+ ```python
8
+ from memoryx import connect_memory
9
+
10
+ # 自动注册并连接
11
+ memory = connect_memory()
12
+
13
+ # 存储记忆
14
+ memory.add("用户喜欢深色模式")
15
+
16
+ # 搜索记忆
17
+ results = memory.search("用户偏好")
18
+ ```
19
+
20
+ ## 功能特性
21
+
22
+ - 🔧 **自动注册** - Agent 自动注册,无需手动配置
23
+ - 💾 **永久存储** - 记忆永久保存到向量数据库
24
+ - 🔍 **智能搜索** - 基于语义的相似度搜索
25
+ - 🏷️ **认知分类** - 自动分类为情景/语义/程序/情感/反思记忆
26
+ - 🔒 **隐私安全** - 机器隔离,验证码认领机制
27
+
28
+ ## 完整示例
29
+
30
+ ```python
31
+ from memoryx import connect_memory
32
+
33
+ # 连接记忆系统
34
+ memory = connect_memory()
35
+
36
+ # 存储不同类型的记忆
37
+ memory.add(
38
+ content="用户是Python开发者",
39
+ category="semantic" # 语义记忆
40
+ )
41
+
42
+ memory.add(
43
+ content="用户昨天去了北京",
44
+ category="episodic" # 情景记忆
45
+ )
46
+
47
+ # 列出所有记忆
48
+ memories = memory.list(limit=10)
49
+
50
+ # 搜索相关记忆
51
+ results = memory.search("用户职业")
52
+ for item in results["data"]["data"]:
53
+ print(f"- {item['content']}")
54
+
55
+ # 删除记忆
56
+ memory.delete("memory_id_here")
57
+
58
+ # 获取认领验证码
59
+ code = memory.get_claim_code()
60
+ print(f"认领验证码: {code}")
61
+ ```
62
+
63
+ ## 安装
64
+
65
+ ```bash
66
+ pip install memoryx
67
+ ```
68
+
69
+ ## 认领机器
70
+
71
+ Agent 注册后,访问 [t0ken.ai/agent-register](http://t0ken.ai/agent-register) 输入验证码认领这台机器。
72
+
73
+ ## 文档
74
+
75
+ 详细文档请访问: https://docs.t0ken.ai
76
+
77
+ ## 开源
78
+
79
+ MemoryX 是开源项目,欢迎贡献代码!
80
+
81
+ - GitHub: https://github.com/CensorKo/MemoryX
82
+ - 许可证: MIT
@@ -0,0 +1,11 @@
1
+ """
2
+ MemoryX Python SDK
3
+ 让 AI Agents 轻松拥有持久记忆
4
+ """
5
+
6
+ __version__ = "1.0.0"
7
+ __author__ = "MemoryX Team"
8
+
9
+ from .client import MemoryXClient, connect_memory
10
+
11
+ __all__ = ["MemoryXClient", "connect_memory"]
@@ -0,0 +1,298 @@
1
+ """
2
+ MemoryX Client - 核心客户端
3
+ """
4
+
5
+ import json
6
+ import hashlib
7
+ import platform
8
+ import socket
9
+ import uuid
10
+ from typing import Optional, List, Dict, Any
11
+ from urllib.request import Request, urlopen
12
+ from urllib.error import HTTPError
13
+
14
+
15
+ class MemoryXClient:
16
+ """MemoryX 记忆客户端"""
17
+
18
+ DEFAULT_BASE_URL = "http://t0ken.ai/api"
19
+
20
+ def __init__(self, api_key: Optional[str] = None, base_url: Optional[str] = None):
21
+ """
22
+ 初始化 MemoryX 客户端
23
+
24
+ Args:
25
+ api_key: API Key(如果已有)
26
+ base_url: API 基础 URL
27
+ """
28
+ self.api_key = api_key
29
+ self.base_url = base_url or self.DEFAULT_BASE_URL
30
+ self.machine_fingerprint = self._generate_fingerprint()
31
+
32
+ def _generate_fingerprint(self) -> str:
33
+ """生成机器指纹"""
34
+ # 基于硬件信息生成唯一标识
35
+ machine_info = {
36
+ "hostname": socket.gethostname(),
37
+ "platform": platform.system(),
38
+ "machine": platform.machine(),
39
+ "processor": platform.processor() or "unknown",
40
+ "mac": hex(uuid.getnode()),
41
+ }
42
+ fingerprint_str = json.dumps(machine_info, sort_keys=True)
43
+ return hashlib.sha256(fingerprint_str.encode()).hexdigest()[:32]
44
+
45
+ def _request(self, method: str, endpoint: str, data: Optional[dict] = None) -> dict:
46
+ """发送 HTTP 请求"""
47
+ url = f"{self.base_url}{endpoint}"
48
+ headers = {
49
+ "Content-Type": "application/json",
50
+ "User-Agent": f"memoryx-python/1.0.0"
51
+ }
52
+
53
+ if self.api_key:
54
+ headers["X-API-Key"] = self.api_key
55
+
56
+ req = Request(
57
+ url,
58
+ data=json.dumps(data).encode() if data else None,
59
+ headers=headers,
60
+ method=method
61
+ )
62
+
63
+ try:
64
+ with urlopen(req, timeout=30) as response:
65
+ return json.loads(response.read().decode())
66
+ except HTTPError as e:
67
+ error_body = e.read().decode()
68
+ try:
69
+ error_data = json.loads(error_body)
70
+ raise MemoryXError(error_data.get("message", f"HTTP {e.code}"))
71
+ except json.JSONDecodeError:
72
+ raise MemoryXError(f"HTTP {e.code}: {error_body}")
73
+ except Exception as e:
74
+ raise MemoryXError(f"Request failed: {str(e)}")
75
+
76
+ def auto_register(self) -> dict:
77
+ """
78
+ 自动注册机器账户
79
+
80
+ Returns:
81
+ 注册结果,包含 api_key, user_id 等
82
+ """
83
+ data = {
84
+ "machine_fingerprint": self.machine_fingerprint,
85
+ "platform": platform.system().lower(),
86
+ "hostname": socket.gethostname()
87
+ }
88
+
89
+ result = self._request("POST", "/agents/auto-register", data)
90
+
91
+ if result.get("success"):
92
+ self.api_key = result["data"]["api_key"]
93
+ # 保存配置
94
+ self._save_config()
95
+
96
+ return result
97
+
98
+ def _save_config(self):
99
+ """保存配置到本地文件"""
100
+ import os
101
+ config_dir = os.path.expanduser("~/.memoryx")
102
+ os.makedirs(config_dir, exist_ok=True)
103
+
104
+ config = {
105
+ "api_key": self.api_key,
106
+ "machine_fingerprint": self.machine_fingerprint,
107
+ "base_url": self.base_url
108
+ }
109
+
110
+ with open(os.path.join(config_dir, "config.json"), "w") as f:
111
+ json.dump(config, f)
112
+
113
+ def _load_config(self) -> bool:
114
+ """从本地文件加载配置"""
115
+ import os
116
+ config_path = os.path.expanduser("~/.memoryx/config.json")
117
+
118
+ if not os.path.exists(config_path):
119
+ return False
120
+
121
+ try:
122
+ with open(config_path, "r") as f:
123
+ config = json.load(f)
124
+
125
+ # 验证机器指纹
126
+ if config.get("machine_fingerprint") == self.machine_fingerprint:
127
+ self.api_key = config.get("api_key")
128
+ self.base_url = config.get("base_url", self.DEFAULT_BASE_URL)
129
+ return True
130
+ except Exception:
131
+ pass
132
+
133
+ return False
134
+
135
+ def add(self, content: str, category: str = "semantic",
136
+ project_id: str = "default", metadata: Optional[dict] = None) -> dict:
137
+ """
138
+ 存储记忆
139
+
140
+ Args:
141
+ content: 记忆内容
142
+ category: 认知分类 (episodic/semantic/procedural/emotional/reflective)
143
+ project_id: 项目 ID
144
+ metadata: 额外元数据
145
+
146
+ Returns:
147
+ 存储结果
148
+ """
149
+ if not self.api_key:
150
+ raise MemoryXError("Not registered. Call auto_register() first.")
151
+
152
+ data = {
153
+ "content": content,
154
+ "category": category,
155
+ "project_id": project_id,
156
+ "metadata": metadata or {}
157
+ }
158
+
159
+ return self._request("POST", "/memories", data)
160
+
161
+ def list(self, project_id: Optional[str] = None,
162
+ limit: int = 100, offset: int = 0) -> dict:
163
+ """
164
+ 列出记忆
165
+
166
+ Args:
167
+ project_id: 项目 ID 过滤
168
+ limit: 返回数量限制
169
+ offset: 分页偏移
170
+
171
+ Returns:
172
+ 记忆列表
173
+ """
174
+ if not self.api_key:
175
+ raise MemoryXError("Not registered. Call auto_register() first.")
176
+
177
+ params = f"?limit={limit}&offset={offset}"
178
+ if project_id:
179
+ params += f"&project_id={project_id}"
180
+
181
+ return self._request("GET", f"/memories{params}")
182
+
183
+ def search(self, query: str, project_id: Optional[str] = None,
184
+ limit: int = 10) -> dict:
185
+ """
186
+ 搜索记忆
187
+
188
+ Args:
189
+ query: 搜索关键词
190
+ project_id: 项目 ID 过滤
191
+ limit: 返回数量限制
192
+
193
+ Returns:
194
+ 搜索结果
195
+ """
196
+ if not self.api_key:
197
+ raise MemoryXError("Not registered. Call auto_register() first.")
198
+
199
+ data = {
200
+ "query": query,
201
+ "limit": limit
202
+ }
203
+
204
+ if project_id:
205
+ data["project_id"] = project_id
206
+
207
+ return self._request("POST", "/memories/search", data)
208
+
209
+ def delete(self, memory_id: str) -> dict:
210
+ """
211
+ 删除记忆
212
+
213
+ Args:
214
+ memory_id: 记忆 ID
215
+
216
+ Returns:
217
+ 删除结果
218
+ """
219
+ if not self.api_key:
220
+ raise MemoryXError("Not registered. Call auto_register() first.")
221
+
222
+ return self._request("DELETE", f"/memories/{memory_id}")
223
+
224
+ def get_claim_code(self) -> str:
225
+ """
226
+ 获取认领验证码
227
+
228
+ Returns:
229
+ 6 位验证码
230
+ """
231
+ if not self.api_key:
232
+ raise MemoryXError("Not registered. Call auto_register() first.")
233
+
234
+ # 这里需要调用 claim/init 接口
235
+ # 由于需要邮箱,我们先返回一个提示
236
+ result = self._request("POST", "/agents/claim/init", {
237
+ "machine_fingerprint": self.machine_fingerprint,
238
+ "email": "pending@example.com" # 占位,实际需要用户提供
239
+ })
240
+
241
+ if result.get("success"):
242
+ return result["data"]["verification_code"]
243
+
244
+ raise MemoryXError("Failed to get claim code")
245
+
246
+ def get_stats(self) -> dict:
247
+ """获取机器统计信息"""
248
+ if not self.api_key:
249
+ raise MemoryXError("Not registered. Call auto_register() first.")
250
+
251
+ return self._request("GET", f"/agents/machine-stats?machine_fingerprint={self.machine_fingerprint}")
252
+
253
+
254
+ class MemoryXError(Exception):
255
+ """MemoryX 错误"""
256
+ pass
257
+
258
+
259
+ def connect_memory(base_url: Optional[str] = None) -> MemoryXClient:
260
+ """
261
+ 快速连接记忆系统
262
+
263
+ 自动检测本地配置,如果没有则自动注册
264
+
265
+ Args:
266
+ base_url: API 基础 URL(可选)
267
+
268
+ Returns:
269
+ MemoryXClient 实例
270
+
271
+ Example:
272
+ >>> from memoryx import connect_memory
273
+ >>> memory = connect_memory()
274
+ >>> memory.add("用户喜欢深色模式")
275
+ >>> results = memory.search("用户偏好")
276
+ """
277
+ client = MemoryXClient(base_url=base_url)
278
+
279
+ # 尝试加载已有配置
280
+ if client._load_config():
281
+ print("✅ 已连接到 MemoryX 记忆系统")
282
+ return client
283
+
284
+ # 自动注册
285
+ print("🔄 首次使用,自动注册中...")
286
+ result = client.auto_register()
287
+
288
+ if result.get("success"):
289
+ data = result["data"]
290
+ print(f"✅ 注册成功!")
291
+ print(f" Agent ID: {data['user_id']}")
292
+ print(f" API Key: {data['api_key'][:20]}...")
293
+ print(f"\n💡 请访问 http://t0ken.ai/agent-register 认领这台机器")
294
+ print(f" 或询问我:\"我的认领验证码是多少?\"")
295
+ else:
296
+ raise MemoryXError(f"Registration failed: {result.get('message')}")
297
+
298
+ return client
@@ -0,0 +1,39 @@
1
+ [build-system]
2
+ requires = ["setuptools>=45", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "t0ken-memoryx"
7
+ version = "1.0.0"
8
+ description = "MemoryX Python SDK - 让 AI Agents 轻松拥有持久记忆"
9
+ readme = "README.md"
10
+ requires-python = ">=3.7"
11
+ license = {text = "MIT"}
12
+ authors = [
13
+ {name = "MemoryX Team", email = "support@t0ken.ai"}
14
+ ]
15
+ keywords = ["memory", "ai", "agent", "llm", "cognitive", "memoryx"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.7",
22
+ "Programming Language :: Python :: 3.8",
23
+ "Programming Language :: Python :: 3.9",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Topic :: Software Development :: Libraries :: Python Modules",
28
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
29
+ ]
30
+
31
+ [project.urls]
32
+ Homepage = "https://t0ken.ai"
33
+ Documentation = "https://docs.t0ken.ai"
34
+ Repository = "https://github.com/CensorKo/MemoryX"
35
+ Issues = "https://github.com/CensorKo/MemoryX/issues"
36
+
37
+ [tool.setuptools.packages.find]
38
+ where = ["."]
39
+ include = ["memoryx*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,28 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="t0ken-memoryx",
5
+ version="1.0.0",
6
+ description="MemoryX Python SDK - 让 AI Agents 轻松拥有持久记忆",
7
+ long_description=open("README.md").read(),
8
+ long_description_content_type="text/markdown",
9
+ author="MemoryX Team",
10
+ author_email="support@t0ken.ai",
11
+ url="https://t0ken.ai",
12
+ packages=find_packages(),
13
+ python_requires=">=3.7",
14
+ classifiers=[
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: Developers",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.7",
20
+ "Programming Language :: Python :: 3.8",
21
+ "Programming Language :: Python :: 3.9",
22
+ "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ ],
26
+ keywords="memory ai agent llm cognitive memoryx",
27
+ license="MIT",
28
+ )
@@ -0,0 +1,115 @@
1
+ Metadata-Version: 2.4
2
+ Name: t0ken-memoryx
3
+ Version: 1.0.0
4
+ Summary: MemoryX Python SDK - 让 AI Agents 轻松拥有持久记忆
5
+ Home-page: https://t0ken.ai
6
+ Author: MemoryX Team
7
+ Author-email: MemoryX Team <support@t0ken.ai>
8
+ License: MIT
9
+ Project-URL: Homepage, https://t0ken.ai
10
+ Project-URL: Documentation, https://docs.t0ken.ai
11
+ Project-URL: Repository, https://github.com/CensorKo/MemoryX
12
+ Project-URL: Issues, https://github.com/CensorKo/MemoryX/issues
13
+ Keywords: memory,ai,agent,llm,cognitive,memoryx
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.7
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
26
+ Requires-Python: >=3.7
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Dynamic: author
30
+ Dynamic: home-page
31
+ Dynamic: license-file
32
+ Dynamic: requires-python
33
+
34
+ # MemoryX Python SDK
35
+
36
+ 让 AI Agents 轻松拥有持久记忆
37
+
38
+ ## 快速开始
39
+
40
+ ```python
41
+ from memoryx import connect_memory
42
+
43
+ # 自动注册并连接
44
+ memory = connect_memory()
45
+
46
+ # 存储记忆
47
+ memory.add("用户喜欢深色模式")
48
+
49
+ # 搜索记忆
50
+ results = memory.search("用户偏好")
51
+ ```
52
+
53
+ ## 功能特性
54
+
55
+ - 🔧 **自动注册** - Agent 自动注册,无需手动配置
56
+ - 💾 **永久存储** - 记忆永久保存到向量数据库
57
+ - 🔍 **智能搜索** - 基于语义的相似度搜索
58
+ - 🏷️ **认知分类** - 自动分类为情景/语义/程序/情感/反思记忆
59
+ - 🔒 **隐私安全** - 机器隔离,验证码认领机制
60
+
61
+ ## 完整示例
62
+
63
+ ```python
64
+ from memoryx import connect_memory
65
+
66
+ # 连接记忆系统
67
+ memory = connect_memory()
68
+
69
+ # 存储不同类型的记忆
70
+ memory.add(
71
+ content="用户是Python开发者",
72
+ category="semantic" # 语义记忆
73
+ )
74
+
75
+ memory.add(
76
+ content="用户昨天去了北京",
77
+ category="episodic" # 情景记忆
78
+ )
79
+
80
+ # 列出所有记忆
81
+ memories = memory.list(limit=10)
82
+
83
+ # 搜索相关记忆
84
+ results = memory.search("用户职业")
85
+ for item in results["data"]["data"]:
86
+ print(f"- {item['content']}")
87
+
88
+ # 删除记忆
89
+ memory.delete("memory_id_here")
90
+
91
+ # 获取认领验证码
92
+ code = memory.get_claim_code()
93
+ print(f"认领验证码: {code}")
94
+ ```
95
+
96
+ ## 安装
97
+
98
+ ```bash
99
+ pip install memoryx
100
+ ```
101
+
102
+ ## 认领机器
103
+
104
+ Agent 注册后,访问 [t0ken.ai/agent-register](http://t0ken.ai/agent-register) 输入验证码认领这台机器。
105
+
106
+ ## 文档
107
+
108
+ 详细文档请访问: https://docs.t0ken.ai
109
+
110
+ ## 开源
111
+
112
+ MemoryX 是开源项目,欢迎贡献代码!
113
+
114
+ - GitHub: https://github.com/CensorKo/MemoryX
115
+ - 许可证: MIT
@@ -0,0 +1,10 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ memoryx/__init__.py
6
+ memoryx/client.py
7
+ t0ken_memoryx.egg-info/PKG-INFO
8
+ t0ken_memoryx.egg-info/SOURCES.txt
9
+ t0ken_memoryx.egg-info/dependency_links.txt
10
+ t0ken_memoryx.egg-info/top_level.txt