mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-08-28 05:25:33 +00:00
connections endpoints
This commit is contained in:
parent
9d6b56793a
commit
9c2f020c2c
4 changed files with 312 additions and 48 deletions
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
openapi: get /connect/{app}
|
||||
---
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
openapi: get /connections/{connectionId}
|
||||
---
|
||||
|
|
@ -2,5 +2,58 @@
|
|||
openapi: post /add
|
||||
---
|
||||
|
||||
Add a new memory with content and metadata.
|
||||
|
||||
If i write something here, what happens?
|
||||
Fields:
|
||||
|
||||
`content`: string
|
||||
|
||||
`id`: string
|
||||
|
||||
`metadata`: Record
|
||||
|
||||
The `content` can be of the following types:
|
||||
|
||||
- note / Markdown
|
||||
|
||||
- If it is a markdown, all the images inside `![]` image tags will automatically be parsed.
|
||||
|
||||
- pdf
|
||||
|
||||
- tweet
|
||||
|
||||
- google_doc
|
||||
|
||||
- notion_doc
|
||||
|
||||
- webpage URL
|
||||
|
||||
- Images and other content is also intelligently parsed in case of a webpage.
|
||||
|
||||
|
||||
The metadata provided is a JSON object.
|
||||
|
||||
for eg.
|
||||
|
||||
``` json
|
||||
{
|
||||
"classId": "21412",
|
||||
"year": "fifth"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
If you wish to do exact searches, please use strings. But if you want to search in a range (time, numbers, prices), you can use numbers too.
|
||||
|
||||
``` json
|
||||
{
|
||||
"price": 1250
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
More about \[metadata filtering here\]([https://docs.supermemory.ai/essentials/metadata-filtering](https://docs.supermemory.ai/essentials/metadata-filtering))
|
||||
|
||||
The `id` is optional. If provided, supermemory will store the same ID as your internal database. This can help for retrieval purposes.
|
||||
|
||||
If the `id` already exists, supermemory will update it instead.
|
||||
|
|
@ -23,6 +23,9 @@
|
|||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"shouldLLMFilter": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"categories": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
|
@ -52,7 +55,24 @@
|
|||
"maxLength": 20
|
||||
}
|
||||
},
|
||||
"shouldLLMFilter": { "type": "boolean", "default": false }
|
||||
"filterTags": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"tag": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 50
|
||||
},
|
||||
"score": {
|
||||
"type": "number",
|
||||
"minimum": 0
|
||||
}
|
||||
},
|
||||
"required": ["tag", "score"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -70,8 +90,12 @@
|
|||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": { "type": "string" },
|
||||
"status": { "type": "string" }
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["id", "status"]
|
||||
}
|
||||
|
|
@ -85,8 +109,12 @@
|
|||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"error": { "type": "string" },
|
||||
"details": { "type": "string" }
|
||||
"error": {
|
||||
"type": "string"
|
||||
},
|
||||
"details": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["error"]
|
||||
}
|
||||
|
|
@ -104,22 +132,38 @@
|
|||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"content": { "type": "string" },
|
||||
"content": {
|
||||
"type": "string"
|
||||
},
|
||||
"metadata": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"anyOf": [
|
||||
{ "type": "string" },
|
||||
{ "type": "number" },
|
||||
{ "type": "boolean" }
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"type": "boolean"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"spaceIds": {
|
||||
"type": "array",
|
||||
"items": { "type": "string" }
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"id": { "type": "string" }
|
||||
"summarizeMemories": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["content"]
|
||||
}
|
||||
|
|
@ -138,8 +182,12 @@
|
|||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": { "type": "string" },
|
||||
"status": { "type": "string" }
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["id", "status"]
|
||||
}
|
||||
|
|
@ -153,8 +201,12 @@
|
|||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"error": { "type": "string" },
|
||||
"details": { "type": "string" }
|
||||
"error": {
|
||||
"type": "string"
|
||||
},
|
||||
"details": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["error"]
|
||||
}
|
||||
|
|
@ -168,7 +220,9 @@
|
|||
{
|
||||
"in": "path",
|
||||
"name": "id",
|
||||
"schema": { "type": "string" },
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
|
|
@ -179,18 +233,35 @@
|
|||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"content": { "type": "string" },
|
||||
"content": {
|
||||
"type": "string"
|
||||
},
|
||||
"metadata": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"anyOf": [
|
||||
{ "type": "string" },
|
||||
{ "type": "number" },
|
||||
{ "type": "boolean" }
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"type": "boolean"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"spaceIds": { "type": "array", "items": { "type": "string" } }
|
||||
"spaceIds": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"summarizeMemories": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
"required": ["content"]
|
||||
}
|
||||
|
|
@ -208,7 +279,11 @@
|
|||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": { "success": { "type": "boolean" } },
|
||||
"properties": {
|
||||
"success": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": ["success"]
|
||||
}
|
||||
}
|
||||
|
|
@ -221,8 +296,12 @@
|
|||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"error": { "type": "string" },
|
||||
"details": { "type": "string" }
|
||||
"error": {
|
||||
"type": "string"
|
||||
},
|
||||
"details": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["error"]
|
||||
}
|
||||
|
|
@ -236,7 +315,9 @@
|
|||
{
|
||||
"in": "path",
|
||||
"name": "id",
|
||||
"schema": { "type": "string" },
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
|
|
@ -258,21 +339,54 @@
|
|||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"documentId": { "type": "string" },
|
||||
"documentId": {
|
||||
"type": "string"
|
||||
},
|
||||
"chunks": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"content": { "type": "string" },
|
||||
"isRelevant": { "type": "boolean" }
|
||||
"content": {
|
||||
"type": "string"
|
||||
},
|
||||
"isRelevant": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": ["content", "isRelevant"]
|
||||
}
|
||||
},
|
||||
"score": { "type": "number" }
|
||||
"score": {
|
||||
"type": "number"
|
||||
},
|
||||
"documentSummary": {
|
||||
"type": "string"
|
||||
},
|
||||
"metadata": {
|
||||
"type": "object",
|
||||
"additionalProperties": {}
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["documentId", "chunks", "score"]
|
||||
"required": [
|
||||
"documentId",
|
||||
"chunks",
|
||||
"score",
|
||||
"documentSummary",
|
||||
"metadata",
|
||||
"title",
|
||||
"createdAt",
|
||||
"updatedAt"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -288,8 +402,12 @@
|
|||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"error": { "type": "string" },
|
||||
"details": { "type": "string" }
|
||||
"error": {
|
||||
"type": "string"
|
||||
},
|
||||
"details": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["error"]
|
||||
}
|
||||
|
|
@ -303,8 +421,12 @@
|
|||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"error": { "type": "string" },
|
||||
"details": { "type": "string" }
|
||||
"error": {
|
||||
"type": "string"
|
||||
},
|
||||
"details": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["error"]
|
||||
}
|
||||
|
|
@ -322,7 +444,10 @@
|
|||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"q": { "type": "string", "minLength": 1 },
|
||||
"q": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"limit": {
|
||||
"type": "integer",
|
||||
"exclusiveMinimum": 0,
|
||||
|
|
@ -333,16 +458,27 @@
|
|||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"OR": { "type": "array", "items": {} },
|
||||
"AND": { "type": "array", "items": {} }
|
||||
"OR": {
|
||||
"type": "array",
|
||||
"items": {}
|
||||
},
|
||||
"AND": {
|
||||
"type": "array",
|
||||
"items": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ "type": "object", "additionalProperties": {} }
|
||||
{
|
||||
"type": "object",
|
||||
"additionalProperties": {}
|
||||
}
|
||||
]
|
||||
},
|
||||
"categoriesFilter": {
|
||||
"type": "array",
|
||||
"items": { "type": "string" }
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["q"]
|
||||
|
|
@ -367,9 +503,15 @@
|
|||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": { "type": "string" },
|
||||
"content": { "type": "string" },
|
||||
"similarity": { "type": "number" }
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"content": {
|
||||
"type": "string"
|
||||
},
|
||||
"similarity": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": ["id", "content", "similarity"]
|
||||
}
|
||||
|
|
@ -387,8 +529,12 @@
|
|||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"error": { "type": "string" },
|
||||
"details": { "type": "string" }
|
||||
"error": {
|
||||
"type": "string"
|
||||
},
|
||||
"details": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["error"]
|
||||
}
|
||||
|
|
@ -402,19 +548,78 @@
|
|||
{
|
||||
"in": "query",
|
||||
"name": "q",
|
||||
"schema": { "type": "string", "minLength": 1 },
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"in": "query",
|
||||
"name": "limit",
|
||||
"schema": { "type": "string", "pattern": "^\\d+$" },
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"pattern": "^\\d+$"
|
||||
},
|
||||
"required": false
|
||||
}
|
||||
],
|
||||
"description": "Fast, lossy search using quantized embeddings"
|
||||
}
|
||||
},
|
||||
"/connect/{app}": {
|
||||
"get": {
|
||||
"responses": {},
|
||||
"operationId": "getConnectByApp",
|
||||
"tags": ["Connect"],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "app",
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"enum": ["notion"]
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"in": "query",
|
||||
"name": "id",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"in": "query",
|
||||
"name": "redirectUrl",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/connections/{connectionId}": {
|
||||
"get": {
|
||||
"responses": {},
|
||||
"operationId": "getConnectionsByConnectionId",
|
||||
"tags": ["Connect"],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "connectionId",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": { "schemas": {} }
|
||||
"components": {
|
||||
"schemas": {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue