updated docs (#2647)

This commit is contained in:
Prateek Chhikara
2025-05-07 14:09:48 -07:00
committed by GitHub
parent 326f33757b
commit 2b58775c17
3 changed files with 6 additions and 6 deletions

View File

@@ -18,7 +18,7 @@ The v2 search API is powerful and flexible, allowing for more precise memory ret
query="What are Alice's hobbies?", query="What are Alice's hobbies?",
version="v2", version="v2",
filters={ filters={
"AND": [ "OR": [
{ {
"user_id": "alice" "user_id": "alice"
}, },

View File

@@ -1490,11 +1490,11 @@
"x-code-samples": [ "x-code-samples": [
{ {
"lang": "Python", "lang": "Python",
"source": "# To use the Python SDK, install the package:\n# pip install mem0ai\n\nfrom mem0 import MemoryClient\nclient = MemoryClient(api_key=\"your_api_key\", org_id=\"your_org_id\", project_id=\"your_project_id\")\n\nquery = \"What do you know about me?\"\nfilters = {\n \"AND\":[\n {\n \"user_id\":\"alex\"\n },\n {\n \"agent_id\":{\n \"in\":[\n \"travel-assistant\",\n \"customer-support\"\n ]\n }\n }\n ]\n}\nclient.search(query, version=\"v2\", filters=filters)" "source": "# To use the Python SDK, install the package:\n# pip install mem0ai\n\nfrom mem0 import MemoryClient\nclient = MemoryClient(api_key=\"your_api_key\", org_id=\"your_org_id\", project_id=\"your_project_id\")\n\nquery = \"What do you know about me?\"\nfilters = {\n \"OR\":[\n {\n \"user_id\":\"alex\"\n },\n {\n \"agent_id\":{\n \"in\":[\n \"travel-assistant\",\n \"customer-support\"\n ]\n }\n }\n ]\n}\nclient.search(query, version=\"v2\", filters=filters)"
}, },
{ {
"lang": "JavaScript", "lang": "JavaScript",
"source": "// To use the JavaScript SDK, install the package:\n// npm i mem0ai\n\nimport MemoryClient from 'mem0ai';\nconst client = new MemoryClient({ apiKey: \"your-api-key\" });\n\nconst query = \"What do you know about me?\";\nconst filters = {\n AND: [\n { user_id: \"alex\" },\n { agent_id: { in: [\"travel-assistant\", \"customer-support\"] } }\n ]\n};\n\nclient.search(query, { api_version: \"v2\", filters })\n .then(result => console.log(result))\n .catch(error => console.error(error));" "source": "// To use the JavaScript SDK, install the package:\n// npm i mem0ai\n\nimport MemoryClient from 'mem0ai';\nconst client = new MemoryClient({ apiKey: \"your-api-key\" });\n\nconst query = \"What do you know about me?\";\nconst filters = {\n OR: [\n { user_id: \"alex\" },\n { agent_id: { in: [\"travel-assistant\", \"customer-support\"] } }\n ]\n};\n\nclient.search(query, { api_version: \"v2\", filters })\n .then(result => console.log(result))\n .catch(error => console.error(error));"
}, },
{ {
"lang": "cURL", "lang": "cURL",

View File

@@ -453,7 +453,7 @@ Example 1: Search using user_id and agent_id filters
```python Python ```python Python
query = "What do you know about me?" query = "What do you know about me?"
filters = { filters = {
"AND":[ "OR":[
{ {
"user_id":"alex" "user_id":"alex"
}, },
@@ -473,7 +473,7 @@ client.search(query, version="v2", filters=filters)
```javascript JavaScript ```javascript JavaScript
const query = "What do you know about me?"; const query = "What do you know about me?";
const filters = { const filters = {
"AND":[ "OR":[
{ {
"user_id":"alex" "user_id":"alex"
}, },
@@ -499,7 +499,7 @@ curl -X POST "https://api.mem0.ai/v1/memories/search/?version=v2" \
-d '{ -d '{
"query": "What do you know about me?", "query": "What do you know about me?",
"filters": { "filters": {
"AND": [ "OR": [
{ {
"user_id": "alex" "user_id": "alex"
}, },