The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.
Python agentic-memoryagentic-memory-systemagentsaiai-agentschatgptgenaillmlong-term-memorymemorymemory-managementpythonragstate-management
Add JavaScript examples for memory export API (#3119)
Saket Aryan0f5612b96d0a
diff --git a/docs/platform/features/memory-export.mdx b/docs/platform/features/memory-export.mdxindex fa870a1a2..2776fe5a0 100644--- a/docs/platform/features/memory-export.mdx+++ b/docs/platform/features/memory-export.mdx@@ -109,6 +109,38 @@ response = client.create_memory_export(print(response)```+```javascript JavaScript+// Basic Export request+const response = await client.createMemoryExport({+ schema: json_schema,+ user_id: "alice"+});++// Export with custom instructions+const export_instructions = `+1. Create a comprehensive profile with detailed information in each category+2. Only mark fields as "None" when absolutely no relevant information exists+3. Base all information directly on the user's memories+4. When contradictions exist, prioritize the most recent information+5. Clearly distinguish between factual statements and inferences+`;++// For create operation, using only user_id filter as requested+const filters = {+ "AND": [+ {"user_id": "alex"}+ ]+}++const responseWithInstructions = await client.createMemoryExport({+ schema: json_schema,+ filters: filters,+ export_instructions: export_instructions+});++console.log(responseWithInstructions);+```+```bash cURLcurl -X POST "https://api.mem0.ai/v1/memories/export/" \-H "Authorization: Token your-api-key" \@@ -133,23 +165,27 @@ curl -X POST "https://api.mem0.ai/v1/memories/export/" \Once the export job is complete, you can retrieve the structured data in two ways:-#### Using Filters+#### Using Export ID<CodeGroup>```python Python-# Retrieve using filters-filters = {- "AND": [- {"created_at": {"gte": "2024-07-10", "lte": "2024-07-20"}},- {"user_id": "alex"}- ]-}--response = client.get_memory_export(filters=filters)+# Retrieve using export ID+response = client.get_memory_export(memory_export_id="550e8400-e29b-41d4-a716-446655440000")print(response)```+```javascript JavaScript+// Retrieve using export ID+const memory_export_id = "550e8400-e29b-41d4-a716-446655440000";++const response = await client.getMemoryExport({+ memory_export_id: memory_export_id+});++console.log(response);+```+```json Output{"full_name": "John Doe",@@ -163,16 +199,39 @@ print(response)</CodeGroup>-#### Using Export ID+#### Using Filters<CodeGroup>```python Python-# Retrieve using export ID-response = client.get_memory_export(memory_export_id="550e8400-e29b-41d4-a716-446655440000")+# Retrieve using filters+filters = {+ "AND": [+ {"created_at": {"gte": "2024-07-10", "lte": "2024-07-20"}},+ {"user_id": "alex"}+ ]+}++response = client.get_memory_export(filters=filters)print(response)```+```javascript JavaScript+// Retrieve using filters+const filters = {+ "AND": [+ {"created_at": {"gte": "2024-07-10", "lte": "2024-07-20"}},+ {"user_id": "alex"}+ ]+}++const response = await client.getMemoryExport({+ filters: filters+});++console.log(response);+```+```json Output{"full_name": "John Doe",