From 7cff8cbe4298641fd18b41dc53694101100dfa48 Mon Sep 17 00:00:00 2001 From: MaheshtheDev <38828053+MaheshtheDev@users.noreply.github.com> Date: Wed, 7 Oct 2026 00:53:30 +0000 Subject: [PATCH] chore: regenerate SDK from v5 OpenAPI spec (5.0.1) --- fern/openapi.json | 629 +++++++++++++++--- pyproject.toml | 2 +- reference.md | 6 +- src/supermemory/client.py | 4 +- src/supermemory/core/client_wrapper.py | 2 +- src/supermemory/memories/client.py | 8 +- src/supermemory/memories/raw_client.py | 8 +- src/supermemory/raw_client.py | 4 +- .../requests/batch_add_item_result.py | 2 +- src/supermemory/requests/connector.py | 2 +- .../requests/list_request_include.py | 2 +- .../requests/memory_included_related.py | 6 +- .../types/batch_add_item_result.py | 2 +- src/supermemory/types/connector.py | 2 +- src/supermemory/types/list_request_include.py | 2 +- .../types/memory_included_related.py | 6 +- uv.lock | 6 +- 17 files changed, 576 insertions(+), 117 deletions(-) diff --git a/fern/openapi.json b/fern/openapi.json index a8d89ff0..393fc470 100644 --- a/fern/openapi.json +++ b/fern/openapi.json @@ -464,10 +464,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "The isolated namespace. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope documents." @@ -584,10 +584,20 @@ } }, "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst doc = await client.add(\"user_123\", {\n content: \"Sarah is being promoted to VP of Product.\",\n id: \"chat_session_1\",\n metadata: { type: \"conversation\" },\n dreaming: \"instant\",\n});\nconsole.log(doc.id, doc.status);" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\ndoc = client.add(\n \"user_123\",\n content=\"Sarah is being promoted to VP of Product.\",\n id=\"chat_session_1\",\n metadata={\"type\": \"conversation\"},\n dreaming=\"instant\",\n)\nprint(doc.id, doc.status)" + }, { "lang": "bash", "label": "cURL", - "source": "curl -X POST \"https://api.supermemory.ai/ns/user_123/document\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"content\": \"Sarah is being promoted to VP of Product.\",\n \"dreaming\": \"instant\",\n \"id\": \"chat_session_1\",\n \"metadata\": { \"type\": \"conversation\" }\n }'" + "source": "curl -X POST \"https://api.supermemory.ai/ns/user_123/document\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"content\": \"Sarah is being promoted to VP of Product.\",\n \"id\": \"chat_session_1\",\n \"metadata\": { \"type\": \"conversation\" },\n \"dreaming\": \"instant\"\n }'" } ] }, @@ -701,10 +711,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "The isolated namespace. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope documents." @@ -741,7 +751,24 @@ } } } - } + }, + "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst res = await client.documents.delete(\"user_123\", {\n ids: [\"chat_session_1\", \"doc_roadmap\"],\n});\nconsole.log(res.count, res.errors);" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\nres = client.documents.delete(\"user_123\", ids=[\"chat_session_1\", \"doc_roadmap\"])\nprint(res.count, res.errors)" + }, + { + "lang": "bash", + "label": "cURL", + "source": "curl -X DELETE \"https://api.supermemory.ai/ns/user_123/document\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{ \"ids\": [\"chat_session_1\", \"doc_roadmap\"] }'" + } + ] } }, "/ns/{namespace}/document/batch": { @@ -777,7 +804,7 @@ "failed", "error" ], - "description": "The document's processing state, as for a single add; error when this item failed" + "description": "The document's processing state after this request, or error when this item failed" }, "error": { "description": "Failure reason", @@ -891,10 +918,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "The isolated namespace. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope documents." @@ -1026,6 +1053,16 @@ } }, "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst res = await client.documents.batchAdd(\"user_123\", {\n documents: [\n { content: \"Q3 roadmap notes\", id: \"doc_roadmap\" },\n { content: \"Gift policy for VP promotions\", id: \"doc_gifts\" },\n ],\n dreaming: \"instant\",\n});\nconsole.log(res.count, res.failed);" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\nres = client.documents.batch_add(\n \"user_123\",\n documents=[\n {\"content\": \"Q3 roadmap notes\", \"id\": \"doc_roadmap\"},\n {\"content\": \"Gift policy for VP promotions\", \"id\": \"doc_gifts\"},\n ],\n dreaming=\"instant\",\n)\nprint(res.count, res.failed)" + }, { "lang": "bash", "label": "cURL", @@ -1361,10 +1398,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "The isolated namespace. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope documents." @@ -1400,10 +1437,20 @@ } ], "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst doc = await client.documents.get(\"user_123\", \"doc_abc123\", {\n include: [\"chunks\", \"memories\"],\n});\nconsole.log(doc.system.status, doc.chunks?.length, doc.memories?.length);" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\ndoc = client.documents.get(\"user_123\", \"doc_abc123\", include=[\"chunks\", \"memories\"])\nprint(doc.system.status, len(doc.chunks or []), len(doc.memories or []))" + }, { "lang": "bash", "label": "cURL", - "source": "curl \"https://api.supermemory.ai/ns/project_123/document/doc_abc123?include=chunks,memories\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\"" + "source": "curl \"https://api.supermemory.ai/ns/user_123/document/doc_abc123?include=chunks,memories\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\"" } ] }, @@ -1534,10 +1581,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "The isolated namespace. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope documents." @@ -1656,10 +1703,20 @@ } }, "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst updated = await client.documents.update(\"user_123\", \"chat_session_1\", {\n content: \"Updated notes: Sarah is now VP of Product.\",\n metadata: { type: \"conversation\" },\n});\nconsole.log(updated.status);" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\nupdated = client.documents.update(\n \"user_123\",\n \"chat_session_1\",\n content=\"Updated notes: Sarah is now VP of Product.\",\n metadata={\"type\": \"conversation\"},\n)\nprint(updated.status)" + }, { "lang": "bash", "label": "cURL", - "source": "curl -X PATCH \"https://api.supermemory.ai/ns/user_123/document/chat_session_1\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"content\": \"Updated notes \u2014 Sarah is now VP of Product.\",\n \"metadata\": { \"type\": \"conversation\" }\n }'" + "source": "curl -X PATCH \"https://api.supermemory.ai/ns/user_123/document/chat_session_1\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"content\": \"Updated notes: Sarah is now VP of Product.\",\n \"metadata\": { \"type\": \"conversation\" }\n }'" } ] } @@ -1782,10 +1839,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "The isolated namespace. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope documents." @@ -1862,7 +1919,24 @@ } } } - } + }, + "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\nimport { openAsBlob } from \"node:fs\";\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst doc = await client.documents.uploadFile(\"user_123\", {\n file: await openAsBlob(\"notes.pdf\"),\n metadata: JSON.stringify({ source: \"upload\" }), // multipart: metadata is a JSON string\n});\nconsole.log(doc.id, doc.status);" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\nimport json\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\nwith open(\"notes.pdf\", \"rb\") as f:\n doc = client.documents.upload_file(\n \"user_123\",\n file=f,\n metadata=json.dumps({\"source\": \"upload\"}), # multipart: metadata is a JSON string\n )\nprint(doc.id, doc.status)" + }, + { + "lang": "bash", + "label": "cURL", + "source": "curl -X POST \"https://api.supermemory.ai/ns/user_123/document/file\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\" \\\n -F \"file=@notes.pdf\" \\\n -F 'metadata={\"source\":\"upload\"}'" + } + ] } }, "/ns/{namespace}/document/file/{id}": { @@ -1993,10 +2067,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "The isolated namespace. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope documents." @@ -2085,7 +2159,24 @@ } } } - } + }, + "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\nimport { openAsBlob } from \"node:fs\";\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst doc = await client.documents.replaceWithFile(\"user_123\", \"doc_abc123\", {\n file: await openAsBlob(\"notes-v2.pdf\"),\n metadata: JSON.stringify({ revision: 2 }),\n});\nconsole.log(doc.status);" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\nimport json\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\nwith open(\"notes-v2.pdf\", \"rb\") as f:\n doc = client.documents.replace_with_file(\n \"user_123\",\n \"doc_abc123\",\n file=f,\n metadata=json.dumps({\"revision\": 2}),\n )\nprint(doc.status)" + }, + { + "lang": "bash", + "label": "cURL", + "source": "curl -X POST \"https://api.supermemory.ai/ns/user_123/document/file/doc_abc123\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\" \\\n -F \"file=@notes-v2.pdf\" \\\n -F 'metadata={\"revision\":2}'" + } + ] }, "patch": { "operationId": "patchNsByNamespaceDocumentFileById", @@ -2214,10 +2305,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "The isolated namespace. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope documents." @@ -2303,7 +2394,24 @@ } } } - } + }, + "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst doc = await client.documents.updateFile(\"user_123\", \"doc_abc123\", {\n metadata: JSON.stringify({ reviewed: true }), // file is optional here\n});\nconsole.log(doc.status);" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\nimport json\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\ndoc = client.documents.update_file(\n \"user_123\",\n \"doc_abc123\",\n metadata=json.dumps({\"reviewed\": True}), # file is optional here\n)\nprint(doc.status)" + }, + { + "lang": "bash", + "label": "cURL", + "source": "curl -X PATCH \"https://api.supermemory.ai/ns/user_123/document/file/doc_abc123\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\" \\\n -F 'metadata={\"reviewed\":true}'" + } + ] } }, "/ns/{namespace}/search": { @@ -2761,10 +2869,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "The isolated namespace to search. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope memories." @@ -2876,6 +2984,16 @@ } }, "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst { results, searchTime } = await client.search(\"user_123\", {\n query: \"gift ideas for a VP promotion after a Tokyo offsite\",\n searchMode: \"hybrid\",\n limit: 5,\n include: { related: true },\n filter: {\n operator: \"and\",\n operands: [\n { field: \"category\", operator: \"eq\", value: \"work\" },\n { field: \"importance\", operator: \"gte\", value: 0.8 },\n ],\n },\n});\nfor (const r of results) console.log(r.similarity.toFixed(2), r.memory ?? r.chunk);" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\nresponse = client.search(\n \"user_123\",\n query=\"gift ideas for a VP promotion after a Tokyo offsite\",\n search_mode=\"hybrid\",\n limit=5,\n include={\"related\": True},\n filter={\n \"operator\": \"and\",\n \"operands\": [\n {\"field\": \"category\", \"operator\": \"eq\", \"value\": \"work\"},\n {\"field\": \"importance\", \"operator\": \"gte\", \"value\": 0.8},\n ],\n },\n)\nfor r in response.results:\n print(round(r.similarity, 2), r.memory or r.chunk)" + }, { "lang": "bash", "label": "cURL", @@ -3046,10 +3164,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "The isolated namespace to search. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope memories." @@ -3089,10 +3207,20 @@ } }, "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst { profile } = await client.profile(\"user_123\");\nconsole.log(profile.static.map((m) => m.memory));\nconsole.log(profile.dynamic.map((m) => m.memory));" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\nprofile = client.profile(\"user_123\").profile\nprint([m.memory for m in profile.static])\nprint([m.memory for m in profile.dynamic])" + }, { "lang": "bash", "label": "cURL", - "source": "curl -X POST \"https://api.supermemory.ai/ns/user_123/profile\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"filter\": {\n \"field\": \"region\",\n \"operator\": \"eq\",\n \"value\": \"us-west\"\n }\n }'" + "source": "curl -X POST \"https://api.supermemory.ai/ns/user_123/profile\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{}'" } ] } @@ -3174,25 +3302,30 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "The isolated namespace to search. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope memories." } ], "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst buckets = await client.profiles.getBuckets(\"user_123\");\nconsole.log(buckets);" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\nbuckets = client.profiles.get_buckets(\"user_123\")\nprint(buckets)" + }, { "lang": "bash", "label": "cURL", "source": "curl \"https://api.supermemory.ai/ns/user_123/profile/buckets\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\"" - }, - { - "lang": "typescript", - "label": "TypeScript SDK", - "source": "import Supermemory from \"supermemory\";\n\nconst client = new Supermemory({\n apiKey: process.env.SUPERMEMORY_API_KEY,\n});\n\nconst res = await fetch(\"https://api.supermemory.ai/ns/user_123/profile/buckets\", {\n headers: {\n Authorization: `Bearer ${process.env.SUPERMEMORY_API_KEY}`,\n },\n});\nconst data = await res.json();\nconsole.log(data);" } ] }, @@ -3302,10 +3435,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "The isolated namespace to search. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope memories." @@ -3344,7 +3477,24 @@ } } } - } + }, + "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nawait client.profiles.setBuckets(\"user_123\", {\n buckets: {\n work: \"Job, team, and current projects\",\n preferences: \"Food, travel, and communication preferences\",\n },\n});" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\nclient.profiles.set_buckets(\n \"user_123\",\n buckets={\n \"work\": \"Job, team, and current projects\",\n \"preferences\": \"Food, travel, and communication preferences\",\n },\n)" + }, + { + "lang": "bash", + "label": "cURL", + "source": "curl -X PUT \"https://api.supermemory.ai/ns/user_123/profile/buckets\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"buckets\": {\n \"work\": \"Job, team, and current projects\",\n \"preferences\": \"Food, travel, and communication preferences\"\n }\n }'" + } + ] }, "delete": { "operationId": "deleteNsByNamespaceProfileBuckets", @@ -3452,10 +3602,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "The isolated namespace to search. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope memories." @@ -3492,7 +3642,24 @@ } } } - } + }, + "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nawait client.profiles.deleteBuckets(\"user_123\", { buckets: [\"work\"] });" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\nclient.profiles.delete_buckets(\"user_123\", buckets=[\"work\"])" + }, + { + "lang": "bash", + "label": "cURL", + "source": "curl -X DELETE \"https://api.supermemory.ai/ns/user_123/profile/buckets\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{ \"buckets\": [\"work\"] }'" + } + ] } }, "/ns/{namespace}/memories": { @@ -3625,10 +3792,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "Namespace containing the memories to forget. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope memories." @@ -3665,6 +3832,16 @@ } }, "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst res = await client.memories.forget(\"user_123\", { ids: [\"mem_1\", \"mem_2\"] });\nconsole.log(res.count, res.errors);" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\nres = client.memories.forget(\"user_123\", ids=[\"mem_1\", \"mem_2\"])\nprint(res.count, res.errors)" + }, { "lang": "bash", "label": "cURL", @@ -3803,10 +3980,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "Namespace containing the memories to forget. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope memories." @@ -3842,6 +4019,16 @@ } }, "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\n// Preview first, then run again with dryRun: false\nconst preview = await client.memories.forgetMatching(\"user_123\", {\n query: \"forget everything about the old pricing plan\",\n dryRun: true,\n});\nconsole.log(preview.matches.map((m) => m.memory));" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\n# Preview first, then run again with dry_run=False\npreview = client.memories.forget_matching(\n \"user_123\",\n query=\"forget everything about the old pricing plan\",\n dry_run=True,\n)\nprint([m.memory for m in preview.matches])" + }, { "lang": "bash", "label": "cURL", @@ -3858,10 +4045,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "Namespace containing the resources to list. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope resources." @@ -3950,7 +4137,7 @@ "default": { "forgotten": false }, - "description": "Optional extras, matching search's include", + "description": "Optional extras", "example": { "forgotten": true }, @@ -4310,6 +4497,23 @@ "summary": "List resources", "tags": [ "Content Management" + ], + "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst page = await client.list(\"user_123\", \"documents\", {\n page: 1,\n limit: 20,\n sort: \"createdAt\",\n order: \"desc\",\n filter: { field: \"type\", operator: \"eq\", value: \"conversation\" },\n});\nconsole.log(page.documents.length, page.pagination.totalPages);" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\npage = client.list(\n \"user_123\",\n \"documents\",\n page=1,\n limit=20,\n sort=\"createdAt\",\n order=\"desc\",\n filter={\"field\": \"type\", \"operator\": \"eq\", \"value\": \"conversation\"},\n)\nprint(len(page.documents), page.pagination.total_pages)" + }, + { + "lang": "bash", + "label": "cURL", + "source": "curl -X POST \"https://api.supermemory.ai/ns/user_123/list/documents?page=1&limit=20&sort=createdAt&order=desc\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{ \"filter\": { \"field\": \"type\", \"operator\": \"eq\", \"value\": \"conversation\" } }'" + } ] } }, @@ -4504,7 +4708,7 @@ "type": "null" } ], - "description": "What syncs, grouped by kind, in the same shape PATCH takes. Null for connectors that sync everything.", + "description": "What syncs, grouped by kind (repos, labels, files or folders), each a list of { id, name }. Null for connectors that sync everything.", "example": { "labels": [ { @@ -4918,7 +5122,24 @@ "Connectors" ], "x-speakeasy-group": "connectors", - "x-speakeasy-name-override": "listAll" + "x-speakeasy-name-override": "listAll", + "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst { connectors } = await client.connectors.listAll({ provider: \"notion\", limit: 50 });\nfor (const c of connectors) console.log(c.namespace, c.provider, c.latestRun?.system.status);" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\npage = client.connectors.list_all(provider=\"notion\", limit=50)\nfor c in page.connectors:\n print(c.namespace, c.provider, c.latest_run.system.status if c.latest_run else None)" + }, + { + "lang": "bash", + "label": "cURL", + "source": "curl \"https://api.supermemory.ai/connectors?provider=notion&limit=50\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\"" + } + ] } }, "/ns/{namespace}/connectors": { @@ -4929,10 +5150,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "Namespace identifier. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope documents and memories." @@ -5340,7 +5561,24 @@ "Connectors" ], "x-speakeasy-group": "connectors", - "x-speakeasy-name-override": "create" + "x-speakeasy-name-override": "create", + "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst { id, authorization } = await client.connectors.create(\"user_123\", {\n provider: \"notion\",\n redirectUrl: \"https://app.example.com/connected\",\n});\n// OAuth providers return authorization.url to send the user to; config providers return null\nconsole.log(id, authorization?.url, authorization?.expiresAt);" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\nsetup = client.connectors.create(\n \"user_123\",\n request={\"provider\": \"notion\", \"redirectUrl\": \"https://app.example.com/connected\"},\n)\n# OAuth providers return authorization.url to send the user to; config providers return None\nprint(setup.id, setup.authorization.url if setup.authorization else None)" + }, + { + "lang": "bash", + "label": "cURL", + "source": "curl -X POST \"https://api.supermemory.ai/ns/user_123/connectors\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{ \"provider\": \"notion\", \"redirectUrl\": \"https://app.example.com/connected\" }'" + } + ] }, "get": { "operationId": "getNsByNamespaceConnectors", @@ -5349,10 +5587,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "Namespace identifier. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope documents and memories." @@ -5544,7 +5782,7 @@ "type": "null" } ], - "description": "What syncs, grouped by kind, in the same shape PATCH takes. Null for connectors that sync everything.", + "description": "What syncs, grouped by kind (repos, labels, files or folders), each a list of { id, name }. Null for connectors that sync everything.", "example": { "labels": [ { @@ -5958,7 +6196,24 @@ "Connectors" ], "x-speakeasy-group": "connectors", - "x-speakeasy-name-override": "list" + "x-speakeasy-name-override": "list", + "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst { connectors } = await client.connectors.list(\"user_123\");\nfor (const c of connectors) console.log(c.id, c.provider, c.documentCount);" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\npage = client.connectors.list(\"user_123\")\nfor c in page.connectors:\n print(c.id, c.provider, c.document_count)" + }, + { + "lang": "bash", + "label": "cURL", + "source": "curl \"https://api.supermemory.ai/ns/user_123/connectors\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\"" + } + ] } }, "/ns/{namespace}/connectors/{id}": { @@ -5969,10 +6224,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "Namespace identifier. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope documents and memories." @@ -6156,7 +6411,7 @@ "type": "null" } ], - "description": "What syncs, grouped by kind, in the same shape PATCH takes. Null for connectors that sync everything.", + "description": "What syncs, grouped by kind (repos, labels, files or folders), each a list of { id, name }. Null for connectors that sync everything.", "example": { "labels": [ { @@ -6542,7 +6797,24 @@ "Connectors" ], "x-speakeasy-group": "connectors", - "x-speakeasy-name-override": "get" + "x-speakeasy-name-override": "get", + "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst connector = await client.connectors.get(\"user_123\", \"conn_abc123\", {\n include: [\"syncs\", \"picker\"],\n});\nconsole.log(connector.latestRun?.system.status, connector.syncs?.length, connector.picker?.url);" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\nconnector = client.connectors.get(\"user_123\", \"conn_abc123\", include=[\"syncs\", \"picker\"])\nprint(connector.latest_run, connector.syncs, connector.picker)" + }, + { + "lang": "bash", + "label": "cURL", + "source": "curl \"https://api.supermemory.ai/ns/user_123/connectors/conn_abc123?include=syncs,picker\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\"" + } + ] }, "patch": { "operationId": "patchNsByNamespaceConnectorsById", @@ -6551,10 +6823,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "Namespace identifier. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope documents and memories." @@ -6774,7 +7046,7 @@ "type": "null" } ], - "description": "What syncs, grouped by kind, in the same shape PATCH takes. Null for connectors that sync everything.", + "description": "What syncs, grouped by kind (repos, labels, files or folders), each a list of { id, name }. Null for connectors that sync everything.", "example": { "labels": [ { @@ -7160,7 +7432,24 @@ "Connectors" ], "x-speakeasy-group": "connectors", - "x-speakeasy-name-override": "update" + "x-speakeasy-name-override": "update", + "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nawait client.connectors.update(\"user_123\", \"conn_abc123\", {\n documentLimit: 500,\n selection: { repos: [\"123456789\"] }, // provider-specific selection\n});" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\nclient.connectors.update(\n \"user_123\",\n \"conn_abc123\",\n document_limit=500,\n selection={\"repos\": [\"123456789\"]}, # provider-specific selection\n)" + }, + { + "lang": "bash", + "label": "cURL", + "source": "curl -X PATCH \"https://api.supermemory.ai/ns/user_123/connectors/conn_abc123\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{ \"documentLimit\": 500, \"selection\": { \"repos\": [\"123456789\"] } }'" + } + ] }, "delete": { "operationId": "deleteNsByNamespaceConnectorsById", @@ -7169,10 +7458,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "Namespace identifier. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope documents and memories." @@ -7285,7 +7574,24 @@ "Connectors" ], "x-speakeasy-group": "connectors", - "x-speakeasy-name-override": "delete" + "x-speakeasy-name-override": "delete", + "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nawait client.connectors.delete(\"user_123\", \"conn_abc123\", { deleteDocuments: true });" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\nclient.connectors.delete(\"user_123\", \"conn_abc123\", delete_documents=True)" + }, + { + "lang": "bash", + "label": "cURL", + "source": "curl -X DELETE \"https://api.supermemory.ai/ns/user_123/connectors/conn_abc123?deleteDocuments=true\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\"" + } + ] } }, "/ns/{namespace}/connectors/{id}/sync": { @@ -7296,10 +7602,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "Namespace identifier. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope documents and memories." @@ -7435,7 +7741,24 @@ "Connectors" ], "x-speakeasy-group": "connectors", - "x-speakeasy-name-override": "sync" + "x-speakeasy-name-override": "sync", + "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst run = await client.connectors.sync(\"user_123\", \"conn_abc123\");\nconsole.log(run.status); // \"queued\"; 409 if a sync is already running" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\nrun = client.connectors.sync(\"user_123\", \"conn_abc123\")\nprint(run.status) # \"queued\"; 409 if a sync is already running" + }, + { + "lang": "bash", + "label": "cURL", + "source": "curl -X POST \"https://api.supermemory.ai/ns/user_123/connectors/conn_abc123/sync\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\"" + } + ] } }, "/namespaces": { @@ -7633,6 +7956,23 @@ }, "description": "Maximum namespaces to return per page" } + ], + "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst { namespaces } = await client.namespaces.list({ page: 1, limit: 50 });\nconsole.log(namespaces.map((ns) => ns.namespace));" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\npage = client.namespaces.list(page=1, limit=50)\nprint([ns.namespace for ns in page.namespaces])" + }, + { + "lang": "bash", + "label": "cURL", + "source": "curl \"https://api.supermemory.ai/namespaces?page=1&limit=50\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\"" + } ] } }, @@ -7831,6 +8171,23 @@ }, "description": "Maximum namespaces to return per page" } + ], + "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst { namespaces, pagination } = await client.namespaces.list({ page: 1, limit: 50 });\nfor (const ns of namespaces) console.log(ns.namespace, ns.documentCount, ns.memoryCount);\nconsole.log(pagination.totalPages);" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\npage = client.namespaces.list(page=1, limit=50)\nfor ns in page.namespaces:\n print(ns.namespace, ns.document_count, ns.memory_count)\nprint(page.pagination.total_pages)" + }, + { + "lang": "bash", + "label": "cURL", + "source": "curl \"https://api.supermemory.ai/ns?page=1&limit=50\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\"" + } ] } }, @@ -7958,14 +8315,31 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "Namespace identifier. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope documents and memories." } + ], + "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst ns = await client.namespaces.get(\"user_123\");\nconsole.log(ns.supportingContext, ns.system.createdAt);" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\nns = client.namespaces.get(\"user_123\")\nprint(ns.supporting_context, ns.system.created_at)" + }, + { + "lang": "bash", + "label": "cURL", + "source": "curl \"https://api.supermemory.ai/ns/user_123\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\"" + } ] }, "patch": { @@ -7975,10 +8349,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "Namespace identifier. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope documents and memories." @@ -8125,6 +8499,23 @@ "summary": "Update namespace settings", "tags": [ "Namespaces" + ], + "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nawait client.namespaces.update(\"user_123\", {\n supportingContext: \"A paying customer on the Pro plan; prefers concise answers.\",\n});" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\nclient.namespaces.update(\n \"user_123\",\n supporting_context=\"A paying customer on the Pro plan; prefers concise answers.\",\n)" + }, + { + "lang": "bash", + "label": "cURL", + "source": "curl -X PATCH \"https://api.supermemory.ai/ns/user_123\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{ \"supportingContext\": \"A paying customer on the Pro plan; prefers concise answers.\" }'" + } ] }, "delete": { @@ -8314,10 +8705,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "Namespace identifier. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope documents and memories." @@ -8333,6 +8724,23 @@ }, "description": "Destination namespace that should receive this namespace's content before deletion. Omit to permanently delete the content." } + ], + "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\n// Move everything into another namespace instead of deleting: add { moveTo: \"project_main\" }\nconst res = await client.namespaces.delete(\"project_old\");\nconsole.log(res.status); // \"deleted\", or \"queued\" when moving" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\n# Move everything into another namespace instead of deleting: add move_to=\"project_main\"\nres = client.namespaces.delete(\"project_old\")\nprint(res.status) # \"deleted\", or \"queued\" when moving" + }, + { + "lang": "bash", + "label": "cURL", + "source": "curl -X DELETE \"https://api.supermemory.ai/ns/project_old?moveTo=project_main\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\"" + } ] } }, @@ -8408,6 +8816,23 @@ "summary": "Get organization settings", "tags": [ "Organization" + ], + "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst org = await client.organization.get();\nconsole.log(org.organizationalContext, org.namespaceCount);" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\norg = client.organization.get()\nprint(org.organizational_context, org.namespace_count)" + }, + { + "lang": "bash", + "label": "cURL", + "source": "curl \"https://api.supermemory.ai/organization\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\"" + } ] }, "patch": { @@ -8527,13 +8952,30 @@ "summary": "Update organization settings", "tags": [ "Organization" + ], + "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nawait client.organization.update({\n organizationalContext: \"Acme sells billing software to dental clinics.\",\n});" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\nclient.organization.update(\n organizational_context=\"Acme sells billing software to dental clinics.\",\n)" + }, + { + "lang": "bash", + "label": "cURL", + "source": "curl -X PATCH \"https://api.supermemory.ai/organization\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{ \"organizationalContext\": \"Acme sells billing software to dental clinics.\" }'" + } ] } }, "/ns/{namespace}/memories/{id}": { "get": { "operationId": "getNsByNamespaceMemoriesById", - "description": "Retrieve one memory by ID. Optionally include its version history and connected memories (each list walks outward up to relatedLimit, nearest first) and its source document.", + "description": "Retrieve one memory by ID. Optionally include its version history and connected memories (each list walks outward up to relatedLimit) and its source document.", "responses": { "200": { "content": { @@ -8749,7 +9191,7 @@ "system" ] }, - "description": "Earlier versions this memory updates, nearest first" + "description": "Earlier versions this memory updates" }, "children": { "type": "array", @@ -8891,7 +9333,7 @@ "system" ] }, - "description": "Newer versions that update this memory, nearest first" + "description": "Newer versions that update this memory" }, "siblings": { "type": "array", @@ -9033,7 +9475,7 @@ "system" ] }, - "description": "Memories connected by extends or derives, nearest first" + "description": "Memories connected by extends or derives" } }, "required": [ @@ -9205,10 +9647,10 @@ "in": "path", "name": "namespace", "schema": { + "example": "user_alex", "type": "string", "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$", - "example": "user_alex" + "pattern": "^[a-zA-Z0-9_:-]+$" }, "required": true, "description": "Namespace containing the memories to forget. This can be an ID for your user, a project ID, or any other identifier you wish to use to scope memories." @@ -9250,7 +9692,24 @@ "minimum": 1, "maximum": 100 }, - "description": "Maximum parents, children and siblings to return, applied to each list separately. Each list walks outward from the memory, nearest first, until it reaches this many." + "description": "Maximum parents, children and siblings to return, applied to each list separately. Each list walks outward from the memory until it reaches this many." + } + ], + "x-codeSamples": [ + { + "lang": "typescript", + "label": "TypeScript SDK", + "source": "import { Supermemory } from \"supermemory\";\n\nconst client = new Supermemory(); // reads SUPERMEMORY_API_KEY\n\nconst memory = await client.memories.get(\"user_123\", \"mem_abc123\", {\n include: [\"related\", \"documents\"],\n});\nconsole.log(memory.memory, memory.isLatest);" + }, + { + "lang": "python", + "label": "Python SDK", + "source": "from supermemory import Supermemory\n\nclient = Supermemory() # reads SUPERMEMORY_API_KEY\n\nmemory = client.memories.get(\"user_123\", \"mem_abc123\", include=[\"related\", \"documents\"])\nprint(memory.memory, memory.is_latest)" + }, + { + "lang": "bash", + "label": "cURL", + "source": "curl \"https://api.supermemory.ai/ns/user_123/memories/mem_abc123?include=related,documents\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\"" } ] } diff --git a/pyproject.toml b/pyproject.toml index 808b0526..81e13413 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "supermemory" -version = "5.0.0" +version = "5.0.1" description = "The official Python library for the Supermemory API" readme = "README.md" license = "Apache-2.0" diff --git a/reference.md b/reference.md index adcaa31d..02a1029f 100644 --- a/reference.md +++ b/reference.md @@ -476,7 +476,7 @@ client.list(