[docs] Filters fix in docs (#3815)

This commit is contained in:
Parth Sharma
2025-12-11 18:38:08 +05:30
committed by GitHub
parent 222c6ceea1
commit 654089fcfc
4 changed files with 73 additions and 34 deletions
@@ -144,9 +144,14 @@ Retrieve just constraints for workout planning:
```python
constraints = mem0_client.search(
"injury concerns",
user_id="max",
filters={"categories": {"in": ["constraints"]}}
query="injury concerns",
filters={
"AND": [
{"user_id": "max"},
{"categories": {"in": ["constraints"]}}
]
},
threshold=0.0 # optional: widen recall for short phrases
)
print([m["memory"] for m in constraints["results"]])
# Output: ["Max's right knee flares up on downhills"]
@@ -63,8 +63,10 @@ print(agent_memories)
**Output:**
```
# User scope returns user's memory
{'results': [{'memory': 'avoids shellfish and prefers boutique hotels', ...}]}
{'results': [{'memory': 'avoids shellfish and prefers boutique hotels', ...}]}
# Agent scope returns agent's own memory
{'results': [{'memory': 'Cam prefers boutique hotels and avoids shellfish', ...}]}
```
<Tip icon="compass">
@@ -137,7 +139,9 @@ Nora white-labels her travel service for a sports brand. Use `app_id` to keep en
```python
enterprise_filters = {
"AND": [
{"app_id": "sports_brand_portal"},
{"app_id": "sports_brand_portal"}
],
"OR": [
{"user_id": "*"},
{"agent_id": "*"}
]
@@ -176,7 +180,10 @@ client.delete_all(app_id="sports_brand_portal")
```python
# Nightly audits - check all data for an app
def audit_app(app_id: str):
filters = {"AND": [{"app_id": app_id}, {"user_id": "*"}, {"agent_id": "*"}]}
filters = {
"AND": [{"app_id": app_id}],
"OR": [{"user_id": "*"}, {"agent_id": "*"}]
}
return client.get_all(filters=filters, page=1, page_size=50)
# Session cleanup - delete temporary conversations