diff --git a/MIGRATION.md b/MIGRATION.md index ca5b620..ec291f3 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -56,7 +56,7 @@ Only the API methods change. Everything around them works as before: | `custom_id` | `id` | | `q` | `query` | | `filters` | `filter` (typed filter expression) | -| `include` | `attach` | +| `include` | `include` (a list on GETs, a dict on search) | | search `timing` / `total` | `search_time` | ## Profile no longer searches diff --git a/fern/openapi.json b/fern/openapi.json index 09927f6..a8d89ff 100644 --- a/fern/openapi.json +++ b/fern/openapi.json @@ -359,11 +359,22 @@ "properties": { "id": { "type": "string", - "description": "Unique identifier of the document" + "minLength": 1, + "description": "Document identifier to poll or retrieve" }, "status": { "type": "string", - "description": "Status of the document" + "enum": [ + "unknown", + "queued", + "extracting", + "chunking", + "embedding", + "indexing", + "done", + "failed" + ], + "description": "The document's processing state after this request. queued when new work was queued; otherwise its current state, e.g. done for an unchanged duplicate or failed for a metadata-only update to a failed document." } }, "required": [ @@ -460,30 +471,6 @@ }, "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." - }, - { - "in": "query", - "name": "taskType", - "schema": { - "type": "string", - "enum": [ - "memory", - "superrag" - ] - }, - "description": "Processing pipeline. \"memory\" builds durable learned context; \"superrag\" optimizes the document for retrieval without generating memories." - }, - { - "in": "query", - "name": "dreaming", - "schema": { - "type": "string", - "enum": [ - "dynamic", - "instant" - ] - }, - "description": "Processing mode. \"dynamic\" (default) groups related documents so memories form from coherent context. \"instant\" processes each document independently right away and bills one extra operation per document." } ], "requestBody": { @@ -570,6 +557,22 @@ "description": "When the source content is from, in ISO 8601 format", "example": "2026-01-15", "type": "string" + }, + "taskType": { + "description": "Processing pipeline. \"memory\" builds durable learned context; \"superrag\" optimizes the document for retrieval without generating memories.", + "type": "string", + "enum": [ + "memory", + "superrag" + ] + }, + "dreaming": { + "description": "Processing mode. \"dynamic\" (default) groups related documents so memories form from coherent context. \"instant\" processes each document independently right away and bills one extra operation per document.", + "type": "string", + "enum": [ + "dynamic", + "instant" + ] } }, "required": [ @@ -584,7 +587,7 @@ { "lang": "bash", "label": "cURL", - "source": "curl -X POST \"https://api.supermemory.ai/ns/user_123/document?dreaming=instant\" \\\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 }'" + "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 }'" } ] }, @@ -598,7 +601,7 @@ "schema": { "type": "object", "properties": { - "deletedCount": { + "count": { "type": "integer", "minimum": 0, "maximum": 9007199254740991, @@ -632,7 +635,7 @@ } }, "required": [ - "deletedCount", + "count", "errors" ], "additionalProperties": false @@ -759,22 +762,33 @@ "properties": { "id": { "type": "string", - "description": "Unique identifier of the document (empty string for failed items)" + "description": "Document identifier" }, "status": { "type": "string", - "description": "Status of the document (e.g. 'done', 'queued', 'error')" + "enum": [ + "unknown", + "queued", + "extracting", + "chunking", + "embedding", + "indexing", + "done", + "failed", + "error" + ], + "description": "The document's processing state, as for a single add; error when this item failed" }, "error": { - "description": "Error message when status is 'error'", + "description": "Failure reason", "type": "string" }, "details": { - "description": "Additional error details when status is 'error'", + "description": "Human-readable explanation of the failure", "type": "string" }, "url": { - "description": "URL of the failed item, when it had one. Only present on failed items, where it may be the only way to tell which input the error belongs to (the id falls back to 'unknown' when the input had neither an id nor a customId).", + "description": "URL of the failed item, when it had one", "type": "string" } }, @@ -784,21 +798,25 @@ ], "additionalProperties": false }, - "description": "Array of results for each document in the batch" + "description": "One result per submitted document: accepted documents first, in request order, then failed ones. Match results by id, or by url for a failed item with no id." }, - "failed": { - "type": "number", - "description": "Count of documents that failed to add" + "count": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991, + "description": "Number of documents accepted" }, - "success": { - "type": "number", - "description": "Count of documents successfully added" + "failed": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991, + "description": "Number of documents that failed" } }, "required": [ "results", - "failed", - "success" + "count", + "failed" ], "additionalProperties": false } @@ -880,30 +898,6 @@ }, "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." - }, - { - "in": "query", - "name": "taskType", - "schema": { - "type": "string", - "enum": [ - "memory", - "superrag" - ] - }, - "description": "Processing pipeline. \"memory\" builds durable learned context; \"superrag\" optimizes the document for retrieval without generating memories." - }, - { - "in": "query", - "name": "dreaming", - "schema": { - "type": "string", - "enum": [ - "dynamic", - "instant" - ] - }, - "description": "Processing mode. \"dynamic\" (default) groups related documents so memories form from coherent context. \"instant\" processes each document independently right away and bills one extra operation per document." } ], "requestBody": { @@ -1005,6 +999,22 @@ "additionalProperties": false }, "description": "Documents to ingest or append in one request" + }, + "taskType": { + "description": "Processing pipeline. \"memory\" builds durable learned context; \"superrag\" optimizes the document for retrieval without generating memories.", + "type": "string", + "enum": [ + "memory", + "superrag" + ] + }, + "dreaming": { + "description": "Processing mode. \"dynamic\" (default) groups related documents so memories form from coherent context. \"instant\" processes each document independently right away and bills one extra operation per document.", + "type": "string", + "enum": [ + "dynamic", + "instant" + ] } }, "required": [ @@ -1019,7 +1029,7 @@ { "lang": "bash", "label": "cURL", - "source": "curl -X POST \"https://api.supermemory.ai/ns/user_123/document/batch?dreaming=instant\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"documents\": [\n { \"content\": \"Q3 roadmap notes\", \"id\": \"doc_roadmap\" },\n { \"content\": \"Gift policy for VP promotions\", \"id\": \"doc_gifts\" }\n ]\n }'" + "source": "curl -X POST \"https://api.supermemory.ai/ns/user_123/document/batch\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\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 }'" } ] } @@ -1027,7 +1037,7 @@ "/ns/{namespace}/document/{id}": { "get": { "operationId": "getNsByNamespaceDocumentById", - "description": "Retrieve a document's canonical content, metadata, and processing state by document ID or caller-defined ID. Optionally attach its source chunks, derived memories, or both in the same response.", + "description": "Retrieve a document's canonical content, metadata, and processing state by document ID or caller-defined ID. Optionally include its source chunks, derived memories, or both in the same response.", "responses": { "200": { "content": { @@ -1096,6 +1106,16 @@ "properties": { "status": { "type": "string", + "enum": [ + "unknown", + "queued", + "extracting", + "chunking", + "embedding", + "indexing", + "done", + "failed" + ], "description": "Current extraction and memory-processing status" }, "createdAt": { @@ -1143,19 +1163,12 @@ "description": "Chunk content type" }, "metadata": { - "anyOf": [ - { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": {} - }, - { - "type": "null" - } - ], - "description": "Chunk metadata, when available" + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {}, + "description": "Chunk metadata; empty object when none" }, "system": { "type": "object", @@ -1199,19 +1212,12 @@ "description": "Learned fact or context extracted from the document" }, "metadata": { - "anyOf": [ - { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": {} - }, - { - "type": "null" - } - ], - "description": "Memory metadata, including temporal context when available" + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {}, + "description": "Memory metadata, including temporal context; empty object when none" }, "isStatic": { "type": "boolean", @@ -1282,7 +1288,7 @@ "metadata", "system" ], - "description": "Namespace-scoped document. Attachment keys are omitted unless requested and are empty arrays when requested without results." + "description": "Namespace-scoped document. Included keys are omitted unless requested and are empty arrays when requested without results." } } }, @@ -1377,7 +1383,7 @@ }, { "in": "query", - "name": "attach", + "name": "include", "schema": { "type": "array", "items": { @@ -1386,16 +1392,18 @@ "chunks", "memories" ] - } + }, + "style": "form", + "explode": false }, - "description": "Child resources to include. Repeat the parameter to attach chunks, memories, or both." + "description": "Comma-separated child resources to include: chunks, memories, or both." } ], "x-codeSamples": [ { "lang": "bash", "label": "cURL", - "source": "curl \"https://api.supermemory.ai/ns/project_123/document/doc_abc123?attach=chunks&attach=memories\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\"" + "source": "curl \"https://api.supermemory.ai/ns/project_123/document/doc_abc123?include=chunks,memories\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\"" } ] }, @@ -1411,11 +1419,22 @@ "properties": { "id": { "type": "string", - "description": "Unique identifier of the document" + "minLength": 1, + "description": "Document identifier to poll or retrieve" }, "status": { "type": "string", - "description": "Status of the document" + "enum": [ + "unknown", + "queued", + "extracting", + "chunking", + "embedding", + "indexing", + "done", + "failed" + ], + "description": "The document's processing state after this request. queued when new work was queued; otherwise its current state, e.g. done for an unchanged duplicate or failed for a metadata-only update to a failed document." } }, "required": [ @@ -1534,30 +1553,6 @@ }, "required": true, "description": "The public document ID" - }, - { - "in": "query", - "name": "taskType", - "schema": { - "type": "string", - "enum": [ - "memory", - "superrag" - ] - }, - "description": "Processing pipeline. \"memory\" builds durable learned context; \"superrag\" optimizes the document for retrieval without generating memories." - }, - { - "in": "query", - "name": "dreaming", - "schema": { - "type": "string", - "enum": [ - "dynamic", - "instant" - ] - }, - "description": "Processing mode. \"dynamic\" (default) groups related documents so memories form from coherent context. \"instant\" processes each document independently right away and bills one extra operation per document." } ], "requestBody": { @@ -1637,6 +1632,22 @@ "description": "When the source content is from, in ISO 8601 format", "example": "2026-01-15", "type": "string" + }, + "taskType": { + "description": "Processing pipeline. \"memory\" builds durable learned context; \"superrag\" optimizes the document for retrieval without generating memories.", + "type": "string", + "enum": [ + "memory", + "superrag" + ] + }, + "dreaming": { + "description": "Processing mode. \"dynamic\" (default) groups related documents so memories form from coherent context. \"instant\" processes each document independently right away and bills one extra operation per document.", + "type": "string", + "enum": [ + "dynamic", + "instant" + ] } }, "additionalProperties": false @@ -1671,8 +1682,17 @@ }, "status": { "type": "string", - "const": "processing", - "description": "Confirms the file was accepted for asynchronous processing" + "enum": [ + "unknown", + "queued", + "extracting", + "chunking", + "embedding", + "indexing", + "done", + "failed" + ], + "description": "The document's processing state after this request. queued when new work was queued; otherwise its current state, e.g. done for an unchanged duplicate or failed for a metadata-only update to a failed document." } }, "required": [ @@ -1769,54 +1789,6 @@ }, "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." - }, - { - "in": "query", - "name": "taskType", - "schema": { - "type": "string", - "enum": [ - "memory", - "superrag" - ] - }, - "description": "Processing pipeline. \"memory\" builds durable learned context; \"superrag\" optimizes the document for retrieval without generating memories." - }, - { - "in": "query", - "name": "dreaming", - "schema": { - "type": "string", - "enum": [ - "dynamic", - "instant" - ] - }, - "description": "Processing mode. \"dynamic\" (default) groups related documents so memories form from coherent context. \"instant\" processes each document independently right away and bills one extra operation per document." - }, - { - "in": "query", - "name": "fileType", - "schema": { - "type": "string", - "enum": [ - "text", - "pdf", - "image", - "video", - "audio" - ] - }, - "description": "Explicit source type used when automatic inference is insufficient" - }, - { - "in": "query", - "name": "mimeType", - "schema": { - "type": "string", - "pattern": "^[^\\s/]+\\/[^\\s/]+$" - }, - "description": "Explicit MIME type used when upload metadata is insufficient" } ], "requestBody": { @@ -1849,6 +1821,38 @@ "description": "When the source content is from, in ISO 8601 format", "example": "2026-01-15", "type": "string" + }, + "taskType": { + "description": "Processing pipeline. \"memory\" builds durable learned context; \"superrag\" optimizes the document for retrieval without generating memories.", + "type": "string", + "enum": [ + "memory", + "superrag" + ] + }, + "dreaming": { + "description": "Processing mode. \"dynamic\" (default) groups related documents so memories form from coherent context. \"instant\" processes each document independently right away and bills one extra operation per document.", + "type": "string", + "enum": [ + "dynamic", + "instant" + ] + }, + "fileType": { + "description": "Explicit source type used when automatic inference is insufficient", + "type": "string", + "enum": [ + "text", + "pdf", + "image", + "video", + "audio" + ] + }, + "mimeType": { + "description": "Explicit MIME type used when upload metadata is insufficient", + "type": "string", + "pattern": "^[^\\s/]+\\/[^\\s/]+$" } }, "required": [ @@ -1879,8 +1883,17 @@ }, "status": { "type": "string", - "const": "processing", - "description": "Confirms the file was accepted for asynchronous processing" + "enum": [ + "unknown", + "queued", + "extracting", + "chunking", + "embedding", + "indexing", + "done", + "failed" + ], + "description": "The document's processing state after this request. queued when new work was queued; otherwise its current state, e.g. done for an unchanged duplicate or failed for a metadata-only update to a failed document." } }, "required": [ @@ -1999,54 +2012,6 @@ }, "required": true, "description": "The public document ID" - }, - { - "in": "query", - "name": "taskType", - "schema": { - "type": "string", - "enum": [ - "memory", - "superrag" - ] - }, - "description": "Processing pipeline. \"memory\" builds durable learned context; \"superrag\" optimizes the document for retrieval without generating memories." - }, - { - "in": "query", - "name": "dreaming", - "schema": { - "type": "string", - "enum": [ - "dynamic", - "instant" - ] - }, - "description": "Processing mode. \"dynamic\" (default) groups related documents so memories form from coherent context. \"instant\" processes each document independently right away and bills one extra operation per document." - }, - { - "in": "query", - "name": "fileType", - "schema": { - "type": "string", - "enum": [ - "text", - "pdf", - "image", - "video", - "audio" - ] - }, - "description": "Explicit source type used when automatic inference is insufficient" - }, - { - "in": "query", - "name": "mimeType", - "schema": { - "type": "string", - "pattern": "^[^\\s/]+\\/[^\\s/]+$" - }, - "description": "Explicit MIME type used when upload metadata is insufficient" } ], "requestBody": { @@ -2079,6 +2044,38 @@ "description": "When the source content is from, in ISO 8601 format", "example": "2026-01-15", "type": "string" + }, + "taskType": { + "description": "Processing pipeline. \"memory\" builds durable learned context; \"superrag\" optimizes the document for retrieval without generating memories.", + "type": "string", + "enum": [ + "memory", + "superrag" + ] + }, + "dreaming": { + "description": "Processing mode. \"dynamic\" (default) groups related documents so memories form from coherent context. \"instant\" processes each document independently right away and bills one extra operation per document.", + "type": "string", + "enum": [ + "dynamic", + "instant" + ] + }, + "fileType": { + "description": "Explicit source type used when automatic inference is insufficient", + "type": "string", + "enum": [ + "text", + "pdf", + "image", + "video", + "audio" + ] + }, + "mimeType": { + "description": "Explicit MIME type used when upload metadata is insufficient", + "type": "string", + "pattern": "^[^\\s/]+\\/[^\\s/]+$" } }, "required": [ @@ -2107,8 +2104,17 @@ }, "status": { "type": "string", - "const": "processing", - "description": "Confirms the file was accepted for asynchronous processing" + "enum": [ + "unknown", + "queued", + "extracting", + "chunking", + "embedding", + "indexing", + "done", + "failed" + ], + "description": "The document's processing state after this request. queued when new work was queued; otherwise its current state, e.g. done for an unchanged duplicate or failed for a metadata-only update to a failed document." } }, "required": [ @@ -2227,54 +2233,6 @@ }, "required": true, "description": "The public document ID" - }, - { - "in": "query", - "name": "taskType", - "schema": { - "type": "string", - "enum": [ - "memory", - "superrag" - ] - }, - "description": "Processing pipeline. \"memory\" builds durable learned context; \"superrag\" optimizes the document for retrieval without generating memories." - }, - { - "in": "query", - "name": "dreaming", - "schema": { - "type": "string", - "enum": [ - "dynamic", - "instant" - ] - }, - "description": "Processing mode. \"dynamic\" (default) groups related documents so memories form from coherent context. \"instant\" processes each document independently right away and bills one extra operation per document." - }, - { - "in": "query", - "name": "fileType", - "schema": { - "type": "string", - "enum": [ - "text", - "pdf", - "image", - "video", - "audio" - ] - }, - "description": "Explicit source type used when automatic inference is insufficient" - }, - { - "in": "query", - "name": "mimeType", - "schema": { - "type": "string", - "pattern": "^[^\\s/]+\\/[^\\s/]+$" - }, - "description": "Explicit MIME type used when upload metadata is insufficient" } ], "requestBody": { @@ -2307,8 +2265,40 @@ "description": "When the source content is from, in ISO 8601 format", "example": "2026-01-15", "type": "string" - } - }, + }, + "taskType": { + "description": "Processing pipeline. \"memory\" builds durable learned context; \"superrag\" optimizes the document for retrieval without generating memories.", + "type": "string", + "enum": [ + "memory", + "superrag" + ] + }, + "dreaming": { + "description": "Processing mode. \"dynamic\" (default) groups related documents so memories form from coherent context. \"instant\" processes each document independently right away and bills one extra operation per document.", + "type": "string", + "enum": [ + "dynamic", + "instant" + ] + }, + "fileType": { + "description": "Explicit source type used when automatic inference is insufficient", + "type": "string", + "enum": [ + "text", + "pdf", + "image", + "video", + "audio" + ] + }, + "mimeType": { + "description": "Explicit MIME type used when upload metadata is insufficient", + "type": "string", + "pattern": "^[^\\s/]+\\/[^\\s/]+$" + } + }, "additionalProperties": false } } @@ -2348,18 +2338,11 @@ "type": "string" }, "metadata": { - "anyOf": [ - { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": {} - }, - { - "type": "null" - } - ], + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {}, "description": "Public metadata attached to the result", "example": { "source": "conversation", @@ -2375,6 +2358,10 @@ "type": "boolean", "description": "Whether the memory is its latest version; false for recalled forgotten memories" }, + "isInference": { + "type": "boolean", + "description": "Whether the memory was inferred rather than stated directly; false for chunks" + }, "system": { "type": "object", "properties": { @@ -2397,7 +2384,7 @@ "type": "object", "properties": { "related": { - "description": "Memory relationships attached when requested", + "description": "Memory relationships included when requested", "type": "object", "properties": { "parents": { @@ -2405,6 +2392,10 @@ "items": { "type": "object", "properties": { + "id": { + "type": "string", + "description": "Related memory ID" + }, "relation": { "type": "string", "enum": [ @@ -2430,19 +2421,12 @@ "description": "Related learned fact or context" }, "metadata": { - "description": "Public metadata associated with the related memory", - "anyOf": [ - { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": {} - }, - { - "type": "null" - } - ] + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {}, + "description": "Public metadata associated with the related memory" }, "system": { "type": "object", @@ -2459,8 +2443,10 @@ } }, "required": [ + "id", "relation", "memory", + "metadata", "system" ] }, @@ -2471,6 +2457,10 @@ "items": { "type": "object", "properties": { + "id": { + "type": "string", + "description": "Related memory ID" + }, "relation": { "type": "string", "enum": [ @@ -2496,19 +2486,12 @@ "description": "Related learned fact or context" }, "metadata": { - "description": "Public metadata associated with the related memory", - "anyOf": [ - { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": {} - }, - { - "type": "null" - } - ] + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {}, + "description": "Public metadata associated with the related memory" }, "system": { "type": "object", @@ -2525,8 +2508,10 @@ } }, "required": [ + "id", "relation", "memory", + "metadata", "system" ] }, @@ -2537,6 +2522,10 @@ "items": { "type": "object", "properties": { + "id": { + "type": "string", + "description": "Related memory ID" + }, "relation": { "type": "string", "enum": [ @@ -2562,19 +2551,12 @@ "description": "Related learned fact or context" }, "metadata": { - "description": "Public metadata associated with the related memory", - "anyOf": [ - { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": {} - }, - { - "type": "null" - } - ] + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {}, + "description": "Public metadata associated with the related memory" }, "system": { "type": "object", @@ -2591,8 +2573,10 @@ } }, "required": [ + "id", "relation", "memory", + "metadata", "system" ] }, @@ -2606,7 +2590,7 @@ ] }, "document": { - "description": "Source document attached when requested and available", + "description": "Source document included when requested and available", "type": "object", "properties": { "id": { @@ -2614,7 +2598,6 @@ "description": "Source document identifier" }, "title": { - "description": "Source document title", "anyOf": [ { "type": "string" @@ -2622,10 +2605,10 @@ { "type": "null" } - ] + ], + "description": "Source document title" }, "type": { - "description": "Detected source or content type", "anyOf": [ { "type": "string" @@ -2633,25 +2616,18 @@ { "type": "null" } - ] + ], + "description": "Detected source or content type" }, "metadata": { - "description": "Public metadata attached to the source document", - "anyOf": [ - { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": {} - }, - { - "type": "null" - } - ] + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {}, + "description": "Public metadata attached to the source document" }, "summary": { - "description": "Generated summary of the source document", "anyOf": [ { "type": "string" @@ -2659,21 +2635,35 @@ { "type": "null" } - ] - }, - "createdAt": { - "type": "string", - "description": "ISO 8601 timestamp when the source document was created" + ], + "description": "Generated summary of the source document" }, - "updatedAt": { - "type": "string", - "description": "ISO 8601 timestamp of the source document's latest update" + "system": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "description": "ISO 8601 timestamp when the source document was created" + }, + "updatedAt": { + "type": "string", + "description": "ISO 8601 timestamp of the source document's latest update" + } + }, + "required": [ + "createdAt", + "updatedAt" + ], + "description": "Lifecycle timestamps maintained by Supermemory" } }, "required": [ "id", - "createdAt", - "updatedAt" + "title", + "type", + "metadata", + "summary", + "system" ] } } @@ -2684,6 +2674,7 @@ "metadata", "similarity", "isLatest", + "isInference", "system" ] }, @@ -2777,33 +2768,6 @@ }, "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." - }, - { - "in": "query", - "name": "limit", - "schema": { - "default": 10, - "example": 10, - "type": "integer", - "minimum": 1, - "maximum": 100 - }, - "description": "Maximum number of results to return" - }, - { - "in": "query", - "name": "searchMode", - "schema": { - "default": "hybrid", - "example": "hybrid", - "type": "string", - "enum": [ - "hybrid", - "memories", - "chunks" - ] - }, - "description": "Search surface. \"hybrid\" combines learned memories with source chunks, \"memories\" returns learned context, and \"chunks\" returns source passages." } ], "requestBody": { @@ -2828,28 +2792,50 @@ }, "$ref": "#/components/schemas/FilterExpression" }, - "attach": { + "searchMode": { + "default": "hybrid", + "description": "Search surface. \"hybrid\" combines learned memories with source chunks, \"memories\" returns learned context, and \"chunks\" returns source passages.", + "example": "hybrid", + "type": "string", + "enum": [ + "hybrid", + "memories", + "chunks" + ] + }, + "limit": { + "default": 10, + "description": "Maximum number of results to return", + "example": 10, + "type": "integer", + "minimum": 1, + "maximum": 100 + }, + "include": { "default": { "documents": false, "related": false, "forgotten": false }, "description": "Optional context to include alongside each matching result", + "example": { + "related": true + }, "type": "object", "properties": { "documents": { "default": false, - "description": "Attach the source document for each result when one is available", + "description": "Include the source document for each result when one is available", "type": "boolean" }, "related": { "default": false, - "description": "Attach parent, child, and sibling memories that explain how each memory evolved", + "description": "Include parent, child, and sibling memories that explain how each memory evolved", "type": "boolean" }, "forgotten": { "default": false, - "description": "Allow forgotten memories to participate in recall", + "description": "Let forgotten and expired memories appear in results", "type": "boolean" } }, @@ -2893,7 +2879,7 @@ { "lang": "bash", "label": "cURL", - "source": "curl -X POST \"https://api.supermemory.ai/ns/user_123/search?searchMode=hybrid&limit=5\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"query\": \"gift ideas for a VP promotion after a Tokyo offsite\",\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 \"attach\": { \"related\": true }\n }'" + "source": "curl -X POST \"https://api.supermemory.ai/ns/user_123/search\" \\\n -H \"Authorization: Bearer $SUPERMEMORY_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\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 }'" } ] } @@ -3900,15 +3886,10 @@ "name": "page", "schema": { "example": 1, - "anyOf": [ - { - "type": "string", - "pattern": "^\\d+$" - }, - { - "type": "number" - } - ] + "default": 1, + "type": "integer", + "minimum": 1, + "maximum": 9007199254740991 }, "description": "One-based page number" }, @@ -3917,15 +3898,10 @@ "name": "limit", "schema": { "example": 10, - "anyOf": [ - { - "type": "string", - "pattern": "^\\d+$" - }, - { - "type": "number" - } - ] + "default": 10, + "type": "integer", + "minimum": 1, + "maximum": 100 }, "description": "Maximum resources to return per page" }, @@ -3933,6 +3909,7 @@ "in": "query", "name": "sort", "schema": { + "default": "createdAt", "example": "createdAt", "type": "string", "enum": [ @@ -3968,6 +3945,24 @@ "filter": { "description": "Type-safe metadata conditions applied before pagination", "$ref": "#/components/schemas/FilterExpression" + }, + "include": { + "default": { + "forgotten": false + }, + "description": "Optional extras, matching search's include", + "example": { + "forgotten": true + }, + "type": "object", + "properties": { + "forgotten": { + "default": false, + "description": "List forgotten and expired memories too, with isForgotten: true. Applies to type memories only.", + "type": "boolean" + } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -4102,19 +4097,12 @@ "description": "Chunk content type" }, "metadata": { - "anyOf": [ - { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": {} - }, - { - "type": "null" - } - ], - "description": "Chunk metadata, when available" + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {}, + "description": "Chunk metadata; empty object when none" }, "system": { "type": "object", @@ -4162,19 +4150,12 @@ "description": "Learned fact or context extracted from the document" }, "metadata": { - "anyOf": [ - { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": {} - }, - { - "type": "null" - } - ], - "description": "Memory metadata, including temporal context when available" + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {}, + "description": "Memory metadata, including temporal context; empty object when none" }, "isStatic": { "type": "boolean", @@ -4369,7 +4350,7 @@ "in": "query", "name": "limit", "schema": { - "default": 50, + "default": 10, "type": "integer", "minimum": 1, "maximum": 100 @@ -4407,23 +4388,25 @@ ], "description": "External source" }, - "status": { - "type": "string", - "enum": [ - "pending_authorization", - "active" - ], - "description": "pending_authorization until the user finishes the provider login at authUrl; DELETE cancels it. Pending connectors are not listed." - }, - "authUrl": { - "description": "Present while pending, when the caller can create connectors in this namespace: where to send the user to authorize", - "type": "string" - }, - "authUrlExpiresAt": { - "description": "Present while pending: when authUrl stops working", - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + "authorization": { + "description": "Present while pending, when the caller can create connectors in this namespace", + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "Send the user here to authorize the provider" + }, + "expiresAt": { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "When url stops working" + } + }, + "required": [ + "url", + "expiresAt" + ] }, "namespace": { "anyOf": [ @@ -4537,19 +4520,11 @@ "documentCount": { "type": "number" }, - "lastSync": { + "latestRun": { "anyOf": [ { "type": "object", "properties": { - "status": { - "type": "string", - "enum": [ - "running", - "completed", - "failed" - ] - }, "errorCode": { "anyOf": [ { @@ -4578,70 +4553,101 @@ ], "description": "Customer-safe error message" }, - "startedAt": { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" - }, - "completedAt": { - "anyOf": [ - { + "system": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "running", + "completed", + "failed" + ] + }, + "startedAt": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "ISO 8601 timestamp when the run started" }, - { - "type": "null" + "completedAt": { + "anyOf": [ + { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + }, + { + "type": "null" + } + ], + "description": "ISO 8601 timestamp when the run ended; null while running" } - ] + }, + "required": [ + "status", + "startedAt", + "completedAt" + ], + "description": "Run status and timestamps maintained by Supermemory" } }, "required": [ - "status", "errorCode", "error", - "startedAt", - "completedAt" + "system" ] }, { "type": "null" } ], - "description": "Most recent sync run" + "description": "The most recent sync run, which may still be running or may have failed" }, - "lastSyncedAt": { - "anyOf": [ - { + "system": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "pending_authorization", + "active" + ], + "description": "pending_authorization until the user finishes the provider login at authorization.url; DELETE cancels it. Pending connectors are not listed." + }, + "createdAt": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "ISO 8601 timestamp when the connector was created" }, - { - "type": "null" - } - ], - "description": "When content last finished syncing" - }, - "createdAt": { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + "lastSuccessfulSyncAt": { + "anyOf": [ + { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + }, + { + "type": "null" + } + ], + "description": "ISO 8601 timestamp when content last finished syncing successfully" + } + }, + "required": [ + "status", + "createdAt", + "lastSuccessfulSyncAt" + ], + "description": "Lifecycle status and timestamps maintained by Supermemory" }, "syncs": { - "description": "Present when attach=syncs", + "description": "Present when include=syncs", "type": "array", "items": { "type": "object", "properties": { - "status": { - "type": "string", - "enum": [ - "running", - "completed", - "failed" - ] - }, "errorCode": { "anyOf": [ { @@ -4670,22 +4676,43 @@ ], "description": "Customer-safe error message" }, - "startedAt": { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" - }, - "completedAt": { - "anyOf": [ - { + "system": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "running", + "completed", + "failed" + ] + }, + "startedAt": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "ISO 8601 timestamp when the run started" }, - { - "type": "null" + "completedAt": { + "anyOf": [ + { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + }, + { + "type": "null" + } + ], + "description": "ISO 8601 timestamp when the run ended; null while running" } - ] + }, + "required": [ + "status", + "startedAt", + "completedAt" + ], + "description": "Run status and timestamps maintained by Supermemory" }, "id": { "type": "string" @@ -4744,11 +4771,9 @@ } }, "required": [ - "status", "errorCode", "error", - "startedAt", - "completedAt", + "system", "id", "trigger", "itemsProcessed", @@ -4758,7 +4783,7 @@ } }, "picker": { - "description": "Present when attach=picker. Null for connectors that sync everything.", + "description": "Present when include=picker. Null for connectors that sync everything.", "anyOf": [ { "type": "object", @@ -4787,7 +4812,6 @@ "required": [ "id", "provider", - "status", "namespace", "account", "capabilities", @@ -4795,9 +4819,8 @@ "selection", "documentLimit", "documentCount", - "lastSync", - "lastSyncedAt", - "createdAt" + "latestRun", + "system" ] } }, @@ -5195,7 +5218,7 @@ } } }, - "description": "Connect an external source to this namespace. OAuth providers return an authUrl to send the user to; providers that authenticate with config start syncing right away.", + "description": "Connect an external source to this namespace. OAuth providers return an authorization url to send the user to; providers that authenticate with config start syncing right away.", "responses": { "201": { "content": { @@ -5207,35 +5230,37 @@ "type": "string", "description": "Connector identifier" }, - "authUrl": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Send the user here to authorize the provider. Null for providers that authenticate with config only." - }, - "authUrlExpiresAt": { + "authorization": { "anyOf": [ { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "Send the user here to authorize the provider" + }, + "expiresAt": { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "When url stops working" + } + }, + "required": [ + "url", + "expiresAt" + ] }, { "type": "null" } ], - "description": "When authUrl stops working" + "description": "Null for providers that authenticate with config only" } }, "required": [ "id", - "authUrl", - "authUrlExpiresAt" + "authorization" ] } } @@ -5365,7 +5390,7 @@ "in": "query", "name": "limit", "schema": { - "default": 50, + "default": 10, "type": "integer", "minimum": 1, "maximum": 100 @@ -5403,23 +5428,25 @@ ], "description": "External source" }, - "status": { - "type": "string", - "enum": [ - "pending_authorization", - "active" - ], - "description": "pending_authorization until the user finishes the provider login at authUrl; DELETE cancels it. Pending connectors are not listed." - }, - "authUrl": { - "description": "Present while pending, when the caller can create connectors in this namespace: where to send the user to authorize", - "type": "string" - }, - "authUrlExpiresAt": { - "description": "Present while pending: when authUrl stops working", - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + "authorization": { + "description": "Present while pending, when the caller can create connectors in this namespace", + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "Send the user here to authorize the provider" + }, + "expiresAt": { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "When url stops working" + } + }, + "required": [ + "url", + "expiresAt" + ] }, "namespace": { "anyOf": [ @@ -5533,19 +5560,11 @@ "documentCount": { "type": "number" }, - "lastSync": { + "latestRun": { "anyOf": [ { "type": "object", "properties": { - "status": { - "type": "string", - "enum": [ - "running", - "completed", - "failed" - ] - }, "errorCode": { "anyOf": [ { @@ -5574,70 +5593,101 @@ ], "description": "Customer-safe error message" }, - "startedAt": { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" - }, - "completedAt": { - "anyOf": [ - { + "system": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "running", + "completed", + "failed" + ] + }, + "startedAt": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "ISO 8601 timestamp when the run started" }, - { - "type": "null" + "completedAt": { + "anyOf": [ + { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + }, + { + "type": "null" + } + ], + "description": "ISO 8601 timestamp when the run ended; null while running" } - ] + }, + "required": [ + "status", + "startedAt", + "completedAt" + ], + "description": "Run status and timestamps maintained by Supermemory" } }, "required": [ - "status", "errorCode", "error", - "startedAt", - "completedAt" + "system" ] }, { "type": "null" } ], - "description": "Most recent sync run" + "description": "The most recent sync run, which may still be running or may have failed" }, - "lastSyncedAt": { - "anyOf": [ - { + "system": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "pending_authorization", + "active" + ], + "description": "pending_authorization until the user finishes the provider login at authorization.url; DELETE cancels it. Pending connectors are not listed." + }, + "createdAt": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "ISO 8601 timestamp when the connector was created" }, - { - "type": "null" + "lastSuccessfulSyncAt": { + "anyOf": [ + { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + }, + { + "type": "null" + } + ], + "description": "ISO 8601 timestamp when content last finished syncing successfully" } + }, + "required": [ + "status", + "createdAt", + "lastSuccessfulSyncAt" ], - "description": "When content last finished syncing" - }, - "createdAt": { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + "description": "Lifecycle status and timestamps maintained by Supermemory" }, "syncs": { - "description": "Present when attach=syncs", + "description": "Present when include=syncs", "type": "array", "items": { "type": "object", "properties": { - "status": { - "type": "string", - "enum": [ - "running", - "completed", - "failed" - ] - }, "errorCode": { "anyOf": [ { @@ -5666,22 +5716,43 @@ ], "description": "Customer-safe error message" }, - "startedAt": { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" - }, - "completedAt": { - "anyOf": [ - { + "system": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "running", + "completed", + "failed" + ] + }, + "startedAt": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "ISO 8601 timestamp when the run started" }, - { - "type": "null" + "completedAt": { + "anyOf": [ + { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + }, + { + "type": "null" + } + ], + "description": "ISO 8601 timestamp when the run ended; null while running" } - ] + }, + "required": [ + "status", + "startedAt", + "completedAt" + ], + "description": "Run status and timestamps maintained by Supermemory" }, "id": { "type": "string" @@ -5740,11 +5811,9 @@ } }, "required": [ - "status", "errorCode", "error", - "startedAt", - "completedAt", + "system", "id", "trigger", "itemsProcessed", @@ -5754,7 +5823,7 @@ } }, "picker": { - "description": "Present when attach=picker. Null for connectors that sync everything.", + "description": "Present when include=picker. Null for connectors that sync everything.", "anyOf": [ { "type": "object", @@ -5783,7 +5852,6 @@ "required": [ "id", "provider", - "status", "namespace", "account", "capabilities", @@ -5791,9 +5859,8 @@ "selection", "documentLimit", "documentCount", - "lastSync", - "lastSyncedAt", - "createdAt" + "latestRun", + "system" ] } }, @@ -5923,10 +5990,18 @@ }, { "in": "query", - "name": "attach", + "name": "include", "schema": { - "type": "string", - "pattern": "^(syncs|picker)(,(syncs|picker))*$" + "type": "array", + "items": { + "type": "string", + "enum": [ + "syncs", + "picker" + ] + }, + "style": "form", + "explode": false }, "description": "Comma-separated extras. syncs: the 10 most recent sync runs with their failed items. picker: a one-time hosted picker URL." }, @@ -5940,7 +6015,7 @@ "description": "Where the hosted picker sends the user when they finish" } ], - "description": "Read one connector. Add attach=syncs to include its recent sync runs and the items that failed. attach=picker needs an admin with write access, since the link changes what syncs.", + "description": "Read one connector. Add include=syncs to include its recent sync runs and the items that failed. include=picker needs an admin with write access, since the link changes what syncs.", "responses": { "200": { "content": { @@ -5965,23 +6040,25 @@ ], "description": "External source" }, - "status": { - "type": "string", - "enum": [ - "pending_authorization", - "active" - ], - "description": "pending_authorization until the user finishes the provider login at authUrl; DELETE cancels it. Pending connectors are not listed." - }, - "authUrl": { - "description": "Present while pending, when the caller can create connectors in this namespace: where to send the user to authorize", - "type": "string" - }, - "authUrlExpiresAt": { - "description": "Present while pending: when authUrl stops working", - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + "authorization": { + "description": "Present while pending, when the caller can create connectors in this namespace", + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "Send the user here to authorize the provider" + }, + "expiresAt": { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "When url stops working" + } + }, + "required": [ + "url", + "expiresAt" + ] }, "namespace": { "anyOf": [ @@ -6095,19 +6172,11 @@ "documentCount": { "type": "number" }, - "lastSync": { + "latestRun": { "anyOf": [ { "type": "object", "properties": { - "status": { - "type": "string", - "enum": [ - "running", - "completed", - "failed" - ] - }, "errorCode": { "anyOf": [ { @@ -6136,70 +6205,101 @@ ], "description": "Customer-safe error message" }, - "startedAt": { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" - }, - "completedAt": { - "anyOf": [ - { + "system": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "running", + "completed", + "failed" + ] + }, + "startedAt": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "ISO 8601 timestamp when the run started" }, - { - "type": "null" + "completedAt": { + "anyOf": [ + { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + }, + { + "type": "null" + } + ], + "description": "ISO 8601 timestamp when the run ended; null while running" } - ] + }, + "required": [ + "status", + "startedAt", + "completedAt" + ], + "description": "Run status and timestamps maintained by Supermemory" } }, "required": [ - "status", "errorCode", "error", - "startedAt", - "completedAt" + "system" ] }, { "type": "null" } ], - "description": "Most recent sync run" + "description": "The most recent sync run, which may still be running or may have failed" }, - "lastSyncedAt": { - "anyOf": [ - { + "system": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "pending_authorization", + "active" + ], + "description": "pending_authorization until the user finishes the provider login at authorization.url; DELETE cancels it. Pending connectors are not listed." + }, + "createdAt": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "ISO 8601 timestamp when the connector was created" }, - { - "type": "null" + "lastSuccessfulSyncAt": { + "anyOf": [ + { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + }, + { + "type": "null" + } + ], + "description": "ISO 8601 timestamp when content last finished syncing successfully" } - ], - "description": "When content last finished syncing" - }, - "createdAt": { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + }, + "required": [ + "status", + "createdAt", + "lastSuccessfulSyncAt" + ], + "description": "Lifecycle status and timestamps maintained by Supermemory" }, "syncs": { - "description": "Present when attach=syncs", + "description": "Present when include=syncs", "type": "array", "items": { "type": "object", "properties": { - "status": { - "type": "string", - "enum": [ - "running", - "completed", - "failed" - ] - }, "errorCode": { "anyOf": [ { @@ -6228,22 +6328,43 @@ ], "description": "Customer-safe error message" }, - "startedAt": { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" - }, - "completedAt": { - "anyOf": [ - { + "system": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "running", + "completed", + "failed" + ] + }, + "startedAt": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "ISO 8601 timestamp when the run started" }, - { - "type": "null" + "completedAt": { + "anyOf": [ + { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + }, + { + "type": "null" + } + ], + "description": "ISO 8601 timestamp when the run ended; null while running" } - ] + }, + "required": [ + "status", + "startedAt", + "completedAt" + ], + "description": "Run status and timestamps maintained by Supermemory" }, "id": { "type": "string" @@ -6302,11 +6423,9 @@ } }, "required": [ - "status", "errorCode", "error", - "startedAt", - "completedAt", + "system", "id", "trigger", "itemsProcessed", @@ -6316,7 +6435,7 @@ } }, "picker": { - "description": "Present when attach=picker. Null for connectors that sync everything.", + "description": "Present when include=picker. Null for connectors that sync everything.", "anyOf": [ { "type": "object", @@ -6345,7 +6464,6 @@ "required": [ "id", "provider", - "status", "namespace", "account", "capabilities", @@ -6353,9 +6471,8 @@ "selection", "documentLimit", "documentCount", - "lastSync", - "lastSyncedAt", - "createdAt" + "latestRun", + "system" ] } } @@ -6541,23 +6658,25 @@ ], "description": "External source" }, - "status": { - "type": "string", - "enum": [ - "pending_authorization", - "active" - ], - "description": "pending_authorization until the user finishes the provider login at authUrl; DELETE cancels it. Pending connectors are not listed." - }, - "authUrl": { - "description": "Present while pending, when the caller can create connectors in this namespace: where to send the user to authorize", - "type": "string" - }, - "authUrlExpiresAt": { - "description": "Present while pending: when authUrl stops working", - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + "authorization": { + "description": "Present while pending, when the caller can create connectors in this namespace", + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "Send the user here to authorize the provider" + }, + "expiresAt": { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "When url stops working" + } + }, + "required": [ + "url", + "expiresAt" + ] }, "namespace": { "anyOf": [ @@ -6671,19 +6790,11 @@ "documentCount": { "type": "number" }, - "lastSync": { + "latestRun": { "anyOf": [ { "type": "object", "properties": { - "status": { - "type": "string", - "enum": [ - "running", - "completed", - "failed" - ] - }, "errorCode": { "anyOf": [ { @@ -6712,70 +6823,101 @@ ], "description": "Customer-safe error message" }, - "startedAt": { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" - }, - "completedAt": { - "anyOf": [ - { + "system": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "running", + "completed", + "failed" + ] + }, + "startedAt": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "ISO 8601 timestamp when the run started" }, - { - "type": "null" + "completedAt": { + "anyOf": [ + { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + }, + { + "type": "null" + } + ], + "description": "ISO 8601 timestamp when the run ended; null while running" } - ] + }, + "required": [ + "status", + "startedAt", + "completedAt" + ], + "description": "Run status and timestamps maintained by Supermemory" } }, "required": [ - "status", "errorCode", "error", - "startedAt", - "completedAt" + "system" ] }, { "type": "null" } ], - "description": "Most recent sync run" + "description": "The most recent sync run, which may still be running or may have failed" }, - "lastSyncedAt": { - "anyOf": [ - { + "system": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "pending_authorization", + "active" + ], + "description": "pending_authorization until the user finishes the provider login at authorization.url; DELETE cancels it. Pending connectors are not listed." + }, + "createdAt": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "ISO 8601 timestamp when the connector was created" }, - { - "type": "null" + "lastSuccessfulSyncAt": { + "anyOf": [ + { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + }, + { + "type": "null" + } + ], + "description": "ISO 8601 timestamp when content last finished syncing successfully" } + }, + "required": [ + "status", + "createdAt", + "lastSuccessfulSyncAt" ], - "description": "When content last finished syncing" - }, - "createdAt": { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + "description": "Lifecycle status and timestamps maintained by Supermemory" }, "syncs": { - "description": "Present when attach=syncs", + "description": "Present when include=syncs", "type": "array", "items": { "type": "object", "properties": { - "status": { - "type": "string", - "enum": [ - "running", - "completed", - "failed" - ] - }, "errorCode": { "anyOf": [ { @@ -6804,22 +6946,43 @@ ], "description": "Customer-safe error message" }, - "startedAt": { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" - }, - "completedAt": { - "anyOf": [ - { + "system": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "running", + "completed", + "failed" + ] + }, + "startedAt": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "ISO 8601 timestamp when the run started" }, - { - "type": "null" + "completedAt": { + "anyOf": [ + { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + }, + { + "type": "null" + } + ], + "description": "ISO 8601 timestamp when the run ended; null while running" } - ] + }, + "required": [ + "status", + "startedAt", + "completedAt" + ], + "description": "Run status and timestamps maintained by Supermemory" }, "id": { "type": "string" @@ -6878,11 +7041,9 @@ } }, "required": [ - "status", "errorCode", "error", - "startedAt", - "completedAt", + "system", "id", "trigger", "itemsProcessed", @@ -6892,7 +7053,7 @@ } }, "picker": { - "description": "Present when attach=picker. Null for connectors that sync everything.", + "description": "Present when include=picker. Null for connectors that sync everything.", "anyOf": [ { "type": "object", @@ -6921,7 +7082,6 @@ "required": [ "id", "provider", - "status", "namespace", "account", "capabilities", @@ -6929,9 +7089,8 @@ "selection", "documentLimit", "documentCount", - "lastSync", - "lastSyncedAt", - "createdAt" + "latestRun", + "system" ] } } @@ -7288,76 +7447,134 @@ "content": { "application/json": { "schema": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Internal identifier for the namespace" - }, - "namespace": { - "type": "string", - "description": "Namespace identifier used in API paths" - }, - "documentCount": { - "type": "integer", - "minimum": 0, - "maximum": 9007199254740991, - "description": "Number of active source documents in the namespace" - }, - "memoryCount": { - "type": "integer", - "minimum": 0, - "maximum": 9007199254740991, - "description": "Number of current, recallable memories in the namespace" - }, - "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Human-readable purpose or scope of the namespace" - }, - "system": { + "type": "object", + "properties": { + "namespaces": { + "type": "array", + "items": { "type": "object", "properties": { - "createdAt": { + "id": { "type": "string", - "format": "date-time", - "description": "ISO 8601 timestamp when the namespace was created" + "description": "Internal identifier for the namespace" }, - "updatedAt": { + "namespace": { "type": "string", - "format": "date-time", - "description": "ISO 8601 timestamp of the latest namespace update" + "description": "Namespace identifier used in API paths" + }, + "documentCount": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991, + "description": "Number of active source documents in the namespace" + }, + "memoryCount": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991, + "description": "Number of current, recallable memories in the namespace" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Human-readable purpose or scope of the namespace" + }, + "system": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "format": "date-time", + "description": "ISO 8601 timestamp when the namespace was created" + }, + "updatedAt": { + "type": "string", + "format": "date-time", + "description": "ISO 8601 timestamp of the latest namespace update" + } + }, + "required": [ + "createdAt", + "updatedAt" + ], + "description": "Namespace lifecycle timestamps" } }, "required": [ - "createdAt", - "updatedAt" - ], - "description": "Namespace lifecycle timestamps" - } + "id", + "namespace", + "documentCount", + "memoryCount", + "description", + "system" + ] + }, + "description": "Namespaces on this page, newest first" }, - "required": [ - "id", - "namespace", - "documentCount", - "memoryCount", - "description", - "system" - ] - } + "pagination": { + "type": "object", + "properties": { + "currentPage": { + "type": "number" + }, + "limit": { + "default": 10, + "type": "number", + "maximum": 1100 + }, + "totalItems": { + "type": "number" + }, + "totalPages": { + "type": "number" + } + }, + "required": [ + "currentPage", + "totalItems", + "totalPages" + ], + "description": "Pagination metadata", + "example": { + "currentPage": 1, + "limit": 10, + "totalItems": 100, + "totalPages": 10 + } + } + }, + "required": [ + "namespaces", + "pagination" + ] } } }, "description": "Namespaces available to the caller" }, + "400": { + "description": "Invalid request", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/ErrorResponse" + }, + { + "$ref": "#/components/schemas/ValidationErrorResponse" + } + ] + } + } + } + }, "401": { "content": { "application/json": { @@ -7392,6 +7609,30 @@ "summary": "List namespaces", "tags": [ "Namespaces" + ], + "parameters": [ + { + "in": "query", + "name": "page", + "schema": { + "default": 1, + "type": "integer", + "minimum": 1, + "maximum": 9007199254740991 + }, + "description": "One-based page number" + }, + { + "in": "query", + "name": "limit", + "schema": { + "default": 10, + "type": "integer", + "minimum": 1, + "maximum": 100 + }, + "description": "Maximum namespaces to return per page" + } ] } }, @@ -7404,76 +7645,134 @@ "content": { "application/json": { "schema": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Internal identifier for the namespace" - }, - "namespace": { - "type": "string", - "description": "Namespace identifier used in API paths" - }, - "documentCount": { - "type": "integer", - "minimum": 0, - "maximum": 9007199254740991, - "description": "Number of active source documents in the namespace" - }, - "memoryCount": { - "type": "integer", - "minimum": 0, - "maximum": 9007199254740991, - "description": "Number of current, recallable memories in the namespace" - }, - "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Human-readable purpose or scope of the namespace" - }, - "system": { + "type": "object", + "properties": { + "namespaces": { + "type": "array", + "items": { "type": "object", "properties": { - "createdAt": { + "id": { "type": "string", - "format": "date-time", - "description": "ISO 8601 timestamp when the namespace was created" + "description": "Internal identifier for the namespace" }, - "updatedAt": { + "namespace": { "type": "string", - "format": "date-time", - "description": "ISO 8601 timestamp of the latest namespace update" + "description": "Namespace identifier used in API paths" + }, + "documentCount": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991, + "description": "Number of active source documents in the namespace" + }, + "memoryCount": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991, + "description": "Number of current, recallable memories in the namespace" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Human-readable purpose or scope of the namespace" + }, + "system": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "format": "date-time", + "description": "ISO 8601 timestamp when the namespace was created" + }, + "updatedAt": { + "type": "string", + "format": "date-time", + "description": "ISO 8601 timestamp of the latest namespace update" + } + }, + "required": [ + "createdAt", + "updatedAt" + ], + "description": "Namespace lifecycle timestamps" } }, "required": [ - "createdAt", - "updatedAt" - ], - "description": "Namespace lifecycle timestamps" - } + "id", + "namespace", + "documentCount", + "memoryCount", + "description", + "system" + ] + }, + "description": "Namespaces on this page, newest first" }, - "required": [ - "id", - "namespace", - "documentCount", - "memoryCount", - "description", - "system" - ] - } + "pagination": { + "type": "object", + "properties": { + "currentPage": { + "type": "number" + }, + "limit": { + "default": 10, + "type": "number", + "maximum": 1100 + }, + "totalItems": { + "type": "number" + }, + "totalPages": { + "type": "number" + } + }, + "required": [ + "currentPage", + "totalItems", + "totalPages" + ], + "description": "Pagination metadata", + "example": { + "currentPage": 1, + "limit": 10, + "totalItems": 100, + "totalPages": 10 + } + } + }, + "required": [ + "namespaces", + "pagination" + ] } } }, "description": "Namespaces available to the caller" }, + "400": { + "description": "Invalid request", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/ErrorResponse" + }, + { + "$ref": "#/components/schemas/ValidationErrorResponse" + } + ] + } + } + } + }, "401": { "content": { "application/json": { @@ -7508,6 +7807,30 @@ "summary": "List namespaces", "tags": [ "Namespaces" + ], + "parameters": [ + { + "in": "query", + "name": "page", + "schema": { + "default": 1, + "type": "integer", + "minimum": 1, + "maximum": 9007199254740991 + }, + "description": "One-based page number" + }, + { + "in": "query", + "name": "limit", + "schema": { + "default": 10, + "type": "integer", + "minimum": 1, + "maximum": 100 + }, + "description": "Maximum namespaces to return per page" + } ] } }, @@ -7816,11 +8139,6 @@ { "type": "object", "properties": { - "success": { - "type": "boolean", - "const": true, - "description": "Confirms the namespace was deleted" - }, "status": { "type": "string", "const": "deleted", @@ -7844,7 +8162,6 @@ } }, "required": [ - "success", "status", "namespace", "deletedDocumentsCount", @@ -7854,11 +8171,6 @@ { "type": "object", "properties": { - "success": { - "type": "boolean", - "const": true, - "description": "Confirms the namespace move was accepted" - }, "status": { "type": "string", "const": "queued", @@ -7878,7 +8190,6 @@ } }, "required": [ - "success", "status", "operationId", "namespace", @@ -7897,11 +8208,6 @@ "schema": { "type": "object", "properties": { - "success": { - "type": "boolean", - "const": true, - "description": "Confirms the namespace move was accepted" - }, "status": { "type": "string", "const": "queued", @@ -7921,7 +8227,6 @@ } }, "required": [ - "success", "status", "operationId", "namespace", @@ -8016,29 +8321,19 @@ }, "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." + }, + { + "in": "query", + "name": "moveTo", + "schema": { + "example": "project_archive", + "type": "string", + "maxLength": 100, + "pattern": "^[a-zA-Z0-9_:-]+$" + }, + "description": "Destination namespace that should receive this namespace's content before deletion. Omit to permanently delete the content." } - ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "default": {}, - "type": "object", - "properties": { - "moveTo": { - "description": "Destination namespace that should receive this namespace's content before deletion. Omit to permanently delete the content.", - "example": "project_archive", - "type": "string", - "maxLength": 100, - "pattern": "^[a-zA-Z0-9_:-]+$" - } - }, - "additionalProperties": false - } - } - } - } + ] } }, "/organization": { @@ -8234,6 +8529,731 @@ "Organization" ] } + }, + "/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.", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Stable memory identifier" + }, + "memory": { + "type": "string", + "description": "Learned fact or context extracted from the document" + }, + "metadata": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {}, + "description": "Memory metadata, including temporal context; empty object when none" + }, + "isStatic": { + "type": "boolean", + "description": "Whether the memory belongs to the stable profile section" + }, + "isInference": { + "type": "boolean", + "description": "Whether the memory was inferred rather than explicitly stated" + }, + "isLatest": { + "type": "boolean", + "description": "Whether this is the newest version in its memory chain" + }, + "isForgotten": { + "type": "boolean", + "description": "Whether this memory has been excluded from normal recall" + }, + "version": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991, + "description": "Version number within the memory chain" + }, + "system": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "ISO 8601 timestamp when this memory version was created" + }, + "updatedAt": { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "ISO 8601 timestamp of the latest update to this version" + } + }, + "required": [ + "createdAt", + "updatedAt" + ], + "description": "Lifecycle timestamps maintained by Supermemory" + }, + "included": { + "description": "Requested extras", + "type": "object", + "properties": { + "related": { + "description": "Present when include has related", + "type": "object", + "properties": { + "parents": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Related memory ID" + }, + "relation": { + "type": "string", + "enum": [ + "updates", + "extends", + "derives" + ], + "description": "How this memory is connected to the matched memory" + }, + "version": { + "description": "Version number within the related memory's history", + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + }, + "memory": { + "type": "string", + "description": "Related learned fact or context" + }, + "metadata": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {}, + "description": "Public metadata associated with the related memory" + }, + "system": { + "type": "object", + "properties": { + "updatedAt": { + "type": "string", + "description": "ISO 8601 timestamp of the related memory's latest update" + } + }, + "required": [ + "updatedAt" + ], + "description": "Lifecycle details for the related memory" + }, + "document": { + "description": "Source document; present when include has both related and documents", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Source document identifier" + }, + "title": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Source document title" + }, + "type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Detected source or content type" + }, + "metadata": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {}, + "description": "Public metadata attached to the source document" + }, + "summary": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Generated summary of the source document" + }, + "system": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "description": "ISO 8601 timestamp when the source document was created" + }, + "updatedAt": { + "type": "string", + "description": "ISO 8601 timestamp of the source document's latest update" + } + }, + "required": [ + "createdAt", + "updatedAt" + ], + "description": "Lifecycle timestamps maintained by Supermemory" + } + }, + "required": [ + "id", + "title", + "type", + "metadata", + "summary", + "system" + ] + } + }, + "required": [ + "id", + "relation", + "memory", + "metadata", + "system" + ] + }, + "description": "Earlier versions this memory updates, nearest first" + }, + "children": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Related memory ID" + }, + "relation": { + "type": "string", + "enum": [ + "updates", + "extends", + "derives" + ], + "description": "How this memory is connected to the matched memory" + }, + "version": { + "description": "Version number within the related memory's history", + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + }, + "memory": { + "type": "string", + "description": "Related learned fact or context" + }, + "metadata": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {}, + "description": "Public metadata associated with the related memory" + }, + "system": { + "type": "object", + "properties": { + "updatedAt": { + "type": "string", + "description": "ISO 8601 timestamp of the related memory's latest update" + } + }, + "required": [ + "updatedAt" + ], + "description": "Lifecycle details for the related memory" + }, + "document": { + "description": "Source document; present when include has both related and documents", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Source document identifier" + }, + "title": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Source document title" + }, + "type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Detected source or content type" + }, + "metadata": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {}, + "description": "Public metadata attached to the source document" + }, + "summary": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Generated summary of the source document" + }, + "system": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "description": "ISO 8601 timestamp when the source document was created" + }, + "updatedAt": { + "type": "string", + "description": "ISO 8601 timestamp of the source document's latest update" + } + }, + "required": [ + "createdAt", + "updatedAt" + ], + "description": "Lifecycle timestamps maintained by Supermemory" + } + }, + "required": [ + "id", + "title", + "type", + "metadata", + "summary", + "system" + ] + } + }, + "required": [ + "id", + "relation", + "memory", + "metadata", + "system" + ] + }, + "description": "Newer versions that update this memory, nearest first" + }, + "siblings": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Related memory ID" + }, + "relation": { + "type": "string", + "enum": [ + "updates", + "extends", + "derives" + ], + "description": "How this memory is connected to the matched memory" + }, + "version": { + "description": "Version number within the related memory's history", + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + }, + "memory": { + "type": "string", + "description": "Related learned fact or context" + }, + "metadata": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {}, + "description": "Public metadata associated with the related memory" + }, + "system": { + "type": "object", + "properties": { + "updatedAt": { + "type": "string", + "description": "ISO 8601 timestamp of the related memory's latest update" + } + }, + "required": [ + "updatedAt" + ], + "description": "Lifecycle details for the related memory" + }, + "document": { + "description": "Source document; present when include has both related and documents", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Source document identifier" + }, + "title": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Source document title" + }, + "type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Detected source or content type" + }, + "metadata": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {}, + "description": "Public metadata attached to the source document" + }, + "summary": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Generated summary of the source document" + }, + "system": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "description": "ISO 8601 timestamp when the source document was created" + }, + "updatedAt": { + "type": "string", + "description": "ISO 8601 timestamp of the source document's latest update" + } + }, + "required": [ + "createdAt", + "updatedAt" + ], + "description": "Lifecycle timestamps maintained by Supermemory" + } + }, + "required": [ + "id", + "title", + "type", + "metadata", + "summary", + "system" + ] + } + }, + "required": [ + "id", + "relation", + "memory", + "metadata", + "system" + ] + }, + "description": "Memories connected by extends or derives, nearest first" + } + }, + "required": [ + "parents", + "children", + "siblings" + ] + }, + "document": { + "description": "Source document; present when include has documents and one exists", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Source document identifier" + }, + "title": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Source document title" + }, + "type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Detected source or content type" + }, + "metadata": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {}, + "description": "Public metadata attached to the source document" + }, + "summary": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Generated summary of the source document" + }, + "system": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "description": "ISO 8601 timestamp when the source document was created" + }, + "updatedAt": { + "type": "string", + "description": "ISO 8601 timestamp of the source document's latest update" + } + }, + "required": [ + "createdAt", + "updatedAt" + ], + "description": "Lifecycle timestamps maintained by Supermemory" + } + }, + "required": [ + "id", + "title", + "type", + "metadata", + "summary", + "system" + ] + } + } + } + }, + "required": [ + "id", + "memory", + "metadata", + "isStatic", + "isInference", + "isLatest", + "isForgotten", + "version", + "system" + ] + } + } + }, + "description": "Memory retrieved" + }, + "400": { + "description": "Invalid request", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/ErrorResponse" + }, + { + "$ref": "#/components/schemas/ValidationErrorResponse" + } + ] + } + } + } + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Unauthorized" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Namespace access denied" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Memory not found" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Server error" + } + }, + "summary": "Get memory", + "tags": [ + "Content Management" + ], + "parameters": [ + { + "in": "path", + "name": "namespace", + "schema": { + "type": "string", + "maxLength": 100, + "pattern": "^[a-zA-Z0-9_:-]+$", + "example": "user_alex" + }, + "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." + }, + { + "in": "path", + "name": "id", + "schema": { + "type": "string", + "minLength": 1, + "example": "mem_abc123" + }, + "required": true, + "description": "Memory identifier" + }, + { + "in": "query", + "name": "include", + "schema": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "related", + "documents" + ] + }, + "style": "form", + "explode": false + }, + "description": "Comma-separated extras. related: the memory's version history and connected memories. documents: the source document, also attached to each related memory when both are requested." + }, + { + "in": "query", + "name": "relatedLimit", + "schema": { + "default": 10, + "type": "integer", + "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." + } + ] + } } } } diff --git a/fern/overlay.yaml b/fern/overlay.yaml index 3148c24..6370f3c 100644 --- a/fern/overlay.yaml +++ b/fern/overlay.yaml @@ -21,6 +21,7 @@ actions: # memories - { target: '$.paths["/ns/{namespace}/memories"].delete', update: { x-fern-sdk-group-name: memories, x-fern-sdk-method-name: forget } } - { target: '$.paths["/ns/{namespace}/memories/semantic"].delete', update: { x-fern-sdk-group-name: memories, x-fern-sdk-method-name: forget_matching } } + - { target: '$.paths["/ns/{namespace}/memories/{id}"].get', update: { x-fern-sdk-group-name: memories, x-fern-sdk-method-name: get } } # profiles - { target: '$.paths["/ns/{namespace}/profile/buckets"].get', update: { x-fern-sdk-group-name: profiles, x-fern-sdk-method-name: get_buckets } } - { target: '$.paths["/ns/{namespace}/profile/buckets"].put', update: { x-fern-sdk-group-name: profiles, x-fern-sdk-method-name: set_buckets } } diff --git a/fern/schemas.yaml b/fern/schemas.yaml index 4534be6..20f993e 100644 --- a/fern/schemas.yaml +++ b/fern/schemas.yaml @@ -15,18 +15,15 @@ # bodies stay inline because their fields become keyword arguments. # --- enums -TaskType: POST /ns/{namespace}/document param:taskType -DreamingMode: POST /ns/{namespace}/document param:dreaming -FileType: POST /ns/{namespace}/document/file param:fileType -SearchMode: POST /ns/{namespace}/search param:searchMode +TaskType: POST /ns/{namespace}/document body.taskType +DreamingMode: POST /ns/{namespace}/document body.dreaming +FileType: POST /ns/{namespace}/document/file body.fileType +SearchMode: POST /ns/{namespace}/search body.searchMode ListType: POST /ns/{namespace}/list/{type} param:type ListSort: POST /ns/{namespace}/list/{type} param:sort SortOrder: POST /ns/{namespace}/list/{type} param:order MemoryRelation: POST /ns/{namespace}/search 200.results[].included.related.parents[].relation ConnectorProvider: GET /connectors param:provider -ConnectorStatus: GET /ns/{namespace}/connectors/{id} 200.status -ConnectorSyncStatus: GET /ns/{namespace}/connectors/{id} 200.lastSync?.status -ConnectorErrorCode: GET /ns/{namespace}/connectors/{id} 200.lastSync?.errorCode? ConnectorSyncTrigger: GET /ns/{namespace}/connectors/{id} 200.syncs[].trigger # --- filters @@ -46,13 +43,17 @@ BatchAddResult: POST /ns/{namespace}/document/batch 200 BatchAddItemResult: POST /ns/{namespace}/document/batch 200.results[] DeleteDocumentsResult: DELETE /ns/{namespace}/document 200 DeleteDocumentError: DELETE /ns/{namespace}/document 200.errors[] -DocumentAttachment: GET /ns/{namespace}/document/{id} param:attach[] -FileUploadResult: POST /ns/{namespace}/document/file 200 +DocumentInclude: GET /ns/{namespace}/document/{id} param:include[] +SearchInclude: POST /ns/{namespace}/search body.include +MemoryInclude: GET /ns/{namespace}/memories/{id} param:include[] +ConnectorInclude: GET /ns/{namespace}/connectors/{id} param:include[] Document: GET /ns/{namespace}/document/{id} 200 DocumentSystem: GET /ns/{namespace}/document/{id} 200.system Chunk: GET /ns/{namespace}/document/{id} 200.chunks[] ChunkSystem: GET /ns/{namespace}/document/{id} 200.chunks[].system Memory: GET /ns/{namespace}/document/{id} 200.memories[] +MemoryIncluded: GET /ns/{namespace}/memories/{id} 200.included +MemoryDetails: GET /ns/{namespace}/memories/{id} 200 MemorySystem: GET /ns/{namespace}/document/{id} 200.memories[].system # --- list @@ -77,12 +78,16 @@ ForgetError: DELETE /ns/{namespace}/memories 200.errors[] ForgetMatch: DELETE /ns/{namespace}/memories 200.matches[] # --- connectors +ConnectorStatus: GET /ns/{namespace}/connectors/{id} 200.system.status +ConnectorRunStatus: GET /ns/{namespace}/connectors/{id} 200.latestRun?.system.status +ConnectorErrorCode: GET /ns/{namespace}/connectors/{id} 200.latestRun?.errorCode? +ConnectorRun: GET /ns/{namespace}/connectors/{id} 200.latestRun? +ConnectorSystem: GET /ns/{namespace}/connectors/{id} 200.system Connector: GET /ns/{namespace}/connectors/{id} 200 ConnectorList: GET /connectors 200 ConnectorCapabilities: GET /ns/{namespace}/connectors/{id} 200.capabilities -ConnectorPicker: GET /ns/{namespace}/connectors/{id} 200.picker? +ConnectorLink: GET /ns/{namespace}/connectors/{id} 200.picker? # same {url, expiresAt} shape as authorization ConnectorSelectionItem: GET /ns/{namespace}/connectors/{id} 200.selection?{}[] -ConnectorLastSync: GET /ns/{namespace}/connectors/{id} 200.lastSync? ConnectorSync: GET /ns/{namespace}/connectors/{id} 200.syncs[] ConnectorSyncFailure: GET /ns/{namespace}/connectors/{id} 200.syncs[].failures[] ConnectorSelection: PATCH /ns/{namespace}/connectors/{id} body.selection @@ -96,8 +101,9 @@ ConnectorSyncStarted: POST /ns/{namespace}/connectors/{id}/sync 202 ConnectorDeleted: DELETE /ns/{namespace}/connectors/{id} 200 # --- namespaces and organization -Namespace: GET /ns 200[] -NamespaceSystem: GET /ns 200[].system +NamespaceList: GET /ns 200 +Namespace: GET /ns 200.namespaces[] +NamespaceSystem: GET /ns 200.namespaces[].system NamespaceDetails: GET /ns/{namespace} 200 NamespaceDeleted: DELETE /ns/{namespace} 200 Organization: GET /organization 200 diff --git a/pyproject.toml b/pyproject.toml index 6ba243b..51e27c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "supermemory" -version = "5.0.0rc2" +version = "5.0.0rc3" 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 68b18ce..adcaa31 100644 --- a/reference.md +++ b/reference.md @@ -69,7 +69,7 @@ client.add(
-**task_type:** `typing.Optional[TaskType]` — Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. +**id:** `typing.Optional[str]` — An optional caller-defined document ID
@@ -77,7 +77,7 @@ client.add(
-**dreaming:** `typing.Optional[DreamingMode]` — Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. +**supporting_context:** `typing.Optional[str]` — Context used to guide memory extraction within this namespace. Max 1500 characters.
@@ -85,7 +85,7 @@ client.add(
-**id:** `typing.Optional[str]` — An optional caller-defined document ID +**metadata:** `typing.Optional[typing.Dict[str, MetadataValue]]` — Arbitrary metadata attached to the document and derived data
@@ -93,7 +93,7 @@ client.add(
-**supporting_context:** `typing.Optional[str]` — Context used to guide memory extraction within this namespace. Max 1500 characters. +**group:** `typing.Optional[typing.Dict[str, MetadataValue]]` — Metadata values that isolate related context within the namespace
@@ -101,7 +101,7 @@ client.add(
-**metadata:** `typing.Optional[typing.Dict[str, MetadataValue]]` — Arbitrary metadata attached to the document and derived data +**date:** `typing.Optional[str]` — When the source content is from, in ISO 8601 format
@@ -109,7 +109,7 @@ client.add(
-**group:** `typing.Optional[typing.Dict[str, MetadataValue]]` — Metadata values that isolate related context within the namespace +**task_type:** `typing.Optional[TaskType]` — Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories.
@@ -117,7 +117,7 @@ client.add(
-**date:** `typing.Optional[str]` — When the source content is from, in ISO 8601 format +**dreaming:** `typing.Optional[DreamingMode]` — Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document.
@@ -174,7 +174,6 @@ client = Supermemory( client.search( namespace="user_alex", - limit=10, query="what are the API rate limits", ) @@ -208,7 +207,7 @@ client.search(
-**limit:** `typing.Optional[int]` — Maximum number of results to return +**filter:** `typing.Optional[FilterExpression]` — Type-safe metadata conditions applied before ranking results. Replaces the v4 `filters` field and unifies both legacy filter formats into one expression type.
@@ -224,7 +223,7 @@ client.search(
-**filter:** `typing.Optional[FilterExpression]` — Type-safe metadata conditions applied before ranking results. Replaces the v4 `filters` field and unifies both legacy filter formats into one expression type. +**limit:** `typing.Optional[int]` — Maximum number of results to return
@@ -232,7 +231,7 @@ client.search(
-**attach:** `typing.Optional[SearchRequestAttach]` — Optional context to include alongside each matching result +**include:** `typing.Optional[SearchInclude]` — Optional context to include alongside each matching result
@@ -403,6 +402,8 @@ client = Supermemory( client.list( namespace="user_alex", type="documents", + page=1, + limit=10, ) ``` @@ -435,7 +436,7 @@ client.list(
-**page:** `typing.Optional[ListRequestPage]` — One-based page number +**page:** `typing.Optional[int]` — One-based page number
@@ -443,7 +444,7 @@ client.list(
-**limit:** `typing.Optional[ListRequestLimit]` — Maximum resources to return per page +**limit:** `typing.Optional[int]` — Maximum resources to return per page
@@ -475,6 +476,14 @@ client.list(
+**include:** `typing.Optional[ListRequestInclude]` — Optional extras, matching search's include + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -686,7 +695,7 @@ client.documents.batch_add(
-Retrieve a document's canonical content, metadata, and processing state by document ID or caller-defined ID. Optionally attach its source chunks, derived memories, or both in the same response. +Retrieve a document's canonical content, metadata, and processing state by document ID or caller-defined ID. Optionally include its source chunks, derived memories, or both in the same response.
@@ -744,7 +753,7 @@ client.documents.get(
-**attach:** `typing.Optional[typing.Union[DocumentAttachment, typing.Sequence[DocumentAttachment]]]` — Child resources to include. Repeat the parameter to attach chunks, memories, or both. +**include:** `typing.Optional[typing.Union[DocumentInclude, typing.Sequence[DocumentInclude]]]` — Comma-separated child resources to include: chunks, memories, or both.
@@ -834,7 +843,7 @@ client.documents.update(
-**task_type:** `typing.Optional[TaskType]` — Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. +**content:** `typing.Optional[str]` — The content to process. This may be plaintext or a URL to supported rich content.
@@ -842,7 +851,7 @@ client.documents.update(
-**dreaming:** `typing.Optional[DreamingMode]` — Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. +**supporting_context:** `typing.Optional[str]` — Context used to guide memory extraction within this namespace. Max 1500 characters.
@@ -850,7 +859,7 @@ client.documents.update(
-**content:** `typing.Optional[str]` — The content to process. This may be plaintext or a URL to supported rich content. +**metadata:** `typing.Optional[typing.Dict[str, MetadataValue]]` — Arbitrary metadata attached to the document and derived data
@@ -858,7 +867,7 @@ client.documents.update(
-**supporting_context:** `typing.Optional[str]` — Context used to guide memory extraction within this namespace. Max 1500 characters. +**group:** `typing.Optional[typing.Dict[str, MetadataValue]]` — Metadata values that isolate related context within the namespace
@@ -866,7 +875,7 @@ client.documents.update(
-**metadata:** `typing.Optional[typing.Dict[str, MetadataValue]]` — Arbitrary metadata attached to the document and derived data +**date:** `typing.Optional[str]` — When the source content is from, in ISO 8601 format
@@ -874,7 +883,7 @@ client.documents.update(
-**group:** `typing.Optional[typing.Dict[str, MetadataValue]]` — Metadata values that isolate related context within the namespace +**task_type:** `typing.Optional[TaskType]` — Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories.
@@ -882,7 +891,7 @@ client.documents.update(
-**date:** `typing.Optional[str]` — When the source content is from, in ISO 8601 format +**dreaming:** `typing.Optional[DreamingMode]` — Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document.
@@ -902,7 +911,7 @@ client.documents.update(
-
client.documents.upload_file(...) -> FileUploadResult +
client.documents.upload_file(...) -> DocumentRef
@@ -972,7 +981,7 @@ client.documents.upload_file(
-**task_type:** `typing.Optional[TaskType]` — Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. +**supporting_context:** `typing.Optional[str]` — Context used to guide memory extraction within this namespace. Max 1500 characters.
@@ -980,7 +989,7 @@ client.documents.upload_file(
-**dreaming:** `typing.Optional[DreamingMode]` — Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. +**metadata:** `typing.Optional[str]` — JSON-encoded metadata to attach to the document and its derived memories
@@ -988,7 +997,7 @@ client.documents.upload_file(
-**file_type:** `typing.Optional[FileType]` — Explicit source type used when automatic inference is insufficient +**group:** `typing.Optional[str]` — JSON-encoded metadata used to keep related context isolated during processing and recall
@@ -996,7 +1005,7 @@ client.documents.upload_file(
-**mime_type:** `typing.Optional[str]` — Explicit MIME type used when upload metadata is insufficient +**date:** `typing.Optional[str]` — When the source content is from, in ISO 8601 format
@@ -1004,7 +1013,7 @@ client.documents.upload_file(
-**supporting_context:** `typing.Optional[str]` — Context used to guide memory extraction within this namespace. Max 1500 characters. +**task_type:** `typing.Optional[TaskType]` — Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories.
@@ -1012,7 +1021,7 @@ client.documents.upload_file(
-**metadata:** `typing.Optional[str]` — JSON-encoded metadata to attach to the document and its derived memories +**dreaming:** `typing.Optional[DreamingMode]` — Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document.
@@ -1020,7 +1029,7 @@ client.documents.upload_file(
-**group:** `typing.Optional[str]` — JSON-encoded metadata used to keep related context isolated during processing and recall +**file_type:** `typing.Optional[FileType]` — Explicit source type used when automatic inference is insufficient
@@ -1028,7 +1037,7 @@ client.documents.upload_file(
-**date:** `typing.Optional[str]` — When the source content is from, in ISO 8601 format +**mime_type:** `typing.Optional[str]` — Explicit MIME type used when upload metadata is insufficient
@@ -1048,7 +1057,7 @@ client.documents.upload_file(
-
client.documents.replace_with_file(...) -> FileUploadResult +
client.documents.replace_with_file(...) -> DocumentRef
@@ -1127,7 +1136,7 @@ client.documents.replace_with_file(
-**task_type:** `typing.Optional[TaskType]` — Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. +**supporting_context:** `typing.Optional[str]` — Context used to guide memory extraction within this namespace. Max 1500 characters.
@@ -1135,7 +1144,7 @@ client.documents.replace_with_file(
-**dreaming:** `typing.Optional[DreamingMode]` — Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. +**metadata:** `typing.Optional[str]` — JSON-encoded metadata to attach to the document and its derived memories
@@ -1143,7 +1152,7 @@ client.documents.replace_with_file(
-**file_type:** `typing.Optional[FileType]` — Explicit source type used when automatic inference is insufficient +**group:** `typing.Optional[str]` — JSON-encoded metadata used to keep related context isolated during processing and recall
@@ -1151,7 +1160,7 @@ client.documents.replace_with_file(
-**mime_type:** `typing.Optional[str]` — Explicit MIME type used when upload metadata is insufficient +**date:** `typing.Optional[str]` — When the source content is from, in ISO 8601 format
@@ -1159,7 +1168,7 @@ client.documents.replace_with_file(
-**supporting_context:** `typing.Optional[str]` — Context used to guide memory extraction within this namespace. Max 1500 characters. +**task_type:** `typing.Optional[TaskType]` — Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories.
@@ -1167,7 +1176,7 @@ client.documents.replace_with_file(
-**metadata:** `typing.Optional[str]` — JSON-encoded metadata to attach to the document and its derived memories +**dreaming:** `typing.Optional[DreamingMode]` — Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document.
@@ -1175,7 +1184,7 @@ client.documents.replace_with_file(
-**group:** `typing.Optional[str]` — JSON-encoded metadata used to keep related context isolated during processing and recall +**file_type:** `typing.Optional[FileType]` — Explicit source type used when automatic inference is insufficient
@@ -1183,7 +1192,7 @@ client.documents.replace_with_file(
-**date:** `typing.Optional[str]` — When the source content is from, in ISO 8601 format +**mime_type:** `typing.Optional[str]` — Explicit MIME type used when upload metadata is insufficient
@@ -1203,7 +1212,7 @@ client.documents.replace_with_file(
-
client.documents.update_file(...) -> FileUploadResult +
client.documents.update_file(...) -> DocumentRef
@@ -1274,7 +1283,7 @@ client.documents.update_file(
-**task_type:** `typing.Optional[TaskType]` — Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. +**file:** `typing.Optional[core.File]` — File contents to upload
@@ -1282,7 +1291,7 @@ client.documents.update_file(
-**dreaming:** `typing.Optional[DreamingMode]` — Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. +**supporting_context:** `typing.Optional[str]` — Context used to guide memory extraction within this namespace. Max 1500 characters.
@@ -1290,7 +1299,7 @@ client.documents.update_file(
-**file_type:** `typing.Optional[FileType]` — Explicit source type used when automatic inference is insufficient +**metadata:** `typing.Optional[str]` — JSON-encoded metadata to attach to the document and its derived memories
@@ -1298,7 +1307,7 @@ client.documents.update_file(
-**mime_type:** `typing.Optional[str]` — Explicit MIME type used when upload metadata is insufficient +**group:** `typing.Optional[str]` — JSON-encoded metadata used to keep related context isolated during processing and recall
@@ -1306,7 +1315,7 @@ client.documents.update_file(
-**file:** `typing.Optional[core.File]` — File contents to upload +**date:** `typing.Optional[str]` — When the source content is from, in ISO 8601 format
@@ -1314,7 +1323,7 @@ client.documents.update_file(
-**supporting_context:** `typing.Optional[str]` — Context used to guide memory extraction within this namespace. Max 1500 characters. +**task_type:** `typing.Optional[TaskType]` — Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories.
@@ -1322,7 +1331,7 @@ client.documents.update_file(
-**metadata:** `typing.Optional[str]` — JSON-encoded metadata to attach to the document and its derived memories +**dreaming:** `typing.Optional[DreamingMode]` — Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document.
@@ -1330,7 +1339,7 @@ client.documents.update_file(
-**group:** `typing.Optional[str]` — JSON-encoded metadata used to keep related context isolated during processing and recall +**file_type:** `typing.Optional[FileType]` — Explicit source type used when automatic inference is insufficient
@@ -1338,7 +1347,7 @@ client.documents.update_file(
-**date:** `typing.Optional[str]` — When the source content is from, in ISO 8601 format +**mime_type:** `typing.Optional[str]` — Explicit MIME type used when upload metadata is insufficient
@@ -1772,6 +1781,104 @@ client.memories.forget_matching(
+ + +
+ +
client.memories.get(...) -> MemoryDetails +
+
+ +#### 📝 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. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from supermemory import Supermemory +from supermemory.environment import SupermemoryEnvironment + +client = Supermemory( + api_key="", + environment=SupermemoryEnvironment.DEFAULT, +) + +client.memories.get( + namespace="user_alex", + id="mem_abc123", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**namespace:** `str` — 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. + +
+
+ +
+
+ +**id:** `str` — Memory identifier + +
+
+ +
+
+ +**include:** `typing.Optional[typing.Union[MemoryInclude, typing.Sequence[MemoryInclude]]]` — Comma-separated extras. related: the memory's version history and connected memories. documents: the source document, also attached to each related memory when both are requested. + +
+
+ +
+
+ +**related_limit:** `typing.Optional[int]` — 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. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ +
@@ -1973,7 +2080,7 @@ client.connectors.list(
-Connect an external source to this namespace. OAuth providers return an authUrl to send the user to; providers that authenticate with config start syncing right away. +Connect an external source to this namespace. OAuth providers return an authorization url to send the user to; providers that authenticate with config start syncing right away.
@@ -2057,7 +2164,7 @@ client.connectors.create(
-Read one connector. Add attach=syncs to include its recent sync runs and the items that failed. attach=picker needs an admin with write access, since the link changes what syncs. +Read one connector. Add include=syncs to include its recent sync runs and the items that failed. include=picker needs an admin with write access, since the link changes what syncs.
@@ -2115,7 +2222,7 @@ client.connectors.get(
-**attach:** `typing.Optional[str]` — Comma-separated extras. syncs: the 10 most recent sync runs with their failed items. picker: a one-time hosted picker URL. +**include:** `typing.Optional[typing.Union[ConnectorInclude, typing.Sequence[ConnectorInclude]]]` — Comma-separated extras. syncs: the 10 most recent sync runs with their failed items. picker: a one-time hosted picker URL.
@@ -2414,7 +2521,7 @@ client.connectors.sync(
## Namespaces -
client.namespaces.list() -> typing.List[Namespace] +
client.namespaces.list(...) -> NamespaceList
@@ -2465,6 +2572,22 @@ client.namespaces.list()
+**page:** `typing.Optional[int]` — One-based page number + +
+
+ +
+
+ +**limit:** `typing.Optional[int]` — Maximum namespaces to return per page + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -2587,6 +2710,7 @@ client = Supermemory( client.namespaces.delete( namespace="user_alex", + move_to="project_archive", ) ``` diff --git a/src/supermemory/__init__.py b/src/supermemory/__init__.py index df6ca31..77a5cff 100644 --- a/src/supermemory/__init__.py +++ b/src/supermemory/__init__.py @@ -9,6 +9,7 @@ from .types import ( BadRequestErrorBody, BatchAddItemResult, + BatchAddItemResultStatus, BatchAddResult, Chunk, ChunkListItem, @@ -18,10 +19,13 @@ ConnectorConfigValue, ConnectorDeleted, ConnectorErrorCode, - ConnectorLastSync, + ConnectorInclude, + ConnectorLink, ConnectorList, - ConnectorPicker, ConnectorProvider, + ConnectorRun, + ConnectorRunStatus, + ConnectorRunSystem, ConnectorSelection, ConnectorSelectionItem, ConnectorSetup, @@ -46,20 +50,23 @@ ConnectorSync, ConnectorSyncFailure, ConnectorSyncStarted, - ConnectorSyncStatus, + ConnectorSyncSystem, ConnectorSyncTrigger, + ConnectorSystem, DeleteDocumentError, DeleteDocumentsResult, Document, - DocumentAttachment, + DocumentInclude, DocumentInput, DocumentListItem, + DocumentListItemSystem, DocumentRef, + DocumentRefStatus, DocumentSystem, + DocumentSystemStatus, DreamingMode, ErrorResponse, FileType, - FileUploadResult, FilterAnd, FilterArrayContains, FilterArrayContainsOperator, @@ -81,12 +88,29 @@ GoogleDriveConfig, GoogleDriveConfigSyncScope, GranolaConfig, - ListRequestLimit, - ListRequestPage, + ListRequestInclude, ListResponse, ListSort, ListType, Memory, + MemoryDetails, + MemoryInclude, + MemoryIncluded, + MemoryIncludedDocument, + MemoryIncludedDocumentSystem, + MemoryIncludedRelated, + MemoryIncludedRelatedChildrenItem, + MemoryIncludedRelatedChildrenItemDocument, + MemoryIncludedRelatedChildrenItemDocumentSystem, + MemoryIncludedRelatedChildrenItemSystem, + MemoryIncludedRelatedParentsItem, + MemoryIncludedRelatedParentsItemDocument, + MemoryIncludedRelatedParentsItemDocumentSystem, + MemoryIncludedRelatedParentsItemSystem, + MemoryIncludedRelatedSiblingsItem, + MemoryIncludedRelatedSiblingsItemDocument, + MemoryIncludedRelatedSiblingsItemDocumentSystem, + MemoryIncludedRelatedSiblingsItemSystem, MemoryRelation, MemorySystem, MetadataValue, @@ -97,6 +121,7 @@ NamespaceDeleted_Deleted, NamespaceDeleted_Queued, NamespaceDetails, + NamespaceList, NamespaceSystem, Organization, Pagination, @@ -108,13 +133,14 @@ RelatedMemory, RelatedMemorySystem, S3Config, + SearchInclude, SearchMode, - SearchRequestAttach, SearchRequestRerank, SearchResponse, SearchResult, SearchResultIncluded, SearchResultIncludedDocument, + SearchResultIncludedDocumentSystem, SearchResultSystem, SortOrder, TaskType, @@ -142,10 +168,11 @@ ConnectorCapabilitiesParams, ConnectorConfigValueParams, ConnectorDeletedParams, - ConnectorLastSyncParams, + ConnectorLinkParams, ConnectorListParams, ConnectorParams, - ConnectorPickerParams, + ConnectorRunParams, + ConnectorRunSystemParams, ConnectorSelectionItemParams, ConnectorSelectionParams, ConnectorSetupGithubParams, @@ -169,15 +196,17 @@ ConnectorSyncFailureParams, ConnectorSyncParams, ConnectorSyncStartedParams, + ConnectorSyncSystemParams, + ConnectorSystemParams, DeleteDocumentErrorParams, DeleteDocumentsResultParams, DocumentInputParams, DocumentListItemParams, + DocumentListItemSystemParams, DocumentParams, DocumentRefParams, DocumentSystemParams, ErrorResponseParams, - FileUploadResultParams, FilterAndParams, FilterArrayContainsParams, FilterExpressionParams, @@ -193,9 +222,25 @@ ForgetResultParams, GoogleDriveConfigParams, GranolaConfigParams, - ListRequestLimitParams, - ListRequestPageParams, + ListRequestIncludeParams, ListResponseParams, + MemoryDetailsParams, + MemoryIncludedDocumentParams, + MemoryIncludedDocumentSystemParams, + MemoryIncludedParams, + MemoryIncludedRelatedChildrenItemDocumentParams, + MemoryIncludedRelatedChildrenItemDocumentSystemParams, + MemoryIncludedRelatedChildrenItemParams, + MemoryIncludedRelatedChildrenItemSystemParams, + MemoryIncludedRelatedParams, + MemoryIncludedRelatedParentsItemDocumentParams, + MemoryIncludedRelatedParentsItemDocumentSystemParams, + MemoryIncludedRelatedParentsItemParams, + MemoryIncludedRelatedParentsItemSystemParams, + MemoryIncludedRelatedSiblingsItemDocumentParams, + MemoryIncludedRelatedSiblingsItemDocumentSystemParams, + MemoryIncludedRelatedSiblingsItemParams, + MemoryIncludedRelatedSiblingsItemSystemParams, MemoryParams, MemorySystemParams, MetadataValueParams, @@ -205,6 +250,7 @@ NamespaceDeleted_DeletedParams, NamespaceDeleted_QueuedParams, NamespaceDetailsParams, + NamespaceListParams, NamespaceParams, NamespaceSystemParams, OrganizationParams, @@ -217,9 +263,10 @@ RelatedMemoryParams, RelatedMemorySystemParams, S3ConfigParams, - SearchRequestAttachParams, + SearchIncludeParams, SearchResponseParams, SearchResultIncludedDocumentParams, + SearchResultIncludedDocumentSystemParams, SearchResultIncludedParams, SearchResultParams, SearchResultSystemParams, @@ -233,6 +280,7 @@ "BadRequestErrorBodyParams": ".requests", "BatchAddItemResult": ".types", "BatchAddItemResultParams": ".requests", + "BatchAddItemResultStatus": ".types", "BatchAddResult": ".types", "BatchAddResultParams": ".requests", "Chunk": ".types", @@ -249,14 +297,18 @@ "ConnectorDeleted": ".types", "ConnectorDeletedParams": ".requests", "ConnectorErrorCode": ".types", - "ConnectorLastSync": ".types", - "ConnectorLastSyncParams": ".requests", + "ConnectorInclude": ".types", + "ConnectorLink": ".types", + "ConnectorLinkParams": ".requests", "ConnectorList": ".types", "ConnectorListParams": ".requests", "ConnectorParams": ".requests", - "ConnectorPicker": ".types", - "ConnectorPickerParams": ".requests", "ConnectorProvider": ".types", + "ConnectorRun": ".types", + "ConnectorRunParams": ".requests", + "ConnectorRunStatus": ".types", + "ConnectorRunSystem": ".types", + "ConnectorRunSystemParams": ".requests", "ConnectorSelection": ".types", "ConnectorSelectionItem": ".types", "ConnectorSelectionItemParams": ".requests", @@ -304,8 +356,11 @@ "ConnectorSyncParams": ".requests", "ConnectorSyncStarted": ".types", "ConnectorSyncStartedParams": ".requests", - "ConnectorSyncStatus": ".types", + "ConnectorSyncSystem": ".types", + "ConnectorSyncSystemParams": ".requests", "ConnectorSyncTrigger": ".types", + "ConnectorSystem": ".types", + "ConnectorSystemParams": ".requests", "DefaultAioHttpClient": "._default_clients", "DefaultAsyncHttpxClient": "._default_clients", "DeleteDocumentError": ".types", @@ -313,22 +368,24 @@ "DeleteDocumentsResult": ".types", "DeleteDocumentsResultParams": ".requests", "Document": ".types", - "DocumentAttachment": ".types", + "DocumentInclude": ".types", "DocumentInput": ".types", "DocumentInputParams": ".requests", "DocumentListItem": ".types", "DocumentListItemParams": ".requests", + "DocumentListItemSystem": ".types", + "DocumentListItemSystemParams": ".requests", "DocumentParams": ".requests", "DocumentRef": ".types", "DocumentRefParams": ".requests", + "DocumentRefStatus": ".types", "DocumentSystem": ".types", "DocumentSystemParams": ".requests", + "DocumentSystemStatus": ".types", "DreamingMode": ".types", "ErrorResponse": ".types", "ErrorResponseParams": ".requests", "FileType": ".types", - "FileUploadResult": ".types", - "FileUploadResultParams": ".requests", "FilterAnd": ".types", "FilterAndParams": ".requests", "FilterArrayContains": ".types", @@ -366,15 +423,48 @@ "GoogleDriveConfigSyncScope": ".types", "GranolaConfig": ".types", "GranolaConfigParams": ".requests", - "ListRequestLimit": ".types", - "ListRequestLimitParams": ".requests", - "ListRequestPage": ".types", - "ListRequestPageParams": ".requests", + "ListRequestInclude": ".types", + "ListRequestIncludeParams": ".requests", "ListResponse": ".types", "ListResponseParams": ".requests", "ListSort": ".types", "ListType": ".types", "Memory": ".types", + "MemoryDetails": ".types", + "MemoryDetailsParams": ".requests", + "MemoryInclude": ".types", + "MemoryIncluded": ".types", + "MemoryIncludedDocument": ".types", + "MemoryIncludedDocumentParams": ".requests", + "MemoryIncludedDocumentSystem": ".types", + "MemoryIncludedDocumentSystemParams": ".requests", + "MemoryIncludedParams": ".requests", + "MemoryIncludedRelated": ".types", + "MemoryIncludedRelatedChildrenItem": ".types", + "MemoryIncludedRelatedChildrenItemDocument": ".types", + "MemoryIncludedRelatedChildrenItemDocumentParams": ".requests", + "MemoryIncludedRelatedChildrenItemDocumentSystem": ".types", + "MemoryIncludedRelatedChildrenItemDocumentSystemParams": ".requests", + "MemoryIncludedRelatedChildrenItemParams": ".requests", + "MemoryIncludedRelatedChildrenItemSystem": ".types", + "MemoryIncludedRelatedChildrenItemSystemParams": ".requests", + "MemoryIncludedRelatedParams": ".requests", + "MemoryIncludedRelatedParentsItem": ".types", + "MemoryIncludedRelatedParentsItemDocument": ".types", + "MemoryIncludedRelatedParentsItemDocumentParams": ".requests", + "MemoryIncludedRelatedParentsItemDocumentSystem": ".types", + "MemoryIncludedRelatedParentsItemDocumentSystemParams": ".requests", + "MemoryIncludedRelatedParentsItemParams": ".requests", + "MemoryIncludedRelatedParentsItemSystem": ".types", + "MemoryIncludedRelatedParentsItemSystemParams": ".requests", + "MemoryIncludedRelatedSiblingsItem": ".types", + "MemoryIncludedRelatedSiblingsItemDocument": ".types", + "MemoryIncludedRelatedSiblingsItemDocumentParams": ".requests", + "MemoryIncludedRelatedSiblingsItemDocumentSystem": ".types", + "MemoryIncludedRelatedSiblingsItemDocumentSystemParams": ".requests", + "MemoryIncludedRelatedSiblingsItemParams": ".requests", + "MemoryIncludedRelatedSiblingsItemSystem": ".types", + "MemoryIncludedRelatedSiblingsItemSystemParams": ".requests", "MemoryParams": ".requests", "MemoryRelation": ".types", "MemorySystem": ".types", @@ -394,6 +484,8 @@ "NamespaceDeleted_QueuedParams": ".requests", "NamespaceDetails": ".types", "NamespaceDetailsParams": ".requests", + "NamespaceList": ".types", + "NamespaceListParams": ".requests", "NamespaceParams": ".requests", "NamespaceSystem": ".types", "NamespaceSystemParams": ".requests", @@ -418,9 +510,9 @@ "RelatedMemorySystemParams": ".requests", "S3Config": ".types", "S3ConfigParams": ".requests", + "SearchInclude": ".types", + "SearchIncludeParams": ".requests", "SearchMode": ".types", - "SearchRequestAttach": ".types", - "SearchRequestAttachParams": ".requests", "SearchRequestRerank": ".types", "SearchResponse": ".types", "SearchResponseParams": ".requests", @@ -428,6 +520,8 @@ "SearchResultIncluded": ".types", "SearchResultIncludedDocument": ".types", "SearchResultIncludedDocumentParams": ".requests", + "SearchResultIncludedDocumentSystem": ".types", + "SearchResultIncludedDocumentSystemParams": ".requests", "SearchResultIncludedParams": ".requests", "SearchResultParams": ".requests", "SearchResultSystem": ".types", @@ -482,6 +576,7 @@ def __dir__(): "BadRequestErrorBodyParams", "BatchAddItemResult", "BatchAddItemResultParams", + "BatchAddItemResultStatus", "BatchAddResult", "BatchAddResultParams", "Chunk", @@ -499,14 +594,18 @@ def __dir__(): "ConnectorDeleted", "ConnectorDeletedParams", "ConnectorErrorCode", - "ConnectorLastSync", - "ConnectorLastSyncParams", + "ConnectorInclude", + "ConnectorLink", + "ConnectorLinkParams", "ConnectorList", "ConnectorListParams", "ConnectorParams", - "ConnectorPicker", - "ConnectorPickerParams", "ConnectorProvider", + "ConnectorRun", + "ConnectorRunParams", + "ConnectorRunStatus", + "ConnectorRunSystem", + "ConnectorRunSystemParams", "ConnectorSelection", "ConnectorSelectionItem", "ConnectorSelectionItemParams", @@ -554,8 +653,11 @@ def __dir__(): "ConnectorSyncParams", "ConnectorSyncStarted", "ConnectorSyncStartedParams", - "ConnectorSyncStatus", + "ConnectorSyncSystem", + "ConnectorSyncSystemParams", "ConnectorSyncTrigger", + "ConnectorSystem", + "ConnectorSystemParams", "DefaultAioHttpClient", "DefaultAsyncHttpxClient", "DeleteDocumentError", @@ -563,22 +665,24 @@ def __dir__(): "DeleteDocumentsResult", "DeleteDocumentsResultParams", "Document", - "DocumentAttachment", + "DocumentInclude", "DocumentInput", "DocumentInputParams", "DocumentListItem", "DocumentListItemParams", + "DocumentListItemSystem", + "DocumentListItemSystemParams", "DocumentParams", "DocumentRef", "DocumentRefParams", + "DocumentRefStatus", "DocumentSystem", "DocumentSystemParams", + "DocumentSystemStatus", "DreamingMode", "ErrorResponse", "ErrorResponseParams", "FileType", - "FileUploadResult", - "FileUploadResultParams", "FilterAnd", "FilterAndParams", "FilterArrayContains", @@ -617,15 +721,48 @@ def __dir__(): "GranolaConfig", "GranolaConfigParams", "InternalServerError", - "ListRequestLimit", - "ListRequestLimitParams", - "ListRequestPage", - "ListRequestPageParams", + "ListRequestInclude", + "ListRequestIncludeParams", "ListResponse", "ListResponseParams", "ListSort", "ListType", "Memory", + "MemoryDetails", + "MemoryDetailsParams", + "MemoryInclude", + "MemoryIncluded", + "MemoryIncludedDocument", + "MemoryIncludedDocumentParams", + "MemoryIncludedDocumentSystem", + "MemoryIncludedDocumentSystemParams", + "MemoryIncludedParams", + "MemoryIncludedRelated", + "MemoryIncludedRelatedChildrenItem", + "MemoryIncludedRelatedChildrenItemDocument", + "MemoryIncludedRelatedChildrenItemDocumentParams", + "MemoryIncludedRelatedChildrenItemDocumentSystem", + "MemoryIncludedRelatedChildrenItemDocumentSystemParams", + "MemoryIncludedRelatedChildrenItemParams", + "MemoryIncludedRelatedChildrenItemSystem", + "MemoryIncludedRelatedChildrenItemSystemParams", + "MemoryIncludedRelatedParams", + "MemoryIncludedRelatedParentsItem", + "MemoryIncludedRelatedParentsItemDocument", + "MemoryIncludedRelatedParentsItemDocumentParams", + "MemoryIncludedRelatedParentsItemDocumentSystem", + "MemoryIncludedRelatedParentsItemDocumentSystemParams", + "MemoryIncludedRelatedParentsItemParams", + "MemoryIncludedRelatedParentsItemSystem", + "MemoryIncludedRelatedParentsItemSystemParams", + "MemoryIncludedRelatedSiblingsItem", + "MemoryIncludedRelatedSiblingsItemDocument", + "MemoryIncludedRelatedSiblingsItemDocumentParams", + "MemoryIncludedRelatedSiblingsItemDocumentSystem", + "MemoryIncludedRelatedSiblingsItemDocumentSystemParams", + "MemoryIncludedRelatedSiblingsItemParams", + "MemoryIncludedRelatedSiblingsItemSystem", + "MemoryIncludedRelatedSiblingsItemSystemParams", "MemoryParams", "MemoryRelation", "MemorySystem", @@ -645,6 +782,8 @@ def __dir__(): "NamespaceDeleted_QueuedParams", "NamespaceDetails", "NamespaceDetailsParams", + "NamespaceList", + "NamespaceListParams", "NamespaceParams", "NamespaceSystem", "NamespaceSystemParams", @@ -670,9 +809,9 @@ def __dir__(): "RelatedMemorySystemParams", "S3Config", "S3ConfigParams", + "SearchInclude", + "SearchIncludeParams", "SearchMode", - "SearchRequestAttach", - "SearchRequestAttachParams", "SearchRequestRerank", "SearchResponse", "SearchResponseParams", @@ -680,6 +819,8 @@ def __dir__(): "SearchResultIncluded", "SearchResultIncludedDocument", "SearchResultIncludedDocumentParams", + "SearchResultIncludedDocumentSystem", + "SearchResultIncludedDocumentSystemParams", "SearchResultIncludedParams", "SearchResultParams", "SearchResultSystem", diff --git a/src/supermemory/client.py b/src/supermemory/client.py index 7999535..4f1cbac 100644 --- a/src/supermemory/client.py +++ b/src/supermemory/client.py @@ -15,10 +15,9 @@ from .environment import SupermemoryEnvironment from .raw_client import AsyncRawSupermemory, RawSupermemory from .requests.filter_expression import FilterExpressionParams -from .requests.list_request_limit import ListRequestLimitParams -from .requests.list_request_page import ListRequestPageParams +from .requests.list_request_include import ListRequestIncludeParams from .requests.metadata_value import MetadataValueParams -from .requests.search_request_attach import SearchRequestAttachParams +from .requests.search_include import SearchIncludeParams from .types.document_ref import DocumentRef from .types.dreaming_mode import DreamingMode from .types.list_response import ListResponse @@ -154,13 +153,13 @@ def add( namespace: str, *, content: str, - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, id: typing.Optional[str] = OMIT, supporting_context: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, MetadataValueParams]] = OMIT, group: typing.Optional[typing.Dict[str, MetadataValueParams]] = OMIT, date: typing.Optional[str] = OMIT, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -178,12 +177,6 @@ def add( content : str The content to process. This may be plaintext or a URL to supported rich content. - task_type : typing.Optional[TaskType] - Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. - - dreaming : typing.Optional[DreamingMode] - Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. - id : typing.Optional[str] An optional caller-defined document ID @@ -199,6 +192,12 @@ def add( date : typing.Optional[str] When the source content is from, in ISO 8601 format + task_type : typing.Optional[TaskType] + Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. + + dreaming : typing.Optional[DreamingMode] + Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -222,13 +221,13 @@ def add( _response = self._raw_client.add( namespace, content=content, - task_type=task_type, - dreaming=dreaming, id=id, supporting_context=supporting_context, metadata=metadata, group=group, date=date, + task_type=task_type, + dreaming=dreaming, request_options=request_options, ) return _response.data @@ -238,10 +237,10 @@ def search( namespace: str, *, query: str, - limit: typing.Optional[int] = None, - search_mode: typing.Optional[SearchMode] = None, filter: typing.Optional[FilterExpressionParams] = OMIT, - attach: typing.Optional[SearchRequestAttachParams] = OMIT, + search_mode: typing.Optional[SearchMode] = OMIT, + limit: typing.Optional[int] = OMIT, + include: typing.Optional[SearchIncludeParams] = OMIT, threshold: typing.Optional[float] = OMIT, rerank: typing.Optional[SearchRequestRerank] = OMIT, rewrite_query: typing.Optional[bool] = OMIT, @@ -262,16 +261,16 @@ def search( query : str Natural-language question, topic, or phrase to retrieve relevant context for. Replaces the v4 `q` field. - limit : typing.Optional[int] - Maximum number of results to return + filter : typing.Optional[FilterExpressionParams] + Type-safe metadata conditions applied before ranking results. Replaces the v4 `filters` field and unifies both legacy filter formats into one expression type. search_mode : typing.Optional[SearchMode] Search surface. "hybrid" combines learned memories with source chunks, "memories" returns learned context, and "chunks" returns source passages. - filter : typing.Optional[FilterExpressionParams] - Type-safe metadata conditions applied before ranking results. Replaces the v4 `filters` field and unifies both legacy filter formats into one expression type. + limit : typing.Optional[int] + Maximum number of results to return - attach : typing.Optional[SearchRequestAttachParams] + include : typing.Optional[SearchIncludeParams] Optional context to include alongside each matching result threshold : typing.Optional[float] @@ -300,17 +299,16 @@ def search( ) client.search( namespace="user_alex", - limit=10, query="what are the API rate limits", ) """ _response = self._raw_client.search( namespace, query=query, - limit=limit, - search_mode=search_mode, filter=filter, - attach=attach, + search_mode=search_mode, + limit=limit, + include=include, threshold=threshold, rerank=rerank, rewrite_query=rewrite_query, @@ -371,11 +369,12 @@ def list( namespace: str, type: ListType, *, - page: typing.Optional[ListRequestPageParams] = None, - limit: typing.Optional[ListRequestLimitParams] = None, + page: typing.Optional[int] = None, + limit: typing.Optional[int] = None, sort: typing.Optional[ListSort] = None, order: typing.Optional[SortOrder] = None, filter: typing.Optional[FilterExpressionParams] = OMIT, + include: typing.Optional[ListRequestIncludeParams] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -393,10 +392,10 @@ def list( type : ListType Resource collection to list: source documents, extracted chunks, or learned memories - page : typing.Optional[ListRequestPageParams] + page : typing.Optional[int] One-based page number - limit : typing.Optional[ListRequestLimitParams] + limit : typing.Optional[int] Maximum resources to return per page sort : typing.Optional[ListSort] @@ -408,6 +407,9 @@ def list( filter : typing.Optional[FilterExpressionParams] Type-safe metadata conditions applied before pagination + include : typing.Optional[ListRequestIncludeParams] + Optional extras, matching search's include + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -426,6 +428,8 @@ def list( client.list( namespace="user_alex", type="documents", + page=1, + limit=10, ) """ _response = self._raw_client.list( @@ -436,6 +440,7 @@ def list( sort=sort, order=order, filter=filter, + include=include, request_options=request_options, ) return _response.data @@ -622,13 +627,13 @@ async def add( namespace: str, *, content: str, - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, id: typing.Optional[str] = OMIT, supporting_context: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, MetadataValueParams]] = OMIT, group: typing.Optional[typing.Dict[str, MetadataValueParams]] = OMIT, date: typing.Optional[str] = OMIT, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -646,12 +651,6 @@ async def add( content : str The content to process. This may be plaintext or a URL to supported rich content. - task_type : typing.Optional[TaskType] - Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. - - dreaming : typing.Optional[DreamingMode] - Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. - id : typing.Optional[str] An optional caller-defined document ID @@ -667,6 +666,12 @@ async def add( date : typing.Optional[str] When the source content is from, in ISO 8601 format + task_type : typing.Optional[TaskType] + Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. + + dreaming : typing.Optional[DreamingMode] + Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -698,13 +703,13 @@ async def main() -> None: _response = await self._raw_client.add( namespace, content=content, - task_type=task_type, - dreaming=dreaming, id=id, supporting_context=supporting_context, metadata=metadata, group=group, date=date, + task_type=task_type, + dreaming=dreaming, request_options=request_options, ) return _response.data @@ -714,10 +719,10 @@ async def search( namespace: str, *, query: str, - limit: typing.Optional[int] = None, - search_mode: typing.Optional[SearchMode] = None, filter: typing.Optional[FilterExpressionParams] = OMIT, - attach: typing.Optional[SearchRequestAttachParams] = OMIT, + search_mode: typing.Optional[SearchMode] = OMIT, + limit: typing.Optional[int] = OMIT, + include: typing.Optional[SearchIncludeParams] = OMIT, threshold: typing.Optional[float] = OMIT, rerank: typing.Optional[SearchRequestRerank] = OMIT, rewrite_query: typing.Optional[bool] = OMIT, @@ -738,16 +743,16 @@ async def search( query : str Natural-language question, topic, or phrase to retrieve relevant context for. Replaces the v4 `q` field. - limit : typing.Optional[int] - Maximum number of results to return + filter : typing.Optional[FilterExpressionParams] + Type-safe metadata conditions applied before ranking results. Replaces the v4 `filters` field and unifies both legacy filter formats into one expression type. search_mode : typing.Optional[SearchMode] Search surface. "hybrid" combines learned memories with source chunks, "memories" returns learned context, and "chunks" returns source passages. - filter : typing.Optional[FilterExpressionParams] - Type-safe metadata conditions applied before ranking results. Replaces the v4 `filters` field and unifies both legacy filter formats into one expression type. + limit : typing.Optional[int] + Maximum number of results to return - attach : typing.Optional[SearchRequestAttachParams] + include : typing.Optional[SearchIncludeParams] Optional context to include alongside each matching result threshold : typing.Optional[float] @@ -781,7 +786,6 @@ async def search( async def main() -> None: await client.search( namespace="user_alex", - limit=10, query="what are the API rate limits", ) @@ -791,10 +795,10 @@ async def main() -> None: _response = await self._raw_client.search( namespace, query=query, - limit=limit, - search_mode=search_mode, filter=filter, - attach=attach, + search_mode=search_mode, + limit=limit, + include=include, threshold=threshold, rerank=rerank, rewrite_query=rewrite_query, @@ -865,11 +869,12 @@ async def list( namespace: str, type: ListType, *, - page: typing.Optional[ListRequestPageParams] = None, - limit: typing.Optional[ListRequestLimitParams] = None, + page: typing.Optional[int] = None, + limit: typing.Optional[int] = None, sort: typing.Optional[ListSort] = None, order: typing.Optional[SortOrder] = None, filter: typing.Optional[FilterExpressionParams] = OMIT, + include: typing.Optional[ListRequestIncludeParams] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -887,10 +892,10 @@ async def list( type : ListType Resource collection to list: source documents, extracted chunks, or learned memories - page : typing.Optional[ListRequestPageParams] + page : typing.Optional[int] One-based page number - limit : typing.Optional[ListRequestLimitParams] + limit : typing.Optional[int] Maximum resources to return per page sort : typing.Optional[ListSort] @@ -902,6 +907,9 @@ async def list( filter : typing.Optional[FilterExpressionParams] Type-safe metadata conditions applied before pagination + include : typing.Optional[ListRequestIncludeParams] + Optional extras, matching search's include + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -925,6 +933,8 @@ async def main() -> None: await client.list( namespace="user_alex", type="documents", + page=1, + limit=10, ) @@ -938,6 +948,7 @@ async def main() -> None: sort=sort, order=order, filter=filter, + include=include, request_options=request_options, ) return _response.data diff --git a/src/supermemory/connectors/client.py b/src/supermemory/connectors/client.py index 7593d64..5741b9f 100644 --- a/src/supermemory/connectors/client.py +++ b/src/supermemory/connectors/client.py @@ -12,6 +12,7 @@ from ..requests.connector_setup import ConnectorSetupParams from ..types.connector import Connector from ..types.connector_deleted import ConnectorDeleted +from ..types.connector_include import ConnectorInclude from ..types.connector_list import ConnectorList from ..types.connector_provider import ConnectorProvider from ..types.connector_setup_result import ConnectorSetupResult @@ -151,7 +152,7 @@ def create( timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, ) -> ConnectorSetupResult: """ - Connect an external source to this namespace. OAuth providers return an authUrl to send the user to; providers that authenticate with config start syncing right away. + Connect an external source to this namespace. OAuth providers return an authorization url to send the user to; providers that authenticate with config start syncing right away. Parameters ---------- @@ -188,7 +189,7 @@ def get( namespace: str, id: str, *, - attach: typing.Optional[str] = None, + include: typing.Optional[typing.Union[ConnectorInclude, typing.Sequence[ConnectorInclude]]] = None, return_url: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, @@ -197,7 +198,7 @@ def get( timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, ) -> Connector: """ - Read one connector. Add attach=syncs to include its recent sync runs and the items that failed. attach=picker needs an admin with write access, since the link changes what syncs. + Read one connector. Add include=syncs to include its recent sync runs and the items that failed. include=picker needs an admin with write access, since the link changes what syncs. Parameters ---------- @@ -207,7 +208,7 @@ def get( id : str Connector identifier returned when the connector was created - attach : typing.Optional[str] + include : typing.Optional[typing.Union[ConnectorInclude, typing.Sequence[ConnectorInclude]]] Comma-separated extras. syncs: the 10 most recent sync runs with their failed items. picker: a one-time hosted picker URL. return_url : typing.Optional[str] @@ -234,7 +235,7 @@ def get( ) """ _response = self._raw_client.get( - namespace, id, attach=attach, return_url=return_url, request_options=request_options + namespace, id, include=include, return_url=return_url, request_options=request_options ) return _response.data @@ -535,7 +536,7 @@ async def create( timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, ) -> ConnectorSetupResult: """ - Connect an external source to this namespace. OAuth providers return an authUrl to send the user to; providers that authenticate with config start syncing right away. + Connect an external source to this namespace. OAuth providers return an authorization url to send the user to; providers that authenticate with config start syncing right away. Parameters ---------- @@ -580,7 +581,7 @@ async def get( namespace: str, id: str, *, - attach: typing.Optional[str] = None, + include: typing.Optional[typing.Union[ConnectorInclude, typing.Sequence[ConnectorInclude]]] = None, return_url: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, @@ -589,7 +590,7 @@ async def get( timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, ) -> Connector: """ - Read one connector. Add attach=syncs to include its recent sync runs and the items that failed. attach=picker needs an admin with write access, since the link changes what syncs. + Read one connector. Add include=syncs to include its recent sync runs and the items that failed. include=picker needs an admin with write access, since the link changes what syncs. Parameters ---------- @@ -599,7 +600,7 @@ async def get( id : str Connector identifier returned when the connector was created - attach : typing.Optional[str] + include : typing.Optional[typing.Union[ConnectorInclude, typing.Sequence[ConnectorInclude]]] Comma-separated extras. syncs: the 10 most recent sync runs with their failed items. picker: a one-time hosted picker URL. return_url : typing.Optional[str] @@ -634,7 +635,7 @@ async def main() -> None: asyncio.run(main()) """ _response = await self._raw_client.get( - namespace, id, attach=attach, return_url=return_url, request_options=request_options + namespace, id, include=include, return_url=return_url, request_options=request_options ) return _response.data diff --git a/src/supermemory/connectors/raw_client.py b/src/supermemory/connectors/raw_client.py index 3a1f081..cd66a11 100644 --- a/src/supermemory/connectors/raw_client.py +++ b/src/supermemory/connectors/raw_client.py @@ -28,6 +28,7 @@ from ..types.bad_request_error_body import BadRequestErrorBody from ..types.connector import Connector from ..types.connector_deleted import ConnectorDeleted +from ..types.connector_include import ConnectorInclude from ..types.connector_list import ConnectorList from ..types.connector_provider import ConnectorProvider from ..types.connector_setup_result import ConnectorSetupResult @@ -273,7 +274,7 @@ def create( timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, ) -> HttpResponse[ConnectorSetupResult]: """ - Connect an external source to this namespace. OAuth providers return an authUrl to send the user to; providers that authenticate with config start syncing right away. + Connect an external source to this namespace. OAuth providers return an authorization url to send the user to; providers that authenticate with config start syncing right away. Parameters ---------- @@ -392,7 +393,7 @@ def get( namespace: str, id: str, *, - attach: typing.Optional[str] = None, + include: typing.Optional[typing.Union[ConnectorInclude, typing.Sequence[ConnectorInclude]]] = None, return_url: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, @@ -401,7 +402,7 @@ def get( timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, ) -> HttpResponse[Connector]: """ - Read one connector. Add attach=syncs to include its recent sync runs and the items that failed. attach=picker needs an admin with write access, since the link changes what syncs. + Read one connector. Add include=syncs to include its recent sync runs and the items that failed. include=picker needs an admin with write access, since the link changes what syncs. Parameters ---------- @@ -411,7 +412,7 @@ def get( id : str Connector identifier returned when the connector was created - attach : typing.Optional[str] + include : typing.Optional[typing.Union[ConnectorInclude, typing.Sequence[ConnectorInclude]]] Comma-separated extras. syncs: the 10 most recent sync runs with their failed items. picker: a one-time hosted picker URL. return_url : typing.Optional[str] @@ -429,7 +430,7 @@ def get( f"ns/{encode_path_param(namespace)}/connectors/{encode_path_param(id)}", method="GET", params={ - "attach": attach, + "include": include, "returnUrl": return_url, }, request_options=request_options, @@ -1128,7 +1129,7 @@ async def create( timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, ) -> AsyncHttpResponse[ConnectorSetupResult]: """ - Connect an external source to this namespace. OAuth providers return an authUrl to send the user to; providers that authenticate with config start syncing right away. + Connect an external source to this namespace. OAuth providers return an authorization url to send the user to; providers that authenticate with config start syncing right away. Parameters ---------- @@ -1247,7 +1248,7 @@ async def get( namespace: str, id: str, *, - attach: typing.Optional[str] = None, + include: typing.Optional[typing.Union[ConnectorInclude, typing.Sequence[ConnectorInclude]]] = None, return_url: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, @@ -1256,7 +1257,7 @@ async def get( timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, ) -> AsyncHttpResponse[Connector]: """ - Read one connector. Add attach=syncs to include its recent sync runs and the items that failed. attach=picker needs an admin with write access, since the link changes what syncs. + Read one connector. Add include=syncs to include its recent sync runs and the items that failed. include=picker needs an admin with write access, since the link changes what syncs. Parameters ---------- @@ -1266,7 +1267,7 @@ async def get( id : str Connector identifier returned when the connector was created - attach : typing.Optional[str] + include : typing.Optional[typing.Union[ConnectorInclude, typing.Sequence[ConnectorInclude]]] Comma-separated extras. syncs: the 10 most recent sync runs with their failed items. picker: a one-time hosted picker URL. return_url : typing.Optional[str] @@ -1284,7 +1285,7 @@ async def get( f"ns/{encode_path_param(namespace)}/connectors/{encode_path_param(id)}", method="GET", params={ - "attach": attach, + "include": include, "returnUrl": return_url, }, request_options=request_options, diff --git a/src/supermemory/core/client_wrapper.py b/src/supermemory/core/client_wrapper.py index 4ed96e7..97a04cc 100644 --- a/src/supermemory/core/client_wrapper.py +++ b/src/supermemory/core/client_wrapper.py @@ -33,7 +33,7 @@ def get_headers(self) -> typing.Dict[str, str]: import platform headers: typing.Dict[str, str] = { - "User-Agent": "supermemory/5.0.0rc2", + "User-Agent": "supermemory/5.0.0rc3", "X-Fern-Language": "Python", "X-Fern-Runtime": f"python/{platform.python_version()}", "X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}", diff --git a/src/supermemory/documents/client.py b/src/supermemory/documents/client.py index e5c8534..5068abe 100644 --- a/src/supermemory/documents/client.py +++ b/src/supermemory/documents/client.py @@ -14,11 +14,10 @@ from ..types.batch_add_result import BatchAddResult from ..types.delete_documents_result import DeleteDocumentsResult from ..types.document import Document -from ..types.document_attachment import DocumentAttachment +from ..types.document_include import DocumentInclude from ..types.document_ref import DocumentRef from ..types.dreaming_mode import DreamingMode from ..types.file_type import FileType -from ..types.file_upload_result import FileUploadResult from ..types.task_type import TaskType from .raw_client import AsyncRawDocumentsClient, RawDocumentsClient @@ -91,8 +90,8 @@ def batch_add( namespace: str, *, documents: typing.Sequence[DocumentInputParams], - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -150,7 +149,7 @@ def get( namespace: str, id: str, *, - attach: typing.Optional[typing.Union[DocumentAttachment, typing.Sequence[DocumentAttachment]]] = None, + include: typing.Optional[typing.Union[DocumentInclude, typing.Sequence[DocumentInclude]]] = None, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -158,7 +157,7 @@ def get( timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, ) -> Document: """ - Retrieve a document's canonical content, metadata, and processing state by document ID or caller-defined ID. Optionally attach its source chunks, derived memories, or both in the same response. + Retrieve a document's canonical content, metadata, and processing state by document ID or caller-defined ID. Optionally include its source chunks, derived memories, or both in the same response. Parameters ---------- @@ -168,8 +167,8 @@ def get( id : str The public document ID - attach : typing.Optional[typing.Union[DocumentAttachment, typing.Sequence[DocumentAttachment]]] - Child resources to include. Repeat the parameter to attach chunks, memories, or both. + include : typing.Optional[typing.Union[DocumentInclude, typing.Sequence[DocumentInclude]]] + Comma-separated child resources to include: chunks, memories, or both. request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -191,7 +190,7 @@ def get( id="my-doc-123", ) """ - _response = self._raw_client.get(namespace, id, attach=attach, request_options=request_options) + _response = self._raw_client.get(namespace, id, include=include, request_options=request_options) return _response.data def update( @@ -199,13 +198,13 @@ def update( namespace: str, id: str, *, - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, content: typing.Optional[str] = OMIT, supporting_context: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, MetadataValueParams]] = OMIT, group: typing.Optional[typing.Dict[str, MetadataValueParams]] = OMIT, date: typing.Optional[str] = OMIT, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -223,12 +222,6 @@ def update( id : str The public document ID - task_type : typing.Optional[TaskType] - Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. - - dreaming : typing.Optional[DreamingMode] - Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. - content : typing.Optional[str] The content to process. This may be plaintext or a URL to supported rich content. @@ -244,6 +237,12 @@ def update( date : typing.Optional[str] When the source content is from, in ISO 8601 format + task_type : typing.Optional[TaskType] + Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. + + dreaming : typing.Optional[DreamingMode] + Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -267,13 +266,13 @@ def update( _response = self._raw_client.update( namespace, id, - task_type=task_type, - dreaming=dreaming, content=content, supporting_context=supporting_context, metadata=metadata, group=group, date=date, + task_type=task_type, + dreaming=dreaming, request_options=request_options, ) return _response.data @@ -283,20 +282,20 @@ def upload_file( namespace: str, *, file: core.File, - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, - file_type: typing.Optional[FileType] = None, - mime_type: typing.Optional[str] = None, supporting_context: typing.Optional[str] = OMIT, metadata: typing.Optional[str] = OMIT, group: typing.Optional[str] = OMIT, date: typing.Optional[str] = OMIT, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, + file_type: typing.Optional[FileType] = OMIT, + mime_type: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, extra_body: typing.Optional[typing.Mapping[str, typing.Any]] = None, timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, - ) -> FileUploadResult: + ) -> DocumentRef: """ Transform an uploaded file into searchable knowledge and learned memory. The response returns as soon as ingestion is safely queued while extraction and memory formation continue asynchronously. @@ -308,18 +307,6 @@ def upload_file( file : core.File See core.File for more documentation - task_type : typing.Optional[TaskType] - Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. - - dreaming : typing.Optional[DreamingMode] - Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. - - file_type : typing.Optional[FileType] - Explicit source type used when automatic inference is insufficient - - mime_type : typing.Optional[str] - Explicit MIME type used when upload metadata is insufficient - supporting_context : typing.Optional[str] Context used to guide memory extraction within this namespace. Max 1500 characters. @@ -332,12 +319,24 @@ def upload_file( date : typing.Optional[str] When the source content is from, in ISO 8601 format + task_type : typing.Optional[TaskType] + Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. + + dreaming : typing.Optional[DreamingMode] + Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. + + file_type : typing.Optional[FileType] + Explicit source type used when automatic inference is insufficient + + mime_type : typing.Optional[str] + Explicit MIME type used when upload metadata is insufficient + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - FileUploadResult + DocumentRef File accepted for processing Examples @@ -354,14 +353,14 @@ def upload_file( _response = self._raw_client.upload_file( namespace, file=file, - task_type=task_type, - dreaming=dreaming, - file_type=file_type, - mime_type=mime_type, supporting_context=supporting_context, metadata=metadata, group=group, date=date, + task_type=task_type, + dreaming=dreaming, + file_type=file_type, + mime_type=mime_type, request_options=request_options, ) return _response.data @@ -372,20 +371,20 @@ def replace_with_file( id: str, *, file: core.File, - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, - file_type: typing.Optional[FileType] = None, - mime_type: typing.Optional[str] = None, supporting_context: typing.Optional[str] = OMIT, metadata: typing.Optional[str] = OMIT, group: typing.Optional[str] = OMIT, date: typing.Optional[str] = OMIT, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, + file_type: typing.Optional[FileType] = OMIT, + mime_type: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, extra_body: typing.Optional[typing.Mapping[str, typing.Any]] = None, timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, - ) -> FileUploadResult: + ) -> DocumentRef: """ Replace an existing document with a new file while keeping its stable document ID. Content and caller metadata are overwritten, then the document is reprocessed asynchronously. @@ -400,18 +399,6 @@ def replace_with_file( file : core.File See core.File for more documentation - task_type : typing.Optional[TaskType] - Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. - - dreaming : typing.Optional[DreamingMode] - Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. - - file_type : typing.Optional[FileType] - Explicit source type used when automatic inference is insufficient - - mime_type : typing.Optional[str] - Explicit MIME type used when upload metadata is insufficient - supporting_context : typing.Optional[str] Context used to guide memory extraction within this namespace. Max 1500 characters. @@ -424,12 +411,24 @@ def replace_with_file( date : typing.Optional[str] When the source content is from, in ISO 8601 format + task_type : typing.Optional[TaskType] + Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. + + dreaming : typing.Optional[DreamingMode] + Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. + + file_type : typing.Optional[FileType] + Explicit source type used when automatic inference is insufficient + + mime_type : typing.Optional[str] + Explicit MIME type used when upload metadata is insufficient + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - FileUploadResult + DocumentRef Replacement accepted for processing Examples @@ -448,14 +447,14 @@ def replace_with_file( namespace, id, file=file, - task_type=task_type, - dreaming=dreaming, - file_type=file_type, - mime_type=mime_type, supporting_context=supporting_context, metadata=metadata, group=group, date=date, + task_type=task_type, + dreaming=dreaming, + file_type=file_type, + mime_type=mime_type, request_options=request_options, ) return _response.data @@ -465,21 +464,21 @@ def update_file( namespace: str, id: str, *, - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, - file_type: typing.Optional[FileType] = None, - mime_type: typing.Optional[str] = None, file: typing.Optional[core.File] = OMIT, supporting_context: typing.Optional[str] = OMIT, metadata: typing.Optional[str] = OMIT, group: typing.Optional[str] = OMIT, date: typing.Optional[str] = OMIT, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, + file_type: typing.Optional[FileType] = OMIT, + mime_type: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, extra_body: typing.Optional[typing.Mapping[str, typing.Any]] = None, timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, - ) -> FileUploadResult: + ) -> DocumentRef: """ Refresh only the file-backed fields you provide. Supplying a file replaces the canonical content; omitted metadata and processing context remain unchanged. @@ -491,18 +490,6 @@ def update_file( id : str The public document ID - task_type : typing.Optional[TaskType] - Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. - - dreaming : typing.Optional[DreamingMode] - Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. - - file_type : typing.Optional[FileType] - Explicit source type used when automatic inference is insufficient - - mime_type : typing.Optional[str] - Explicit MIME type used when upload metadata is insufficient - file : typing.Optional[core.File] See core.File for more documentation @@ -518,12 +505,24 @@ def update_file( date : typing.Optional[str] When the source content is from, in ISO 8601 format + task_type : typing.Optional[TaskType] + Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. + + dreaming : typing.Optional[DreamingMode] + Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. + + file_type : typing.Optional[FileType] + Explicit source type used when automatic inference is insufficient + + mime_type : typing.Optional[str] + Explicit MIME type used when upload metadata is insufficient + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - FileUploadResult + DocumentRef Update accepted for processing Examples @@ -541,15 +540,15 @@ def update_file( _response = self._raw_client.update_file( namespace, id, - task_type=task_type, - dreaming=dreaming, - file_type=file_type, - mime_type=mime_type, file=file, supporting_context=supporting_context, metadata=metadata, group=group, date=date, + task_type=task_type, + dreaming=dreaming, + file_type=file_type, + mime_type=mime_type, request_options=request_options, ) return _response.data @@ -628,8 +627,8 @@ async def batch_add( namespace: str, *, documents: typing.Sequence[DocumentInputParams], - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -695,7 +694,7 @@ async def get( namespace: str, id: str, *, - attach: typing.Optional[typing.Union[DocumentAttachment, typing.Sequence[DocumentAttachment]]] = None, + include: typing.Optional[typing.Union[DocumentInclude, typing.Sequence[DocumentInclude]]] = None, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -703,7 +702,7 @@ async def get( timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, ) -> Document: """ - Retrieve a document's canonical content, metadata, and processing state by document ID or caller-defined ID. Optionally attach its source chunks, derived memories, or both in the same response. + Retrieve a document's canonical content, metadata, and processing state by document ID or caller-defined ID. Optionally include its source chunks, derived memories, or both in the same response. Parameters ---------- @@ -713,8 +712,8 @@ async def get( id : str The public document ID - attach : typing.Optional[typing.Union[DocumentAttachment, typing.Sequence[DocumentAttachment]]] - Child resources to include. Repeat the parameter to attach chunks, memories, or both. + include : typing.Optional[typing.Union[DocumentInclude, typing.Sequence[DocumentInclude]]] + Comma-separated child resources to include: chunks, memories, or both. request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -744,7 +743,7 @@ async def main() -> None: asyncio.run(main()) """ - _response = await self._raw_client.get(namespace, id, attach=attach, request_options=request_options) + _response = await self._raw_client.get(namespace, id, include=include, request_options=request_options) return _response.data async def update( @@ -752,13 +751,13 @@ async def update( namespace: str, id: str, *, - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, content: typing.Optional[str] = OMIT, supporting_context: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, MetadataValueParams]] = OMIT, group: typing.Optional[typing.Dict[str, MetadataValueParams]] = OMIT, date: typing.Optional[str] = OMIT, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -776,12 +775,6 @@ async def update( id : str The public document ID - task_type : typing.Optional[TaskType] - Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. - - dreaming : typing.Optional[DreamingMode] - Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. - content : typing.Optional[str] The content to process. This may be plaintext or a URL to supported rich content. @@ -797,6 +790,12 @@ async def update( date : typing.Optional[str] When the source content is from, in ISO 8601 format + task_type : typing.Optional[TaskType] + Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. + + dreaming : typing.Optional[DreamingMode] + Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -828,13 +827,13 @@ async def main() -> None: _response = await self._raw_client.update( namespace, id, - task_type=task_type, - dreaming=dreaming, content=content, supporting_context=supporting_context, metadata=metadata, group=group, date=date, + task_type=task_type, + dreaming=dreaming, request_options=request_options, ) return _response.data @@ -844,20 +843,20 @@ async def upload_file( namespace: str, *, file: core.File, - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, - file_type: typing.Optional[FileType] = None, - mime_type: typing.Optional[str] = None, supporting_context: typing.Optional[str] = OMIT, metadata: typing.Optional[str] = OMIT, group: typing.Optional[str] = OMIT, date: typing.Optional[str] = OMIT, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, + file_type: typing.Optional[FileType] = OMIT, + mime_type: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, extra_body: typing.Optional[typing.Mapping[str, typing.Any]] = None, timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, - ) -> FileUploadResult: + ) -> DocumentRef: """ Transform an uploaded file into searchable knowledge and learned memory. The response returns as soon as ingestion is safely queued while extraction and memory formation continue asynchronously. @@ -869,18 +868,6 @@ async def upload_file( file : core.File See core.File for more documentation - task_type : typing.Optional[TaskType] - Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. - - dreaming : typing.Optional[DreamingMode] - Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. - - file_type : typing.Optional[FileType] - Explicit source type used when automatic inference is insufficient - - mime_type : typing.Optional[str] - Explicit MIME type used when upload metadata is insufficient - supporting_context : typing.Optional[str] Context used to guide memory extraction within this namespace. Max 1500 characters. @@ -893,12 +880,24 @@ async def upload_file( date : typing.Optional[str] When the source content is from, in ISO 8601 format + task_type : typing.Optional[TaskType] + Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. + + dreaming : typing.Optional[DreamingMode] + Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. + + file_type : typing.Optional[FileType] + Explicit source type used when automatic inference is insufficient + + mime_type : typing.Optional[str] + Explicit MIME type used when upload metadata is insufficient + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - FileUploadResult + DocumentRef File accepted for processing Examples @@ -923,14 +922,14 @@ async def main() -> None: _response = await self._raw_client.upload_file( namespace, file=file, - task_type=task_type, - dreaming=dreaming, - file_type=file_type, - mime_type=mime_type, supporting_context=supporting_context, metadata=metadata, group=group, date=date, + task_type=task_type, + dreaming=dreaming, + file_type=file_type, + mime_type=mime_type, request_options=request_options, ) return _response.data @@ -941,20 +940,20 @@ async def replace_with_file( id: str, *, file: core.File, - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, - file_type: typing.Optional[FileType] = None, - mime_type: typing.Optional[str] = None, supporting_context: typing.Optional[str] = OMIT, metadata: typing.Optional[str] = OMIT, group: typing.Optional[str] = OMIT, date: typing.Optional[str] = OMIT, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, + file_type: typing.Optional[FileType] = OMIT, + mime_type: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, extra_body: typing.Optional[typing.Mapping[str, typing.Any]] = None, timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, - ) -> FileUploadResult: + ) -> DocumentRef: """ Replace an existing document with a new file while keeping its stable document ID. Content and caller metadata are overwritten, then the document is reprocessed asynchronously. @@ -969,18 +968,6 @@ async def replace_with_file( file : core.File See core.File for more documentation - task_type : typing.Optional[TaskType] - Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. - - dreaming : typing.Optional[DreamingMode] - Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. - - file_type : typing.Optional[FileType] - Explicit source type used when automatic inference is insufficient - - mime_type : typing.Optional[str] - Explicit MIME type used when upload metadata is insufficient - supporting_context : typing.Optional[str] Context used to guide memory extraction within this namespace. Max 1500 characters. @@ -993,12 +980,24 @@ async def replace_with_file( date : typing.Optional[str] When the source content is from, in ISO 8601 format + task_type : typing.Optional[TaskType] + Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. + + dreaming : typing.Optional[DreamingMode] + Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. + + file_type : typing.Optional[FileType] + Explicit source type used when automatic inference is insufficient + + mime_type : typing.Optional[str] + Explicit MIME type used when upload metadata is insufficient + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - FileUploadResult + DocumentRef Replacement accepted for processing Examples @@ -1025,14 +1024,14 @@ async def main() -> None: namespace, id, file=file, - task_type=task_type, - dreaming=dreaming, - file_type=file_type, - mime_type=mime_type, supporting_context=supporting_context, metadata=metadata, group=group, date=date, + task_type=task_type, + dreaming=dreaming, + file_type=file_type, + mime_type=mime_type, request_options=request_options, ) return _response.data @@ -1042,21 +1041,21 @@ async def update_file( namespace: str, id: str, *, - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, - file_type: typing.Optional[FileType] = None, - mime_type: typing.Optional[str] = None, file: typing.Optional[core.File] = OMIT, supporting_context: typing.Optional[str] = OMIT, metadata: typing.Optional[str] = OMIT, group: typing.Optional[str] = OMIT, date: typing.Optional[str] = OMIT, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, + file_type: typing.Optional[FileType] = OMIT, + mime_type: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, extra_body: typing.Optional[typing.Mapping[str, typing.Any]] = None, timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, - ) -> FileUploadResult: + ) -> DocumentRef: """ Refresh only the file-backed fields you provide. Supplying a file replaces the canonical content; omitted metadata and processing context remain unchanged. @@ -1068,18 +1067,6 @@ async def update_file( id : str The public document ID - task_type : typing.Optional[TaskType] - Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. - - dreaming : typing.Optional[DreamingMode] - Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. - - file_type : typing.Optional[FileType] - Explicit source type used when automatic inference is insufficient - - mime_type : typing.Optional[str] - Explicit MIME type used when upload metadata is insufficient - file : typing.Optional[core.File] See core.File for more documentation @@ -1095,12 +1082,24 @@ async def update_file( date : typing.Optional[str] When the source content is from, in ISO 8601 format + task_type : typing.Optional[TaskType] + Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. + + dreaming : typing.Optional[DreamingMode] + Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. + + file_type : typing.Optional[FileType] + Explicit source type used when automatic inference is insufficient + + mime_type : typing.Optional[str] + Explicit MIME type used when upload metadata is insufficient + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - FileUploadResult + DocumentRef Update accepted for processing Examples @@ -1126,15 +1125,15 @@ async def main() -> None: _response = await self._raw_client.update_file( namespace, id, - task_type=task_type, - dreaming=dreaming, - file_type=file_type, - mime_type=mime_type, file=file, supporting_context=supporting_context, metadata=metadata, group=group, date=date, + task_type=task_type, + dreaming=dreaming, + file_type=file_type, + mime_type=mime_type, request_options=request_options, ) return _response.data diff --git a/src/supermemory/documents/raw_client.py b/src/supermemory/documents/raw_client.py index 1a47265..032047b 100644 --- a/src/supermemory/documents/raw_client.py +++ b/src/supermemory/documents/raw_client.py @@ -29,12 +29,11 @@ from ..types.batch_add_result import BatchAddResult from ..types.delete_documents_result import DeleteDocumentsResult from ..types.document import Document -from ..types.document_attachment import DocumentAttachment +from ..types.document_include import DocumentInclude from ..types.document_ref import DocumentRef from ..types.dreaming_mode import DreamingMode from ..types.error_response import ErrorResponse from ..types.file_type import FileType -from ..types.file_upload_result import FileUploadResult from ..types.task_type import TaskType from pydantic import ValidationError @@ -156,8 +155,8 @@ def batch_add( namespace: str, *, documents: typing.Sequence[DocumentInputParams], - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -192,14 +191,12 @@ def batch_add( _response = self._client_wrapper.httpx_client.request( f"ns/{encode_path_param(namespace)}/document/batch", method="POST", - params={ - "taskType": task_type, - "dreaming": dreaming, - }, json={ "documents": convert_and_respect_annotation_metadata( object_=documents, annotation=typing.Sequence[DocumentInputParams], direction="write" ), + "taskType": task_type, + "dreaming": dreaming, }, headers={ "content-type": "application/json", @@ -286,7 +283,7 @@ def get( namespace: str, id: str, *, - attach: typing.Optional[typing.Union[DocumentAttachment, typing.Sequence[DocumentAttachment]]] = None, + include: typing.Optional[typing.Union[DocumentInclude, typing.Sequence[DocumentInclude]]] = None, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -294,7 +291,7 @@ def get( timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, ) -> HttpResponse[Document]: """ - Retrieve a document's canonical content, metadata, and processing state by document ID or caller-defined ID. Optionally attach its source chunks, derived memories, or both in the same response. + Retrieve a document's canonical content, metadata, and processing state by document ID or caller-defined ID. Optionally include its source chunks, derived memories, or both in the same response. Parameters ---------- @@ -304,8 +301,8 @@ def get( id : str The public document ID - attach : typing.Optional[typing.Union[DocumentAttachment, typing.Sequence[DocumentAttachment]]] - Child resources to include. Repeat the parameter to attach chunks, memories, or both. + include : typing.Optional[typing.Union[DocumentInclude, typing.Sequence[DocumentInclude]]] + Comma-separated child resources to include: chunks, memories, or both. request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -319,7 +316,7 @@ def get( f"ns/{encode_path_param(namespace)}/document/{encode_path_param(id)}", method="GET", params={ - "attach": attach, + "include": include, }, request_options=request_options, ) @@ -402,13 +399,13 @@ def update( namespace: str, id: str, *, - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, content: typing.Optional[str] = OMIT, supporting_context: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, MetadataValueParams]] = OMIT, group: typing.Optional[typing.Dict[str, MetadataValueParams]] = OMIT, date: typing.Optional[str] = OMIT, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -426,12 +423,6 @@ def update( id : str The public document ID - task_type : typing.Optional[TaskType] - Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. - - dreaming : typing.Optional[DreamingMode] - Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. - content : typing.Optional[str] The content to process. This may be plaintext or a URL to supported rich content. @@ -447,6 +438,12 @@ def update( date : typing.Optional[str] When the source content is from, in ISO 8601 format + task_type : typing.Optional[TaskType] + Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. + + dreaming : typing.Optional[DreamingMode] + Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -458,10 +455,6 @@ def update( _response = self._client_wrapper.httpx_client.request( f"ns/{encode_path_param(namespace)}/document/{encode_path_param(id)}", method="PATCH", - params={ - "taskType": task_type, - "dreaming": dreaming, - }, json={ "content": content, "supportingContext": supporting_context, @@ -472,6 +465,8 @@ def update( object_=group, annotation=typing.Dict[str, MetadataValueParams], direction="write" ), "date": date, + "taskType": task_type, + "dreaming": dreaming, }, headers={ "content-type": "application/json", @@ -580,20 +575,20 @@ def upload_file( namespace: str, *, file: core.File, - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, - file_type: typing.Optional[FileType] = None, - mime_type: typing.Optional[str] = None, supporting_context: typing.Optional[str] = OMIT, metadata: typing.Optional[str] = OMIT, group: typing.Optional[str] = OMIT, date: typing.Optional[str] = OMIT, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, + file_type: typing.Optional[FileType] = OMIT, + mime_type: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, extra_body: typing.Optional[typing.Mapping[str, typing.Any]] = None, timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, - ) -> HttpResponse[FileUploadResult]: + ) -> HttpResponse[DocumentRef]: """ Transform an uploaded file into searchable knowledge and learned memory. The response returns as soon as ingestion is safely queued while extraction and memory formation continue asynchronously. @@ -605,18 +600,6 @@ def upload_file( file : core.File See core.File for more documentation - task_type : typing.Optional[TaskType] - Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. - - dreaming : typing.Optional[DreamingMode] - Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. - - file_type : typing.Optional[FileType] - Explicit source type used when automatic inference is insufficient - - mime_type : typing.Optional[str] - Explicit MIME type used when upload metadata is insufficient - supporting_context : typing.Optional[str] Context used to guide memory extraction within this namespace. Max 1500 characters. @@ -629,28 +612,38 @@ def upload_file( date : typing.Optional[str] When the source content is from, in ISO 8601 format + task_type : typing.Optional[TaskType] + Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. + + dreaming : typing.Optional[DreamingMode] + Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. + + file_type : typing.Optional[FileType] + Explicit source type used when automatic inference is insufficient + + mime_type : typing.Optional[str] + Explicit MIME type used when upload metadata is insufficient + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - HttpResponse[FileUploadResult] + HttpResponse[DocumentRef] File accepted for processing """ _response = self._client_wrapper.httpx_client.request( f"ns/{encode_path_param(namespace)}/document/file", method="POST", - params={ - "taskType": task_type, - "dreaming": dreaming, - "fileType": file_type, - "mimeType": mime_type, - }, data={ "supportingContext": supporting_context, "metadata": metadata, "group": group, "date": date, + "taskType": task_type, + "dreaming": dreaming, + "fileType": file_type, + "mimeType": mime_type, }, files={ "file": file, @@ -662,9 +655,9 @@ def upload_file( try: if 200 <= _response.status_code < 300: _data = typing.cast( - FileUploadResult, + DocumentRef, construct_type( - type_=FileUploadResult, # type: ignore + type_=DocumentRef, # type: ignore object_=_response.json(), ), ) @@ -750,20 +743,20 @@ def replace_with_file( id: str, *, file: core.File, - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, - file_type: typing.Optional[FileType] = None, - mime_type: typing.Optional[str] = None, supporting_context: typing.Optional[str] = OMIT, metadata: typing.Optional[str] = OMIT, group: typing.Optional[str] = OMIT, date: typing.Optional[str] = OMIT, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, + file_type: typing.Optional[FileType] = OMIT, + mime_type: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, extra_body: typing.Optional[typing.Mapping[str, typing.Any]] = None, timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, - ) -> HttpResponse[FileUploadResult]: + ) -> HttpResponse[DocumentRef]: """ Replace an existing document with a new file while keeping its stable document ID. Content and caller metadata are overwritten, then the document is reprocessed asynchronously. @@ -778,18 +771,6 @@ def replace_with_file( file : core.File See core.File for more documentation - task_type : typing.Optional[TaskType] - Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. - - dreaming : typing.Optional[DreamingMode] - Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. - - file_type : typing.Optional[FileType] - Explicit source type used when automatic inference is insufficient - - mime_type : typing.Optional[str] - Explicit MIME type used when upload metadata is insufficient - supporting_context : typing.Optional[str] Context used to guide memory extraction within this namespace. Max 1500 characters. @@ -802,28 +783,38 @@ def replace_with_file( date : typing.Optional[str] When the source content is from, in ISO 8601 format + task_type : typing.Optional[TaskType] + Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. + + dreaming : typing.Optional[DreamingMode] + Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. + + file_type : typing.Optional[FileType] + Explicit source type used when automatic inference is insufficient + + mime_type : typing.Optional[str] + Explicit MIME type used when upload metadata is insufficient + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - HttpResponse[FileUploadResult] + HttpResponse[DocumentRef] Replacement accepted for processing """ _response = self._client_wrapper.httpx_client.request( f"ns/{encode_path_param(namespace)}/document/file/{encode_path_param(id)}", method="POST", - params={ - "taskType": task_type, - "dreaming": dreaming, - "fileType": file_type, - "mimeType": mime_type, - }, data={ "supportingContext": supporting_context, "metadata": metadata, "group": group, "date": date, + "taskType": task_type, + "dreaming": dreaming, + "fileType": file_type, + "mimeType": mime_type, }, files={ "file": file, @@ -835,9 +826,9 @@ def replace_with_file( try: if 200 <= _response.status_code < 300: _data = typing.cast( - FileUploadResult, + DocumentRef, construct_type( - type_=FileUploadResult, # type: ignore + type_=DocumentRef, # type: ignore object_=_response.json(), ), ) @@ -933,21 +924,21 @@ def update_file( namespace: str, id: str, *, - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, - file_type: typing.Optional[FileType] = None, - mime_type: typing.Optional[str] = None, file: typing.Optional[core.File] = OMIT, supporting_context: typing.Optional[str] = OMIT, metadata: typing.Optional[str] = OMIT, group: typing.Optional[str] = OMIT, date: typing.Optional[str] = OMIT, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, + file_type: typing.Optional[FileType] = OMIT, + mime_type: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, extra_body: typing.Optional[typing.Mapping[str, typing.Any]] = None, timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, - ) -> HttpResponse[FileUploadResult]: + ) -> HttpResponse[DocumentRef]: """ Refresh only the file-backed fields you provide. Supplying a file replaces the canonical content; omitted metadata and processing context remain unchanged. @@ -959,18 +950,6 @@ def update_file( id : str The public document ID - task_type : typing.Optional[TaskType] - Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. - - dreaming : typing.Optional[DreamingMode] - Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. - - file_type : typing.Optional[FileType] - Explicit source type used when automatic inference is insufficient - - mime_type : typing.Optional[str] - Explicit MIME type used when upload metadata is insufficient - file : typing.Optional[core.File] See core.File for more documentation @@ -986,28 +965,38 @@ def update_file( date : typing.Optional[str] When the source content is from, in ISO 8601 format + task_type : typing.Optional[TaskType] + Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. + + dreaming : typing.Optional[DreamingMode] + Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. + + file_type : typing.Optional[FileType] + Explicit source type used when automatic inference is insufficient + + mime_type : typing.Optional[str] + Explicit MIME type used when upload metadata is insufficient + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - HttpResponse[FileUploadResult] + HttpResponse[DocumentRef] Update accepted for processing """ _response = self._client_wrapper.httpx_client.request( f"ns/{encode_path_param(namespace)}/document/file/{encode_path_param(id)}", method="PATCH", - params={ - "taskType": task_type, - "dreaming": dreaming, - "fileType": file_type, - "mimeType": mime_type, - }, data={ "supportingContext": supporting_context, "metadata": metadata, "group": group, "date": date, + "taskType": task_type, + "dreaming": dreaming, + "fileType": file_type, + "mimeType": mime_type, }, files={ **({"file": file} if file is not None else {}), @@ -1019,9 +1008,9 @@ def update_file( try: if 200 <= _response.status_code < 300: _data = typing.cast( - FileUploadResult, + DocumentRef, construct_type( - type_=FileUploadResult, # type: ignore + type_=DocumentRef, # type: ignore object_=_response.json(), ), ) @@ -1227,8 +1216,8 @@ async def batch_add( namespace: str, *, documents: typing.Sequence[DocumentInputParams], - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -1263,14 +1252,12 @@ async def batch_add( _response = await self._client_wrapper.httpx_client.request( f"ns/{encode_path_param(namespace)}/document/batch", method="POST", - params={ - "taskType": task_type, - "dreaming": dreaming, - }, json={ "documents": convert_and_respect_annotation_metadata( object_=documents, annotation=typing.Sequence[DocumentInputParams], direction="write" ), + "taskType": task_type, + "dreaming": dreaming, }, headers={ "content-type": "application/json", @@ -1357,7 +1344,7 @@ async def get( namespace: str, id: str, *, - attach: typing.Optional[typing.Union[DocumentAttachment, typing.Sequence[DocumentAttachment]]] = None, + include: typing.Optional[typing.Union[DocumentInclude, typing.Sequence[DocumentInclude]]] = None, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -1365,7 +1352,7 @@ async def get( timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, ) -> AsyncHttpResponse[Document]: """ - Retrieve a document's canonical content, metadata, and processing state by document ID or caller-defined ID. Optionally attach its source chunks, derived memories, or both in the same response. + Retrieve a document's canonical content, metadata, and processing state by document ID or caller-defined ID. Optionally include its source chunks, derived memories, or both in the same response. Parameters ---------- @@ -1375,8 +1362,8 @@ async def get( id : str The public document ID - attach : typing.Optional[typing.Union[DocumentAttachment, typing.Sequence[DocumentAttachment]]] - Child resources to include. Repeat the parameter to attach chunks, memories, or both. + include : typing.Optional[typing.Union[DocumentInclude, typing.Sequence[DocumentInclude]]] + Comma-separated child resources to include: chunks, memories, or both. request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1390,7 +1377,7 @@ async def get( f"ns/{encode_path_param(namespace)}/document/{encode_path_param(id)}", method="GET", params={ - "attach": attach, + "include": include, }, request_options=request_options, ) @@ -1473,13 +1460,13 @@ async def update( namespace: str, id: str, *, - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, content: typing.Optional[str] = OMIT, supporting_context: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, MetadataValueParams]] = OMIT, group: typing.Optional[typing.Dict[str, MetadataValueParams]] = OMIT, date: typing.Optional[str] = OMIT, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -1497,12 +1484,6 @@ async def update( id : str The public document ID - task_type : typing.Optional[TaskType] - Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. - - dreaming : typing.Optional[DreamingMode] - Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. - content : typing.Optional[str] The content to process. This may be plaintext or a URL to supported rich content. @@ -1518,6 +1499,12 @@ async def update( date : typing.Optional[str] When the source content is from, in ISO 8601 format + task_type : typing.Optional[TaskType] + Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. + + dreaming : typing.Optional[DreamingMode] + Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1529,10 +1516,6 @@ async def update( _response = await self._client_wrapper.httpx_client.request( f"ns/{encode_path_param(namespace)}/document/{encode_path_param(id)}", method="PATCH", - params={ - "taskType": task_type, - "dreaming": dreaming, - }, json={ "content": content, "supportingContext": supporting_context, @@ -1543,6 +1526,8 @@ async def update( object_=group, annotation=typing.Dict[str, MetadataValueParams], direction="write" ), "date": date, + "taskType": task_type, + "dreaming": dreaming, }, headers={ "content-type": "application/json", @@ -1651,20 +1636,20 @@ async def upload_file( namespace: str, *, file: core.File, - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, - file_type: typing.Optional[FileType] = None, - mime_type: typing.Optional[str] = None, supporting_context: typing.Optional[str] = OMIT, metadata: typing.Optional[str] = OMIT, group: typing.Optional[str] = OMIT, date: typing.Optional[str] = OMIT, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, + file_type: typing.Optional[FileType] = OMIT, + mime_type: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, extra_body: typing.Optional[typing.Mapping[str, typing.Any]] = None, timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, - ) -> AsyncHttpResponse[FileUploadResult]: + ) -> AsyncHttpResponse[DocumentRef]: """ Transform an uploaded file into searchable knowledge and learned memory. The response returns as soon as ingestion is safely queued while extraction and memory formation continue asynchronously. @@ -1676,18 +1661,6 @@ async def upload_file( file : core.File See core.File for more documentation - task_type : typing.Optional[TaskType] - Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. - - dreaming : typing.Optional[DreamingMode] - Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. - - file_type : typing.Optional[FileType] - Explicit source type used when automatic inference is insufficient - - mime_type : typing.Optional[str] - Explicit MIME type used when upload metadata is insufficient - supporting_context : typing.Optional[str] Context used to guide memory extraction within this namespace. Max 1500 characters. @@ -1700,28 +1673,38 @@ async def upload_file( date : typing.Optional[str] When the source content is from, in ISO 8601 format + task_type : typing.Optional[TaskType] + Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. + + dreaming : typing.Optional[DreamingMode] + Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. + + file_type : typing.Optional[FileType] + Explicit source type used when automatic inference is insufficient + + mime_type : typing.Optional[str] + Explicit MIME type used when upload metadata is insufficient + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[FileUploadResult] + AsyncHttpResponse[DocumentRef] File accepted for processing """ _response = await self._client_wrapper.httpx_client.request( f"ns/{encode_path_param(namespace)}/document/file", method="POST", - params={ - "taskType": task_type, - "dreaming": dreaming, - "fileType": file_type, - "mimeType": mime_type, - }, data={ "supportingContext": supporting_context, "metadata": metadata, "group": group, "date": date, + "taskType": task_type, + "dreaming": dreaming, + "fileType": file_type, + "mimeType": mime_type, }, files={ "file": file, @@ -1733,9 +1716,9 @@ async def upload_file( try: if 200 <= _response.status_code < 300: _data = typing.cast( - FileUploadResult, + DocumentRef, construct_type( - type_=FileUploadResult, # type: ignore + type_=DocumentRef, # type: ignore object_=_response.json(), ), ) @@ -1821,20 +1804,20 @@ async def replace_with_file( id: str, *, file: core.File, - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, - file_type: typing.Optional[FileType] = None, - mime_type: typing.Optional[str] = None, supporting_context: typing.Optional[str] = OMIT, metadata: typing.Optional[str] = OMIT, group: typing.Optional[str] = OMIT, date: typing.Optional[str] = OMIT, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, + file_type: typing.Optional[FileType] = OMIT, + mime_type: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, extra_body: typing.Optional[typing.Mapping[str, typing.Any]] = None, timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, - ) -> AsyncHttpResponse[FileUploadResult]: + ) -> AsyncHttpResponse[DocumentRef]: """ Replace an existing document with a new file while keeping its stable document ID. Content and caller metadata are overwritten, then the document is reprocessed asynchronously. @@ -1849,18 +1832,6 @@ async def replace_with_file( file : core.File See core.File for more documentation - task_type : typing.Optional[TaskType] - Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. - - dreaming : typing.Optional[DreamingMode] - Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. - - file_type : typing.Optional[FileType] - Explicit source type used when automatic inference is insufficient - - mime_type : typing.Optional[str] - Explicit MIME type used when upload metadata is insufficient - supporting_context : typing.Optional[str] Context used to guide memory extraction within this namespace. Max 1500 characters. @@ -1873,28 +1844,38 @@ async def replace_with_file( date : typing.Optional[str] When the source content is from, in ISO 8601 format + task_type : typing.Optional[TaskType] + Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. + + dreaming : typing.Optional[DreamingMode] + Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. + + file_type : typing.Optional[FileType] + Explicit source type used when automatic inference is insufficient + + mime_type : typing.Optional[str] + Explicit MIME type used when upload metadata is insufficient + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[FileUploadResult] + AsyncHttpResponse[DocumentRef] Replacement accepted for processing """ _response = await self._client_wrapper.httpx_client.request( f"ns/{encode_path_param(namespace)}/document/file/{encode_path_param(id)}", method="POST", - params={ - "taskType": task_type, - "dreaming": dreaming, - "fileType": file_type, - "mimeType": mime_type, - }, data={ "supportingContext": supporting_context, "metadata": metadata, "group": group, "date": date, + "taskType": task_type, + "dreaming": dreaming, + "fileType": file_type, + "mimeType": mime_type, }, files={ "file": file, @@ -1906,9 +1887,9 @@ async def replace_with_file( try: if 200 <= _response.status_code < 300: _data = typing.cast( - FileUploadResult, + DocumentRef, construct_type( - type_=FileUploadResult, # type: ignore + type_=DocumentRef, # type: ignore object_=_response.json(), ), ) @@ -2004,21 +1985,21 @@ async def update_file( namespace: str, id: str, *, - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, - file_type: typing.Optional[FileType] = None, - mime_type: typing.Optional[str] = None, file: typing.Optional[core.File] = OMIT, supporting_context: typing.Optional[str] = OMIT, metadata: typing.Optional[str] = OMIT, group: typing.Optional[str] = OMIT, date: typing.Optional[str] = OMIT, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, + file_type: typing.Optional[FileType] = OMIT, + mime_type: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, extra_body: typing.Optional[typing.Mapping[str, typing.Any]] = None, timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, - ) -> AsyncHttpResponse[FileUploadResult]: + ) -> AsyncHttpResponse[DocumentRef]: """ Refresh only the file-backed fields you provide. Supplying a file replaces the canonical content; omitted metadata and processing context remain unchanged. @@ -2030,18 +2011,6 @@ async def update_file( id : str The public document ID - task_type : typing.Optional[TaskType] - Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. - - dreaming : typing.Optional[DreamingMode] - Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. - - file_type : typing.Optional[FileType] - Explicit source type used when automatic inference is insufficient - - mime_type : typing.Optional[str] - Explicit MIME type used when upload metadata is insufficient - file : typing.Optional[core.File] See core.File for more documentation @@ -2057,28 +2026,38 @@ async def update_file( date : typing.Optional[str] When the source content is from, in ISO 8601 format + task_type : typing.Optional[TaskType] + Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. + + dreaming : typing.Optional[DreamingMode] + Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. + + file_type : typing.Optional[FileType] + Explicit source type used when automatic inference is insufficient + + mime_type : typing.Optional[str] + Explicit MIME type used when upload metadata is insufficient + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[FileUploadResult] + AsyncHttpResponse[DocumentRef] Update accepted for processing """ _response = await self._client_wrapper.httpx_client.request( f"ns/{encode_path_param(namespace)}/document/file/{encode_path_param(id)}", method="PATCH", - params={ - "taskType": task_type, - "dreaming": dreaming, - "fileType": file_type, - "mimeType": mime_type, - }, data={ "supportingContext": supporting_context, "metadata": metadata, "group": group, "date": date, + "taskType": task_type, + "dreaming": dreaming, + "fileType": file_type, + "mimeType": mime_type, }, files={ **({"file": file} if file is not None else {}), @@ -2090,9 +2069,9 @@ async def update_file( try: if 200 <= _response.status_code < 300: _data = typing.cast( - FileUploadResult, + DocumentRef, construct_type( - type_=FileUploadResult, # type: ignore + type_=DocumentRef, # type: ignore object_=_response.json(), ), ) diff --git a/src/supermemory/memories/client.py b/src/supermemory/memories/client.py index 875f453..c3eb759 100644 --- a/src/supermemory/memories/client.py +++ b/src/supermemory/memories/client.py @@ -9,6 +9,8 @@ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from ..core.request_options import RequestOptions from ..types.forget_result import ForgetResult +from ..types.memory_details import MemoryDetails +from ..types.memory_include import MemoryInclude from .raw_client import AsyncRawMemoriesClient, RawMemoriesClient # this is used as the default value for optional parameters @@ -127,6 +129,61 @@ def forget_matching( ) return _response.data + def get( + self, + namespace: str, + id: str, + *, + include: typing.Optional[typing.Union[MemoryInclude, typing.Sequence[MemoryInclude]]] = None, + related_limit: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + extra_headers: typing.Optional[typing.Mapping[str, str]] = None, + extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, + extra_body: typing.Optional[typing.Mapping[str, typing.Any]] = None, + timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, + ) -> MemoryDetails: + """ + 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. + + Parameters + ---------- + namespace : str + 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. + + id : str + Memory identifier + + include : typing.Optional[typing.Union[MemoryInclude, typing.Sequence[MemoryInclude]]] + Comma-separated extras. related: the memory's version history and connected memories. documents: the source document, also attached to each related memory when both are requested. + + related_limit : typing.Optional[int] + 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. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MemoryDetails + Memory retrieved + + Examples + -------- + from supermemory import Supermemory + + client = Supermemory( + api_key="YOUR_API_KEY", + ) + client.memories.get( + namespace="user_alex", + id="mem_abc123", + ) + """ + _response = self._raw_client.get( + namespace, id, include=include, related_limit=related_limit, request_options=request_options + ) + return _response.data + class AsyncMemoriesClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): @@ -255,3 +312,66 @@ async def main() -> None: namespace, query=query, dry_run=dry_run, request_options=request_options ) return _response.data + + async def get( + self, + namespace: str, + id: str, + *, + include: typing.Optional[typing.Union[MemoryInclude, typing.Sequence[MemoryInclude]]] = None, + related_limit: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + extra_headers: typing.Optional[typing.Mapping[str, str]] = None, + extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, + extra_body: typing.Optional[typing.Mapping[str, typing.Any]] = None, + timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, + ) -> MemoryDetails: + """ + 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. + + Parameters + ---------- + namespace : str + 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. + + id : str + Memory identifier + + include : typing.Optional[typing.Union[MemoryInclude, typing.Sequence[MemoryInclude]]] + Comma-separated extras. related: the memory's version history and connected memories. documents: the source document, also attached to each related memory when both are requested. + + related_limit : typing.Optional[int] + 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. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MemoryDetails + Memory retrieved + + Examples + -------- + import asyncio + + from supermemory import AsyncSupermemory + + client = AsyncSupermemory( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.memories.get( + namespace="user_alex", + id="mem_abc123", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get( + namespace, id, include=include, related_limit=related_limit, request_options=request_options + ) + return _response.data diff --git a/src/supermemory/memories/raw_client.py b/src/supermemory/memories/raw_client.py index 7c8fa3a..f0c33db 100644 --- a/src/supermemory/memories/raw_client.py +++ b/src/supermemory/memories/raw_client.py @@ -17,10 +17,13 @@ from ..errors.bad_request_error import BadRequestError from ..errors.forbidden_error import ForbiddenError from ..errors.internal_server_error import InternalServerError +from ..errors.not_found_error import NotFoundError from ..errors.unauthorized_error import UnauthorizedError from ..types.bad_request_error_body import BadRequestErrorBody from ..types.error_response import ErrorResponse from ..types.forget_result import ForgetResult +from ..types.memory_details import MemoryDetails +from ..types.memory_include import MemoryInclude from pydantic import ValidationError # this is used as the default value for optional parameters @@ -246,6 +249,127 @@ def forget_matching( ) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + def get( + self, + namespace: str, + id: str, + *, + include: typing.Optional[typing.Union[MemoryInclude, typing.Sequence[MemoryInclude]]] = None, + related_limit: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + extra_headers: typing.Optional[typing.Mapping[str, str]] = None, + extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, + extra_body: typing.Optional[typing.Mapping[str, typing.Any]] = None, + timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, + ) -> HttpResponse[MemoryDetails]: + """ + 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. + + Parameters + ---------- + namespace : str + 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. + + id : str + Memory identifier + + include : typing.Optional[typing.Union[MemoryInclude, typing.Sequence[MemoryInclude]]] + Comma-separated extras. related: the memory's version history and connected memories. documents: the source document, also attached to each related memory when both are requested. + + related_limit : typing.Optional[int] + 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. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MemoryDetails] + Memory retrieved + """ + _response = self._client_wrapper.httpx_client.request( + f"ns/{encode_path_param(namespace)}/memories/{encode_path_param(id)}", + method="GET", + params={ + "include": include, + "relatedLimit": related_limit, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MemoryDetails, + construct_type( + type_=MemoryDetails, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + BadRequestErrorBody, + construct_type( + type_=BadRequestErrorBody, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + ErrorResponse, + construct_type( + type_=ErrorResponse, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + ErrorResponse, + construct_type( + type_=ErrorResponse, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + ErrorResponse, + construct_type( + type_=ErrorResponse, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 500: + raise InternalServerError( + headers=dict(_response.headers), + body=typing.cast( + ErrorResponse, + construct_type( + type_=ErrorResponse, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + class AsyncRawMemoriesClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): @@ -465,3 +589,124 @@ async def forget_matching( status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e ) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, + namespace: str, + id: str, + *, + include: typing.Optional[typing.Union[MemoryInclude, typing.Sequence[MemoryInclude]]] = None, + related_limit: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + extra_headers: typing.Optional[typing.Mapping[str, str]] = None, + extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, + extra_body: typing.Optional[typing.Mapping[str, typing.Any]] = None, + timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, + ) -> AsyncHttpResponse[MemoryDetails]: + """ + 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. + + Parameters + ---------- + namespace : str + 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. + + id : str + Memory identifier + + include : typing.Optional[typing.Union[MemoryInclude, typing.Sequence[MemoryInclude]]] + Comma-separated extras. related: the memory's version history and connected memories. documents: the source document, also attached to each related memory when both are requested. + + related_limit : typing.Optional[int] + 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. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MemoryDetails] + Memory retrieved + """ + _response = await self._client_wrapper.httpx_client.request( + f"ns/{encode_path_param(namespace)}/memories/{encode_path_param(id)}", + method="GET", + params={ + "include": include, + "relatedLimit": related_limit, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MemoryDetails, + construct_type( + type_=MemoryDetails, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + BadRequestErrorBody, + construct_type( + type_=BadRequestErrorBody, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + ErrorResponse, + construct_type( + type_=ErrorResponse, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + ErrorResponse, + construct_type( + type_=ErrorResponse, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + ErrorResponse, + construct_type( + type_=ErrorResponse, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 500: + raise InternalServerError( + headers=dict(_response.headers), + body=typing.cast( + ErrorResponse, + construct_type( + type_=ErrorResponse, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/supermemory/namespaces/client.py b/src/supermemory/namespaces/client.py index 070bd37..5f26551 100644 --- a/src/supermemory/namespaces/client.py +++ b/src/supermemory/namespaces/client.py @@ -8,9 +8,9 @@ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from ..core.request_options import RequestOptions -from ..types.namespace import Namespace from ..types.namespace_deleted import NamespaceDeleted from ..types.namespace_details import NamespaceDetails +from ..types.namespace_list import NamespaceList from .raw_client import AsyncRawNamespacesClient, RawNamespacesClient # this is used as the default value for optional parameters @@ -35,23 +35,31 @@ def with_raw_response(self) -> RawNamespacesClient: def list( self, *, + page: typing.Optional[int] = None, + limit: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, extra_body: typing.Optional[typing.Mapping[str, typing.Any]] = None, timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, - ) -> typing.List[Namespace]: + ) -> NamespaceList: """ Discover every namespace available to the caller, including its purpose, document volume, memory count, and lifecycle timestamps. Parameters ---------- + page : typing.Optional[int] + One-based page number + + limit : typing.Optional[int] + Maximum namespaces to return per page + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - typing.List[Namespace] + NamespaceList Namespaces available to the caller Examples @@ -63,7 +71,7 @@ def list( ) client.namespaces.list() """ - _response = self._raw_client.list(request_options=request_options) + _response = self._raw_client.list(page=page, limit=limit, request_options=request_options) return _response.data def get( @@ -110,7 +118,7 @@ def delete( self, namespace: str, *, - move_to: typing.Optional[str] = OMIT, + move_to: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -145,6 +153,7 @@ def delete( ) client.namespaces.delete( namespace="user_alex", + move_to="project_archive", ) """ _response = self._raw_client.delete(namespace, move_to=move_to, request_options=request_options) @@ -215,23 +224,31 @@ def with_raw_response(self) -> AsyncRawNamespacesClient: async def list( self, *, + page: typing.Optional[int] = None, + limit: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, extra_body: typing.Optional[typing.Mapping[str, typing.Any]] = None, timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, - ) -> typing.List[Namespace]: + ) -> NamespaceList: """ Discover every namespace available to the caller, including its purpose, document volume, memory count, and lifecycle timestamps. Parameters ---------- + page : typing.Optional[int] + One-based page number + + limit : typing.Optional[int] + Maximum namespaces to return per page + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - typing.List[Namespace] + NamespaceList Namespaces available to the caller Examples @@ -251,7 +268,7 @@ async def main() -> None: asyncio.run(main()) """ - _response = await self._raw_client.list(request_options=request_options) + _response = await self._raw_client.list(page=page, limit=limit, request_options=request_options) return _response.data async def get( @@ -306,7 +323,7 @@ async def delete( self, namespace: str, *, - move_to: typing.Optional[str] = OMIT, + move_to: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -346,6 +363,7 @@ async def delete( async def main() -> None: await client.namespaces.delete( namespace="user_alex", + move_to="project_archive", ) diff --git a/src/supermemory/namespaces/raw_client.py b/src/supermemory/namespaces/raw_client.py index 5d90c23..ca322fb 100644 --- a/src/supermemory/namespaces/raw_client.py +++ b/src/supermemory/namespaces/raw_client.py @@ -22,9 +22,9 @@ from ..errors.unauthorized_error import UnauthorizedError from ..types.bad_request_error_body import BadRequestErrorBody from ..types.error_response import ErrorResponse -from ..types.namespace import Namespace from ..types.namespace_deleted import NamespaceDeleted from ..types.namespace_details import NamespaceDetails +from ..types.namespace_list import NamespaceList from pydantic import ValidationError # this is used as the default value for optional parameters @@ -38,40 +38,63 @@ def __init__(self, *, client_wrapper: SyncClientWrapper): def list( self, *, + page: typing.Optional[int] = None, + limit: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, extra_body: typing.Optional[typing.Mapping[str, typing.Any]] = None, timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, - ) -> HttpResponse[typing.List[Namespace]]: + ) -> HttpResponse[NamespaceList]: """ Discover every namespace available to the caller, including its purpose, document volume, memory count, and lifecycle timestamps. Parameters ---------- + page : typing.Optional[int] + One-based page number + + limit : typing.Optional[int] + Maximum namespaces to return per page + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - HttpResponse[typing.List[Namespace]] + HttpResponse[NamespaceList] Namespaces available to the caller """ _response = self._client_wrapper.httpx_client.request( "ns", method="GET", + params={ + "page": page, + "limit": limit, + }, request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - typing.List[Namespace], + NamespaceList, construct_type( - type_=typing.List[Namespace], # type: ignore + type_=NamespaceList, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + BadRequestErrorBody, + construct_type( + type_=BadRequestErrorBody, # type: ignore + object_=_response.json(), + ), + ), + ) if _response.status_code == 401: raise UnauthorizedError( headers=dict(_response.headers), @@ -223,7 +246,7 @@ def delete( self, namespace: str, *, - move_to: typing.Optional[str] = OMIT, + move_to: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -252,14 +275,10 @@ def delete( _response = self._client_wrapper.httpx_client.request( f"ns/{encode_path_param(namespace)}", method="DELETE", - json={ + params={ "moveTo": move_to, }, - headers={ - "content-type": "application/json", - }, request_options=request_options, - omit=OMIT, ) try: if 200 <= _response.status_code < 300: @@ -470,40 +489,63 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper): async def list( self, *, + page: typing.Optional[int] = None, + limit: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, extra_body: typing.Optional[typing.Mapping[str, typing.Any]] = None, timeout: typing.Union[float, httpx.Timeout, None, NotGiven] = NOT_GIVEN, - ) -> AsyncHttpResponse[typing.List[Namespace]]: + ) -> AsyncHttpResponse[NamespaceList]: """ Discover every namespace available to the caller, including its purpose, document volume, memory count, and lifecycle timestamps. Parameters ---------- + page : typing.Optional[int] + One-based page number + + limit : typing.Optional[int] + Maximum namespaces to return per page + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[typing.List[Namespace]] + AsyncHttpResponse[NamespaceList] Namespaces available to the caller """ _response = await self._client_wrapper.httpx_client.request( "ns", method="GET", + params={ + "page": page, + "limit": limit, + }, request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - typing.List[Namespace], + NamespaceList, construct_type( - type_=typing.List[Namespace], # type: ignore + type_=NamespaceList, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + BadRequestErrorBody, + construct_type( + type_=BadRequestErrorBody, # type: ignore + object_=_response.json(), + ), + ), + ) if _response.status_code == 401: raise UnauthorizedError( headers=dict(_response.headers), @@ -655,7 +697,7 @@ async def delete( self, namespace: str, *, - move_to: typing.Optional[str] = OMIT, + move_to: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -684,14 +726,10 @@ async def delete( _response = await self._client_wrapper.httpx_client.request( f"ns/{encode_path_param(namespace)}", method="DELETE", - json={ + params={ "moveTo": move_to, }, - headers={ - "content-type": "application/json", - }, request_options=request_options, - omit=OMIT, ) try: if 200 <= _response.status_code < 300: diff --git a/src/supermemory/raw_client.py b/src/supermemory/raw_client.py index 6629d2e..09cca69 100644 --- a/src/supermemory/raw_client.py +++ b/src/supermemory/raw_client.py @@ -22,10 +22,9 @@ from .errors.payment_required_error import PaymentRequiredError from .errors.unauthorized_error import UnauthorizedError from .requests.filter_expression import FilterExpressionParams -from .requests.list_request_limit import ListRequestLimitParams -from .requests.list_request_page import ListRequestPageParams +from .requests.list_request_include import ListRequestIncludeParams from .requests.metadata_value import MetadataValueParams -from .requests.search_request_attach import SearchRequestAttachParams +from .requests.search_include import SearchIncludeParams from .types.bad_request_error_body import BadRequestErrorBody from .types.document_ref import DocumentRef from .types.dreaming_mode import DreamingMode @@ -54,13 +53,13 @@ def add( namespace: str, *, content: str, - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, id: typing.Optional[str] = OMIT, supporting_context: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, MetadataValueParams]] = OMIT, group: typing.Optional[typing.Dict[str, MetadataValueParams]] = OMIT, date: typing.Optional[str] = OMIT, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -78,12 +77,6 @@ def add( content : str The content to process. This may be plaintext or a URL to supported rich content. - task_type : typing.Optional[TaskType] - Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. - - dreaming : typing.Optional[DreamingMode] - Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. - id : typing.Optional[str] An optional caller-defined document ID @@ -99,6 +92,12 @@ def add( date : typing.Optional[str] When the source content is from, in ISO 8601 format + task_type : typing.Optional[TaskType] + Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. + + dreaming : typing.Optional[DreamingMode] + Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -110,10 +109,6 @@ def add( _response = self._client_wrapper.httpx_client.request( f"ns/{encode_path_param(namespace)}/document", method="POST", - params={ - "taskType": task_type, - "dreaming": dreaming, - }, json={ "content": content, "id": id, @@ -125,6 +120,8 @@ def add( object_=group, annotation=typing.Dict[str, MetadataValueParams], direction="write" ), "date": date, + "taskType": task_type, + "dreaming": dreaming, }, headers={ "content-type": "application/json", @@ -222,10 +219,10 @@ def search( namespace: str, *, query: str, - limit: typing.Optional[int] = None, - search_mode: typing.Optional[SearchMode] = None, filter: typing.Optional[FilterExpressionParams] = OMIT, - attach: typing.Optional[SearchRequestAttachParams] = OMIT, + search_mode: typing.Optional[SearchMode] = OMIT, + limit: typing.Optional[int] = OMIT, + include: typing.Optional[SearchIncludeParams] = OMIT, threshold: typing.Optional[float] = OMIT, rerank: typing.Optional[SearchRequestRerank] = OMIT, rewrite_query: typing.Optional[bool] = OMIT, @@ -246,16 +243,16 @@ def search( query : str Natural-language question, topic, or phrase to retrieve relevant context for. Replaces the v4 `q` field. - limit : typing.Optional[int] - Maximum number of results to return + filter : typing.Optional[FilterExpressionParams] + Type-safe metadata conditions applied before ranking results. Replaces the v4 `filters` field and unifies both legacy filter formats into one expression type. search_mode : typing.Optional[SearchMode] Search surface. "hybrid" combines learned memories with source chunks, "memories" returns learned context, and "chunks" returns source passages. - filter : typing.Optional[FilterExpressionParams] - Type-safe metadata conditions applied before ranking results. Replaces the v4 `filters` field and unifies both legacy filter formats into one expression type. + limit : typing.Optional[int] + Maximum number of results to return - attach : typing.Optional[SearchRequestAttachParams] + include : typing.Optional[SearchIncludeParams] Optional context to include alongside each matching result threshold : typing.Optional[float] @@ -278,17 +275,15 @@ def search( _response = self._client_wrapper.httpx_client.request( f"ns/{encode_path_param(namespace)}/search", method="POST", - params={ - "limit": limit, - "searchMode": search_mode, - }, json={ "query": query, "filter": convert_and_respect_annotation_metadata( object_=filter, annotation=FilterExpressionParams, direction="write" ), - "attach": convert_and_respect_annotation_metadata( - object_=attach, annotation=SearchRequestAttachParams, direction="write" + "searchMode": search_mode, + "limit": limit, + "include": convert_and_respect_annotation_metadata( + object_=include, annotation=SearchIncludeParams, direction="write" ), "threshold": threshold, "rerank": rerank, @@ -491,11 +486,12 @@ def list( namespace: str, type: ListType, *, - page: typing.Optional[ListRequestPageParams] = None, - limit: typing.Optional[ListRequestLimitParams] = None, + page: typing.Optional[int] = None, + limit: typing.Optional[int] = None, sort: typing.Optional[ListSort] = None, order: typing.Optional[SortOrder] = None, filter: typing.Optional[FilterExpressionParams] = OMIT, + include: typing.Optional[ListRequestIncludeParams] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -513,10 +509,10 @@ def list( type : ListType Resource collection to list: source documents, extracted chunks, or learned memories - page : typing.Optional[ListRequestPageParams] + page : typing.Optional[int] One-based page number - limit : typing.Optional[ListRequestLimitParams] + limit : typing.Optional[int] Maximum resources to return per page sort : typing.Optional[ListSort] @@ -528,6 +524,9 @@ def list( filter : typing.Optional[FilterExpressionParams] Type-safe metadata conditions applied before pagination + include : typing.Optional[ListRequestIncludeParams] + Optional extras, matching search's include + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -540,12 +539,8 @@ def list( f"ns/{encode_path_param(namespace)}/list/{encode_path_param(type)}", method="POST", params={ - "page": convert_and_respect_annotation_metadata( - object_=page, annotation=ListRequestPageParams, direction="write" - ), - "limit": convert_and_respect_annotation_metadata( - object_=limit, annotation=ListRequestLimitParams, direction="write" - ), + "page": page, + "limit": limit, "sort": sort, "order": order, }, @@ -553,6 +548,9 @@ def list( "filter": convert_and_respect_annotation_metadata( object_=filter, annotation=FilterExpressionParams, direction="write" ), + "include": convert_and_respect_annotation_metadata( + object_=include, annotation=ListRequestIncludeParams, direction="write" + ), }, headers={ "content-type": "application/json", @@ -633,13 +631,13 @@ async def add( namespace: str, *, content: str, - task_type: typing.Optional[TaskType] = None, - dreaming: typing.Optional[DreamingMode] = None, id: typing.Optional[str] = OMIT, supporting_context: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, MetadataValueParams]] = OMIT, group: typing.Optional[typing.Dict[str, MetadataValueParams]] = OMIT, date: typing.Optional[str] = OMIT, + task_type: typing.Optional[TaskType] = OMIT, + dreaming: typing.Optional[DreamingMode] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -657,12 +655,6 @@ async def add( content : str The content to process. This may be plaintext or a URL to supported rich content. - task_type : typing.Optional[TaskType] - Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. - - dreaming : typing.Optional[DreamingMode] - Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. - id : typing.Optional[str] An optional caller-defined document ID @@ -678,6 +670,12 @@ async def add( date : typing.Optional[str] When the source content is from, in ISO 8601 format + task_type : typing.Optional[TaskType] + Processing pipeline. "memory" builds durable learned context; "superrag" optimizes the document for retrieval without generating memories. + + dreaming : typing.Optional[DreamingMode] + Processing mode. "dynamic" (default) groups related documents so memories form from coherent context. "instant" processes each document independently right away and bills one extra operation per document. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -689,10 +687,6 @@ async def add( _response = await self._client_wrapper.httpx_client.request( f"ns/{encode_path_param(namespace)}/document", method="POST", - params={ - "taskType": task_type, - "dreaming": dreaming, - }, json={ "content": content, "id": id, @@ -704,6 +698,8 @@ async def add( object_=group, annotation=typing.Dict[str, MetadataValueParams], direction="write" ), "date": date, + "taskType": task_type, + "dreaming": dreaming, }, headers={ "content-type": "application/json", @@ -801,10 +797,10 @@ async def search( namespace: str, *, query: str, - limit: typing.Optional[int] = None, - search_mode: typing.Optional[SearchMode] = None, filter: typing.Optional[FilterExpressionParams] = OMIT, - attach: typing.Optional[SearchRequestAttachParams] = OMIT, + search_mode: typing.Optional[SearchMode] = OMIT, + limit: typing.Optional[int] = OMIT, + include: typing.Optional[SearchIncludeParams] = OMIT, threshold: typing.Optional[float] = OMIT, rerank: typing.Optional[SearchRequestRerank] = OMIT, rewrite_query: typing.Optional[bool] = OMIT, @@ -825,16 +821,16 @@ async def search( query : str Natural-language question, topic, or phrase to retrieve relevant context for. Replaces the v4 `q` field. - limit : typing.Optional[int] - Maximum number of results to return + filter : typing.Optional[FilterExpressionParams] + Type-safe metadata conditions applied before ranking results. Replaces the v4 `filters` field and unifies both legacy filter formats into one expression type. search_mode : typing.Optional[SearchMode] Search surface. "hybrid" combines learned memories with source chunks, "memories" returns learned context, and "chunks" returns source passages. - filter : typing.Optional[FilterExpressionParams] - Type-safe metadata conditions applied before ranking results. Replaces the v4 `filters` field and unifies both legacy filter formats into one expression type. + limit : typing.Optional[int] + Maximum number of results to return - attach : typing.Optional[SearchRequestAttachParams] + include : typing.Optional[SearchIncludeParams] Optional context to include alongside each matching result threshold : typing.Optional[float] @@ -857,17 +853,15 @@ async def search( _response = await self._client_wrapper.httpx_client.request( f"ns/{encode_path_param(namespace)}/search", method="POST", - params={ - "limit": limit, - "searchMode": search_mode, - }, json={ "query": query, "filter": convert_and_respect_annotation_metadata( object_=filter, annotation=FilterExpressionParams, direction="write" ), - "attach": convert_and_respect_annotation_metadata( - object_=attach, annotation=SearchRequestAttachParams, direction="write" + "searchMode": search_mode, + "limit": limit, + "include": convert_and_respect_annotation_metadata( + object_=include, annotation=SearchIncludeParams, direction="write" ), "threshold": threshold, "rerank": rerank, @@ -1070,11 +1064,12 @@ async def list( namespace: str, type: ListType, *, - page: typing.Optional[ListRequestPageParams] = None, - limit: typing.Optional[ListRequestLimitParams] = None, + page: typing.Optional[int] = None, + limit: typing.Optional[int] = None, sort: typing.Optional[ListSort] = None, order: typing.Optional[SortOrder] = None, filter: typing.Optional[FilterExpressionParams] = OMIT, + include: typing.Optional[ListRequestIncludeParams] = OMIT, request_options: typing.Optional[RequestOptions] = None, extra_headers: typing.Optional[typing.Mapping[str, str]] = None, extra_query: typing.Optional[typing.Mapping[str, typing.Any]] = None, @@ -1092,10 +1087,10 @@ async def list( type : ListType Resource collection to list: source documents, extracted chunks, or learned memories - page : typing.Optional[ListRequestPageParams] + page : typing.Optional[int] One-based page number - limit : typing.Optional[ListRequestLimitParams] + limit : typing.Optional[int] Maximum resources to return per page sort : typing.Optional[ListSort] @@ -1107,6 +1102,9 @@ async def list( filter : typing.Optional[FilterExpressionParams] Type-safe metadata conditions applied before pagination + include : typing.Optional[ListRequestIncludeParams] + Optional extras, matching search's include + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1119,12 +1117,8 @@ async def list( f"ns/{encode_path_param(namespace)}/list/{encode_path_param(type)}", method="POST", params={ - "page": convert_and_respect_annotation_metadata( - object_=page, annotation=ListRequestPageParams, direction="write" - ), - "limit": convert_and_respect_annotation_metadata( - object_=limit, annotation=ListRequestLimitParams, direction="write" - ), + "page": page, + "limit": limit, "sort": sort, "order": order, }, @@ -1132,6 +1126,9 @@ async def list( "filter": convert_and_respect_annotation_metadata( object_=filter, annotation=FilterExpressionParams, direction="write" ), + "include": convert_and_respect_annotation_metadata( + object_=include, annotation=ListRequestIncludeParams, direction="write" + ), }, headers={ "content-type": "application/json", diff --git a/src/supermemory/requests/__init__.py b/src/supermemory/requests/__init__.py index b52199f..f994ada 100644 --- a/src/supermemory/requests/__init__.py +++ b/src/supermemory/requests/__init__.py @@ -16,9 +16,10 @@ from .connector_capabilities import ConnectorCapabilitiesParams from .connector_config_value import ConnectorConfigValueParams from .connector_deleted import ConnectorDeletedParams - from .connector_last_sync import ConnectorLastSyncParams + from .connector_link import ConnectorLinkParams from .connector_list import ConnectorListParams - from .connector_picker import ConnectorPickerParams + from .connector_run import ConnectorRunParams + from .connector_run_system import ConnectorRunSystemParams from .connector_selection import ConnectorSelectionParams from .connector_selection_item import ConnectorSelectionItemParams from .connector_setup import ( @@ -44,15 +45,17 @@ from .connector_sync import ConnectorSyncParams from .connector_sync_failure import ConnectorSyncFailureParams from .connector_sync_started import ConnectorSyncStartedParams + from .connector_sync_system import ConnectorSyncSystemParams + from .connector_system import ConnectorSystemParams from .delete_document_error import DeleteDocumentErrorParams from .delete_documents_result import DeleteDocumentsResultParams from .document import DocumentParams from .document_input import DocumentInputParams from .document_list_item import DocumentListItemParams + from .document_list_item_system import DocumentListItemSystemParams from .document_ref import DocumentRefParams from .document_system import DocumentSystemParams from .error_response import ErrorResponseParams - from .file_upload_result import FileUploadResultParams from .filter_and import FilterAndParams from .filter_array_contains import FilterArrayContainsParams from .filter_expression import FilterExpressionParams @@ -68,10 +71,32 @@ from .forget_result import ForgetResultParams from .google_drive_config import GoogleDriveConfigParams from .granola_config import GranolaConfigParams - from .list_request_limit import ListRequestLimitParams - from .list_request_page import ListRequestPageParams + from .list_request_include import ListRequestIncludeParams from .list_response import ListResponseParams from .memory import MemoryParams + from .memory_details import MemoryDetailsParams + from .memory_included import MemoryIncludedParams + from .memory_included_document import MemoryIncludedDocumentParams + from .memory_included_document_system import MemoryIncludedDocumentSystemParams + from .memory_included_related import MemoryIncludedRelatedParams + from .memory_included_related_children_item import MemoryIncludedRelatedChildrenItemParams + from .memory_included_related_children_item_document import MemoryIncludedRelatedChildrenItemDocumentParams + from .memory_included_related_children_item_document_system import ( + MemoryIncludedRelatedChildrenItemDocumentSystemParams, + ) + from .memory_included_related_children_item_system import MemoryIncludedRelatedChildrenItemSystemParams + from .memory_included_related_parents_item import MemoryIncludedRelatedParentsItemParams + from .memory_included_related_parents_item_document import MemoryIncludedRelatedParentsItemDocumentParams + from .memory_included_related_parents_item_document_system import ( + MemoryIncludedRelatedParentsItemDocumentSystemParams, + ) + from .memory_included_related_parents_item_system import MemoryIncludedRelatedParentsItemSystemParams + from .memory_included_related_siblings_item import MemoryIncludedRelatedSiblingsItemParams + from .memory_included_related_siblings_item_document import MemoryIncludedRelatedSiblingsItemDocumentParams + from .memory_included_related_siblings_item_document_system import ( + MemoryIncludedRelatedSiblingsItemDocumentSystemParams, + ) + from .memory_included_related_siblings_item_system import MemoryIncludedRelatedSiblingsItemSystemParams from .memory_system import MemorySystemParams from .metadata_value import MetadataValueParams from .namespace import NamespaceParams @@ -79,6 +104,7 @@ from .namespace_deleted_deleted import NamespaceDeletedDeletedParams from .namespace_deleted_queued import NamespaceDeletedQueuedParams from .namespace_details import NamespaceDetailsParams + from .namespace_list import NamespaceListParams from .namespace_system import NamespaceSystemParams from .organization import OrganizationParams from .pagination import PaginationParams @@ -90,11 +116,12 @@ from .related_memory import RelatedMemoryParams from .related_memory_system import RelatedMemorySystemParams from .s3config import S3ConfigParams - from .search_request_attach import SearchRequestAttachParams + from .search_include import SearchIncludeParams from .search_response import SearchResponseParams from .search_result import SearchResultParams from .search_result_included import SearchResultIncludedParams from .search_result_included_document import SearchResultIncludedDocumentParams + from .search_result_included_document_system import SearchResultIncludedDocumentSystemParams from .search_result_system import SearchResultSystemParams from .validation_error_response import ValidationErrorResponseParams from .validation_error_response_error_item import ValidationErrorResponseErrorItemParams @@ -110,10 +137,11 @@ "ConnectorCapabilitiesParams": ".connector_capabilities", "ConnectorConfigValueParams": ".connector_config_value", "ConnectorDeletedParams": ".connector_deleted", - "ConnectorLastSyncParams": ".connector_last_sync", + "ConnectorLinkParams": ".connector_link", "ConnectorListParams": ".connector_list", "ConnectorParams": ".connector", - "ConnectorPickerParams": ".connector_picker", + "ConnectorRunParams": ".connector_run", + "ConnectorRunSystemParams": ".connector_run_system", "ConnectorSelectionItemParams": ".connector_selection_item", "ConnectorSelectionParams": ".connector_selection", "ConnectorSetupGithubParams": ".connector_setup_github", @@ -137,15 +165,17 @@ "ConnectorSyncFailureParams": ".connector_sync_failure", "ConnectorSyncParams": ".connector_sync", "ConnectorSyncStartedParams": ".connector_sync_started", + "ConnectorSyncSystemParams": ".connector_sync_system", + "ConnectorSystemParams": ".connector_system", "DeleteDocumentErrorParams": ".delete_document_error", "DeleteDocumentsResultParams": ".delete_documents_result", "DocumentInputParams": ".document_input", "DocumentListItemParams": ".document_list_item", + "DocumentListItemSystemParams": ".document_list_item_system", "DocumentParams": ".document", "DocumentRefParams": ".document_ref", "DocumentSystemParams": ".document_system", "ErrorResponseParams": ".error_response", - "FileUploadResultParams": ".file_upload_result", "FilterAndParams": ".filter_and", "FilterArrayContainsParams": ".filter_array_contains", "FilterExpressionParams": ".filter_expression", @@ -161,9 +191,25 @@ "ForgetResultParams": ".forget_result", "GoogleDriveConfigParams": ".google_drive_config", "GranolaConfigParams": ".granola_config", - "ListRequestLimitParams": ".list_request_limit", - "ListRequestPageParams": ".list_request_page", + "ListRequestIncludeParams": ".list_request_include", "ListResponseParams": ".list_response", + "MemoryDetailsParams": ".memory_details", + "MemoryIncludedDocumentParams": ".memory_included_document", + "MemoryIncludedDocumentSystemParams": ".memory_included_document_system", + "MemoryIncludedParams": ".memory_included", + "MemoryIncludedRelatedChildrenItemDocumentParams": ".memory_included_related_children_item_document", + "MemoryIncludedRelatedChildrenItemDocumentSystemParams": ".memory_included_related_children_item_document_system", + "MemoryIncludedRelatedChildrenItemParams": ".memory_included_related_children_item", + "MemoryIncludedRelatedChildrenItemSystemParams": ".memory_included_related_children_item_system", + "MemoryIncludedRelatedParams": ".memory_included_related", + "MemoryIncludedRelatedParentsItemDocumentParams": ".memory_included_related_parents_item_document", + "MemoryIncludedRelatedParentsItemDocumentSystemParams": ".memory_included_related_parents_item_document_system", + "MemoryIncludedRelatedParentsItemParams": ".memory_included_related_parents_item", + "MemoryIncludedRelatedParentsItemSystemParams": ".memory_included_related_parents_item_system", + "MemoryIncludedRelatedSiblingsItemDocumentParams": ".memory_included_related_siblings_item_document", + "MemoryIncludedRelatedSiblingsItemDocumentSystemParams": ".memory_included_related_siblings_item_document_system", + "MemoryIncludedRelatedSiblingsItemParams": ".memory_included_related_siblings_item", + "MemoryIncludedRelatedSiblingsItemSystemParams": ".memory_included_related_siblings_item_system", "MemoryParams": ".memory", "MemorySystemParams": ".memory_system", "MetadataValueParams": ".metadata_value", @@ -173,6 +219,7 @@ "NamespaceDeleted_DeletedParams": ".namespace_deleted", "NamespaceDeleted_QueuedParams": ".namespace_deleted", "NamespaceDetailsParams": ".namespace_details", + "NamespaceListParams": ".namespace_list", "NamespaceParams": ".namespace", "NamespaceSystemParams": ".namespace_system", "OrganizationParams": ".organization", @@ -185,9 +232,10 @@ "RelatedMemoryParams": ".related_memory", "RelatedMemorySystemParams": ".related_memory_system", "S3ConfigParams": ".s3config", - "SearchRequestAttachParams": ".search_request_attach", + "SearchIncludeParams": ".search_include", "SearchResponseParams": ".search_response", "SearchResultIncludedDocumentParams": ".search_result_included_document", + "SearchResultIncludedDocumentSystemParams": ".search_result_included_document_system", "SearchResultIncludedParams": ".search_result_included", "SearchResultParams": ".search_result", "SearchResultSystemParams": ".search_result_system", @@ -229,10 +277,11 @@ def __dir__(): "ConnectorCapabilitiesParams", "ConnectorConfigValueParams", "ConnectorDeletedParams", - "ConnectorLastSyncParams", + "ConnectorLinkParams", "ConnectorListParams", "ConnectorParams", - "ConnectorPickerParams", + "ConnectorRunParams", + "ConnectorRunSystemParams", "ConnectorSelectionItemParams", "ConnectorSelectionParams", "ConnectorSetupGithubParams", @@ -256,15 +305,17 @@ def __dir__(): "ConnectorSyncFailureParams", "ConnectorSyncParams", "ConnectorSyncStartedParams", + "ConnectorSyncSystemParams", + "ConnectorSystemParams", "DeleteDocumentErrorParams", "DeleteDocumentsResultParams", "DocumentInputParams", "DocumentListItemParams", + "DocumentListItemSystemParams", "DocumentParams", "DocumentRefParams", "DocumentSystemParams", "ErrorResponseParams", - "FileUploadResultParams", "FilterAndParams", "FilterArrayContainsParams", "FilterExpressionParams", @@ -280,9 +331,25 @@ def __dir__(): "ForgetResultParams", "GoogleDriveConfigParams", "GranolaConfigParams", - "ListRequestLimitParams", - "ListRequestPageParams", + "ListRequestIncludeParams", "ListResponseParams", + "MemoryDetailsParams", + "MemoryIncludedDocumentParams", + "MemoryIncludedDocumentSystemParams", + "MemoryIncludedParams", + "MemoryIncludedRelatedChildrenItemDocumentParams", + "MemoryIncludedRelatedChildrenItemDocumentSystemParams", + "MemoryIncludedRelatedChildrenItemParams", + "MemoryIncludedRelatedChildrenItemSystemParams", + "MemoryIncludedRelatedParams", + "MemoryIncludedRelatedParentsItemDocumentParams", + "MemoryIncludedRelatedParentsItemDocumentSystemParams", + "MemoryIncludedRelatedParentsItemParams", + "MemoryIncludedRelatedParentsItemSystemParams", + "MemoryIncludedRelatedSiblingsItemDocumentParams", + "MemoryIncludedRelatedSiblingsItemDocumentSystemParams", + "MemoryIncludedRelatedSiblingsItemParams", + "MemoryIncludedRelatedSiblingsItemSystemParams", "MemoryParams", "MemorySystemParams", "MetadataValueParams", @@ -292,6 +359,7 @@ def __dir__(): "NamespaceDeleted_DeletedParams", "NamespaceDeleted_QueuedParams", "NamespaceDetailsParams", + "NamespaceListParams", "NamespaceParams", "NamespaceSystemParams", "OrganizationParams", @@ -304,9 +372,10 @@ def __dir__(): "RelatedMemoryParams", "RelatedMemorySystemParams", "S3ConfigParams", - "SearchRequestAttachParams", + "SearchIncludeParams", "SearchResponseParams", "SearchResultIncludedDocumentParams", + "SearchResultIncludedDocumentSystemParams", "SearchResultIncludedParams", "SearchResultParams", "SearchResultSystemParams", diff --git a/src/supermemory/requests/batch_add_item_result.py b/src/supermemory/requests/batch_add_item_result.py index 69b4ecf..15240d4 100644 --- a/src/supermemory/requests/batch_add_item_result.py +++ b/src/supermemory/requests/batch_add_item_result.py @@ -1,30 +1,31 @@ # This file was auto-generated by Fern from our API Definition. import typing_extensions +from ..types.batch_add_item_result_status import BatchAddItemResultStatus class BatchAddItemResultParams(typing_extensions.TypedDict): id: str """ - Unique identifier of the document (empty string for failed items) + Document identifier """ - status: str + status: BatchAddItemResultStatus """ - Status of the document (e.g. 'done', 'queued', 'error') + The document's processing state, as for a single add; error when this item failed """ error: typing_extensions.NotRequired[str] """ - Error message when status is 'error' + Failure reason """ details: typing_extensions.NotRequired[str] """ - Additional error details when status is 'error' + Human-readable explanation of the failure """ url: typing_extensions.NotRequired[str] """ - URL of the failed item, when it had one. Only present on failed items, where it may be the only way to tell which input the error belongs to (the id falls back to 'unknown' when the input had neither an id nor a customId). + URL of the failed item, when it had one """ diff --git a/src/supermemory/requests/batch_add_result.py b/src/supermemory/requests/batch_add_result.py index 4c7313a..b878262 100644 --- a/src/supermemory/requests/batch_add_result.py +++ b/src/supermemory/requests/batch_add_result.py @@ -9,15 +9,15 @@ class BatchAddResultParams(typing_extensions.TypedDict): results: typing.Sequence[BatchAddItemResultParams] """ - Array of results for each document in the batch + One result per submitted document: accepted documents first, in request order, then failed ones. Match results by id, or by url for a failed item with no id. """ - failed: float + count: int """ - Count of documents that failed to add + Number of documents accepted """ - success: float + failed: int """ - Count of documents successfully added + Number of documents that failed """ diff --git a/src/supermemory/requests/chunk.py b/src/supermemory/requests/chunk.py index bd961a0..e460abf 100644 --- a/src/supermemory/requests/chunk.py +++ b/src/supermemory/requests/chunk.py @@ -31,9 +31,9 @@ class ChunkParams(typing_extensions.TypedDict): Chunk content type """ - metadata: typing.Optional[typing.Dict[str, typing.Any]] + metadata: typing.Dict[str, typing.Any] """ - Chunk metadata, when available + Chunk metadata; empty object when none """ system: ChunkSystemParams diff --git a/src/supermemory/requests/chunk_list_item.py b/src/supermemory/requests/chunk_list_item.py index 7f324f5..3cf1f88 100644 --- a/src/supermemory/requests/chunk_list_item.py +++ b/src/supermemory/requests/chunk_list_item.py @@ -28,9 +28,9 @@ class ChunkListItemParams(typing_extensions.TypedDict): Chunk content type """ - metadata: typing.Optional[typing.Dict[str, typing.Any]] + metadata: typing.Dict[str, typing.Any] """ - Chunk metadata, when available + Chunk metadata; empty object when none """ system: ChunkSystemParams diff --git a/src/supermemory/requests/connector.py b/src/supermemory/requests/connector.py index d259aa7..3b3025d 100644 --- a/src/supermemory/requests/connector.py +++ b/src/supermemory/requests/connector.py @@ -1,18 +1,17 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt import typing import typing_extensions from ..core.serialization import FieldMetadata from ..types.connector_provider import ConnectorProvider -from ..types.connector_status import ConnectorStatus from .connector_capabilities import ConnectorCapabilitiesParams from .connector_config_value import ConnectorConfigValueParams -from .connector_last_sync import ConnectorLastSyncParams -from .connector_picker import ConnectorPickerParams +from .connector_link import ConnectorLinkParams +from .connector_run import ConnectorRunParams from .connector_selection_item import ConnectorSelectionItemParams from .connector_sync import ConnectorSyncParams +from .connector_system import ConnectorSystemParams class ConnectorParams(typing_extensions.TypedDict): @@ -22,21 +21,9 @@ class ConnectorParams(typing_extensions.TypedDict): External source """ - status: ConnectorStatus + authorization: typing_extensions.NotRequired[ConnectorLinkParams] """ - pending_authorization until the user finishes the provider login at authUrl; DELETE cancels it. Pending connectors are not listed. - """ - - auth_url: typing_extensions.NotRequired[typing_extensions.Annotated[str, FieldMetadata(alias="authUrl")]] - """ - Present while pending, when the caller can create connectors in this namespace: where to send the user to authorize - """ - - auth_url_expires_at: typing_extensions.NotRequired[ - typing_extensions.Annotated[dt.datetime, FieldMetadata(alias="authUrlExpiresAt")] - ] - """ - Present while pending: when authUrl stops working + Present while pending, when the caller can create connectors in this namespace """ namespace: typing.Optional[str] @@ -62,23 +49,22 @@ class ConnectorParams(typing_extensions.TypedDict): document_limit: typing_extensions.Annotated[float, FieldMetadata(alias="documentLimit")] document_count: typing_extensions.Annotated[float, FieldMetadata(alias="documentCount")] - last_sync: typing_extensions.Annotated[typing.Optional[ConnectorLastSyncParams], FieldMetadata(alias="lastSync")] + latest_run: typing_extensions.Annotated[typing.Optional[ConnectorRunParams], FieldMetadata(alias="latestRun")] """ - Most recent sync run + The most recent sync run, which may still be running or may have failed """ - last_synced_at: typing_extensions.Annotated[typing.Optional[dt.datetime], FieldMetadata(alias="lastSyncedAt")] + system: ConnectorSystemParams """ - When content last finished syncing + Lifecycle status and timestamps maintained by Supermemory """ - created_at: typing_extensions.Annotated[dt.datetime, FieldMetadata(alias="createdAt")] syncs: typing_extensions.NotRequired[typing.Sequence[ConnectorSyncParams]] """ - Present when attach=syncs + Present when include=syncs """ - picker: typing_extensions.NotRequired[typing.Optional[ConnectorPickerParams]] + picker: typing_extensions.NotRequired[typing.Optional[ConnectorLinkParams]] """ - Present when attach=picker. Null for connectors that sync everything. + Present when include=picker. Null for connectors that sync everything. """ diff --git a/src/supermemory/requests/connector_picker.py b/src/supermemory/requests/connector_link.py similarity index 85% rename from src/supermemory/requests/connector_picker.py rename to src/supermemory/requests/connector_link.py index 6d3c6ee..efaf7bf 100644 --- a/src/supermemory/requests/connector_picker.py +++ b/src/supermemory/requests/connector_link.py @@ -6,7 +6,7 @@ from ..core.serialization import FieldMetadata -class ConnectorPickerParams(typing_extensions.TypedDict): +class ConnectorLinkParams(typing_extensions.TypedDict): url: str """ Send the user here to choose what syncs. Works once, in any browser. diff --git a/src/supermemory/requests/connector_last_sync.py b/src/supermemory/requests/connector_run.py similarity index 51% rename from src/supermemory/requests/connector_last_sync.py rename to src/supermemory/requests/connector_run.py index 1a15d3f..56a8998 100644 --- a/src/supermemory/requests/connector_last_sync.py +++ b/src/supermemory/requests/connector_run.py @@ -1,21 +1,21 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt import typing import typing_extensions from ..core.serialization import FieldMetadata from ..types.connector_error_code import ConnectorErrorCode -from ..types.connector_sync_status import ConnectorSyncStatus +from .connector_run_system import ConnectorRunSystemParams -class ConnectorLastSyncParams(typing_extensions.TypedDict): - status: ConnectorSyncStatus +class ConnectorRunParams(typing_extensions.TypedDict): error_code: typing_extensions.Annotated[typing.Optional[ConnectorErrorCode], FieldMetadata(alias="errorCode")] error: typing.Optional[str] """ Customer-safe error message """ - started_at: typing_extensions.Annotated[dt.datetime, FieldMetadata(alias="startedAt")] - completed_at: typing_extensions.Annotated[typing.Optional[dt.datetime], FieldMetadata(alias="completedAt")] + system: ConnectorRunSystemParams + """ + Run status and timestamps maintained by Supermemory + """ diff --git a/src/supermemory/requests/connector_run_system.py b/src/supermemory/requests/connector_run_system.py new file mode 100644 index 0000000..273e8f8 --- /dev/null +++ b/src/supermemory/requests/connector_run_system.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +import typing_extensions +from ..core.serialization import FieldMetadata +from ..types.connector_run_status import ConnectorRunStatus + + +class ConnectorRunSystemParams(typing_extensions.TypedDict): + """ + Run status and timestamps maintained by Supermemory + """ + + status: ConnectorRunStatus + started_at: typing_extensions.Annotated[dt.datetime, FieldMetadata(alias="startedAt")] + """ + ISO 8601 timestamp when the run started + """ + + completed_at: typing_extensions.Annotated[typing.Optional[dt.datetime], FieldMetadata(alias="completedAt")] + """ + ISO 8601 timestamp when the run ended; null while running + """ diff --git a/src/supermemory/requests/connector_setup_result.py b/src/supermemory/requests/connector_setup_result.py index 47a09b6..3f60139 100644 --- a/src/supermemory/requests/connector_setup_result.py +++ b/src/supermemory/requests/connector_setup_result.py @@ -1,10 +1,9 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt import typing import typing_extensions -from ..core.serialization import FieldMetadata +from .connector_link import ConnectorLinkParams class ConnectorSetupResultParams(typing_extensions.TypedDict): @@ -13,14 +12,7 @@ class ConnectorSetupResultParams(typing_extensions.TypedDict): Connector identifier """ - auth_url: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="authUrl")] + authorization: typing.Optional[ConnectorLinkParams] """ - Send the user here to authorize the provider. Null for providers that authenticate with config only. - """ - - auth_url_expires_at: typing_extensions.Annotated[ - typing.Optional[dt.datetime], FieldMetadata(alias="authUrlExpiresAt") - ] - """ - When authUrl stops working + Null for providers that authenticate with config only """ diff --git a/src/supermemory/requests/connector_sync.py b/src/supermemory/requests/connector_sync.py index e9c52ab..6591f74 100644 --- a/src/supermemory/requests/connector_sync.py +++ b/src/supermemory/requests/connector_sync.py @@ -1,26 +1,27 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt import typing import typing_extensions from ..core.serialization import FieldMetadata from ..types.connector_error_code import ConnectorErrorCode -from ..types.connector_sync_status import ConnectorSyncStatus from ..types.connector_sync_trigger import ConnectorSyncTrigger from .connector_sync_failure import ConnectorSyncFailureParams +from .connector_sync_system import ConnectorSyncSystemParams class ConnectorSyncParams(typing_extensions.TypedDict): - status: ConnectorSyncStatus error_code: typing_extensions.Annotated[typing.Optional[ConnectorErrorCode], FieldMetadata(alias="errorCode")] error: typing.Optional[str] """ Customer-safe error message """ - started_at: typing_extensions.Annotated[dt.datetime, FieldMetadata(alias="startedAt")] - completed_at: typing_extensions.Annotated[typing.Optional[dt.datetime], FieldMetadata(alias="completedAt")] + system: ConnectorSyncSystemParams + """ + Run status and timestamps maintained by Supermemory + """ + id: str trigger: ConnectorSyncTrigger items_processed: typing_extensions.Annotated[float, FieldMetadata(alias="itemsProcessed")] diff --git a/src/supermemory/requests/connector_sync_system.py b/src/supermemory/requests/connector_sync_system.py new file mode 100644 index 0000000..81c2b1b --- /dev/null +++ b/src/supermemory/requests/connector_sync_system.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +import typing_extensions +from ..core.serialization import FieldMetadata +from ..types.connector_run_status import ConnectorRunStatus + + +class ConnectorSyncSystemParams(typing_extensions.TypedDict): + """ + Run status and timestamps maintained by Supermemory + """ + + status: ConnectorRunStatus + started_at: typing_extensions.Annotated[dt.datetime, FieldMetadata(alias="startedAt")] + """ + ISO 8601 timestamp when the run started + """ + + completed_at: typing_extensions.Annotated[typing.Optional[dt.datetime], FieldMetadata(alias="completedAt")] + """ + ISO 8601 timestamp when the run ended; null while running + """ diff --git a/src/supermemory/requests/connector_system.py b/src/supermemory/requests/connector_system.py new file mode 100644 index 0000000..ca83efc --- /dev/null +++ b/src/supermemory/requests/connector_system.py @@ -0,0 +1,31 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +import typing_extensions +from ..core.serialization import FieldMetadata +from ..types.connector_status import ConnectorStatus + + +class ConnectorSystemParams(typing_extensions.TypedDict): + """ + Lifecycle status and timestamps maintained by Supermemory + """ + + status: ConnectorStatus + """ + pending_authorization until the user finishes the provider login at authorization.url; DELETE cancels it. Pending connectors are not listed. + """ + + created_at: typing_extensions.Annotated[dt.datetime, FieldMetadata(alias="createdAt")] + """ + ISO 8601 timestamp when the connector was created + """ + + last_successful_sync_at: typing_extensions.Annotated[ + typing.Optional[dt.datetime], FieldMetadata(alias="lastSuccessfulSyncAt") + ] + """ + ISO 8601 timestamp when content last finished syncing successfully + """ diff --git a/src/supermemory/requests/delete_documents_result.py b/src/supermemory/requests/delete_documents_result.py index 240f563..ba1c76e 100644 --- a/src/supermemory/requests/delete_documents_result.py +++ b/src/supermemory/requests/delete_documents_result.py @@ -3,12 +3,11 @@ import typing import typing_extensions -from ..core.serialization import FieldMetadata from .delete_document_error import DeleteDocumentErrorParams class DeleteDocumentsResultParams(typing_extensions.TypedDict): - deleted_count: typing_extensions.Annotated[int, FieldMetadata(alias="deletedCount")] + count: int """ Number of documents successfully deleted """ diff --git a/src/supermemory/requests/document.py b/src/supermemory/requests/document.py index 31a0875..e71580a 100644 --- a/src/supermemory/requests/document.py +++ b/src/supermemory/requests/document.py @@ -10,7 +10,7 @@ class DocumentParams(typing_extensions.TypedDict): """ - Namespace-scoped document. Attachment keys are omitted unless requested and are empty arrays when requested without results. + Namespace-scoped document. Included keys are omitted unless requested and are empty arrays when requested without results. """ id: str diff --git a/src/supermemory/requests/document_list_item.py b/src/supermemory/requests/document_list_item.py index 5fa297c..769e257 100644 --- a/src/supermemory/requests/document_list_item.py +++ b/src/supermemory/requests/document_list_item.py @@ -3,7 +3,7 @@ import typing import typing_extensions -from .document_system import DocumentSystemParams +from .document_list_item_system import DocumentListItemSystemParams class DocumentListItemParams(typing_extensions.TypedDict): @@ -41,7 +41,7 @@ class DocumentListItemParams(typing_extensions.TypedDict): Original source URL, when the document was ingested from the web """ - system: DocumentSystemParams + system: DocumentListItemSystemParams """ Processing status, lifecycle timestamps, and storage path maintained by Supermemory """ diff --git a/src/supermemory/requests/document_list_item_system.py b/src/supermemory/requests/document_list_item_system.py new file mode 100644 index 0000000..c529e00 --- /dev/null +++ b/src/supermemory/requests/document_list_item_system.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt + +import typing_extensions +from ..core.serialization import FieldMetadata + + +class DocumentListItemSystemParams(typing_extensions.TypedDict): + """ + Processing status, lifecycle timestamps, and storage path maintained by Supermemory + """ + + status: str + """ + Current extraction and memory-processing status + """ + + created_at: typing_extensions.Annotated[dt.datetime, FieldMetadata(alias="createdAt")] + """ + ISO 8601 timestamp when the document was created + """ + + updated_at: typing_extensions.Annotated[dt.datetime, FieldMetadata(alias="updatedAt")] + """ + ISO 8601 timestamp of the latest document update + """ diff --git a/src/supermemory/requests/document_ref.py b/src/supermemory/requests/document_ref.py index a5319b6..326934d 100644 --- a/src/supermemory/requests/document_ref.py +++ b/src/supermemory/requests/document_ref.py @@ -1,15 +1,16 @@ # This file was auto-generated by Fern from our API Definition. import typing_extensions +from ..types.document_ref_status import DocumentRefStatus class DocumentRefParams(typing_extensions.TypedDict): id: str """ - Unique identifier of the document + Document identifier to poll or retrieve """ - status: str + status: DocumentRefStatus """ - Status of the document + The document's processing state after this request. queued when new work was queued; otherwise its current state, e.g. done for an unchanged duplicate or failed for a metadata-only update to a failed document. """ diff --git a/src/supermemory/requests/document_system.py b/src/supermemory/requests/document_system.py index a36cef3..8926dbb 100644 --- a/src/supermemory/requests/document_system.py +++ b/src/supermemory/requests/document_system.py @@ -4,6 +4,7 @@ import typing_extensions from ..core.serialization import FieldMetadata +from ..types.document_system_status import DocumentSystemStatus class DocumentSystemParams(typing_extensions.TypedDict): @@ -11,7 +12,7 @@ class DocumentSystemParams(typing_extensions.TypedDict): Processing status, lifecycle timestamps, and storage path maintained by Supermemory """ - status: str + status: DocumentSystemStatus """ Current extraction and memory-processing status """ diff --git a/src/supermemory/requests/file_upload_result.py b/src/supermemory/requests/file_upload_result.py deleted file mode 100644 index 4ecbd43..0000000 --- a/src/supermemory/requests/file_upload_result.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class FileUploadResultParams(typing_extensions.TypedDict): - id: str - """ - Document identifier to poll or retrieve - """ - - status: typing.Literal["processing"] - """ - Confirms the file was accepted for asynchronous processing - """ diff --git a/src/supermemory/requests/list_request_include.py b/src/supermemory/requests/list_request_include.py new file mode 100644 index 0000000..c990ec3 --- /dev/null +++ b/src/supermemory/requests/list_request_include.py @@ -0,0 +1,14 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing_extensions + + +class ListRequestIncludeParams(typing_extensions.TypedDict): + """ + Optional extras, matching search's include + """ + + forgotten: typing_extensions.NotRequired[bool] + """ + List forgotten and expired memories too, with isForgotten: true. Applies to type memories only. + """ diff --git a/src/supermemory/requests/list_request_limit.py b/src/supermemory/requests/list_request_limit.py deleted file mode 100644 index 7b70cac..0000000 --- a/src/supermemory/requests/list_request_limit.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListRequestLimitParams = typing.Union[str, float] diff --git a/src/supermemory/requests/memory.py b/src/supermemory/requests/memory.py index 2b4eddf..87c5a95 100644 --- a/src/supermemory/requests/memory.py +++ b/src/supermemory/requests/memory.py @@ -22,9 +22,9 @@ class MemoryParams(typing_extensions.TypedDict): Learned fact or context extracted from the document """ - metadata: typing.Optional[typing.Dict[str, typing.Any]] + metadata: typing.Dict[str, typing.Any] """ - Memory metadata, including temporal context when available + Memory metadata, including temporal context; empty object when none """ is_static: typing_extensions.Annotated[bool, FieldMetadata(alias="isStatic")] diff --git a/src/supermemory/requests/memory_details.py b/src/supermemory/requests/memory_details.py new file mode 100644 index 0000000..2e59c6a --- /dev/null +++ b/src/supermemory/requests/memory_details.py @@ -0,0 +1,60 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions +from ..core.serialization import FieldMetadata +from .memory_included import MemoryIncludedParams +from .memory_system import MemorySystemParams + + +class MemoryDetailsParams(typing_extensions.TypedDict): + id: str + """ + Stable memory identifier + """ + + memory: str + """ + Learned fact or context extracted from the document + """ + + metadata: typing.Dict[str, typing.Any] + """ + Memory metadata, including temporal context; empty object when none + """ + + is_static: typing_extensions.Annotated[bool, FieldMetadata(alias="isStatic")] + """ + Whether the memory belongs to the stable profile section + """ + + is_inference: typing_extensions.Annotated[bool, FieldMetadata(alias="isInference")] + """ + Whether the memory was inferred rather than explicitly stated + """ + + is_latest: typing_extensions.Annotated[bool, FieldMetadata(alias="isLatest")] + """ + Whether this is the newest version in its memory chain + """ + + is_forgotten: typing_extensions.Annotated[bool, FieldMetadata(alias="isForgotten")] + """ + Whether this memory has been excluded from normal recall + """ + + version: int + """ + Version number within the memory chain + """ + + system: MemorySystemParams + """ + Lifecycle timestamps maintained by Supermemory + """ + + included: typing_extensions.NotRequired[MemoryIncludedParams] + """ + Requested extras + """ diff --git a/src/supermemory/requests/memory_included.py b/src/supermemory/requests/memory_included.py new file mode 100644 index 0000000..f89a313 --- /dev/null +++ b/src/supermemory/requests/memory_included.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing_extensions +from .memory_included_document import MemoryIncludedDocumentParams +from .memory_included_related import MemoryIncludedRelatedParams + + +class MemoryIncludedParams(typing_extensions.TypedDict): + """ + Requested extras + """ + + related: typing_extensions.NotRequired[MemoryIncludedRelatedParams] + """ + Present when include has related + """ + + document: typing_extensions.NotRequired[MemoryIncludedDocumentParams] + """ + Source document; present when include has documents and one exists + """ diff --git a/src/supermemory/requests/memory_included_document.py b/src/supermemory/requests/memory_included_document.py new file mode 100644 index 0000000..f339e4a --- /dev/null +++ b/src/supermemory/requests/memory_included_document.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions +from .memory_included_document_system import MemoryIncludedDocumentSystemParams + + +class MemoryIncludedDocumentParams(typing_extensions.TypedDict): + """ + Source document; present when include has documents and one exists + """ + + id: str + """ + Source document identifier + """ + + title: typing.Optional[str] + """ + Source document title + """ + + type: typing.Optional[str] + """ + Detected source or content type + """ + + metadata: typing.Dict[str, typing.Any] + """ + Public metadata attached to the source document + """ + + summary: typing.Optional[str] + """ + Generated summary of the source document + """ + + system: MemoryIncludedDocumentSystemParams + """ + Lifecycle timestamps maintained by Supermemory + """ diff --git a/src/supermemory/requests/memory_included_document_system.py b/src/supermemory/requests/memory_included_document_system.py new file mode 100644 index 0000000..23aa7ac --- /dev/null +++ b/src/supermemory/requests/memory_included_document_system.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing_extensions +from ..core.serialization import FieldMetadata + + +class MemoryIncludedDocumentSystemParams(typing_extensions.TypedDict): + """ + Lifecycle timestamps maintained by Supermemory + """ + + created_at: typing_extensions.Annotated[str, FieldMetadata(alias="createdAt")] + """ + ISO 8601 timestamp when the source document was created + """ + + updated_at: typing_extensions.Annotated[str, FieldMetadata(alias="updatedAt")] + """ + ISO 8601 timestamp of the source document's latest update + """ diff --git a/src/supermemory/requests/memory_included_related.py b/src/supermemory/requests/memory_included_related.py new file mode 100644 index 0000000..dfa713a --- /dev/null +++ b/src/supermemory/requests/memory_included_related.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions +from .memory_included_related_children_item import MemoryIncludedRelatedChildrenItemParams +from .memory_included_related_parents_item import MemoryIncludedRelatedParentsItemParams +from .memory_included_related_siblings_item import MemoryIncludedRelatedSiblingsItemParams + + +class MemoryIncludedRelatedParams(typing_extensions.TypedDict): + """ + Present when include has related + """ + + parents: typing.Sequence[MemoryIncludedRelatedParentsItemParams] + """ + Earlier versions this memory updates, nearest first + """ + + children: typing.Sequence[MemoryIncludedRelatedChildrenItemParams] + """ + Newer versions that update this memory, nearest first + """ + + siblings: typing.Sequence[MemoryIncludedRelatedSiblingsItemParams] + """ + Memories connected by extends or derives, nearest first + """ diff --git a/src/supermemory/requests/memory_included_related_children_item.py b/src/supermemory/requests/memory_included_related_children_item.py new file mode 100644 index 0000000..e8e1ff8 --- /dev/null +++ b/src/supermemory/requests/memory_included_related_children_item.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions +from ..types.memory_relation import MemoryRelation +from .memory_included_related_children_item_document import MemoryIncludedRelatedChildrenItemDocumentParams +from .memory_included_related_children_item_system import MemoryIncludedRelatedChildrenItemSystemParams + + +class MemoryIncludedRelatedChildrenItemParams(typing_extensions.TypedDict): + id: str + """ + Related memory ID + """ + + relation: MemoryRelation + """ + How this memory is connected to the matched memory + """ + + version: typing_extensions.NotRequired[typing.Optional[float]] + """ + Version number within the related memory's history + """ + + memory: str + """ + Related learned fact or context + """ + + metadata: typing.Dict[str, typing.Any] + """ + Public metadata associated with the related memory + """ + + system: MemoryIncludedRelatedChildrenItemSystemParams + """ + Lifecycle details for the related memory + """ + + document: typing_extensions.NotRequired[MemoryIncludedRelatedChildrenItemDocumentParams] + """ + Source document; present when include has both related and documents + """ diff --git a/src/supermemory/requests/memory_included_related_children_item_document.py b/src/supermemory/requests/memory_included_related_children_item_document.py new file mode 100644 index 0000000..fddb2a6 --- /dev/null +++ b/src/supermemory/requests/memory_included_related_children_item_document.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions +from .memory_included_related_children_item_document_system import MemoryIncludedRelatedChildrenItemDocumentSystemParams + + +class MemoryIncludedRelatedChildrenItemDocumentParams(typing_extensions.TypedDict): + """ + Source document; present when include has both related and documents + """ + + id: str + """ + Source document identifier + """ + + title: typing.Optional[str] + """ + Source document title + """ + + type: typing.Optional[str] + """ + Detected source or content type + """ + + metadata: typing.Dict[str, typing.Any] + """ + Public metadata attached to the source document + """ + + summary: typing.Optional[str] + """ + Generated summary of the source document + """ + + system: MemoryIncludedRelatedChildrenItemDocumentSystemParams + """ + Lifecycle timestamps maintained by Supermemory + """ diff --git a/src/supermemory/requests/memory_included_related_children_item_document_system.py b/src/supermemory/requests/memory_included_related_children_item_document_system.py new file mode 100644 index 0000000..ae0962c --- /dev/null +++ b/src/supermemory/requests/memory_included_related_children_item_document_system.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing_extensions +from ..core.serialization import FieldMetadata + + +class MemoryIncludedRelatedChildrenItemDocumentSystemParams(typing_extensions.TypedDict): + """ + Lifecycle timestamps maintained by Supermemory + """ + + created_at: typing_extensions.Annotated[str, FieldMetadata(alias="createdAt")] + """ + ISO 8601 timestamp when the source document was created + """ + + updated_at: typing_extensions.Annotated[str, FieldMetadata(alias="updatedAt")] + """ + ISO 8601 timestamp of the source document's latest update + """ diff --git a/src/supermemory/requests/memory_included_related_children_item_system.py b/src/supermemory/requests/memory_included_related_children_item_system.py new file mode 100644 index 0000000..df362a7 --- /dev/null +++ b/src/supermemory/requests/memory_included_related_children_item_system.py @@ -0,0 +1,15 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing_extensions +from ..core.serialization import FieldMetadata + + +class MemoryIncludedRelatedChildrenItemSystemParams(typing_extensions.TypedDict): + """ + Lifecycle details for the related memory + """ + + updated_at: typing_extensions.Annotated[str, FieldMetadata(alias="updatedAt")] + """ + ISO 8601 timestamp of the related memory's latest update + """ diff --git a/src/supermemory/requests/memory_included_related_parents_item.py b/src/supermemory/requests/memory_included_related_parents_item.py new file mode 100644 index 0000000..52ba297 --- /dev/null +++ b/src/supermemory/requests/memory_included_related_parents_item.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions +from ..types.memory_relation import MemoryRelation +from .memory_included_related_parents_item_document import MemoryIncludedRelatedParentsItemDocumentParams +from .memory_included_related_parents_item_system import MemoryIncludedRelatedParentsItemSystemParams + + +class MemoryIncludedRelatedParentsItemParams(typing_extensions.TypedDict): + id: str + """ + Related memory ID + """ + + relation: MemoryRelation + """ + How this memory is connected to the matched memory + """ + + version: typing_extensions.NotRequired[typing.Optional[float]] + """ + Version number within the related memory's history + """ + + memory: str + """ + Related learned fact or context + """ + + metadata: typing.Dict[str, typing.Any] + """ + Public metadata associated with the related memory + """ + + system: MemoryIncludedRelatedParentsItemSystemParams + """ + Lifecycle details for the related memory + """ + + document: typing_extensions.NotRequired[MemoryIncludedRelatedParentsItemDocumentParams] + """ + Source document; present when include has both related and documents + """ diff --git a/src/supermemory/requests/memory_included_related_parents_item_document.py b/src/supermemory/requests/memory_included_related_parents_item_document.py new file mode 100644 index 0000000..ab870b8 --- /dev/null +++ b/src/supermemory/requests/memory_included_related_parents_item_document.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions +from .memory_included_related_parents_item_document_system import MemoryIncludedRelatedParentsItemDocumentSystemParams + + +class MemoryIncludedRelatedParentsItemDocumentParams(typing_extensions.TypedDict): + """ + Source document; present when include has both related and documents + """ + + id: str + """ + Source document identifier + """ + + title: typing.Optional[str] + """ + Source document title + """ + + type: typing.Optional[str] + """ + Detected source or content type + """ + + metadata: typing.Dict[str, typing.Any] + """ + Public metadata attached to the source document + """ + + summary: typing.Optional[str] + """ + Generated summary of the source document + """ + + system: MemoryIncludedRelatedParentsItemDocumentSystemParams + """ + Lifecycle timestamps maintained by Supermemory + """ diff --git a/src/supermemory/requests/memory_included_related_parents_item_document_system.py b/src/supermemory/requests/memory_included_related_parents_item_document_system.py new file mode 100644 index 0000000..433a041 --- /dev/null +++ b/src/supermemory/requests/memory_included_related_parents_item_document_system.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing_extensions +from ..core.serialization import FieldMetadata + + +class MemoryIncludedRelatedParentsItemDocumentSystemParams(typing_extensions.TypedDict): + """ + Lifecycle timestamps maintained by Supermemory + """ + + created_at: typing_extensions.Annotated[str, FieldMetadata(alias="createdAt")] + """ + ISO 8601 timestamp when the source document was created + """ + + updated_at: typing_extensions.Annotated[str, FieldMetadata(alias="updatedAt")] + """ + ISO 8601 timestamp of the source document's latest update + """ diff --git a/src/supermemory/requests/memory_included_related_parents_item_system.py b/src/supermemory/requests/memory_included_related_parents_item_system.py new file mode 100644 index 0000000..3bd9d79 --- /dev/null +++ b/src/supermemory/requests/memory_included_related_parents_item_system.py @@ -0,0 +1,15 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing_extensions +from ..core.serialization import FieldMetadata + + +class MemoryIncludedRelatedParentsItemSystemParams(typing_extensions.TypedDict): + """ + Lifecycle details for the related memory + """ + + updated_at: typing_extensions.Annotated[str, FieldMetadata(alias="updatedAt")] + """ + ISO 8601 timestamp of the related memory's latest update + """ diff --git a/src/supermemory/requests/memory_included_related_siblings_item.py b/src/supermemory/requests/memory_included_related_siblings_item.py new file mode 100644 index 0000000..0b2e08a --- /dev/null +++ b/src/supermemory/requests/memory_included_related_siblings_item.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions +from ..types.memory_relation import MemoryRelation +from .memory_included_related_siblings_item_document import MemoryIncludedRelatedSiblingsItemDocumentParams +from .memory_included_related_siblings_item_system import MemoryIncludedRelatedSiblingsItemSystemParams + + +class MemoryIncludedRelatedSiblingsItemParams(typing_extensions.TypedDict): + id: str + """ + Related memory ID + """ + + relation: MemoryRelation + """ + How this memory is connected to the matched memory + """ + + version: typing_extensions.NotRequired[typing.Optional[float]] + """ + Version number within the related memory's history + """ + + memory: str + """ + Related learned fact or context + """ + + metadata: typing.Dict[str, typing.Any] + """ + Public metadata associated with the related memory + """ + + system: MemoryIncludedRelatedSiblingsItemSystemParams + """ + Lifecycle details for the related memory + """ + + document: typing_extensions.NotRequired[MemoryIncludedRelatedSiblingsItemDocumentParams] + """ + Source document; present when include has both related and documents + """ diff --git a/src/supermemory/requests/memory_included_related_siblings_item_document.py b/src/supermemory/requests/memory_included_related_siblings_item_document.py new file mode 100644 index 0000000..23e8f42 --- /dev/null +++ b/src/supermemory/requests/memory_included_related_siblings_item_document.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions +from .memory_included_related_siblings_item_document_system import MemoryIncludedRelatedSiblingsItemDocumentSystemParams + + +class MemoryIncludedRelatedSiblingsItemDocumentParams(typing_extensions.TypedDict): + """ + Source document; present when include has both related and documents + """ + + id: str + """ + Source document identifier + """ + + title: typing.Optional[str] + """ + Source document title + """ + + type: typing.Optional[str] + """ + Detected source or content type + """ + + metadata: typing.Dict[str, typing.Any] + """ + Public metadata attached to the source document + """ + + summary: typing.Optional[str] + """ + Generated summary of the source document + """ + + system: MemoryIncludedRelatedSiblingsItemDocumentSystemParams + """ + Lifecycle timestamps maintained by Supermemory + """ diff --git a/src/supermemory/requests/memory_included_related_siblings_item_document_system.py b/src/supermemory/requests/memory_included_related_siblings_item_document_system.py new file mode 100644 index 0000000..71d1da2 --- /dev/null +++ b/src/supermemory/requests/memory_included_related_siblings_item_document_system.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing_extensions +from ..core.serialization import FieldMetadata + + +class MemoryIncludedRelatedSiblingsItemDocumentSystemParams(typing_extensions.TypedDict): + """ + Lifecycle timestamps maintained by Supermemory + """ + + created_at: typing_extensions.Annotated[str, FieldMetadata(alias="createdAt")] + """ + ISO 8601 timestamp when the source document was created + """ + + updated_at: typing_extensions.Annotated[str, FieldMetadata(alias="updatedAt")] + """ + ISO 8601 timestamp of the source document's latest update + """ diff --git a/src/supermemory/requests/memory_included_related_siblings_item_system.py b/src/supermemory/requests/memory_included_related_siblings_item_system.py new file mode 100644 index 0000000..8a4d0c3 --- /dev/null +++ b/src/supermemory/requests/memory_included_related_siblings_item_system.py @@ -0,0 +1,15 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing_extensions +from ..core.serialization import FieldMetadata + + +class MemoryIncludedRelatedSiblingsItemSystemParams(typing_extensions.TypedDict): + """ + Lifecycle details for the related memory + """ + + updated_at: typing_extensions.Annotated[str, FieldMetadata(alias="updatedAt")] + """ + ISO 8601 timestamp of the related memory's latest update + """ diff --git a/src/supermemory/requests/namespace_deleted.py b/src/supermemory/requests/namespace_deleted.py index b3db5e7..cc1f5b0 100644 --- a/src/supermemory/requests/namespace_deleted.py +++ b/src/supermemory/requests/namespace_deleted.py @@ -10,7 +10,6 @@ class NamespaceDeleted_DeletedParams(typing_extensions.TypedDict): status: typing.Literal["deleted"] - success: typing.Literal[True] namespace: str deleted_documents_count: typing_extensions.Annotated[int, FieldMetadata(alias="deletedDocumentsCount")] deleted_memories_count: typing_extensions.Annotated[int, FieldMetadata(alias="deletedMemoriesCount")] @@ -18,7 +17,6 @@ class NamespaceDeleted_DeletedParams(typing_extensions.TypedDict): class NamespaceDeleted_QueuedParams(typing_extensions.TypedDict): status: typing.Literal["queued"] - success: typing.Literal[True] operation_id: typing_extensions.Annotated[str, FieldMetadata(alias="operationId")] namespace: str move_to: typing_extensions.Annotated[str, FieldMetadata(alias="moveTo")] diff --git a/src/supermemory/requests/namespace_deleted_deleted.py b/src/supermemory/requests/namespace_deleted_deleted.py index 7437fe6..15ec981 100644 --- a/src/supermemory/requests/namespace_deleted_deleted.py +++ b/src/supermemory/requests/namespace_deleted_deleted.py @@ -1,17 +1,10 @@ # This file was auto-generated by Fern from our API Definition. -import typing - import typing_extensions from ..core.serialization import FieldMetadata class NamespaceDeletedDeletedParams(typing_extensions.TypedDict): - success: typing.Literal[True] - """ - Confirms the namespace was deleted - """ - namespace: str """ Deleted namespace identifier diff --git a/src/supermemory/requests/namespace_deleted_queued.py b/src/supermemory/requests/namespace_deleted_queued.py index 6f6fc9b..af95569 100644 --- a/src/supermemory/requests/namespace_deleted_queued.py +++ b/src/supermemory/requests/namespace_deleted_queued.py @@ -1,17 +1,10 @@ # This file was auto-generated by Fern from our API Definition. -import typing - import typing_extensions from ..core.serialization import FieldMetadata class NamespaceDeletedQueuedParams(typing_extensions.TypedDict): - success: typing.Literal[True] - """ - Confirms the namespace move was accepted - """ - operation_id: typing_extensions.Annotated[str, FieldMetadata(alias="operationId")] """ Identifier used to trace the asynchronous move operation diff --git a/src/supermemory/requests/namespace_list.py b/src/supermemory/requests/namespace_list.py new file mode 100644 index 0000000..f9ce174 --- /dev/null +++ b/src/supermemory/requests/namespace_list.py @@ -0,0 +1,19 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions +from .namespace import NamespaceParams +from .pagination import PaginationParams + + +class NamespaceListParams(typing_extensions.TypedDict): + namespaces: typing.Sequence[NamespaceParams] + """ + Namespaces on this page, newest first + """ + + pagination: PaginationParams + """ + Pagination metadata + """ diff --git a/src/supermemory/requests/related_memories.py b/src/supermemory/requests/related_memories.py index b65de04..5614e91 100644 --- a/src/supermemory/requests/related_memories.py +++ b/src/supermemory/requests/related_memories.py @@ -8,7 +8,7 @@ class RelatedMemoriesParams(typing_extensions.TypedDict): """ - Memory relationships attached when requested + Memory relationships included when requested """ parents: typing.Sequence[RelatedMemoryParams] diff --git a/src/supermemory/requests/related_memory.py b/src/supermemory/requests/related_memory.py index 618b647..fbf145b 100644 --- a/src/supermemory/requests/related_memory.py +++ b/src/supermemory/requests/related_memory.py @@ -8,6 +8,11 @@ class RelatedMemoryParams(typing_extensions.TypedDict): + id: str + """ + Related memory ID + """ + relation: MemoryRelation """ How this memory is connected to the matched memory @@ -23,7 +28,7 @@ class RelatedMemoryParams(typing_extensions.TypedDict): Related learned fact or context """ - metadata: typing_extensions.NotRequired[typing.Optional[typing.Dict[str, typing.Any]]] + metadata: typing.Dict[str, typing.Any] """ Public metadata associated with the related memory """ diff --git a/src/supermemory/requests/search_request_attach.py b/src/supermemory/requests/search_include.py similarity index 58% rename from src/supermemory/requests/search_request_attach.py rename to src/supermemory/requests/search_include.py index 9f17bef..cb77128 100644 --- a/src/supermemory/requests/search_request_attach.py +++ b/src/supermemory/requests/search_include.py @@ -3,22 +3,22 @@ import typing_extensions -class SearchRequestAttachParams(typing_extensions.TypedDict): +class SearchIncludeParams(typing_extensions.TypedDict): """ Optional context to include alongside each matching result """ documents: typing_extensions.NotRequired[bool] """ - Attach the source document for each result when one is available + Include the source document for each result when one is available """ related: typing_extensions.NotRequired[bool] """ - Attach parent, child, and sibling memories that explain how each memory evolved + Include parent, child, and sibling memories that explain how each memory evolved """ forgotten: typing_extensions.NotRequired[bool] """ - Allow forgotten memories to participate in recall + Let forgotten and expired memories appear in results """ diff --git a/src/supermemory/requests/search_result.py b/src/supermemory/requests/search_result.py index 9b0694b..ffb59ae 100644 --- a/src/supermemory/requests/search_result.py +++ b/src/supermemory/requests/search_result.py @@ -24,7 +24,7 @@ class SearchResultParams(typing_extensions.TypedDict): Source passage returned by chunk search (only present for chunk results from hybrid search) """ - metadata: typing.Optional[typing.Dict[str, typing.Any]] + metadata: typing.Dict[str, typing.Any] """ Public metadata attached to the result """ @@ -39,6 +39,11 @@ class SearchResultParams(typing_extensions.TypedDict): Whether the memory is its latest version; false for recalled forgotten memories """ + is_inference: typing_extensions.Annotated[bool, FieldMetadata(alias="isInference")] + """ + Whether the memory was inferred rather than stated directly; false for chunks + """ + system: SearchResultSystemParams """ Lifecycle and filesystem details for the result diff --git a/src/supermemory/requests/search_result_included.py b/src/supermemory/requests/search_result_included.py index 1eac276..01a1b0b 100644 --- a/src/supermemory/requests/search_result_included.py +++ b/src/supermemory/requests/search_result_included.py @@ -12,10 +12,10 @@ class SearchResultIncludedParams(typing_extensions.TypedDict): related: typing_extensions.NotRequired[RelatedMemoriesParams] """ - Memory relationships attached when requested + Memory relationships included when requested """ document: typing_extensions.NotRequired[SearchResultIncludedDocumentParams] """ - Source document attached when requested and available + Source document included when requested and available """ diff --git a/src/supermemory/requests/search_result_included_document.py b/src/supermemory/requests/search_result_included_document.py index efd876d..9c06b7a 100644 --- a/src/supermemory/requests/search_result_included_document.py +++ b/src/supermemory/requests/search_result_included_document.py @@ -3,12 +3,12 @@ import typing import typing_extensions -from ..core.serialization import FieldMetadata +from .search_result_included_document_system import SearchResultIncludedDocumentSystemParams class SearchResultIncludedDocumentParams(typing_extensions.TypedDict): """ - Source document attached when requested and available + Source document included when requested and available """ id: str @@ -16,32 +16,27 @@ class SearchResultIncludedDocumentParams(typing_extensions.TypedDict): Source document identifier """ - title: typing_extensions.NotRequired[typing.Optional[str]] + title: typing.Optional[str] """ Source document title """ - type: typing_extensions.NotRequired[typing.Optional[str]] + type: typing.Optional[str] """ Detected source or content type """ - metadata: typing_extensions.NotRequired[typing.Optional[typing.Dict[str, typing.Any]]] + metadata: typing.Dict[str, typing.Any] """ Public metadata attached to the source document """ - summary: typing_extensions.NotRequired[typing.Optional[str]] + summary: typing.Optional[str] """ Generated summary of the source document """ - created_at: typing_extensions.Annotated[str, FieldMetadata(alias="createdAt")] + system: SearchResultIncludedDocumentSystemParams """ - ISO 8601 timestamp when the source document was created - """ - - updated_at: typing_extensions.Annotated[str, FieldMetadata(alias="updatedAt")] - """ - ISO 8601 timestamp of the source document's latest update + Lifecycle timestamps maintained by Supermemory """ diff --git a/src/supermemory/requests/search_result_included_document_system.py b/src/supermemory/requests/search_result_included_document_system.py new file mode 100644 index 0000000..562f168 --- /dev/null +++ b/src/supermemory/requests/search_result_included_document_system.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing_extensions +from ..core.serialization import FieldMetadata + + +class SearchResultIncludedDocumentSystemParams(typing_extensions.TypedDict): + """ + Lifecycle timestamps maintained by Supermemory + """ + + created_at: typing_extensions.Annotated[str, FieldMetadata(alias="createdAt")] + """ + ISO 8601 timestamp when the source document was created + """ + + updated_at: typing_extensions.Annotated[str, FieldMetadata(alias="updatedAt")] + """ + ISO 8601 timestamp of the source document's latest update + """ diff --git a/src/supermemory/types/__init__.py b/src/supermemory/types/__init__.py index 20037e7..397db6f 100644 --- a/src/supermemory/types/__init__.py +++ b/src/supermemory/types/__init__.py @@ -8,6 +8,7 @@ if typing.TYPE_CHECKING: from .bad_request_error_body import BadRequestErrorBody from .batch_add_item_result import BatchAddItemResult + from .batch_add_item_result_status import BatchAddItemResultStatus from .batch_add_result import BatchAddResult from .chunk import Chunk from .chunk_list_item import ChunkListItem @@ -17,10 +18,13 @@ from .connector_config_value import ConnectorConfigValue from .connector_deleted import ConnectorDeleted from .connector_error_code import ConnectorErrorCode - from .connector_last_sync import ConnectorLastSync + from .connector_include import ConnectorInclude + from .connector_link import ConnectorLink from .connector_list import ConnectorList - from .connector_picker import ConnectorPicker from .connector_provider import ConnectorProvider + from .connector_run import ConnectorRun + from .connector_run_status import ConnectorRunStatus + from .connector_run_system import ConnectorRunSystem from .connector_selection import ConnectorSelection from .connector_selection_item import ConnectorSelectionItem from .connector_setup import ( @@ -47,20 +51,23 @@ from .connector_sync import ConnectorSync from .connector_sync_failure import ConnectorSyncFailure from .connector_sync_started import ConnectorSyncStarted - from .connector_sync_status import ConnectorSyncStatus + from .connector_sync_system import ConnectorSyncSystem from .connector_sync_trigger import ConnectorSyncTrigger + from .connector_system import ConnectorSystem from .delete_document_error import DeleteDocumentError from .delete_documents_result import DeleteDocumentsResult from .document import Document - from .document_attachment import DocumentAttachment + from .document_include import DocumentInclude from .document_input import DocumentInput from .document_list_item import DocumentListItem + from .document_list_item_system import DocumentListItemSystem from .document_ref import DocumentRef + from .document_ref_status import DocumentRefStatus from .document_system import DocumentSystem + from .document_system_status import DocumentSystemStatus from .dreaming_mode import DreamingMode from .error_response import ErrorResponse from .file_type import FileType - from .file_upload_result import FileUploadResult from .filter_and import FilterAnd from .filter_array_contains import FilterArrayContains from .filter_array_contains_operator import FilterArrayContainsOperator @@ -82,12 +89,29 @@ from .google_drive_config import GoogleDriveConfig from .google_drive_config_sync_scope import GoogleDriveConfigSyncScope from .granola_config import GranolaConfig - from .list_request_limit import ListRequestLimit - from .list_request_page import ListRequestPage + from .list_request_include import ListRequestInclude from .list_response import ListResponse from .list_sort import ListSort from .list_type import ListType from .memory import Memory + from .memory_details import MemoryDetails + from .memory_include import MemoryInclude + from .memory_included import MemoryIncluded + from .memory_included_document import MemoryIncludedDocument + from .memory_included_document_system import MemoryIncludedDocumentSystem + from .memory_included_related import MemoryIncludedRelated + from .memory_included_related_children_item import MemoryIncludedRelatedChildrenItem + from .memory_included_related_children_item_document import MemoryIncludedRelatedChildrenItemDocument + from .memory_included_related_children_item_document_system import MemoryIncludedRelatedChildrenItemDocumentSystem + from .memory_included_related_children_item_system import MemoryIncludedRelatedChildrenItemSystem + from .memory_included_related_parents_item import MemoryIncludedRelatedParentsItem + from .memory_included_related_parents_item_document import MemoryIncludedRelatedParentsItemDocument + from .memory_included_related_parents_item_document_system import MemoryIncludedRelatedParentsItemDocumentSystem + from .memory_included_related_parents_item_system import MemoryIncludedRelatedParentsItemSystem + from .memory_included_related_siblings_item import MemoryIncludedRelatedSiblingsItem + from .memory_included_related_siblings_item_document import MemoryIncludedRelatedSiblingsItemDocument + from .memory_included_related_siblings_item_document_system import MemoryIncludedRelatedSiblingsItemDocumentSystem + from .memory_included_related_siblings_item_system import MemoryIncludedRelatedSiblingsItemSystem from .memory_relation import MemoryRelation from .memory_system import MemorySystem from .metadata_value import MetadataValue @@ -96,6 +120,7 @@ from .namespace_deleted_deleted import NamespaceDeletedDeleted from .namespace_deleted_queued import NamespaceDeletedQueued from .namespace_details import NamespaceDetails + from .namespace_list import NamespaceList from .namespace_system import NamespaceSystem from .organization import Organization from .pagination import Pagination @@ -107,13 +132,14 @@ from .related_memory import RelatedMemory from .related_memory_system import RelatedMemorySystem from .s3config import S3Config + from .search_include import SearchInclude from .search_mode import SearchMode - from .search_request_attach import SearchRequestAttach from .search_request_rerank import SearchRequestRerank from .search_response import SearchResponse from .search_result import SearchResult from .search_result_included import SearchResultIncluded from .search_result_included_document import SearchResultIncludedDocument + from .search_result_included_document_system import SearchResultIncludedDocumentSystem from .search_result_system import SearchResultSystem from .sort_order import SortOrder from .task_type import TaskType @@ -124,6 +150,7 @@ _dynamic_imports: typing.Dict[str, str] = { "BadRequestErrorBody": ".bad_request_error_body", "BatchAddItemResult": ".batch_add_item_result", + "BatchAddItemResultStatus": ".batch_add_item_result_status", "BatchAddResult": ".batch_add_result", "Chunk": ".chunk", "ChunkListItem": ".chunk_list_item", @@ -133,10 +160,13 @@ "ConnectorConfigValue": ".connector_config_value", "ConnectorDeleted": ".connector_deleted", "ConnectorErrorCode": ".connector_error_code", - "ConnectorLastSync": ".connector_last_sync", + "ConnectorInclude": ".connector_include", + "ConnectorLink": ".connector_link", "ConnectorList": ".connector_list", - "ConnectorPicker": ".connector_picker", "ConnectorProvider": ".connector_provider", + "ConnectorRun": ".connector_run", + "ConnectorRunStatus": ".connector_run_status", + "ConnectorRunSystem": ".connector_run_system", "ConnectorSelection": ".connector_selection", "ConnectorSelectionItem": ".connector_selection_item", "ConnectorSetup": ".connector_setup", @@ -161,20 +191,23 @@ "ConnectorSync": ".connector_sync", "ConnectorSyncFailure": ".connector_sync_failure", "ConnectorSyncStarted": ".connector_sync_started", - "ConnectorSyncStatus": ".connector_sync_status", + "ConnectorSyncSystem": ".connector_sync_system", "ConnectorSyncTrigger": ".connector_sync_trigger", + "ConnectorSystem": ".connector_system", "DeleteDocumentError": ".delete_document_error", "DeleteDocumentsResult": ".delete_documents_result", "Document": ".document", - "DocumentAttachment": ".document_attachment", + "DocumentInclude": ".document_include", "DocumentInput": ".document_input", "DocumentListItem": ".document_list_item", + "DocumentListItemSystem": ".document_list_item_system", "DocumentRef": ".document_ref", + "DocumentRefStatus": ".document_ref_status", "DocumentSystem": ".document_system", + "DocumentSystemStatus": ".document_system_status", "DreamingMode": ".dreaming_mode", "ErrorResponse": ".error_response", "FileType": ".file_type", - "FileUploadResult": ".file_upload_result", "FilterAnd": ".filter_and", "FilterArrayContains": ".filter_array_contains", "FilterArrayContainsOperator": ".filter_array_contains_operator", @@ -196,12 +229,29 @@ "GoogleDriveConfig": ".google_drive_config", "GoogleDriveConfigSyncScope": ".google_drive_config_sync_scope", "GranolaConfig": ".granola_config", - "ListRequestLimit": ".list_request_limit", - "ListRequestPage": ".list_request_page", + "ListRequestInclude": ".list_request_include", "ListResponse": ".list_response", "ListSort": ".list_sort", "ListType": ".list_type", "Memory": ".memory", + "MemoryDetails": ".memory_details", + "MemoryInclude": ".memory_include", + "MemoryIncluded": ".memory_included", + "MemoryIncludedDocument": ".memory_included_document", + "MemoryIncludedDocumentSystem": ".memory_included_document_system", + "MemoryIncludedRelated": ".memory_included_related", + "MemoryIncludedRelatedChildrenItem": ".memory_included_related_children_item", + "MemoryIncludedRelatedChildrenItemDocument": ".memory_included_related_children_item_document", + "MemoryIncludedRelatedChildrenItemDocumentSystem": ".memory_included_related_children_item_document_system", + "MemoryIncludedRelatedChildrenItemSystem": ".memory_included_related_children_item_system", + "MemoryIncludedRelatedParentsItem": ".memory_included_related_parents_item", + "MemoryIncludedRelatedParentsItemDocument": ".memory_included_related_parents_item_document", + "MemoryIncludedRelatedParentsItemDocumentSystem": ".memory_included_related_parents_item_document_system", + "MemoryIncludedRelatedParentsItemSystem": ".memory_included_related_parents_item_system", + "MemoryIncludedRelatedSiblingsItem": ".memory_included_related_siblings_item", + "MemoryIncludedRelatedSiblingsItemDocument": ".memory_included_related_siblings_item_document", + "MemoryIncludedRelatedSiblingsItemDocumentSystem": ".memory_included_related_siblings_item_document_system", + "MemoryIncludedRelatedSiblingsItemSystem": ".memory_included_related_siblings_item_system", "MemoryRelation": ".memory_relation", "MemorySystem": ".memory_system", "MetadataValue": ".metadata_value", @@ -212,6 +262,7 @@ "NamespaceDeleted_Deleted": ".namespace_deleted", "NamespaceDeleted_Queued": ".namespace_deleted", "NamespaceDetails": ".namespace_details", + "NamespaceList": ".namespace_list", "NamespaceSystem": ".namespace_system", "Organization": ".organization", "Pagination": ".pagination", @@ -223,13 +274,14 @@ "RelatedMemory": ".related_memory", "RelatedMemorySystem": ".related_memory_system", "S3Config": ".s3config", + "SearchInclude": ".search_include", "SearchMode": ".search_mode", - "SearchRequestAttach": ".search_request_attach", "SearchRequestRerank": ".search_request_rerank", "SearchResponse": ".search_response", "SearchResult": ".search_result", "SearchResultIncluded": ".search_result_included", "SearchResultIncludedDocument": ".search_result_included_document", + "SearchResultIncludedDocumentSystem": ".search_result_included_document_system", "SearchResultSystem": ".search_result_system", "SortOrder": ".sort_order", "TaskType": ".task_type", @@ -264,6 +316,7 @@ def __dir__(): __all__ = [ "BadRequestErrorBody", "BatchAddItemResult", + "BatchAddItemResultStatus", "BatchAddResult", "Chunk", "ChunkListItem", @@ -273,10 +326,13 @@ def __dir__(): "ConnectorConfigValue", "ConnectorDeleted", "ConnectorErrorCode", - "ConnectorLastSync", + "ConnectorInclude", + "ConnectorLink", "ConnectorList", - "ConnectorPicker", "ConnectorProvider", + "ConnectorRun", + "ConnectorRunStatus", + "ConnectorRunSystem", "ConnectorSelection", "ConnectorSelectionItem", "ConnectorSetup", @@ -301,20 +357,23 @@ def __dir__(): "ConnectorSync", "ConnectorSyncFailure", "ConnectorSyncStarted", - "ConnectorSyncStatus", + "ConnectorSyncSystem", "ConnectorSyncTrigger", + "ConnectorSystem", "DeleteDocumentError", "DeleteDocumentsResult", "Document", - "DocumentAttachment", + "DocumentInclude", "DocumentInput", "DocumentListItem", + "DocumentListItemSystem", "DocumentRef", + "DocumentRefStatus", "DocumentSystem", + "DocumentSystemStatus", "DreamingMode", "ErrorResponse", "FileType", - "FileUploadResult", "FilterAnd", "FilterArrayContains", "FilterArrayContainsOperator", @@ -336,12 +395,29 @@ def __dir__(): "GoogleDriveConfig", "GoogleDriveConfigSyncScope", "GranolaConfig", - "ListRequestLimit", - "ListRequestPage", + "ListRequestInclude", "ListResponse", "ListSort", "ListType", "Memory", + "MemoryDetails", + "MemoryInclude", + "MemoryIncluded", + "MemoryIncludedDocument", + "MemoryIncludedDocumentSystem", + "MemoryIncludedRelated", + "MemoryIncludedRelatedChildrenItem", + "MemoryIncludedRelatedChildrenItemDocument", + "MemoryIncludedRelatedChildrenItemDocumentSystem", + "MemoryIncludedRelatedChildrenItemSystem", + "MemoryIncludedRelatedParentsItem", + "MemoryIncludedRelatedParentsItemDocument", + "MemoryIncludedRelatedParentsItemDocumentSystem", + "MemoryIncludedRelatedParentsItemSystem", + "MemoryIncludedRelatedSiblingsItem", + "MemoryIncludedRelatedSiblingsItemDocument", + "MemoryIncludedRelatedSiblingsItemDocumentSystem", + "MemoryIncludedRelatedSiblingsItemSystem", "MemoryRelation", "MemorySystem", "MetadataValue", @@ -352,6 +428,7 @@ def __dir__(): "NamespaceDeleted_Deleted", "NamespaceDeleted_Queued", "NamespaceDetails", + "NamespaceList", "NamespaceSystem", "Organization", "Pagination", @@ -363,13 +440,14 @@ def __dir__(): "RelatedMemory", "RelatedMemorySystem", "S3Config", + "SearchInclude", "SearchMode", - "SearchRequestAttach", "SearchRequestRerank", "SearchResponse", "SearchResult", "SearchResultIncluded", "SearchResultIncludedDocument", + "SearchResultIncludedDocumentSystem", "SearchResultSystem", "SortOrder", "TaskType", diff --git a/src/supermemory/types/batch_add_item_result.py b/src/supermemory/types/batch_add_item_result.py index c6ecca4..c22900a 100644 --- a/src/supermemory/types/batch_add_item_result.py +++ b/src/supermemory/types/batch_add_item_result.py @@ -5,32 +5,33 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2 from ..core.unchecked_base_model import UncheckedBaseModel +from .batch_add_item_result_status import BatchAddItemResultStatus class BatchAddItemResult(UncheckedBaseModel): id: str = pydantic.Field() """ - Unique identifier of the document (empty string for failed items) + Document identifier """ - status: str = pydantic.Field() + status: BatchAddItemResultStatus = pydantic.Field() """ - Status of the document (e.g. 'done', 'queued', 'error') + The document's processing state, as for a single add; error when this item failed """ error: typing.Optional[str] = pydantic.Field(default=None) """ - Error message when status is 'error' + Failure reason """ details: typing.Optional[str] = pydantic.Field(default=None) """ - Additional error details when status is 'error' + Human-readable explanation of the failure """ url: typing.Optional[str] = pydantic.Field(default=None) """ - URL of the failed item, when it had one. Only present on failed items, where it may be the only way to tell which input the error belongs to (the id falls back to 'unknown' when the input had neither an id nor a customId). + URL of the failed item, when it had one """ if IS_PYDANTIC_V2: diff --git a/src/supermemory/types/batch_add_item_result_status.py b/src/supermemory/types/batch_add_item_result_status.py new file mode 100644 index 0000000..a9d4f82 --- /dev/null +++ b/src/supermemory/types/batch_add_item_result_status.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BatchAddItemResultStatus = typing.Union[ + typing.Literal["unknown", "queued", "extracting", "chunking", "embedding", "indexing", "done", "failed", "error"], + typing.Any, +] diff --git a/src/supermemory/types/batch_add_result.py b/src/supermemory/types/batch_add_result.py index d92f753..9ce3142 100644 --- a/src/supermemory/types/batch_add_result.py +++ b/src/supermemory/types/batch_add_result.py @@ -11,17 +11,17 @@ class BatchAddResult(UncheckedBaseModel): results: typing.List[BatchAddItemResult] = pydantic.Field() """ - Array of results for each document in the batch + One result per submitted document: accepted documents first, in request order, then failed ones. Match results by id, or by url for a failed item with no id. """ - failed: float = pydantic.Field() + count: int = pydantic.Field() """ - Count of documents that failed to add + Number of documents accepted """ - success: float = pydantic.Field() + failed: int = pydantic.Field() """ - Count of documents successfully added + Number of documents that failed """ if IS_PYDANTIC_V2: diff --git a/src/supermemory/types/chunk.py b/src/supermemory/types/chunk.py index 3a8c1f8..b10a87b 100644 --- a/src/supermemory/types/chunk.py +++ b/src/supermemory/types/chunk.py @@ -33,9 +33,9 @@ class Chunk(UncheckedBaseModel): Chunk content type """ - metadata: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + metadata: typing.Dict[str, typing.Any] = pydantic.Field() """ - Chunk metadata, when available + Chunk metadata; empty object when none """ system: ChunkSystem = pydantic.Field() diff --git a/src/supermemory/types/chunk_list_item.py b/src/supermemory/types/chunk_list_item.py index 9ebee84..d90a30e 100644 --- a/src/supermemory/types/chunk_list_item.py +++ b/src/supermemory/types/chunk_list_item.py @@ -31,9 +31,9 @@ class ChunkListItem(UncheckedBaseModel): Chunk content type """ - metadata: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + metadata: typing.Dict[str, typing.Any] = pydantic.Field() """ - Chunk metadata, when available + Chunk metadata; empty object when none """ system: ChunkSystem = pydantic.Field() diff --git a/src/supermemory/types/connector.py b/src/supermemory/types/connector.py index a778f34..09f3407 100644 --- a/src/supermemory/types/connector.py +++ b/src/supermemory/types/connector.py @@ -1,6 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt import typing import pydantic @@ -10,12 +9,12 @@ from ..core.unchecked_base_model import UncheckedBaseModel from .connector_capabilities import ConnectorCapabilities from .connector_config_value import ConnectorConfigValue -from .connector_last_sync import ConnectorLastSync -from .connector_picker import ConnectorPicker +from .connector_link import ConnectorLink from .connector_provider import ConnectorProvider +from .connector_run import ConnectorRun from .connector_selection_item import ConnectorSelectionItem -from .connector_status import ConnectorStatus from .connector_sync import ConnectorSync +from .connector_system import ConnectorSystem class Connector(UncheckedBaseModel): @@ -25,30 +24,9 @@ class Connector(UncheckedBaseModel): External source """ - status: ConnectorStatus = pydantic.Field() + authorization: typing.Optional[ConnectorLink] = pydantic.Field(default=None) """ - pending_authorization until the user finishes the provider login at authUrl; DELETE cancels it. Pending connectors are not listed. - """ - - auth_url: typing_extensions.Annotated[ - typing.Optional[str], - FieldMetadata(alias="authUrl"), - pydantic.Field( - alias="authUrl", - description="Present while pending, when the caller can create connectors in this namespace: where to send the user to authorize", - ), - ] = None - """ - Present while pending, when the caller can create connectors in this namespace: where to send the user to authorize - """ - - auth_url_expires_at: typing_extensions.Annotated[ - typing.Optional[dt.datetime], - FieldMetadata(alias="authUrlExpiresAt"), - pydantic.Field(alias="authUrlExpiresAt", description="Present while pending: when authUrl stops working"), - ] = None - """ - Present while pending: when authUrl stops working + Present while pending, when the caller can create connectors in this namespace """ namespace: typing.Optional[str] = pydantic.Field(default=None) @@ -80,35 +58,30 @@ class Connector(UncheckedBaseModel): document_count: typing_extensions.Annotated[ float, FieldMetadata(alias="documentCount"), pydantic.Field(alias="documentCount") ] - last_sync: typing_extensions.Annotated[ - typing.Optional[ConnectorLastSync], - FieldMetadata(alias="lastSync"), - pydantic.Field(alias="lastSync", description="Most recent sync run"), + latest_run: typing_extensions.Annotated[ + typing.Optional[ConnectorRun], + FieldMetadata(alias="latestRun"), + pydantic.Field( + alias="latestRun", description="The most recent sync run, which may still be running or may have failed" + ), ] = None """ - Most recent sync run + The most recent sync run, which may still be running or may have failed """ - last_synced_at: typing_extensions.Annotated[ - typing.Optional[dt.datetime], - FieldMetadata(alias="lastSyncedAt"), - pydantic.Field(alias="lastSyncedAt", description="When content last finished syncing"), - ] = None + system: ConnectorSystem = pydantic.Field() """ - When content last finished syncing + Lifecycle status and timestamps maintained by Supermemory """ - created_at: typing_extensions.Annotated[ - dt.datetime, FieldMetadata(alias="createdAt"), pydantic.Field(alias="createdAt") - ] syncs: typing.Optional[typing.List[ConnectorSync]] = pydantic.Field(default=None) """ - Present when attach=syncs + Present when include=syncs """ - picker: typing.Optional[ConnectorPicker] = pydantic.Field(default=None) + picker: typing.Optional[ConnectorLink] = pydantic.Field(default=None) """ - Present when attach=picker. Null for connectors that sync everything. + Present when include=picker. Null for connectors that sync everything. """ if IS_PYDANTIC_V2: diff --git a/src/supermemory/requests/list_request_page.py b/src/supermemory/types/connector_include.py similarity index 50% rename from src/supermemory/requests/list_request_page.py rename to src/supermemory/types/connector_include.py index 84cfacd..37a9695 100644 --- a/src/supermemory/requests/list_request_page.py +++ b/src/supermemory/types/connector_include.py @@ -2,4 +2,4 @@ import typing -ListRequestPageParams = typing.Union[str, float] +ConnectorInclude = typing.Union[typing.Literal["syncs", "picker"], typing.Any] diff --git a/src/supermemory/types/connector_picker.py b/src/supermemory/types/connector_link.py similarity index 95% rename from src/supermemory/types/connector_picker.py rename to src/supermemory/types/connector_link.py index eabee7d..629b7ed 100644 --- a/src/supermemory/types/connector_picker.py +++ b/src/supermemory/types/connector_link.py @@ -10,7 +10,7 @@ from ..core.unchecked_base_model import UncheckedBaseModel -class ConnectorPicker(UncheckedBaseModel): +class ConnectorLink(UncheckedBaseModel): url: str = pydantic.Field() """ Send the user here to choose what syncs. Works once, in any browser. diff --git a/src/supermemory/types/connector_last_sync.py b/src/supermemory/types/connector_run.py similarity index 66% rename from src/supermemory/types/connector_last_sync.py rename to src/supermemory/types/connector_run.py index 677a86d..713f1ee 100644 --- a/src/supermemory/types/connector_last_sync.py +++ b/src/supermemory/types/connector_run.py @@ -1,6 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt import typing import pydantic @@ -9,11 +8,10 @@ from ..core.serialization import FieldMetadata from ..core.unchecked_base_model import UncheckedBaseModel from .connector_error_code import ConnectorErrorCode -from .connector_sync_status import ConnectorSyncStatus +from .connector_run_system import ConnectorRunSystem -class ConnectorLastSync(UncheckedBaseModel): - status: ConnectorSyncStatus +class ConnectorRun(UncheckedBaseModel): error_code: typing_extensions.Annotated[ typing.Optional[ConnectorErrorCode], FieldMetadata(alias="errorCode"), pydantic.Field(alias="errorCode") ] = None @@ -22,12 +20,10 @@ class ConnectorLastSync(UncheckedBaseModel): Customer-safe error message """ - started_at: typing_extensions.Annotated[ - dt.datetime, FieldMetadata(alias="startedAt"), pydantic.Field(alias="startedAt") - ] - completed_at: typing_extensions.Annotated[ - typing.Optional[dt.datetime], FieldMetadata(alias="completedAt"), pydantic.Field(alias="completedAt") - ] = None + system: ConnectorRunSystem = pydantic.Field() + """ + Run status and timestamps maintained by Supermemory + """ if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/supermemory/types/connector_run_status.py b/src/supermemory/types/connector_run_status.py new file mode 100644 index 0000000..ea85722 --- /dev/null +++ b/src/supermemory/types/connector_run_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConnectorRunStatus = typing.Union[typing.Literal["running", "completed", "failed"], typing.Any] diff --git a/src/supermemory/types/connector_run_system.py b/src/supermemory/types/connector_run_system.py new file mode 100644 index 0000000..81ddfae --- /dev/null +++ b/src/supermemory/types/connector_run_system.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .connector_run_status import ConnectorRunStatus + + +class ConnectorRunSystem(UncheckedBaseModel): + """ + Run status and timestamps maintained by Supermemory + """ + + status: ConnectorRunStatus + started_at: typing_extensions.Annotated[ + dt.datetime, + FieldMetadata(alias="startedAt"), + pydantic.Field(alias="startedAt", description="ISO 8601 timestamp when the run started"), + ] + """ + ISO 8601 timestamp when the run started + """ + + completed_at: typing_extensions.Annotated[ + typing.Optional[dt.datetime], + FieldMetadata(alias="completedAt"), + pydantic.Field(alias="completedAt", description="ISO 8601 timestamp when the run ended; null while running"), + ] = None + """ + ISO 8601 timestamp when the run ended; null while running + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/supermemory/types/connector_setup_result.py b/src/supermemory/types/connector_setup_result.py index 3223089..901fff9 100644 --- a/src/supermemory/types/connector_setup_result.py +++ b/src/supermemory/types/connector_setup_result.py @@ -1,13 +1,11 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt import typing import pydantic -import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.serialization import FieldMetadata from ..core.unchecked_base_model import UncheckedBaseModel +from .connector_link import ConnectorLink class ConnectorSetupResult(UncheckedBaseModel): @@ -16,25 +14,9 @@ class ConnectorSetupResult(UncheckedBaseModel): Connector identifier """ - auth_url: typing_extensions.Annotated[ - typing.Optional[str], - FieldMetadata(alias="authUrl"), - pydantic.Field( - alias="authUrl", - description="Send the user here to authorize the provider. Null for providers that authenticate with config only.", - ), - ] = None + authorization: typing.Optional[ConnectorLink] = pydantic.Field(default=None) """ - Send the user here to authorize the provider. Null for providers that authenticate with config only. - """ - - auth_url_expires_at: typing_extensions.Annotated[ - typing.Optional[dt.datetime], - FieldMetadata(alias="authUrlExpiresAt"), - pydantic.Field(alias="authUrlExpiresAt", description="When authUrl stops working"), - ] = None - """ - When authUrl stops working + Null for providers that authenticate with config only """ if IS_PYDANTIC_V2: diff --git a/src/supermemory/types/connector_sync.py b/src/supermemory/types/connector_sync.py index 8a069cc..d038853 100644 --- a/src/supermemory/types/connector_sync.py +++ b/src/supermemory/types/connector_sync.py @@ -1,6 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt import typing import pydantic @@ -10,12 +9,11 @@ from ..core.unchecked_base_model import UncheckedBaseModel from .connector_error_code import ConnectorErrorCode from .connector_sync_failure import ConnectorSyncFailure -from .connector_sync_status import ConnectorSyncStatus +from .connector_sync_system import ConnectorSyncSystem from .connector_sync_trigger import ConnectorSyncTrigger class ConnectorSync(UncheckedBaseModel): - status: ConnectorSyncStatus error_code: typing_extensions.Annotated[ typing.Optional[ConnectorErrorCode], FieldMetadata(alias="errorCode"), pydantic.Field(alias="errorCode") ] = None @@ -24,12 +22,11 @@ class ConnectorSync(UncheckedBaseModel): Customer-safe error message """ - started_at: typing_extensions.Annotated[ - dt.datetime, FieldMetadata(alias="startedAt"), pydantic.Field(alias="startedAt") - ] - completed_at: typing_extensions.Annotated[ - typing.Optional[dt.datetime], FieldMetadata(alias="completedAt"), pydantic.Field(alias="completedAt") - ] = None + system: ConnectorSyncSystem = pydantic.Field() + """ + Run status and timestamps maintained by Supermemory + """ + id: str trigger: ConnectorSyncTrigger items_processed: typing_extensions.Annotated[ diff --git a/src/supermemory/types/connector_sync_status.py b/src/supermemory/types/connector_sync_status.py deleted file mode 100644 index 20e4882..0000000 --- a/src/supermemory/types/connector_sync_status.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ConnectorSyncStatus = typing.Union[typing.Literal["running", "completed", "failed"], typing.Any] diff --git a/src/supermemory/types/connector_sync_system.py b/src/supermemory/types/connector_sync_system.py new file mode 100644 index 0000000..d063319 --- /dev/null +++ b/src/supermemory/types/connector_sync_system.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .connector_run_status import ConnectorRunStatus + + +class ConnectorSyncSystem(UncheckedBaseModel): + """ + Run status and timestamps maintained by Supermemory + """ + + status: ConnectorRunStatus + started_at: typing_extensions.Annotated[ + dt.datetime, + FieldMetadata(alias="startedAt"), + pydantic.Field(alias="startedAt", description="ISO 8601 timestamp when the run started"), + ] + """ + ISO 8601 timestamp when the run started + """ + + completed_at: typing_extensions.Annotated[ + typing.Optional[dt.datetime], + FieldMetadata(alias="completedAt"), + pydantic.Field(alias="completedAt", description="ISO 8601 timestamp when the run ended; null while running"), + ] = None + """ + ISO 8601 timestamp when the run ended; null while running + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/supermemory/types/connector_system.py b/src/supermemory/types/connector_system.py new file mode 100644 index 0000000..8986fda --- /dev/null +++ b/src/supermemory/types/connector_system.py @@ -0,0 +1,52 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .connector_status import ConnectorStatus + + +class ConnectorSystem(UncheckedBaseModel): + """ + Lifecycle status and timestamps maintained by Supermemory + """ + + status: ConnectorStatus = pydantic.Field() + """ + pending_authorization until the user finishes the provider login at authorization.url; DELETE cancels it. Pending connectors are not listed. + """ + + created_at: typing_extensions.Annotated[ + dt.datetime, + FieldMetadata(alias="createdAt"), + pydantic.Field(alias="createdAt", description="ISO 8601 timestamp when the connector was created"), + ] + """ + ISO 8601 timestamp when the connector was created + """ + + last_successful_sync_at: typing_extensions.Annotated[ + typing.Optional[dt.datetime], + FieldMetadata(alias="lastSuccessfulSyncAt"), + pydantic.Field( + alias="lastSuccessfulSyncAt", + description="ISO 8601 timestamp when content last finished syncing successfully", + ), + ] = None + """ + ISO 8601 timestamp when content last finished syncing successfully + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/supermemory/types/delete_documents_result.py b/src/supermemory/types/delete_documents_result.py index e3272ea..69d5ce2 100644 --- a/src/supermemory/types/delete_documents_result.py +++ b/src/supermemory/types/delete_documents_result.py @@ -3,19 +3,13 @@ import typing import pydantic -import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.serialization import FieldMetadata from ..core.unchecked_base_model import UncheckedBaseModel from .delete_document_error import DeleteDocumentError class DeleteDocumentsResult(UncheckedBaseModel): - deleted_count: typing_extensions.Annotated[ - int, - FieldMetadata(alias="deletedCount"), - pydantic.Field(alias="deletedCount", description="Number of documents successfully deleted"), - ] + count: int = pydantic.Field() """ Number of documents successfully deleted """ diff --git a/src/supermemory/types/document.py b/src/supermemory/types/document.py index 9cd0872..86d0223 100644 --- a/src/supermemory/types/document.py +++ b/src/supermemory/types/document.py @@ -12,7 +12,7 @@ class Document(UncheckedBaseModel): """ - Namespace-scoped document. Attachment keys are omitted unless requested and are empty arrays when requested without results. + Namespace-scoped document. Included keys are omitted unless requested and are empty arrays when requested without results. """ id: str = pydantic.Field() diff --git a/src/supermemory/types/document_attachment.py b/src/supermemory/types/document_attachment.py deleted file mode 100644 index b691cd9..0000000 --- a/src/supermemory/types/document_attachment.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -DocumentAttachment = typing.Union[typing.Literal["chunks", "memories"], typing.Any] diff --git a/src/supermemory/types/document_include.py b/src/supermemory/types/document_include.py new file mode 100644 index 0000000..f02642c --- /dev/null +++ b/src/supermemory/types/document_include.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DocumentInclude = typing.Union[typing.Literal["chunks", "memories"], typing.Any] diff --git a/src/supermemory/types/document_list_item.py b/src/supermemory/types/document_list_item.py index 56346b4..13e3ff7 100644 --- a/src/supermemory/types/document_list_item.py +++ b/src/supermemory/types/document_list_item.py @@ -5,7 +5,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2 from ..core.unchecked_base_model import UncheckedBaseModel -from .document_system import DocumentSystem +from .document_list_item_system import DocumentListItemSystem class DocumentListItem(UncheckedBaseModel): @@ -43,7 +43,7 @@ class DocumentListItem(UncheckedBaseModel): Original source URL, when the document was ingested from the web """ - system: DocumentSystem = pydantic.Field() + system: DocumentListItemSystem = pydantic.Field() """ Processing status, lifecycle timestamps, and storage path maintained by Supermemory """ diff --git a/src/supermemory/types/document_list_item_system.py b/src/supermemory/types/document_list_item_system.py new file mode 100644 index 0000000..8604708 --- /dev/null +++ b/src/supermemory/types/document_list_item_system.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DocumentListItemSystem(UncheckedBaseModel): + """ + Processing status, lifecycle timestamps, and storage path maintained by Supermemory + """ + + status: str = pydantic.Field() + """ + Current extraction and memory-processing status + """ + + created_at: typing_extensions.Annotated[ + dt.datetime, + FieldMetadata(alias="createdAt"), + pydantic.Field(alias="createdAt", description="ISO 8601 timestamp when the document was created"), + ] + """ + ISO 8601 timestamp when the document was created + """ + + updated_at: typing_extensions.Annotated[ + dt.datetime, + FieldMetadata(alias="updatedAt"), + pydantic.Field(alias="updatedAt", description="ISO 8601 timestamp of the latest document update"), + ] + """ + ISO 8601 timestamp of the latest document update + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/supermemory/types/document_ref.py b/src/supermemory/types/document_ref.py index 6df71cc..b110ab1 100644 --- a/src/supermemory/types/document_ref.py +++ b/src/supermemory/types/document_ref.py @@ -5,17 +5,18 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2 from ..core.unchecked_base_model import UncheckedBaseModel +from .document_ref_status import DocumentRefStatus class DocumentRef(UncheckedBaseModel): id: str = pydantic.Field() """ - Unique identifier of the document + Document identifier to poll or retrieve """ - status: str = pydantic.Field() + status: DocumentRefStatus = pydantic.Field() """ - Status of the document + The document's processing state after this request. queued when new work was queued; otherwise its current state, e.g. done for an unchanged duplicate or failed for a metadata-only update to a failed document. """ if IS_PYDANTIC_V2: diff --git a/src/supermemory/types/document_ref_status.py b/src/supermemory/types/document_ref_status.py new file mode 100644 index 0000000..b1468a8 --- /dev/null +++ b/src/supermemory/types/document_ref_status.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DocumentRefStatus = typing.Union[ + typing.Literal["unknown", "queued", "extracting", "chunking", "embedding", "indexing", "done", "failed"], typing.Any +] diff --git a/src/supermemory/types/document_system.py b/src/supermemory/types/document_system.py index 84141d0..db8adff 100644 --- a/src/supermemory/types/document_system.py +++ b/src/supermemory/types/document_system.py @@ -8,6 +8,7 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2 from ..core.serialization import FieldMetadata from ..core.unchecked_base_model import UncheckedBaseModel +from .document_system_status import DocumentSystemStatus class DocumentSystem(UncheckedBaseModel): @@ -15,7 +16,7 @@ class DocumentSystem(UncheckedBaseModel): Processing status, lifecycle timestamps, and storage path maintained by Supermemory """ - status: str = pydantic.Field() + status: DocumentSystemStatus = pydantic.Field() """ Current extraction and memory-processing status """ diff --git a/src/supermemory/types/document_system_status.py b/src/supermemory/types/document_system_status.py new file mode 100644 index 0000000..af74121 --- /dev/null +++ b/src/supermemory/types/document_system_status.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DocumentSystemStatus = typing.Union[ + typing.Literal["unknown", "queued", "extracting", "chunking", "embedding", "indexing", "done", "failed"], typing.Any +] diff --git a/src/supermemory/types/file_upload_result.py b/src/supermemory/types/list_request_include.py similarity index 67% rename from src/supermemory/types/file_upload_result.py rename to src/supermemory/types/list_request_include.py index 997e6be..c8e17d6 100644 --- a/src/supermemory/types/file_upload_result.py +++ b/src/supermemory/types/list_request_include.py @@ -7,15 +7,14 @@ from ..core.unchecked_base_model import UncheckedBaseModel -class FileUploadResult(UncheckedBaseModel): - id: str = pydantic.Field() +class ListRequestInclude(UncheckedBaseModel): """ - Document identifier to poll or retrieve + Optional extras, matching search's include """ - status: typing.Literal["processing"] = pydantic.Field(default="processing") + forgotten: typing.Optional[bool] = pydantic.Field(default=None) """ - Confirms the file was accepted for asynchronous processing + List forgotten and expired memories too, with isForgotten: true. Applies to type memories only. """ if IS_PYDANTIC_V2: diff --git a/src/supermemory/types/list_request_limit.py b/src/supermemory/types/list_request_limit.py deleted file mode 100644 index 5b4838d..0000000 --- a/src/supermemory/types/list_request_limit.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListRequestLimit = typing.Union[str, float] diff --git a/src/supermemory/types/list_request_page.py b/src/supermemory/types/list_request_page.py deleted file mode 100644 index d06e301..0000000 --- a/src/supermemory/types/list_request_page.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListRequestPage = typing.Union[str, float] diff --git a/src/supermemory/types/memory.py b/src/supermemory/types/memory.py index acb8284..533530b 100644 --- a/src/supermemory/types/memory.py +++ b/src/supermemory/types/memory.py @@ -25,9 +25,9 @@ class Memory(UncheckedBaseModel): Learned fact or context extracted from the document """ - metadata: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + metadata: typing.Dict[str, typing.Any] = pydantic.Field() """ - Memory metadata, including temporal context when available + Memory metadata, including temporal context; empty object when none """ is_static: typing_extensions.Annotated[ diff --git a/src/supermemory/types/memory_details.py b/src/supermemory/types/memory_details.py new file mode 100644 index 0000000..ea16057 --- /dev/null +++ b/src/supermemory/types/memory_details.py @@ -0,0 +1,90 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .memory_included import MemoryIncluded +from .memory_system import MemorySystem + + +class MemoryDetails(UncheckedBaseModel): + id: str = pydantic.Field() + """ + Stable memory identifier + """ + + memory: str = pydantic.Field() + """ + Learned fact or context extracted from the document + """ + + metadata: typing.Dict[str, typing.Any] = pydantic.Field() + """ + Memory metadata, including temporal context; empty object when none + """ + + is_static: typing_extensions.Annotated[ + bool, + FieldMetadata(alias="isStatic"), + pydantic.Field(alias="isStatic", description="Whether the memory belongs to the stable profile section"), + ] + """ + Whether the memory belongs to the stable profile section + """ + + is_inference: typing_extensions.Annotated[ + bool, + FieldMetadata(alias="isInference"), + pydantic.Field( + alias="isInference", description="Whether the memory was inferred rather than explicitly stated" + ), + ] + """ + Whether the memory was inferred rather than explicitly stated + """ + + is_latest: typing_extensions.Annotated[ + bool, + FieldMetadata(alias="isLatest"), + pydantic.Field(alias="isLatest", description="Whether this is the newest version in its memory chain"), + ] + """ + Whether this is the newest version in its memory chain + """ + + is_forgotten: typing_extensions.Annotated[ + bool, + FieldMetadata(alias="isForgotten"), + pydantic.Field(alias="isForgotten", description="Whether this memory has been excluded from normal recall"), + ] + """ + Whether this memory has been excluded from normal recall + """ + + version: int = pydantic.Field() + """ + Version number within the memory chain + """ + + system: MemorySystem = pydantic.Field() + """ + Lifecycle timestamps maintained by Supermemory + """ + + included: typing.Optional[MemoryIncluded] = pydantic.Field(default=None) + """ + Requested extras + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/supermemory/types/memory_include.py b/src/supermemory/types/memory_include.py new file mode 100644 index 0000000..7b23058 --- /dev/null +++ b/src/supermemory/types/memory_include.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MemoryInclude = typing.Union[typing.Literal["related", "documents"], typing.Any] diff --git a/src/supermemory/types/memory_included.py b/src/supermemory/types/memory_included.py new file mode 100644 index 0000000..28e29ea --- /dev/null +++ b/src/supermemory/types/memory_included.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .memory_included_document import MemoryIncludedDocument +from .memory_included_related import MemoryIncludedRelated + + +class MemoryIncluded(UncheckedBaseModel): + """ + Requested extras + """ + + related: typing.Optional[MemoryIncludedRelated] = pydantic.Field(default=None) + """ + Present when include has related + """ + + document: typing.Optional[MemoryIncludedDocument] = pydantic.Field(default=None) + """ + Source document; present when include has documents and one exists + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/supermemory/types/memory_included_document.py b/src/supermemory/types/memory_included_document.py new file mode 100644 index 0000000..1dc9b0b --- /dev/null +++ b/src/supermemory/types/memory_included_document.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .memory_included_document_system import MemoryIncludedDocumentSystem + + +class MemoryIncludedDocument(UncheckedBaseModel): + """ + Source document; present when include has documents and one exists + """ + + id: str = pydantic.Field() + """ + Source document identifier + """ + + title: typing.Optional[str] = pydantic.Field(default=None) + """ + Source document title + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + Detected source or content type + """ + + metadata: typing.Dict[str, typing.Any] = pydantic.Field() + """ + Public metadata attached to the source document + """ + + summary: typing.Optional[str] = pydantic.Field(default=None) + """ + Generated summary of the source document + """ + + system: MemoryIncludedDocumentSystem = pydantic.Field() + """ + Lifecycle timestamps maintained by Supermemory + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/supermemory/types/memory_included_document_system.py b/src/supermemory/types/memory_included_document_system.py new file mode 100644 index 0000000..6f14e85 --- /dev/null +++ b/src/supermemory/types/memory_included_document_system.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class MemoryIncludedDocumentSystem(UncheckedBaseModel): + """ + Lifecycle timestamps maintained by Supermemory + """ + + created_at: typing_extensions.Annotated[ + str, + FieldMetadata(alias="createdAt"), + pydantic.Field(alias="createdAt", description="ISO 8601 timestamp when the source document was created"), + ] + """ + ISO 8601 timestamp when the source document was created + """ + + updated_at: typing_extensions.Annotated[ + str, + FieldMetadata(alias="updatedAt"), + pydantic.Field(alias="updatedAt", description="ISO 8601 timestamp of the source document's latest update"), + ] + """ + ISO 8601 timestamp of the source document's latest update + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/supermemory/types/memory_included_related.py b/src/supermemory/types/memory_included_related.py new file mode 100644 index 0000000..ad9a01c --- /dev/null +++ b/src/supermemory/types/memory_included_related.py @@ -0,0 +1,40 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .memory_included_related_children_item import MemoryIncludedRelatedChildrenItem +from .memory_included_related_parents_item import MemoryIncludedRelatedParentsItem +from .memory_included_related_siblings_item import MemoryIncludedRelatedSiblingsItem + + +class MemoryIncludedRelated(UncheckedBaseModel): + """ + Present when include has related + """ + + parents: typing.List[MemoryIncludedRelatedParentsItem] = pydantic.Field() + """ + Earlier versions this memory updates, nearest first + """ + + children: typing.List[MemoryIncludedRelatedChildrenItem] = pydantic.Field() + """ + Newer versions that update this memory, nearest first + """ + + siblings: typing.List[MemoryIncludedRelatedSiblingsItem] = pydantic.Field() + """ + Memories connected by extends or derives, nearest first + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/supermemory/types/memory_included_related_children_item.py b/src/supermemory/types/memory_included_related_children_item.py new file mode 100644 index 0000000..58c32e6 --- /dev/null +++ b/src/supermemory/types/memory_included_related_children_item.py @@ -0,0 +1,56 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .memory_included_related_children_item_document import MemoryIncludedRelatedChildrenItemDocument +from .memory_included_related_children_item_system import MemoryIncludedRelatedChildrenItemSystem +from .memory_relation import MemoryRelation + + +class MemoryIncludedRelatedChildrenItem(UncheckedBaseModel): + id: str = pydantic.Field() + """ + Related memory ID + """ + + relation: MemoryRelation = pydantic.Field() + """ + How this memory is connected to the matched memory + """ + + version: typing.Optional[float] = pydantic.Field(default=None) + """ + Version number within the related memory's history + """ + + memory: str = pydantic.Field() + """ + Related learned fact or context + """ + + metadata: typing.Dict[str, typing.Any] = pydantic.Field() + """ + Public metadata associated with the related memory + """ + + system: MemoryIncludedRelatedChildrenItemSystem = pydantic.Field() + """ + Lifecycle details for the related memory + """ + + document: typing.Optional[MemoryIncludedRelatedChildrenItemDocument] = pydantic.Field(default=None) + """ + Source document; present when include has both related and documents + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/supermemory/types/memory_included_related_children_item_document.py b/src/supermemory/types/memory_included_related_children_item_document.py new file mode 100644 index 0000000..31d0c40 --- /dev/null +++ b/src/supermemory/types/memory_included_related_children_item_document.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .memory_included_related_children_item_document_system import MemoryIncludedRelatedChildrenItemDocumentSystem + + +class MemoryIncludedRelatedChildrenItemDocument(UncheckedBaseModel): + """ + Source document; present when include has both related and documents + """ + + id: str = pydantic.Field() + """ + Source document identifier + """ + + title: typing.Optional[str] = pydantic.Field(default=None) + """ + Source document title + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + Detected source or content type + """ + + metadata: typing.Dict[str, typing.Any] = pydantic.Field() + """ + Public metadata attached to the source document + """ + + summary: typing.Optional[str] = pydantic.Field(default=None) + """ + Generated summary of the source document + """ + + system: MemoryIncludedRelatedChildrenItemDocumentSystem = pydantic.Field() + """ + Lifecycle timestamps maintained by Supermemory + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/supermemory/types/memory_included_related_children_item_document_system.py b/src/supermemory/types/memory_included_related_children_item_document_system.py new file mode 100644 index 0000000..caae241 --- /dev/null +++ b/src/supermemory/types/memory_included_related_children_item_document_system.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class MemoryIncludedRelatedChildrenItemDocumentSystem(UncheckedBaseModel): + """ + Lifecycle timestamps maintained by Supermemory + """ + + created_at: typing_extensions.Annotated[ + str, + FieldMetadata(alias="createdAt"), + pydantic.Field(alias="createdAt", description="ISO 8601 timestamp when the source document was created"), + ] + """ + ISO 8601 timestamp when the source document was created + """ + + updated_at: typing_extensions.Annotated[ + str, + FieldMetadata(alias="updatedAt"), + pydantic.Field(alias="updatedAt", description="ISO 8601 timestamp of the source document's latest update"), + ] + """ + ISO 8601 timestamp of the source document's latest update + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/supermemory/types/memory_included_related_children_item_system.py b/src/supermemory/types/memory_included_related_children_item_system.py new file mode 100644 index 0000000..f2d6400 --- /dev/null +++ b/src/supermemory/types/memory_included_related_children_item_system.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class MemoryIncludedRelatedChildrenItemSystem(UncheckedBaseModel): + """ + Lifecycle details for the related memory + """ + + updated_at: typing_extensions.Annotated[ + str, + FieldMetadata(alias="updatedAt"), + pydantic.Field(alias="updatedAt", description="ISO 8601 timestamp of the related memory's latest update"), + ] + """ + ISO 8601 timestamp of the related memory's latest update + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/supermemory/types/memory_included_related_parents_item.py b/src/supermemory/types/memory_included_related_parents_item.py new file mode 100644 index 0000000..ef6beb3 --- /dev/null +++ b/src/supermemory/types/memory_included_related_parents_item.py @@ -0,0 +1,56 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .memory_included_related_parents_item_document import MemoryIncludedRelatedParentsItemDocument +from .memory_included_related_parents_item_system import MemoryIncludedRelatedParentsItemSystem +from .memory_relation import MemoryRelation + + +class MemoryIncludedRelatedParentsItem(UncheckedBaseModel): + id: str = pydantic.Field() + """ + Related memory ID + """ + + relation: MemoryRelation = pydantic.Field() + """ + How this memory is connected to the matched memory + """ + + version: typing.Optional[float] = pydantic.Field(default=None) + """ + Version number within the related memory's history + """ + + memory: str = pydantic.Field() + """ + Related learned fact or context + """ + + metadata: typing.Dict[str, typing.Any] = pydantic.Field() + """ + Public metadata associated with the related memory + """ + + system: MemoryIncludedRelatedParentsItemSystem = pydantic.Field() + """ + Lifecycle details for the related memory + """ + + document: typing.Optional[MemoryIncludedRelatedParentsItemDocument] = pydantic.Field(default=None) + """ + Source document; present when include has both related and documents + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/supermemory/types/memory_included_related_parents_item_document.py b/src/supermemory/types/memory_included_related_parents_item_document.py new file mode 100644 index 0000000..02065c0 --- /dev/null +++ b/src/supermemory/types/memory_included_related_parents_item_document.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .memory_included_related_parents_item_document_system import MemoryIncludedRelatedParentsItemDocumentSystem + + +class MemoryIncludedRelatedParentsItemDocument(UncheckedBaseModel): + """ + Source document; present when include has both related and documents + """ + + id: str = pydantic.Field() + """ + Source document identifier + """ + + title: typing.Optional[str] = pydantic.Field(default=None) + """ + Source document title + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + Detected source or content type + """ + + metadata: typing.Dict[str, typing.Any] = pydantic.Field() + """ + Public metadata attached to the source document + """ + + summary: typing.Optional[str] = pydantic.Field(default=None) + """ + Generated summary of the source document + """ + + system: MemoryIncludedRelatedParentsItemDocumentSystem = pydantic.Field() + """ + Lifecycle timestamps maintained by Supermemory + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/supermemory/types/memory_included_related_parents_item_document_system.py b/src/supermemory/types/memory_included_related_parents_item_document_system.py new file mode 100644 index 0000000..05bd17b --- /dev/null +++ b/src/supermemory/types/memory_included_related_parents_item_document_system.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class MemoryIncludedRelatedParentsItemDocumentSystem(UncheckedBaseModel): + """ + Lifecycle timestamps maintained by Supermemory + """ + + created_at: typing_extensions.Annotated[ + str, + FieldMetadata(alias="createdAt"), + pydantic.Field(alias="createdAt", description="ISO 8601 timestamp when the source document was created"), + ] + """ + ISO 8601 timestamp when the source document was created + """ + + updated_at: typing_extensions.Annotated[ + str, + FieldMetadata(alias="updatedAt"), + pydantic.Field(alias="updatedAt", description="ISO 8601 timestamp of the source document's latest update"), + ] + """ + ISO 8601 timestamp of the source document's latest update + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/supermemory/types/memory_included_related_parents_item_system.py b/src/supermemory/types/memory_included_related_parents_item_system.py new file mode 100644 index 0000000..c9bbb1a --- /dev/null +++ b/src/supermemory/types/memory_included_related_parents_item_system.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class MemoryIncludedRelatedParentsItemSystem(UncheckedBaseModel): + """ + Lifecycle details for the related memory + """ + + updated_at: typing_extensions.Annotated[ + str, + FieldMetadata(alias="updatedAt"), + pydantic.Field(alias="updatedAt", description="ISO 8601 timestamp of the related memory's latest update"), + ] + """ + ISO 8601 timestamp of the related memory's latest update + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/supermemory/types/memory_included_related_siblings_item.py b/src/supermemory/types/memory_included_related_siblings_item.py new file mode 100644 index 0000000..fbaa9c0 --- /dev/null +++ b/src/supermemory/types/memory_included_related_siblings_item.py @@ -0,0 +1,56 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .memory_included_related_siblings_item_document import MemoryIncludedRelatedSiblingsItemDocument +from .memory_included_related_siblings_item_system import MemoryIncludedRelatedSiblingsItemSystem +from .memory_relation import MemoryRelation + + +class MemoryIncludedRelatedSiblingsItem(UncheckedBaseModel): + id: str = pydantic.Field() + """ + Related memory ID + """ + + relation: MemoryRelation = pydantic.Field() + """ + How this memory is connected to the matched memory + """ + + version: typing.Optional[float] = pydantic.Field(default=None) + """ + Version number within the related memory's history + """ + + memory: str = pydantic.Field() + """ + Related learned fact or context + """ + + metadata: typing.Dict[str, typing.Any] = pydantic.Field() + """ + Public metadata associated with the related memory + """ + + system: MemoryIncludedRelatedSiblingsItemSystem = pydantic.Field() + """ + Lifecycle details for the related memory + """ + + document: typing.Optional[MemoryIncludedRelatedSiblingsItemDocument] = pydantic.Field(default=None) + """ + Source document; present when include has both related and documents + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/supermemory/types/memory_included_related_siblings_item_document.py b/src/supermemory/types/memory_included_related_siblings_item_document.py new file mode 100644 index 0000000..1070000 --- /dev/null +++ b/src/supermemory/types/memory_included_related_siblings_item_document.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .memory_included_related_siblings_item_document_system import MemoryIncludedRelatedSiblingsItemDocumentSystem + + +class MemoryIncludedRelatedSiblingsItemDocument(UncheckedBaseModel): + """ + Source document; present when include has both related and documents + """ + + id: str = pydantic.Field() + """ + Source document identifier + """ + + title: typing.Optional[str] = pydantic.Field(default=None) + """ + Source document title + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + Detected source or content type + """ + + metadata: typing.Dict[str, typing.Any] = pydantic.Field() + """ + Public metadata attached to the source document + """ + + summary: typing.Optional[str] = pydantic.Field(default=None) + """ + Generated summary of the source document + """ + + system: MemoryIncludedRelatedSiblingsItemDocumentSystem = pydantic.Field() + """ + Lifecycle timestamps maintained by Supermemory + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/supermemory/types/memory_included_related_siblings_item_document_system.py b/src/supermemory/types/memory_included_related_siblings_item_document_system.py new file mode 100644 index 0000000..751fca0 --- /dev/null +++ b/src/supermemory/types/memory_included_related_siblings_item_document_system.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class MemoryIncludedRelatedSiblingsItemDocumentSystem(UncheckedBaseModel): + """ + Lifecycle timestamps maintained by Supermemory + """ + + created_at: typing_extensions.Annotated[ + str, + FieldMetadata(alias="createdAt"), + pydantic.Field(alias="createdAt", description="ISO 8601 timestamp when the source document was created"), + ] + """ + ISO 8601 timestamp when the source document was created + """ + + updated_at: typing_extensions.Annotated[ + str, + FieldMetadata(alias="updatedAt"), + pydantic.Field(alias="updatedAt", description="ISO 8601 timestamp of the source document's latest update"), + ] + """ + ISO 8601 timestamp of the source document's latest update + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/supermemory/types/memory_included_related_siblings_item_system.py b/src/supermemory/types/memory_included_related_siblings_item_system.py new file mode 100644 index 0000000..63d1167 --- /dev/null +++ b/src/supermemory/types/memory_included_related_siblings_item_system.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class MemoryIncludedRelatedSiblingsItemSystem(UncheckedBaseModel): + """ + Lifecycle details for the related memory + """ + + updated_at: typing_extensions.Annotated[ + str, + FieldMetadata(alias="updatedAt"), + pydantic.Field(alias="updatedAt", description="ISO 8601 timestamp of the related memory's latest update"), + ] + """ + ISO 8601 timestamp of the related memory's latest update + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/supermemory/types/namespace_deleted.py b/src/supermemory/types/namespace_deleted.py index ec94455..2df27e5 100644 --- a/src/supermemory/types/namespace_deleted.py +++ b/src/supermemory/types/namespace_deleted.py @@ -13,7 +13,6 @@ class NamespaceDeleted_Deleted(UncheckedBaseModel): status: typing.Literal["deleted"] = "deleted" - success: typing.Literal[True] = True namespace: str deleted_documents_count: typing_extensions.Annotated[ int, FieldMetadata(alias="deletedDocumentsCount"), pydantic.Field(alias="deletedDocumentsCount") @@ -34,7 +33,6 @@ class Config: class NamespaceDeleted_Queued(UncheckedBaseModel): status: typing.Literal["queued"] = "queued" - success: typing.Literal[True] = True operation_id: typing_extensions.Annotated[ str, FieldMetadata(alias="operationId"), pydantic.Field(alias="operationId") ] diff --git a/src/supermemory/types/namespace_deleted_deleted.py b/src/supermemory/types/namespace_deleted_deleted.py index 05c0983..296b2f2 100644 --- a/src/supermemory/types/namespace_deleted_deleted.py +++ b/src/supermemory/types/namespace_deleted_deleted.py @@ -10,11 +10,6 @@ class NamespaceDeletedDeleted(UncheckedBaseModel): - success: typing.Literal[True] = pydantic.Field(default=True) - """ - Confirms the namespace was deleted - """ - namespace: str = pydantic.Field() """ Deleted namespace identifier diff --git a/src/supermemory/types/namespace_deleted_queued.py b/src/supermemory/types/namespace_deleted_queued.py index acf46ee..d04c51f 100644 --- a/src/supermemory/types/namespace_deleted_queued.py +++ b/src/supermemory/types/namespace_deleted_queued.py @@ -10,11 +10,6 @@ class NamespaceDeletedQueued(UncheckedBaseModel): - success: typing.Literal[True] = pydantic.Field(default=True) - """ - Confirms the namespace move was accepted - """ - operation_id: typing_extensions.Annotated[ str, FieldMetadata(alias="operationId"), diff --git a/src/supermemory/types/namespace_list.py b/src/supermemory/types/namespace_list.py new file mode 100644 index 0000000..f37cc80 --- /dev/null +++ b/src/supermemory/types/namespace_list.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .namespace import Namespace +from .pagination import Pagination + + +class NamespaceList(UncheckedBaseModel): + namespaces: typing.List[Namespace] = pydantic.Field() + """ + Namespaces on this page, newest first + """ + + pagination: Pagination = pydantic.Field() + """ + Pagination metadata + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/supermemory/types/related_memories.py b/src/supermemory/types/related_memories.py index 7eb33de..aedd780 100644 --- a/src/supermemory/types/related_memories.py +++ b/src/supermemory/types/related_memories.py @@ -10,7 +10,7 @@ class RelatedMemories(UncheckedBaseModel): """ - Memory relationships attached when requested + Memory relationships included when requested """ parents: typing.List[RelatedMemory] = pydantic.Field() diff --git a/src/supermemory/types/related_memory.py b/src/supermemory/types/related_memory.py index a1972e7..f779275 100644 --- a/src/supermemory/types/related_memory.py +++ b/src/supermemory/types/related_memory.py @@ -10,6 +10,11 @@ class RelatedMemory(UncheckedBaseModel): + id: str = pydantic.Field() + """ + Related memory ID + """ + relation: MemoryRelation = pydantic.Field() """ How this memory is connected to the matched memory @@ -25,7 +30,7 @@ class RelatedMemory(UncheckedBaseModel): Related learned fact or context """ - metadata: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + metadata: typing.Dict[str, typing.Any] = pydantic.Field() """ Public metadata associated with the related memory """ diff --git a/src/supermemory/types/search_request_attach.py b/src/supermemory/types/search_include.py similarity index 76% rename from src/supermemory/types/search_request_attach.py rename to src/supermemory/types/search_include.py index 38b1f74..97a0c0e 100644 --- a/src/supermemory/types/search_request_attach.py +++ b/src/supermemory/types/search_include.py @@ -7,24 +7,24 @@ from ..core.unchecked_base_model import UncheckedBaseModel -class SearchRequestAttach(UncheckedBaseModel): +class SearchInclude(UncheckedBaseModel): """ Optional context to include alongside each matching result """ documents: typing.Optional[bool] = pydantic.Field(default=None) """ - Attach the source document for each result when one is available + Include the source document for each result when one is available """ related: typing.Optional[bool] = pydantic.Field(default=None) """ - Attach parent, child, and sibling memories that explain how each memory evolved + Include parent, child, and sibling memories that explain how each memory evolved """ forgotten: typing.Optional[bool] = pydantic.Field(default=None) """ - Allow forgotten memories to participate in recall + Let forgotten and expired memories appear in results """ if IS_PYDANTIC_V2: diff --git a/src/supermemory/types/search_result.py b/src/supermemory/types/search_result.py index e80aac3..afc6cf9 100644 --- a/src/supermemory/types/search_result.py +++ b/src/supermemory/types/search_result.py @@ -27,7 +27,7 @@ class SearchResult(UncheckedBaseModel): Source passage returned by chunk search (only present for chunk results from hybrid search) """ - metadata: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + metadata: typing.Dict[str, typing.Any] = pydantic.Field() """ Public metadata attached to the result """ @@ -49,6 +49,18 @@ class SearchResult(UncheckedBaseModel): Whether the memory is its latest version; false for recalled forgotten memories """ + is_inference: typing_extensions.Annotated[ + bool, + FieldMetadata(alias="isInference"), + pydantic.Field( + alias="isInference", + description="Whether the memory was inferred rather than stated directly; false for chunks", + ), + ] + """ + Whether the memory was inferred rather than stated directly; false for chunks + """ + system: SearchResultSystem = pydantic.Field() """ Lifecycle and filesystem details for the result diff --git a/src/supermemory/types/search_result_included.py b/src/supermemory/types/search_result_included.py index d66268e..8bb38c0 100644 --- a/src/supermemory/types/search_result_included.py +++ b/src/supermemory/types/search_result_included.py @@ -16,12 +16,12 @@ class SearchResultIncluded(UncheckedBaseModel): related: typing.Optional[RelatedMemories] = pydantic.Field(default=None) """ - Memory relationships attached when requested + Memory relationships included when requested """ document: typing.Optional[SearchResultIncludedDocument] = pydantic.Field(default=None) """ - Source document attached when requested and available + Source document included when requested and available """ if IS_PYDANTIC_V2: diff --git a/src/supermemory/types/search_result_included_document.py b/src/supermemory/types/search_result_included_document.py index 8455413..0e1e9a9 100644 --- a/src/supermemory/types/search_result_included_document.py +++ b/src/supermemory/types/search_result_included_document.py @@ -3,15 +3,14 @@ import typing import pydantic -import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.serialization import FieldMetadata from ..core.unchecked_base_model import UncheckedBaseModel +from .search_result_included_document_system import SearchResultIncludedDocumentSystem class SearchResultIncludedDocument(UncheckedBaseModel): """ - Source document attached when requested and available + Source document included when requested and available """ id: str = pydantic.Field() @@ -29,7 +28,7 @@ class SearchResultIncludedDocument(UncheckedBaseModel): Detected source or content type """ - metadata: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + metadata: typing.Dict[str, typing.Any] = pydantic.Field() """ Public metadata attached to the source document """ @@ -39,22 +38,9 @@ class SearchResultIncludedDocument(UncheckedBaseModel): Generated summary of the source document """ - created_at: typing_extensions.Annotated[ - str, - FieldMetadata(alias="createdAt"), - pydantic.Field(alias="createdAt", description="ISO 8601 timestamp when the source document was created"), - ] + system: SearchResultIncludedDocumentSystem = pydantic.Field() """ - ISO 8601 timestamp when the source document was created - """ - - updated_at: typing_extensions.Annotated[ - str, - FieldMetadata(alias="updatedAt"), - pydantic.Field(alias="updatedAt", description="ISO 8601 timestamp of the source document's latest update"), - ] - """ - ISO 8601 timestamp of the source document's latest update + Lifecycle timestamps maintained by Supermemory """ if IS_PYDANTIC_V2: diff --git a/src/supermemory/types/search_result_included_document_system.py b/src/supermemory/types/search_result_included_document_system.py new file mode 100644 index 0000000..d9051d7 --- /dev/null +++ b/src/supermemory/types/search_result_included_document_system.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SearchResultIncludedDocumentSystem(UncheckedBaseModel): + """ + Lifecycle timestamps maintained by Supermemory + """ + + created_at: typing_extensions.Annotated[ + str, + FieldMetadata(alias="createdAt"), + pydantic.Field(alias="createdAt", description="ISO 8601 timestamp when the source document was created"), + ] + """ + ISO 8601 timestamp when the source document was created + """ + + updated_at: typing_extensions.Annotated[ + str, + FieldMetadata(alias="updatedAt"), + pydantic.Field(alias="updatedAt", description="ISO 8601 timestamp of the source document's latest update"), + ] + """ + ISO 8601 timestamp of the source document's latest update + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/tests/test_client.py b/tests/test_client.py index c1279ac..f26051d 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -73,8 +73,8 @@ def test_body_uses_api_field_names() -> None: captured: Captured = [] _client(captured).search("user_alex", query="meetings", limit=5, rewrite_query=True) (request,) = captured - assert request.url.params["limit"] == "5" - assert _body(request) == {"query": "meetings", "rewriteQuery": True} + assert "limit" not in request.url.params + assert _body(request) == {"query": "meetings", "limit": 5, "rewriteQuery": True} def test_nested_dict_params_use_api_field_names() -> None: diff --git a/tests/test_compat.py b/tests/test_compat.py index d8cd3f6..b443dd4 100644 --- a/tests/test_compat.py +++ b/tests/test_compat.py @@ -25,6 +25,8 @@ Handler = Callable[[httpx.Request], httpx.Response] +NS_PAGE = {"namespaces": [], "pagination": {"currentPage": 1, "limit": 10, "totalItems": 0, "totalPages": 0}} + def _ok(captured: list[httpx.Request], body: Any = None) -> Handler: def handle(request: httpx.Request) -> httpx.Response: @@ -135,7 +137,7 @@ def handle(request: httpx.Request) -> httpx.Response: def test_timeout_object_is_forwarded_whole() -> None: captured: list[httpx.Request] = [] - client = _client(_ok(captured, []), timeout=httpx.Timeout(10.0, connect=2.5)) + client = _client(_ok(captured, NS_PAGE), timeout=httpx.Timeout(10.0, connect=2.5)) client.namespaces.list() assert captured[0].extensions["timeout"] == {"connect": 2.5, "read": 10.0, "write": 10.0, "pool": 10.0} @@ -150,13 +152,13 @@ def test_timeout_none_disables_timeouts() -> None: captured: list[httpx.Request] = [] off = {"connect": None, "read": None, "write": None, "pool": None} - _client(_ok(captured, [])).namespaces.list() + _client(_ok(captured, NS_PAGE)).namespaces.list() assert captured[0].extensions["timeout"] == {"connect": 5.0, "read": 60.0, "write": 60.0, "pool": 60.0} - _client(_ok(captured, []), timeout=None).namespaces.list() + _client(_ok(captured, NS_PAGE), timeout=None).namespaces.list() assert captured[1].extensions["timeout"] == off - client = _client(_ok(captured, []), timeout=10.0) + client = _client(_ok(captured, NS_PAGE), timeout=10.0) client.namespaces.list(timeout=None) assert captured[2].extensions["timeout"] == off client.namespaces.list(timeout=NOT_GIVEN) @@ -176,9 +178,9 @@ def handle(request: httpx.Request) -> httpx.Response: calls += 1 if calls == 1: raise httpx.ReadTimeout("slow", request=request) - return httpx.Response(200, json=[]) + return httpx.Response(200, json=NS_PAGE) - assert _client(handle, max_retries=2).namespaces.list() == [] + assert _client(handle, max_retries=2).namespaces.list().namespaces == [] assert calls == 2