aip-agents-binary 0.6.6__py3-none-macosx_13_0_arm64.whl → 0.6.7__py3-none-macosx_13_0_arm64.whl
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.
- aip_agents/memory/adapters/base_adapter.py +25 -21
- aip_agents/memory/adapters/base_adapter.pyi +7 -8
- aip_agents/tools/memory_search/mem0.py +8 -2
- {aip_agents_binary-0.6.6.dist-info → aip_agents_binary-0.6.7.dist-info}/METADATA +1 -1
- {aip_agents_binary-0.6.6.dist-info → aip_agents_binary-0.6.7.dist-info}/RECORD +7 -7
- {aip_agents_binary-0.6.6.dist-info → aip_agents_binary-0.6.7.dist-info}/WHEEL +0 -0
- {aip_agents_binary-0.6.6.dist-info → aip_agents_binary-0.6.7.dist-info}/top_level.txt +0 -0
|
@@ -261,50 +261,54 @@ class BaseMemoryAdapter(BaseMemory):
|
|
|
261
261
|
*,
|
|
262
262
|
query: str,
|
|
263
263
|
user_id: str,
|
|
264
|
-
metadata: dict[str, Any] | None = None,
|
|
265
|
-
threshold: float | None = None,
|
|
266
264
|
top_k: int | None = None,
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
265
|
+
threshold: float | None = 0.3,
|
|
266
|
+
filters: dict[str, Any] | None = None,
|
|
267
|
+
) -> list[dict[str, Any]]:
|
|
268
|
+
"""Delete memories matching a query.
|
|
270
269
|
|
|
271
270
|
Args:
|
|
272
|
-
query:
|
|
271
|
+
query: The search query string used to find memories to delete.
|
|
273
272
|
user_id: User identifier for the deletion scope.
|
|
274
|
-
|
|
275
|
-
threshold:
|
|
276
|
-
|
|
277
|
-
categories: Optional categories to filter by (best-effort).
|
|
273
|
+
top_k: Maximum number of memories to delete.
|
|
274
|
+
threshold: Minimum similarity threshold for deletion.
|
|
275
|
+
filters: Optional filters to apply to the deletion scope.
|
|
278
276
|
|
|
279
277
|
Returns:
|
|
280
|
-
|
|
278
|
+
List of deleted memory hits.
|
|
281
279
|
"""
|
|
280
|
+
options = self._build_retrieve_options(
|
|
281
|
+
user_id=user_id,
|
|
282
|
+
limit=top_k,
|
|
283
|
+
filters=filters,
|
|
284
|
+
page=None,
|
|
285
|
+
)
|
|
282
286
|
try:
|
|
283
287
|
start = perf_counter()
|
|
284
|
-
|
|
285
|
-
self.
|
|
286
|
-
self._manager.delete_by_user_query,
|
|
287
|
-
categories=categories,
|
|
288
|
+
chunks = self._runner.run(
|
|
289
|
+
self._manager.delete_by_user_query(
|
|
288
290
|
query=query,
|
|
289
|
-
user_id=user_id
|
|
291
|
+
user_id=options.user_id,
|
|
290
292
|
agent_id=self.agent_id,
|
|
291
293
|
scopes=DEFAULT_SCOPE,
|
|
292
|
-
metadata=metadata,
|
|
294
|
+
metadata=options.metadata,
|
|
293
295
|
threshold=threshold,
|
|
294
|
-
top_k=top_k,
|
|
296
|
+
top_k=options.top_k,
|
|
295
297
|
)
|
|
296
298
|
)
|
|
297
299
|
duration = perf_counter() - start
|
|
298
300
|
logger.info(
|
|
299
|
-
"BaseMemoryAdapter: delete_by_query user_id='%s' query='%s'
|
|
301
|
+
"BaseMemoryAdapter: delete_by_query user_id='%s' query='%s' deleted %d hits in %.2fs",
|
|
300
302
|
user_id,
|
|
301
303
|
query,
|
|
304
|
+
len(chunks),
|
|
302
305
|
duration,
|
|
303
306
|
)
|
|
304
|
-
return result
|
|
305
307
|
except Exception as exc: # noqa: BLE001
|
|
306
308
|
logger.debug("BaseMemoryAdapter.delete_by_query ignored error: %s", exc)
|
|
307
|
-
return
|
|
309
|
+
return []
|
|
310
|
+
|
|
311
|
+
return [self._chunk_to_hit(chunk) for chunk in chunks]
|
|
308
312
|
|
|
309
313
|
def delete(
|
|
310
314
|
self,
|
|
@@ -106,19 +106,18 @@ class BaseMemoryAdapter(BaseMemory):
|
|
|
106
106
|
Returns:
|
|
107
107
|
List of memory hits matching the criteria.
|
|
108
108
|
"""
|
|
109
|
-
def delete_by_query(self, *, query: str, user_id: str,
|
|
110
|
-
"""Delete memories
|
|
109
|
+
def delete_by_query(self, *, query: str, user_id: str, top_k: int | None = None, threshold: float | None = 0.3, filters: dict[str, Any] | None = None) -> list[dict[str, Any]]:
|
|
110
|
+
"""Delete memories matching a query.
|
|
111
111
|
|
|
112
112
|
Args:
|
|
113
|
-
query:
|
|
113
|
+
query: The search query string used to find memories to delete.
|
|
114
114
|
user_id: User identifier for the deletion scope.
|
|
115
|
-
|
|
116
|
-
threshold:
|
|
117
|
-
|
|
118
|
-
categories: Optional categories to filter by (best-effort).
|
|
115
|
+
top_k: Maximum number of memories to delete.
|
|
116
|
+
threshold: Minimum similarity threshold for deletion.
|
|
117
|
+
filters: Optional filters to apply to the deletion scope.
|
|
119
118
|
|
|
120
119
|
Returns:
|
|
121
|
-
|
|
120
|
+
List of deleted memory hits.
|
|
122
121
|
"""
|
|
123
122
|
def delete(self, *, memory_ids: list[str] | None, user_id: str, metadata: dict[str, Any] | None = None, categories: list[str] | None = None) -> Any:
|
|
124
123
|
"""Delete memories by IDs or by user scope when IDs are None.
|
|
@@ -320,13 +320,19 @@ class Mem0DeleteTool(LongTermMemorySearchTool):
|
|
|
320
320
|
if not hasattr(self.memory, "delete_by_query"):
|
|
321
321
|
return f"Error executing memory tool '{self.name}': backend does not support delete_by_query()"
|
|
322
322
|
mode = "query"
|
|
323
|
+
filters: dict[str, Any] | None = None
|
|
324
|
+
if metadata_filter or categories:
|
|
325
|
+
filters = {}
|
|
326
|
+
if metadata_filter:
|
|
327
|
+
filters["metadata"] = metadata_filter
|
|
328
|
+
if categories:
|
|
329
|
+
filters["categories"] = categories
|
|
323
330
|
result = self.memory.delete_by_query( # type: ignore[attr-defined]
|
|
324
331
|
query=query,
|
|
325
332
|
user_id=user_id,
|
|
326
|
-
metadata=metadata_filter,
|
|
327
333
|
threshold=threshold,
|
|
328
334
|
top_k=top_k,
|
|
329
|
-
|
|
335
|
+
filters=filters,
|
|
330
336
|
)
|
|
331
337
|
elif delete_all:
|
|
332
338
|
if not hasattr(self.memory, "delete"):
|
|
@@ -344,8 +344,8 @@ aip_agents/memory/simple_memory.py,sha256=CpLr7mI_LyurFR6LHqFWXABxGP2Q0ef2GxZyGT
|
|
|
344
344
|
aip_agents/memory/simple_memory.pyi,sha256=E-UJ-pqDOpHqMozwf5M3yHuim_46vzHmUwf_SthHIb4,1126
|
|
345
345
|
aip_agents/memory/adapters/__init__.py,sha256=j-loIdfx_2K4JsjjolEeUrINgwogOOs_jm5pQlhZzac,279
|
|
346
346
|
aip_agents/memory/adapters/__init__.pyi,sha256=KDmdDvG1tcfEQJ8c5_i9q3m74LPTlGsyTTY7b6n5nno,207
|
|
347
|
-
aip_agents/memory/adapters/base_adapter.py,sha256=
|
|
348
|
-
aip_agents/memory/adapters/base_adapter.pyi,sha256=
|
|
347
|
+
aip_agents/memory/adapters/base_adapter.py,sha256=rCOWbPY3IgRYbzQthKXTTydrWdeayvmEMfcSkbt2jzk,28969
|
|
348
|
+
aip_agents/memory/adapters/base_adapter.pyi,sha256=zNFC9GZN98mWg9KgitXy4hLQWs3wQV7bBLQvnaB32YU,7187
|
|
349
349
|
aip_agents/memory/adapters/mem0.py,sha256=wWRUlCusOpMMayj4Uw8nYiAuI4TKxaKXqaTTerzXDL4,2955
|
|
350
350
|
aip_agents/memory/adapters/mem0.pyi,sha256=C8hVoXKmk2J62Lns-OdafTiEEFEcH-SJn-bF3ATHx7s,1093
|
|
351
351
|
aip_agents/middleware/__init__.py,sha256=ggAQsp9G0jNsrQ59unPrv6K8Bapi-WvLMwnI84Tt_Dg,485
|
|
@@ -522,7 +522,7 @@ aip_agents/tools/memory_search/__init__.py,sha256=LGVryzA5hiOGBPBdqQyAX34odd-2gZ
|
|
|
522
522
|
aip_agents/tools/memory_search/__init__.pyi,sha256=T2ROZSTHZz3sL3QGbqVxHVqJLj9i017DIt5gk8haX30,825
|
|
523
523
|
aip_agents/tools/memory_search/base.py,sha256=M4Vq5CnXge1rhVkESfVCAjyWEc6Ijmh8-6oAMkcZkjY,7333
|
|
524
524
|
aip_agents/tools/memory_search/base.pyi,sha256=onVYE9m7WxUQ4qmW5Tj4xBLgFaBGcg8pJj-n6nR5FIw,3087
|
|
525
|
-
aip_agents/tools/memory_search/mem0.py,sha256=
|
|
525
|
+
aip_agents/tools/memory_search/mem0.py,sha256=GDHBloF5GyqV10y0yrXwIKp2gfQzk-hkd7gE4GvV1Qk,14043
|
|
526
526
|
aip_agents/tools/memory_search/mem0.pyi,sha256=Cg7EO70QIK8EwD4-nNARd7qp2izZiquxmhBIt5R6afg,1314
|
|
527
527
|
aip_agents/tools/memory_search/schema.py,sha256=7URsggujl5kw0d-1b71ymLzc9oZ_-xQGgkXuE1bXJow,2775
|
|
528
528
|
aip_agents/tools/memory_search/schema.pyi,sha256=qK_xhhSFo3ncVvybMXlAtUpg9XPydrB84-bsIzfLAzI,744
|
|
@@ -626,7 +626,7 @@ aip_agents/utils/pii/pii_helper.py,sha256=g0yRzakfA2AA6vjUNLWHqFlcxyLql6MXQ90NN3
|
|
|
626
626
|
aip_agents/utils/pii/pii_helper.pyi,sha256=dulZs150ikbAL3Bw2YLcz3_g4DsGmL3lciwf8mKxEjI,2939
|
|
627
627
|
aip_agents/utils/pii/uuid_deanonymizer_mapping.py,sha256=Gks8l8t0cuS9pzoQnrpiK1CaLmWYksjOnTeiHh3_7EE,7348
|
|
628
628
|
aip_agents/utils/pii/uuid_deanonymizer_mapping.pyi,sha256=gnWfD1rWZh_tloJjgKiZ6f6iNUuBaHpKqCSiP0d-9bs,3084
|
|
629
|
-
aip_agents_binary-0.6.
|
|
630
|
-
aip_agents_binary-0.6.
|
|
631
|
-
aip_agents_binary-0.6.
|
|
632
|
-
aip_agents_binary-0.6.
|
|
629
|
+
aip_agents_binary-0.6.7.dist-info/METADATA,sha256=-e2ySxZ7jiX4lfWRCFDK7Y1YfvNlFX49tepp3Vw7dPQ,22194
|
|
630
|
+
aip_agents_binary-0.6.7.dist-info/WHEEL,sha256=KxCTaSkoYs_EnWvWxmau4HAvN-_rCRYV_bfRc_41A9k,106
|
|
631
|
+
aip_agents_binary-0.6.7.dist-info/top_level.txt,sha256=PEz8vcwC1bH4UrkhF0LkIYCNfXGWZUHdSklbvkBe25E,11
|
|
632
|
+
aip_agents_binary-0.6.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|